diff --git a/app/Http/Controllers/Admin/DashboardController.php b/app/Http/Controllers/Admin/DashboardController.php index 601a4302..7999a3b5 100644 --- a/app/Http/Controllers/Admin/DashboardController.php +++ b/app/Http/Controllers/Admin/DashboardController.php @@ -44,7 +44,7 @@ class DashboardController extends Controller $license = Setting::where('name', 'license')->first(); return [ - 'license' => $license->value, + 'license' => $license ? $license->value : null, 'app_version' => config('vuefilemanager.version'), 'total_users' => $total_users, 'total_used_space' => Metric::bytes($total_used_space)->format(), diff --git a/app/Http/Controllers/Admin/UserController.php b/app/Http/Controllers/Admin/UserController.php index 0bf772b6..6403b5eb 100644 --- a/app/Http/Controllers/Admin/UserController.php +++ b/app/Http/Controllers/Admin/UserController.php @@ -192,7 +192,7 @@ class UserController extends Controller ]); // Create settings - $settings = UserSettings::forceCreate([ + UserSettings::forceCreate([ 'user_id' => $user->id, 'storage_capacity' => $request->storage_capacity, ]); diff --git a/app/Http/Controllers/AppFunctionsController.php b/app/Http/Controllers/AppFunctionsController.php index 018e4963..9b926079 100644 --- a/app/Http/Controllers/AppFunctionsController.php +++ b/app/Http/Controllers/AppFunctionsController.php @@ -8,13 +8,11 @@ use App\Http\Resources\PageResource; use App\Mail\SendSupportForm; use App\Page; use App\Setting; +use Artisan; use Doctrine\DBAL\Driver\PDOException; -use Illuminate\Support\Facades\File; -use Illuminate\Support\Facades\Auth; use Illuminate\Http\Request; use Illuminate\Support\Facades\Mail; -use Response; -use Symfony\Component\HttpKernel\Exception\HttpException; +use Schema; class AppFunctionsController extends Controller { @@ -56,9 +54,30 @@ class AppFunctionsController extends Controller // Try to connect to database \DB::getPdo(); - $connection = $this->get_setup_status(); - $settings = json_decode(Setting::all()->pluck('value', 'name')->toJson()); - $legal = Page::whereIn('slug', ['terms-of-service', 'privacy-policy', 'cookie-policy'])->get(['visibility', 'title', 'slug']); + // Check settings table + $settings_table = Schema::hasTable('settings'); + + // If settings table don't exist, then run migrations + if (! $settings_table) { + Artisan::call('migrate'); + } + + // Get settings + $setup_wizard_success = Setting::where('name', 'setup_wizard_success')->first(); + + // Get connection string + if (! $setup_wizard_success) { + $connection = 'quiet-update'; + } else { + $connection = $this->get_setup_status(); + } + + // Get all settings + $settings = Setting::all(); + + // Get legal pages + $legal = Page::whereIn('slug', ['terms-of-service', 'privacy-policy', 'cookie-policy']) + ->get(['visibility', 'title', 'slug']); } catch (PDOException $e) { $connection = 'setup-database'; @@ -66,11 +85,25 @@ class AppFunctionsController extends Controller } return view("index") - ->with('settings', $settings) + ->with('settings', $settings ? json_decode($settings->pluck('value', 'name')->toJson()) : null) ->with('legal', isset($legal) ? $legal : null) ->with('installation', $connection); } + /** + * Check if setup wizard was passed + * + * @return string + */ + private function get_setup_status(): string + { + $setup_success = get_setting('setup_wizard_success'); + + $connection = boolval($setup_success) ? 'setup-done' : 'setup-disclaimer'; + + return $connection; + } + /** * Send contact message from pages * @@ -116,28 +149,14 @@ class AppFunctionsController extends Controller $columns = collect(explode('|', $column)); $columns->each(function ($column) { - if (! in_array($column, $this->whitelist)) abort(401); + if (!in_array($column, $this->whitelist)) abort(401); }); return Setting::whereIn('name', $columns)->pluck('value', 'name'); } - if (! in_array($column, $this->whitelist)) abort(401); + if (!in_array($column, $this->whitelist)) abort(401); return Setting::where('name', $column)->pluck('value', 'name'); } - - /** - * Check if setup wizard was passed - * - * @return string - */ - private function get_setup_status(): string - { - $setup_success = Setting::where('name', 'setup_wizard_success')->first(); - - $connection = $setup_success ? 'setup-done' : 'setup-disclaimer'; - - return $connection; - } } diff --git a/app/Http/Controllers/General/UpgradeAppController.php b/app/Http/Controllers/General/UpgradeAppController.php new file mode 100644 index 00000000..3608ea8f --- /dev/null +++ b/app/Http/Controllers/General/UpgradeAppController.php @@ -0,0 +1,116 @@ +first(); + + if ($upgraded && $upgraded->value === '1.7') abort(401); + + // Create legal pages and index content + if ($request->license === 'Extended') { + Artisan::call('db:seed --class=PageSeeder'); + Artisan::call('db:seed --class=ContentSeeder'); + } + + // Store Logo + if ($request->hasFile('logo')) { + $logo = store_system_image($request->file('logo'), 'system'); + } + + // Store Logo horizontal + if ($request->hasFile('logo_horizontal')) { + $logo_horizontal = store_system_image($request->file('logo_horizontal'), 'system'); + } + + // Store favicon + if ($request->hasFile('favicon')) { + $favicon = store_system_image($request->file('favicon'), 'system'); + } + + // Get options + $settings = collect([ + [ + 'name' => 'setup_wizard_database', + 'value' => 1, + ], + [ + 'name' => 'setup_wizard_success', + 'value' => 1, + ], + [ + 'name' => 'license', + 'value' => $request->license, + ], + [ + 'name' => 'purchase_code', + 'value' => $request->purchase_code, + ], + [ + 'name' => 'app_title', + 'value' => $request->title, + ], + [ + 'name' => 'app_description', + 'value' => $request->description, + ], + [ + 'name' => 'app_logo', + 'value' => $request->hasFile('logo') ? $logo : null, + ], + [ + 'name' => 'app_logo_horizontal', + 'value' => $request->hasFile('logo_horizontal') ? $logo_horizontal : null, + ], + [ + 'name' => 'app_favicon', + 'value' => $request->hasFile('favicon') ? $favicon : null, + ], + [ + 'name' => 'google_analytics', + 'value' => $request->googleAnalytics, + ], + [ + 'name' => 'contact_email', + 'value' => $request->contactMail, + ], + [ + 'name' => 'registration', + 'value' => $request->userRegistration, + ], + [ + 'name' => 'storage_limitation', + 'value' => $request->storageLimitation, + ], + [ + 'name' => 'storage_default', + 'value' => $request->defaultStorage ? $request->defaultStorage : 5, + ], + [ + 'name' => 'latest_upgrade', + 'value' => '1.7', + ], + ]); + + // Store options + $settings->each(function ($col) { + Setting::updateOrCreate(['name' => $col['name']], $col); + }); + + return response('Done', 200); + } +} diff --git a/app/Http/Helpers/helpers.php b/app/Http/Helpers/helpers.php index 2f35b78b..af05c86c 100644 --- a/app/Http/Helpers/helpers.php +++ b/app/Http/Helpers/helpers.php @@ -11,9 +11,17 @@ use Illuminate\Support\Facades\Storage; use Illuminate\Support\Str; use Intervention\Image\ImageManagerStatic as Image; +/** + * Get single value from settings table + * + * @param $setting + * @return |null + */ function get_setting($setting) { - return Setting::where('name', $setting)->first()->value; + $row = Setting::where('name', $setting)->first(); + + return $row ? $row->value : null; } /** diff --git a/app/User.php b/app/User.php index 4c2e4d7a..1fed8132 100644 --- a/app/User.php +++ b/app/User.php @@ -123,9 +123,11 @@ class User extends Authenticatable { // Get storage limitation setup $storage_limitation = get_setting('storage_limitation'); + $is_storage_limit = $storage_limitation ? $storage_limitation : 1; // Get user storage usage - if (!$storage_limitation) { + if (! $is_storage_limit) { + return [ 'used' => $this->used_capacity, 'used_formatted' => Metric::bytes($this->used_capacity)->format(), diff --git a/public/assets/images/admin/feature-boxes.jpg b/public/assets/images/admin/feature-boxes.jpg index b6990be3..4fcbd9e9 100644 Binary files a/public/assets/images/admin/feature-boxes.jpg and b/public/assets/images/admin/feature-boxes.jpg differ diff --git a/public/assets/images/admin/get-started-content.jpg b/public/assets/images/admin/get-started-content.jpg index e7823168..0fd44c83 100644 Binary files a/public/assets/images/admin/get-started-content.jpg and b/public/assets/images/admin/get-started-content.jpg differ diff --git a/public/assets/images/admin/main-features.jpg b/public/assets/images/admin/main-features.jpg index d58a2e77..e420d7f0 100644 Binary files a/public/assets/images/admin/main-features.jpg and b/public/assets/images/admin/main-features.jpg differ diff --git a/public/assets/images/admin/main-header.jpg b/public/assets/images/admin/main-header.jpg index e8bcf75d..dded9a71 100644 Binary files a/public/assets/images/admin/main-header.jpg and b/public/assets/images/admin/main-header.jpg differ diff --git a/public/assets/images/admin/pricing-content.jpg b/public/assets/images/admin/pricing-content.jpg index 6a79aedb..30ba8310 100644 Binary files a/public/assets/images/admin/pricing-content.jpg and b/public/assets/images/admin/pricing-content.jpg differ diff --git a/public/assets/images/app-icon.png b/public/assets/images/app-icon.png deleted file mode 100644 index 6c8e6b08..00000000 Binary files a/public/assets/images/app-icon.png and /dev/null differ diff --git a/public/assets/images/hero.svg b/public/assets/images/hero.svg deleted file mode 100644 index 2bc2a60b..00000000 --- a/public/assets/images/hero.svg +++ /dev/null @@ -1,15 +0,0 @@ - - - - hero - Created with Sketch. - - - - - - - - - - \ No newline at end of file diff --git a/public/assets/images/paypal-logo-thumbnail.png b/public/assets/images/paypal-logo-thumbnail.png deleted file mode 100644 index 7a0a3022..00000000 Binary files a/public/assets/images/paypal-logo-thumbnail.png and /dev/null differ diff --git a/public/assets/images/stripe-logo-thumbnail.png b/public/assets/images/stripe-logo-thumbnail.png deleted file mode 100644 index 1210cd16..00000000 Binary files a/public/assets/images/stripe-logo-thumbnail.png and /dev/null differ diff --git a/public/mix-manifest.json b/public/mix-manifest.json index 2651d7e0..b30bf1f9 100644 --- a/public/mix-manifest.json +++ b/public/mix-manifest.json @@ -89,5 +89,49 @@ "/js/main.1cd1f59cdfc9a4c6ce3a.hot-update.js": "/js/main.1cd1f59cdfc9a4c6ce3a.hot-update.js", "/js/main.c33403bc3d43c471d34e.hot-update.js": "/js/main.c33403bc3d43c471d34e.hot-update.js", "/js/main.3f8cb66167146d51f4b8.hot-update.js": "/js/main.3f8cb66167146d51f4b8.hot-update.js", - "/js/main.f109c44c2c8c6bd471f5.hot-update.js": "/js/main.f109c44c2c8c6bd471f5.hot-update.js" + "/js/main.f109c44c2c8c6bd471f5.hot-update.js": "/js/main.f109c44c2c8c6bd471f5.hot-update.js", + "/js/main.92a5decc545c062cf774.hot-update.js": "/js/main.92a5decc545c062cf774.hot-update.js", + "/js/main.05a1a5f1fc7928b1fb2a.hot-update.js": "/js/main.05a1a5f1fc7928b1fb2a.hot-update.js", + "/js/main.d5418e99db52725b4969.hot-update.js": "/js/main.d5418e99db52725b4969.hot-update.js", + "/js/main.45ae3591ed555dad1f59.hot-update.js": "/js/main.45ae3591ed555dad1f59.hot-update.js", + "/js/main.7abf5359f5f1466169a5.hot-update.js": "/js/main.7abf5359f5f1466169a5.hot-update.js", + "/js/main.18b4e240bd534b894af1.hot-update.js": "/js/main.18b4e240bd534b894af1.hot-update.js", + "/js/main.b40bf910604854eaf974.hot-update.js": "/js/main.b40bf910604854eaf974.hot-update.js", + "/js/main.cc817df3bcd9a5bec6fc.hot-update.js": "/js/main.cc817df3bcd9a5bec6fc.hot-update.js", + "/js/main.60768bf13aaea8e24e4a.hot-update.js": "/js/main.60768bf13aaea8e24e4a.hot-update.js", + "/js/main.31caa8a3b1fc6160bbef.hot-update.js": "/js/main.31caa8a3b1fc6160bbef.hot-update.js", + "/js/main.a7bb0a90ee0b32ab8678.hot-update.js": "/js/main.a7bb0a90ee0b32ab8678.hot-update.js", + "/js/main.8864ba28636fad8ad3c2.hot-update.js": "/js/main.8864ba28636fad8ad3c2.hot-update.js", + "/js/main.d5a2f19292f8a7653e9c.hot-update.js": "/js/main.d5a2f19292f8a7653e9c.hot-update.js", + "/js/main.e94cd9f1704a83978a61.hot-update.js": "/js/main.e94cd9f1704a83978a61.hot-update.js", + "/js/main.2bdd929701ae467b34b6.hot-update.js": "/js/main.2bdd929701ae467b34b6.hot-update.js", + "/js/main.2d7ad56264ae12975872.hot-update.js": "/js/main.2d7ad56264ae12975872.hot-update.js", + "/js/main.4bcca4dbd70c591912a9.hot-update.js": "/js/main.4bcca4dbd70c591912a9.hot-update.js", + "/js/main.b087bf759f3c09cf4392.hot-update.js": "/js/main.b087bf759f3c09cf4392.hot-update.js", + "/js/main.7bea8f513b32fb7a2dc6.hot-update.js": "/js/main.7bea8f513b32fb7a2dc6.hot-update.js", + "/js/main.2bc7cdc1bc24445028a6.hot-update.js": "/js/main.2bc7cdc1bc24445028a6.hot-update.js", + "/js/main.4ab6d1b782215cf562b3.hot-update.js": "/js/main.4ab6d1b782215cf562b3.hot-update.js", + "/js/main.45762826ce2fe9aaf076.hot-update.js": "/js/main.45762826ce2fe9aaf076.hot-update.js", + "/js/main.9dcbab3122976177de71.hot-update.js": "/js/main.9dcbab3122976177de71.hot-update.js", + "/js/main.73e8e53b59255aba4dfc.hot-update.js": "/js/main.73e8e53b59255aba4dfc.hot-update.js", + "/js/main.8bff89cb9772a5d7c5f8.hot-update.js": "/js/main.8bff89cb9772a5d7c5f8.hot-update.js", + "/js/main.50c5535cecbf185d4dd3.hot-update.js": "/js/main.50c5535cecbf185d4dd3.hot-update.js", + "/js/main.c7e77750811ee3feac67.hot-update.js": "/js/main.c7e77750811ee3feac67.hot-update.js", + "/js/main.e6c1120993b2730c25ec.hot-update.js": "/js/main.e6c1120993b2730c25ec.hot-update.js", + "/js/main.c28450331fc421825102.hot-update.js": "/js/main.c28450331fc421825102.hot-update.js", + "/js/main.f5a0965210aee82a9d9c.hot-update.js": "/js/main.f5a0965210aee82a9d9c.hot-update.js", + "/js/main.14a083bee734139e8393.hot-update.js": "/js/main.14a083bee734139e8393.hot-update.js", + "/js/main.a0973368409b709e0bd5.hot-update.js": "/js/main.a0973368409b709e0bd5.hot-update.js", + "/js/main.7b3b818f0d213721751a.hot-update.js": "/js/main.7b3b818f0d213721751a.hot-update.js", + "/js/main.d3779cfa64c08375e5da.hot-update.js": "/js/main.d3779cfa64c08375e5da.hot-update.js", + "/js/main.2fc180b7578b09dc1ec3.hot-update.js": "/js/main.2fc180b7578b09dc1ec3.hot-update.js", + "/js/main.dc2ba8e4942be4ea0baf.hot-update.js": "/js/main.dc2ba8e4942be4ea0baf.hot-update.js", + "/js/main.a7b43362a9262f0462cb.hot-update.js": "/js/main.a7b43362a9262f0462cb.hot-update.js", + "/js/main.aee3225805c2c2372fbe.hot-update.js": "/js/main.aee3225805c2c2372fbe.hot-update.js", + "/js/main.ce87be7dd40cdfc40d99.hot-update.js": "/js/main.ce87be7dd40cdfc40d99.hot-update.js", + "/js/main.7f4679047e954572f307.hot-update.js": "/js/main.7f4679047e954572f307.hot-update.js", + "/js/main.b0f60374e12655123fa3.hot-update.js": "/js/main.b0f60374e12655123fa3.hot-update.js", + "/js/main.3bace6a430879b52f95a.hot-update.js": "/js/main.3bace6a430879b52f95a.hot-update.js", + "/js/main.f3a7a774479629f1cfd4.hot-update.js": "/js/main.f3a7a774479629f1cfd4.hot-update.js", + "/js/main.66e645a33bbdcbf71b3d.hot-update.js": "/js/main.66e645a33bbdcbf71b3d.hot-update.js" } diff --git a/resources/babel.babel b/resources/babel.babel index f1187bea..ebe4b5e3 100644 --- a/resources/babel.babel +++ b/resources/babel.babel @@ -173,6 +173,27 @@ + + description + false + + + + + + en-US + false + + + sk-SK + false + + + zh-CHS + false + + + title false diff --git a/resources/js/App.vue b/resources/js/App.vue index 8e0f3844..25f7389d 100644 --- a/resources/js/App.vue +++ b/resources/js/App.vue @@ -93,6 +93,7 @@ 'ContactUs', 'AppSetup', 'Database', + 'Upgrade', 'SignIn', 'SignUp', ], this.$route.name) @@ -127,9 +128,10 @@ // Redirect to database verify code if ( installation === 'setup-database') { this.$router.push({name: 'PurchaseCode'}) + } // Redirect to starting installation process - } else if ( installation === 'setup-disclaimer' ) { + if ( installation === 'setup-disclaimer' ) { this.$router.push({name: 'InstallationDisclaimer'}) } }, diff --git a/resources/js/components/Admin/WidgetLatestRegistrations.vue b/resources/js/components/Admin/WidgetLatestRegistrations.vue index b8bb8d58..00ec6a16 100644 --- a/resources/js/components/Admin/WidgetLatestRegistrations.vue +++ b/resources/js/components/Admin/WidgetLatestRegistrations.vue @@ -79,7 +79,7 @@ }, { label: this.$t('admin_page_user.table.storage_used'), - field: 'data.attributes.storage.used', + field: 'relationships.storage.data.attributes.used', sortable: true }, { diff --git a/resources/js/components/Index/IndexNavigation.vue b/resources/js/components/Index/IndexNavigation.vue index 9f858095..3643ca4c 100644 --- a/resources/js/components/Index/IndexNavigation.vue +++ b/resources/js/components/Index/IndexNavigation.vue @@ -6,11 +6,11 @@ - +
diff --git a/resources/js/views/Admin/AppSettings/AppSettings.vue b/resources/js/views/Admin/AppSettings/AppSettings.vue index 41c8dcf2..9e7f3855 100644 --- a/resources/js/views/Admin/AppSettings/AppSettings.vue +++ b/resources/js/views/Admin/AppSettings/AppSettings.vue @@ -8,6 +8,16 @@ @@ -76,7 +76,7 @@ + + diff --git a/resources/views/index.blade.php b/resources/views/index.blade.php index 81c16ad2..01e23d30 100644 --- a/resources/views/index.blade.php +++ b/resources/views/index.blade.php @@ -47,7 +47,7 @@ userRegistration: {{ isset($settings->registration) ? $settings->registration : 1 }}, storageLimit: {{ isset($settings->storage_limitation) ? $settings->storage_limitation : 1 }}, - storageDefaultSpace: '{{ isset($settings->storage_default) ? format_gigabytes($settings->storage_default) : 5 }}', + storageDefaultSpace: {{ isset($settings->storage_default) ? $settings->storage_default : 5 }}, hasAuthCookie: {{ Cookie::has('token') ? 1 : 0 }}, isSaaS: {{ isset($settings->license) && $settings->license === 'Extended' ? 1 : 0 }}, @@ -56,6 +56,7 @@ legal: {!! isset($legal) ? $legal : 'undefined' !!}, installation: '{{ $installation }}', + latest_upgrade: '{{ isset($settings->latest_upgrade) && $settings->latest_upgrade ? $settings->latest_upgrade : null }}', } diff --git a/routes/api.php b/routes/api.php index d1b32c81..51bfd59f 100644 --- a/routes/api.php +++ b/routes/api.php @@ -30,6 +30,11 @@ Route::group(['middleware' => ['api'], 'prefix' => 'setup'], function () { Route::post('/admin-setup', 'General\SetupWizardController@create_admin_account'); }); +// Upgrade App +Route::group(['middleware' => ['api'], 'prefix' => 'upgrade'], function () { + Route::post('/app', 'General\UpgradeAppController@upgrade'); +}); + // Plans Route::group(['middleware' => ['api'], 'prefix' => 'public'], function () { Route::get('/pricing', 'General\PricingController@index');