From 7db1c7926f9c67d9a0b62c236a97792c305eda0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=8Carodej?= Date: Fri, 5 Aug 2022 15:24:06 +0200 Subject: [PATCH] extended license restrictions removed --- .env.testing | 2 +- config/vuefilemanager.php | 3 +- public/mix-manifest.json | 142 +++++++++--------- .../components/Dashboard/AppSpecification.vue | 2 +- .../Widgets/WidgetLatestRegistrations.vue | 2 +- .../Admin/Settings/AppSettingsTabs/Others.vue | 112 ++------------ resources/js/views/Frontpage/Homepage.vue | 2 +- resources/js/views/SetupWizard/AppSetup.vue | 5 +- resources/views/index.blade.php | 1 - routes/admin.php | 1 - .../Console/Commands/SetupDevEnvironment.php | 18 ++- .../Console/Commands/SetupProdEnvironment.php | 28 ++-- .../SeedDefaultLanguageTranslationsAction.php | 1 - .../UpgradeLanguageTranslationsAction.php | 25 ++- src/Domain/Localization/Models/Language.php | 1 - .../Settings/Actions/GetConfigAction.php | 1 - .../Actions/SeedDefaultSettingsAction.php | 5 +- .../Controllers/UpgradeLicenseController.php | 107 ------------- .../CreateAdminAccountController.php | 2 +- .../Upgrading/Actions/UpdateSystemAction.php | 18 +-- .../UpgradingVersionsController.php | 76 ++++++++++ tests/Domain/Homepage/HomepageTest.php | 2 +- tests/Domain/Settings/SettingsTest.php | 66 +------- 23 files changed, 219 insertions(+), 403 deletions(-) delete mode 100644 src/Domain/Settings/Controllers/UpgradeLicenseController.php diff --git a/.env.testing b/.env.testing index fd468341..f4a9590e 100644 --- a/.env.testing +++ b/.env.testing @@ -1,6 +1,6 @@ APP_NAME=Laravel APP_ENV=local -APP_KEY=base64:O1wLTTsyz5AfTUJyILnDxLMiiiFaYXiwfajtBuFyWS0= +APP_KEY=base64:loZzMlfoaLRn2ASLI94No42c7aUvmhXkoU/I2ljmxQI= APP_DEBUG=true APP_URL=http://localhost APP_DEMO=false diff --git a/config/vuefilemanager.php b/config/vuefilemanager.php index ea5ad179..aa1ef814 100644 --- a/config/vuefilemanager.php +++ b/config/vuefilemanager.php @@ -1,7 +1,7 @@ '2.2.2', + 'version' => '2.2.3', 'is_demo' => env('APP_DEMO', false), @@ -78,5 +78,6 @@ return [ '2_2_0_13', '2_2_1', '2_2_2', + '2_2_3', ], ]; diff --git a/public/mix-manifest.json b/public/mix-manifest.json index 7fbb66ee..f5c10770 100644 --- a/public/mix-manifest.json +++ b/public/mix-manifest.json @@ -1,76 +1,76 @@ { "/js/main.js": "/js/main.js", - "/chunks/request.js": "/chunks/request.js?id=20ebb21e134700e4", - "/chunks/request-upload.js": "/chunks/request-upload.js?id=f76b221beaf6440b", - "/chunks/setup-wizard.js": "/chunks/setup-wizard.js?id=6122cca2fca4f02b", - "/chunks/status-check.js": "/chunks/status-check.js?id=1f8c33af0e532582", - "/chunks/purchase-code.js": "/chunks/purchase-code.js?id=ff951e86f15f71ae", - "/chunks/database.js": "/chunks/database.js?id=15105175c99fcb46", - "/chunks/environment.js": "/chunks/environment.js?id=12e7ceac54c77dd5", - "/chunks/app-setup.js": "/chunks/app-setup.js?id=3b1c0f1bdedcc613", - "/chunks/admin-account.js": "/chunks/admin-account.js?id=049ae73dfc365a44", - "/chunks/shared.js": "/chunks/shared.js?id=6a301afc0e280d72", - "/chunks/shared/browser.js": "/chunks/shared/browser.js?id=2bacd8aa31df621f", - "/chunks/shared/single-file.js": "/chunks/shared/single-file.js?id=e8d41e256380519c", - "/chunks/shared/authenticate.js": "/chunks/shared/authenticate.js?id=4d66b8a277a638a7", - "/chunks/not-found.js": "/chunks/not-found.js?id=901e26fdc77de6e0", - "/chunks/temporary-unavailable.js": "/chunks/temporary-unavailable.js?id=c3a4f158b971145f", - "/chunks/admin.js": "/chunks/admin.js?id=730ebd7488ed7ea1", - "/chunks/dashboard.js": "/chunks/dashboard.js?id=b8b0690a26f5dfe5", - "/chunks/invoices.js": "/chunks/invoices.js?id=c40b8b7925003659", - "/chunks/subscriptions.js": "/chunks/subscriptions.js?id=1d72d33f4d3e9355", - "/chunks/pages.js": "/chunks/pages.js?id=15ab720d05126115", - "/chunks/page-edit.js": "/chunks/page-edit.js?id=651cd395d5a24dbc", - "/chunks/plans.js": "/chunks/plans.js?id=89b35f8720666147", - "/chunks/users.js": "/chunks/users.js?id=a340a505a2329b33", - "/chunks/user-create.js": "/chunks/user-create.js?id=3c6fdff76fe051ab", - "/chunks/plan-create/fixed.js": "/chunks/plan-create/fixed.js?id=73888464bb69d554", - "/chunks/plan-create/metered.js": "/chunks/plan-create/metered.js?id=01ea01e6b79e1127", - "/chunks/user.js": "/chunks/user.js?id=85aee36020612960", - "/chunks/user-detail.js": "/chunks/user-detail.js?id=454ea88c61de9866", - "/chunks/user-storage.js": "/chunks/user-storage.js?id=5bf9038a2328dc1d", - "/chunks/user-subscription.js": "/chunks/user-subscription.js?id=d793e5bf87fe65a1", - "/chunks/user-password.js": "/chunks/user-password.js?id=984b7a3e1c377303", - "/chunks/user-delete.js": "/chunks/user-delete.js?id=50314acbbfccabd1", - "/chunks/plan.js": "/chunks/plan.js?id=4a082719fc5ce20a", - "/chunks/plan-subscribers.js": "/chunks/plan-subscribers.js?id=3f87f55441ea6acb", - "/chunks/plan-settings.js": "/chunks/plan-settings.js?id=59aa29c4d81f665e", - "/chunks/plan-delete.js": "/chunks/plan-delete.js?id=627e6562f74ae332", - "/chunks/payments.js": "/chunks/payments.js?id=22e84a36acc89129", - "/chunks/payments/billings.js": "/chunks/payments/billings.js?id=ced5adcb7cf4c6c9", - "/chunks/payments/settings.js": "/chunks/payments/settings.js?id=218a17fe40922c5c", - "/chunks/app-settings.js": "/chunks/app-settings.js?id=5de958be12ca920f", - "/chunks/app-appearance.js": "/chunks/app-appearance.js?id=6851c76bf345605f", - "/chunks/app-index.js": "/chunks/app-index.js?id=f914fa6136ff18e1", - "/chunks/app-environment.js": "/chunks/app-environment.js?id=037f1adeccd04620", - "/chunks/app-others.js": "/chunks/app-others.js?id=c0ccc32c1eee6162", - "/chunks/app-sign-in-out.js": "/chunks/app-sign-in-out.js?id=580f3b376cfc93e4", - "/chunks/app-adsense.js": "/chunks/app-adsense.js?id=304eefb5acbe5d93", - "/chunks/app-server.js": "/chunks/app-server.js?id=02bf261940010e9f", - "/chunks/app-language.js": "/chunks/app-language.js?id=33e69eb36f8578be", - "/chunks/homepage.js": "/chunks/homepage.js?id=612d0b10b26b580c", - "/chunks/dynamic-page.js": "/chunks/dynamic-page.js?id=13d00de1153769c5", - "/chunks/contact-us.js": "/chunks/contact-us.js?id=5573693525bfcb27", - "/chunks/demo.js": "/chunks/demo.js?id=aebe316fa638bbb5", - "/chunks/successfully-email-verified.js": "/chunks/successfully-email-verified.js?id=62ed454569571e25", - "/chunks/successfully-email-send.js": "/chunks/successfully-email-send.js?id=d99d1e9adb974ae7", - "/chunks/sign-in.js": "/chunks/sign-in.js?id=6280ef0a858522c8", - "/chunks/sign-up.js": "/chunks/sign-up.js?id=8ca080b244f1647f", - "/chunks/forgotten-password.js": "/chunks/forgotten-password.js?id=b06174390d32669c", - "/chunks/create-new-password.js": "/chunks/create-new-password.js?id=3fe56e872c74d485", - "/chunks/settings.js": "/chunks/settings.js?id=1e1cf11282e05e75", - "/chunks/profile.js": "/chunks/profile.js?id=87ac69edc17d9245", - "/chunks/settings-password.js": "/chunks/settings-password.js?id=6ee89249d080df79", - "/chunks/settings-storage.js": "/chunks/settings-storage.js?id=a9e2543c5362e459", - "/chunks/billing.js": "/chunks/billing.js?id=073f5b46e2ef61bf", - "/chunks/platform.js": "/chunks/platform.js?id=76688d62f15361cc", - "/chunks/files.js": "/chunks/files.js?id=f55e9f88919e0925", - "/chunks/recent-uploads.js": "/chunks/recent-uploads.js?id=847e1649fa88b1fc", - "/chunks/my-shared-items.js": "/chunks/my-shared-items.js?id=f36265974d8237cd", - "/chunks/trash.js": "/chunks/trash.js?id=07d9deb9d1ff75b5", - "/chunks/team-folders.js": "/chunks/team-folders.js?id=10215d85d3d37932", - "/chunks/shared-with-me.js": "/chunks/shared-with-me.js?id=cfe08cfe150cd917", - "/chunks/invitation.js": "/chunks/invitation.js?id=dd7d9c7bb0f39eff", + "/chunks/request.js": "/chunks/request.js?id=22d937ec994df102", + "/chunks/request-upload.js": "/chunks/request-upload.js?id=ec1b08db039dd789", + "/chunks/setup-wizard.js": "/chunks/setup-wizard.js?id=19a0784e59d768ec", + "/chunks/status-check.js": "/chunks/status-check.js?id=37bc98acd7ead7fd", + "/chunks/purchase-code.js": "/chunks/purchase-code.js?id=e153c4e933c899fd", + "/chunks/database.js": "/chunks/database.js?id=b884b991d47c42cf", + "/chunks/environment.js": "/chunks/environment.js?id=54c035b387c89b6f", + "/chunks/app-setup.js": "/chunks/app-setup.js?id=cfcb80c0e5d1af04", + "/chunks/admin-account.js": "/chunks/admin-account.js?id=c04781f1fd5170cf", + "/chunks/shared.js": "/chunks/shared.js?id=e9d2c2972b62138a", + "/chunks/shared/browser.js": "/chunks/shared/browser.js?id=bb36c28b1e2191a4", + "/chunks/shared/single-file.js": "/chunks/shared/single-file.js?id=90e78ba83c719591", + "/chunks/shared/authenticate.js": "/chunks/shared/authenticate.js?id=b0299d25bfaacea2", + "/chunks/not-found.js": "/chunks/not-found.js?id=945e89891ea3a0c8", + "/chunks/temporary-unavailable.js": "/chunks/temporary-unavailable.js?id=4d46688b815d1165", + "/chunks/admin.js": "/chunks/admin.js?id=e451fc09f0a8e0b3", + "/chunks/dashboard.js": "/chunks/dashboard.js?id=a3b22e7f5dab8989", + "/chunks/invoices.js": "/chunks/invoices.js?id=799928609f57ca10", + "/chunks/subscriptions.js": "/chunks/subscriptions.js?id=9784c1597a5d7e57", + "/chunks/pages.js": "/chunks/pages.js?id=bb5cc8327ca846a3", + "/chunks/page-edit.js": "/chunks/page-edit.js?id=0bdc8a5935fd2197", + "/chunks/plans.js": "/chunks/plans.js?id=d4e39044c5fc0ad4", + "/chunks/users.js": "/chunks/users.js?id=b6629338e26b8313", + "/chunks/user-create.js": "/chunks/user-create.js?id=40254ae98547761e", + "/chunks/plan-create/fixed.js": "/chunks/plan-create/fixed.js?id=549867504d6e4e4e", + "/chunks/plan-create/metered.js": "/chunks/plan-create/metered.js?id=6ab9a127099b3293", + "/chunks/user.js": "/chunks/user.js?id=cf9a2a0d8c1fa1d9", + "/chunks/user-detail.js": "/chunks/user-detail.js?id=ff6c1fc63a372d96", + "/chunks/user-storage.js": "/chunks/user-storage.js?id=0e26321285c15e1a", + "/chunks/user-subscription.js": "/chunks/user-subscription.js?id=67993bd6abb6fa9c", + "/chunks/user-password.js": "/chunks/user-password.js?id=900ae71c3d4199ea", + "/chunks/user-delete.js": "/chunks/user-delete.js?id=c88872f2ff8c4df2", + "/chunks/plan.js": "/chunks/plan.js?id=3e7b0b34c2247e6c", + "/chunks/plan-subscribers.js": "/chunks/plan-subscribers.js?id=36d925def6a82cb2", + "/chunks/plan-settings.js": "/chunks/plan-settings.js?id=ee4100b0eff32f36", + "/chunks/plan-delete.js": "/chunks/plan-delete.js?id=630deb1fc4e17ed9", + "/chunks/payments.js": "/chunks/payments.js?id=d59a2a18b680d65c", + "/chunks/payments/billings.js": "/chunks/payments/billings.js?id=27d6c1b58dbd1e6c", + "/chunks/payments/settings.js": "/chunks/payments/settings.js?id=5ebb1c970a407198", + "/chunks/app-settings.js": "/chunks/app-settings.js?id=b0d1082fdcbbd17c", + "/chunks/app-appearance.js": "/chunks/app-appearance.js?id=8ba3feb2cc81a2c3", + "/chunks/app-index.js": "/chunks/app-index.js?id=db4ad4671280c74a", + "/chunks/app-environment.js": "/chunks/app-environment.js?id=e8c421cddbaa4851", + "/chunks/app-others.js": "/chunks/app-others.js?id=ada6e9106c6019e0", + "/chunks/app-sign-in-out.js": "/chunks/app-sign-in-out.js?id=77ac953ce49b5b55", + "/chunks/app-adsense.js": "/chunks/app-adsense.js?id=cf62f3636ad85aab", + "/chunks/app-server.js": "/chunks/app-server.js?id=29dfec5388977be5", + "/chunks/app-language.js": "/chunks/app-language.js?id=f5cfbac7969ddd9e", + "/chunks/homepage.js": "/chunks/homepage.js?id=f3f4ec3a8469ede8", + "/chunks/dynamic-page.js": "/chunks/dynamic-page.js?id=9553d7a2912cb901", + "/chunks/contact-us.js": "/chunks/contact-us.js?id=f35cb6592fcd71c7", + "/chunks/demo.js": "/chunks/demo.js?id=7e21d033be8313af", + "/chunks/successfully-email-verified.js": "/chunks/successfully-email-verified.js?id=e78db2b09e8f07ee", + "/chunks/successfully-email-send.js": "/chunks/successfully-email-send.js?id=940d68f421576013", + "/chunks/sign-in.js": "/chunks/sign-in.js?id=44800b83e3cc169c", + "/chunks/sign-up.js": "/chunks/sign-up.js?id=913e87bca913f106", + "/chunks/forgotten-password.js": "/chunks/forgotten-password.js?id=c1b4a00fb0061371", + "/chunks/create-new-password.js": "/chunks/create-new-password.js?id=3ebf7212f7c549c8", + "/chunks/settings.js": "/chunks/settings.js?id=f2af0f3d8d336b03", + "/chunks/profile.js": "/chunks/profile.js?id=3e24bb5e1f52d4bb", + "/chunks/settings-password.js": "/chunks/settings-password.js?id=1cf499fe8326b3c4", + "/chunks/settings-storage.js": "/chunks/settings-storage.js?id=ecfee7f7e98204f8", + "/chunks/billing.js": "/chunks/billing.js?id=f016e8454a346fc6", + "/chunks/platform.js": "/chunks/platform.js?id=b480b70c132c9260", + "/chunks/files.js": "/chunks/files.js?id=8d14cc22bf819ba4", + "/chunks/recent-uploads.js": "/chunks/recent-uploads.js?id=0096eda68e467f70", + "/chunks/my-shared-items.js": "/chunks/my-shared-items.js?id=3c2f20fe42bd9099", + "/chunks/trash.js": "/chunks/trash.js?id=7e1bcf559eee02b9", + "/chunks/team-folders.js": "/chunks/team-folders.js?id=3a44cea9e32dd13c", + "/chunks/shared-with-me.js": "/chunks/shared-with-me.js?id=da2de82e20a002df", + "/chunks/invitation.js": "/chunks/invitation.js?id=21b5bc5ac116c97e", "/css/tailwind.css": "/css/tailwind.css", "/css/app.css": "/css/app.css" } diff --git a/resources/js/components/Dashboard/AppSpecification.vue b/resources/js/components/Dashboard/AppSpecification.vue index c0a2bc6e..8375ae0b 100644 --- a/resources/js/components/Dashboard/AppSpecification.vue +++ b/resources/js/components/Dashboard/AppSpecification.vue @@ -35,7 +35,7 @@ {{ data.app.license }} - + {{ $t('subscription') }}: {{ config.subscriptionType }} diff --git a/resources/js/components/Dashboard/Widgets/WidgetLatestRegistrations.vue b/resources/js/components/Dashboard/Widgets/WidgetLatestRegistrations.vue index 33338e21..4d03c547 100644 --- a/resources/js/components/Dashboard/Widgets/WidgetLatestRegistrations.vue +++ b/resources/js/components/Dashboard/Widgets/WidgetLatestRegistrations.vue @@ -114,7 +114,7 @@ {{ $t(row.data.attributes.role) }} - + {{ row.data.relationships.subscription ? $t('premium') : $t('free') }} diff --git a/resources/js/views/Admin/Settings/AppSettingsTabs/Others.vue b/resources/js/views/Admin/Settings/AppSettingsTabs/Others.vue index 1f304f8e..a97ef437 100644 --- a/resources/js/views/Admin/Settings/AppSettingsTabs/Others.vue +++ b/resources/js/views/Admin/Settings/AppSettingsTabs/Others.vue @@ -1,6 +1,22 @@ @@ -330,45 +289,6 @@ export default { } }, methods: { - async upgradeLicense() { - this.isLoadingUpgradingButton = true - // Validate fields - const isValid = await this.$refs.upgradeLicense.validate() - - if (!isValid) return - - axios.post('/api/admin/upgrade-license', { - purchaseCode: this.purchaseCode - }) - .then((response) => { - this.$store.dispatch('getLanguageTranslations', this.config.locale) - - this.$store.commit('REPLACE_CONFIG_VALUE', { - key: 'isSaaS', - value: true, - }) - - events.$emit('toaster', { - type: 'success', - message: this.$t('Your license was successfully upgraded'), - }) - }) - .catch((error) => { - if (error.response.status === 400) { - events.$emit('alert:open', { - title: this.$t('Purchase code is invalid or is not Extended License'), - }) - } else { - events.$emit('alert:open', { - title: this.$t('popup_error.title'), - message: this.$t('popup_error.message'), - }) - } - }) - .finally(() => { - this.isLoadingUpgradingButton = false - }) - }, subscriptionTypeChange(type) { events.$emit('confirm:open', { title: this.$t('subscription_type_change_warn'), diff --git a/resources/js/views/Frontpage/Homepage.vue b/resources/js/views/Frontpage/Homepage.vue index 5919ff8e..750dab47 100644 --- a/resources/js/views/Frontpage/Homepage.vue +++ b/resources/js/views/Frontpage/Homepage.vue @@ -17,7 +17,7 @@ - + diff --git a/resources/js/views/SetupWizard/AppSetup.vue b/resources/js/views/SetupWizard/AppSetup.vue index ddb70487..f2b0c169 100644 --- a/resources/js/views/SetupWizard/AppSetup.vue +++ b/resources/js/views/SetupWizard/AppSetup.vue @@ -194,7 +194,7 @@ -
+
Subscription upload->chunkSize }}, isAuthenticated: {{ $config->app->isAuthenticated }}, - isSaaS: {{ $config->app->isSaaS }}, isDev: {{ $config->app->isDev }}, isDemo: {{ $config->app->isDemo }}, diff --git a/routes/admin.php b/routes/admin.php index 2b132ef2..a48cd898 100644 --- a/routes/admin.php +++ b/routes/admin.php @@ -68,5 +68,4 @@ Route::apiResource('/languages', LanguageController::class); // Miscellaneous Route::get('/status', GetServerStatusController::class); -Route::post('/upgrade-license', UpgradeLicenseController::class); Route::post('/test-websockets', TestWebsocketConnectionController::class); diff --git a/src/App/Console/Commands/SetupDevEnvironment.php b/src/App/Console/Commands/SetupDevEnvironment.php index c76d3544..496a9909 100644 --- a/src/App/Console/Commands/SetupDevEnvironment.php +++ b/src/App/Console/Commands/SetupDevEnvironment.php @@ -25,7 +25,7 @@ class SetupDevEnvironment extends Command /** * The name and signature of the console command. */ - protected $signature = 'setup:dev {license=extended}'; + protected $signature = 'setup:dev'; /** * The console command description. @@ -57,7 +57,7 @@ class SetupDevEnvironment extends Command $this->info('Storing default settings and content...'); ($this->seedDefaultPages)(); - ($this->seedDefaultSettings)($this->argument('license')); + ($this->seedDefaultSettings)(); ($this->seedDefaultLanguage)(); $this->store_default_settings(); @@ -1476,7 +1476,7 @@ class SetupDevEnvironment extends Command ], [ 'name' => 'license', - 'value' => $this->argument('license'), + 'value' => 'regular', ], [ 'name' => 'purchase_code', @@ -1555,6 +1555,18 @@ class SetupDevEnvironment extends Command ->each(function ($file) { Storage::putFileAs('system', storage_path("demo/app/$file"), $file, 'private'); }); + + $choice = $this->choice('Choose subscription type', [ + 'metered' => 'Metered', + 'fixed' => 'Fixed', + 'none' => 'None', + ]); + + Setting::updateOrCreate([ + 'name' => 'subscription_type', + ], [ + 'value' => $choice, + ]); } /** diff --git a/src/App/Console/Commands/SetupProdEnvironment.php b/src/App/Console/Commands/SetupProdEnvironment.php index e91497d1..65dadbcd 100644 --- a/src/App/Console/Commands/SetupProdEnvironment.php +++ b/src/App/Console/Commands/SetupProdEnvironment.php @@ -17,7 +17,7 @@ class SetupProdEnvironment extends Command /** * The name and signature of the console command. */ - protected $signature = 'setup:prod {license=extended}'; + protected $signature = 'setup:prod'; /** * The console command description. @@ -55,7 +55,7 @@ class SetupProdEnvironment extends Command $this->store_default_settings(); ($this->seedDefaultPages)(); - ($this->seedDefaultSettings)($this->argument('license')); + ($this->seedDefaultSettings)(); ($this->seedDefaultLanguage)(); $this->info('Creating default admin...'); @@ -155,7 +155,7 @@ class SetupProdEnvironment extends Command ], [ 'name' => 'license', - 'value' => $this->argument('license'), + 'value' => 'regular', ], [ 'name' => 'purchase_code', @@ -204,19 +204,17 @@ class SetupProdEnvironment extends Command ]); }); - if ($this->argument('license') === 'extended') { - $choice = $this->choice('Choose subscription type', [ - 'metered' => 'Metered', - 'fixed' => 'Fixed', - 'none' => 'None', - ]); + $choice = $this->choice('Choose subscription type', [ + 'metered' => 'Metered', + 'fixed' => 'Fixed', + 'none' => 'None', + ]); - Setting::updateOrCreate([ - 'name' => 'subscription_type', - ], [ - 'value' => $choice, - ]); - } + Setting::updateOrCreate([ + 'name' => 'subscription_type', + ], [ + 'value' => $choice, + ]); } /** diff --git a/src/Domain/Localization/Actions/SeedDefaultLanguageTranslationsAction.php b/src/Domain/Localization/Actions/SeedDefaultLanguageTranslationsAction.php index 66e4e416..4983381d 100644 --- a/src/Domain/Localization/Actions/SeedDefaultLanguageTranslationsAction.php +++ b/src/Domain/Localization/Actions/SeedDefaultLanguageTranslationsAction.php @@ -6,7 +6,6 @@ use DB; class SeedDefaultLanguageTranslationsAction { public function __invoke( - string $license, string $locale ): void { $translations = collect([ diff --git a/src/Domain/Localization/Actions/UpgradeLanguageTranslationsAction.php b/src/Domain/Localization/Actions/UpgradeLanguageTranslationsAction.php index ccd1d6b5..b9bd4acd 100644 --- a/src/Domain/Localization/Actions/UpgradeLanguageTranslationsAction.php +++ b/src/Domain/Localization/Actions/UpgradeLanguageTranslationsAction.php @@ -21,23 +21,16 @@ class UpgradeLanguageTranslationsAction $translations = LanguageTranslation::whereLang('en') ->get(); - $default_translations = [ - 'extended' => collect([ - config('language-translations.extended'), - config('language-translations.regular'), - config('custom-language-translations'), - ])->collapse(), - 'regular' => collect([ - config('language-translations.regular'), - config('custom-language-translations'), - ])->collapse(), - ]; - - $license = strtolower(get_settings('license')); - // Find new translations in default translations - $newbies = $default_translations[$license] - ->diffKeys(map_language_translations($translations)); + $newbies = collect([ + config('language-translations.extended'), + config('language-translations.regular'), + config('custom-language-translations'), + ]) + ->collapse() + ->diffKeys( + map_language_translations($translations) + ); // Store new translations for every language $locales->each(function ($locale) use ($newbies) { diff --git a/src/Domain/Localization/Models/Language.php b/src/Domain/Localization/Models/Language.php index 8193328b..7e2c66a9 100644 --- a/src/Domain/Localization/Models/Language.php +++ b/src/Domain/Localization/Models/Language.php @@ -48,7 +48,6 @@ class Language extends Model $language->id = Str::uuid(); resolve(SeedDefaultLanguageTranslationsAction::class)( - license: get_settings('license') ?? 'extended', locale: $language->locale ); }); diff --git a/src/Domain/Settings/Actions/GetConfigAction.php b/src/Domain/Settings/Actions/GetConfigAction.php index 5a64a47d..e962b545 100644 --- a/src/Domain/Settings/Actions/GetConfigAction.php +++ b/src/Domain/Settings/Actions/GetConfigAction.php @@ -94,7 +94,6 @@ class GetConfigAction 'locale' => app()->getLocale(), 'isDev' => is_dev() ? 1 : 0, 'isDemo' => config('vuefilemanager.is_demo') ? 1 : 0, - 'isSaaS' => $settings && optional($settings)->license === 'extended' ? 1 : 0, 'isAuthenticated' => $isUser ? 1 : 0, 'installation' => $setupStatus ?? 'initial', 'name' => $settings->app_title ?? 'VueFileManager', diff --git a/src/Domain/Settings/Actions/SeedDefaultSettingsAction.php b/src/Domain/Settings/Actions/SeedDefaultSettingsAction.php index 68258527..7116e3f0 100644 --- a/src/Domain/Settings/Actions/SeedDefaultSettingsAction.php +++ b/src/Domain/Settings/Actions/SeedDefaultSettingsAction.php @@ -9,9 +9,8 @@ class SeedDefaultSettingsAction /** * Store default VueFileManager settings into database */ - public function __invoke( - string $license - ): void { + public function __invoke(): void + { // Set default settings collect( config('content.content') diff --git a/src/Domain/Settings/Controllers/UpgradeLicenseController.php b/src/Domain/Settings/Controllers/UpgradeLicenseController.php deleted file mode 100644 index 7ab95171..00000000 --- a/src/Domain/Settings/Controllers/UpgradeLicenseController.php +++ /dev/null @@ -1,107 +0,0 @@ -input('purchaseCode')}"); - - if ($response->successful() && $response->body() === 'b6896a44017217c36f4a6fdc56699728') { - // Store default settings for extended version - collect([ - [ - 'name' => 'license', - 'value' => 'extended', - ], - [ - 'name' => 'purchase_code', - 'value' => $request->input('purchaseCode'), - ], - [ - 'name' => 'section_pricing_content', - 'value' => 1, - ], - [ - 'name' => 'paypal_payment_description', - 'value' => 'Available PayPal Credit, Debit or Credit Card.', - ], - [ - 'name' => 'paystack_payment_description', - 'value' => 'Available Bank Account, USSD, Mobile Money, Apple Pay.', - ], - [ - 'name' => 'stripe_payment_description', - 'value' => 'Available credit card or Apple Pay.', - ], - [ - 'name' => 'allowed_registration_bonus', - 'value' => 0, - ], - [ - 'name' => 'registration_bonus_amount', - 'value' => 0, - ], - [ - 'name' => 'pricing_title', - 'value' => 'Pick the Best Plan For Your Needs', - ], - [ - 'name' => 'pricing_description', - 'value' => 'Your private cloud storage software build on Laravel & Vue.js. No limits & no monthly fees. Truly freedom.', - ], - ])->each(function ($col) { - Setting::updateOrCreate([ - 'name' => $col['name'], - ], [ - 'value' => $col['value'], - ]); - }); - - // Seed translations for extended version - Language::all() - ->each(function ($lang) { - $translations = collect( - config('language-translations.extended') - ) - ->map(fn ($value, $key) => [ - 'lang' => $lang->locale, - 'value' => $value, - 'key' => $key, - ])->toArray(); - - $chunks = array_chunk($translations, 100); - - foreach ($chunks as $chunk) { - DB::table('language_translations') - ->insert($chunk); - } - }); - - // Clear config and cache - Artisan::call('config:clear'); - Artisan::call('cache:clear'); - - return response()->json([ - 'status' => 'success', - 'message' => 'Your license was successfully upgraded', - ], 201); - } - - return response()->json([ - 'status' => 'error', - 'message' => 'Purchase code is invalid or is not Extended License.', - ], 400); - } -} diff --git a/src/Domain/SetupWizard/Controllers/CreateAdminAccountController.php b/src/Domain/SetupWizard/Controllers/CreateAdminAccountController.php index 70aec489..788fced4 100644 --- a/src/Domain/SetupWizard/Controllers/CreateAdminAccountController.php +++ b/src/Domain/SetupWizard/Controllers/CreateAdminAccountController.php @@ -80,7 +80,7 @@ class CreateAdminAccountController extends Controller // Set up application ($this->seedDefaultPages)(); - ($this->seedDefaultSettingsAction)($request->input('license')); + ($this->seedDefaultSettingsAction)(); ($this->seedDefaultLanguage)(); return response('Registration was successful', 204); diff --git a/src/Support/Upgrading/Actions/UpdateSystemAction.php b/src/Support/Upgrading/Actions/UpdateSystemAction.php index db24a559..206b6a17 100644 --- a/src/Support/Upgrading/Actions/UpdateSystemAction.php +++ b/src/Support/Upgrading/Actions/UpdateSystemAction.php @@ -57,19 +57,13 @@ class UpdateSystemAction extends UpgradingVersionsController private function shouldUpdateTranslations(): bool { - $default_translations = [ - 'extended' => collect([ - config('language-translations.extended'), - config('language-translations.regular'), - config('custom-language-translations'), - ])->collapse(), - 'regular' => collect([ - config('language-translations.regular'), - config('custom-language-translations'), - ])->collapse(), - ]; + $default_translations = collect([ + config('language-translations.extended'), + config('language-translations.regular'), + config('custom-language-translations'), + ])->collapse(); - $originalTranslationCount = count($default_translations[get_settings('license')]); + $originalTranslationCount = count($default_translations); $activeTranslationsCount = DB::table('language_translations') ->where('lang', 'en') diff --git a/src/Support/Upgrading/Controllers/UpgradingVersionsController.php b/src/Support/Upgrading/Controllers/UpgradingVersionsController.php index 2932c58b..fc3f9e19 100644 --- a/src/Support/Upgrading/Controllers/UpgradingVersionsController.php +++ b/src/Support/Upgrading/Controllers/UpgradingVersionsController.php @@ -3,6 +3,8 @@ namespace Support\Upgrading\Controllers; use DB; use Artisan; +use Domain\Localization\Models\Language; +use Domain\Settings\Models\Setting; use Storage; use App\Users\Models\User; use Illuminate\Support\Arr; @@ -22,6 +24,80 @@ class UpgradingVersionsController ) { } + public function upgrade_to_2_2_3(): void + { + ($this->upgradeDatabase)(); + + // Apply only for regular licenses + if (get_settings('license') === 'regular') { + // Store default settings for extended version + collect([ + [ + 'name' => 'section_pricing_content', + 'value' => 1, + ], + [ + 'name' => 'paypal_payment_description', + 'value' => 'Available PayPal Credit, Debit or Credit Card.', + ], + [ + 'name' => 'paystack_payment_description', + 'value' => 'Available Bank Account, USSD, Mobile Money, Apple Pay.', + ], + [ + 'name' => 'stripe_payment_description', + 'value' => 'Available credit card or Apple Pay.', + ], + [ + 'name' => 'allowed_registration_bonus', + 'value' => 0, + ], + [ + 'name' => 'registration_bonus_amount', + 'value' => 0, + ], + [ + 'name' => 'pricing_title', + 'value' => 'Pick the Best Plan For Your Needs', + ], + [ + 'name' => 'pricing_description', + 'value' => 'Your private cloud storage software build on Laravel & Vue.js. No limits & no monthly fees. Truly freedom.', + ], + ])->each(function ($col) { + Setting::updateOrCreate([ + 'name' => $col['name'], + ], [ + 'value' => $col['value'], + ]); + }); + + // Seed translations for extended version + Language::all() + ->each(function ($lang) { + $translations = collect( + config('language-translations.extended') + ) + ->map(fn ($value, $key) => [ + 'lang' => $lang->locale, + 'value' => $value, + 'key' => $key, + ])->toArray(); + + $chunks = array_chunk($translations, 100); + + foreach ($chunks as $chunk) { + DB::table('language_translations') + ->insert($chunk); + } + }); + + // Clear config and cache + Artisan::call('config:clear'); + Artisan::call('cache:clear'); + } + } + public function upgrade_to_2_2_2(): void { ($this->upgradeDatabase)(); diff --git a/tests/Domain/Homepage/HomepageTest.php b/tests/Domain/Homepage/HomepageTest.php index d98670c4..c3b99808 100644 --- a/tests/Domain/Homepage/HomepageTest.php +++ b/tests/Domain/Homepage/HomepageTest.php @@ -21,7 +21,7 @@ class HomepageTest extends TestCase { resolve(SeedDefaultPagesAction::class)(); - resolve(SeedDefaultSettingsAction::class)('Extended'); + resolve(SeedDefaultSettingsAction::class)(); Setting::create([ 'name' => 'setup_wizard_success', diff --git a/tests/Domain/Settings/SettingsTest.php b/tests/Domain/Settings/SettingsTest.php index 5d942230..a8c7a6e1 100644 --- a/tests/Domain/Settings/SettingsTest.php +++ b/tests/Domain/Settings/SettingsTest.php @@ -6,9 +6,7 @@ use Tests\TestCase; use App\Users\Models\User; use Illuminate\Http\UploadedFile; use Domain\Settings\Models\Setting; -use Illuminate\Support\Facades\Http; use Domain\Settings\Actions\SeedDefaultSettingsAction; -use Domain\Localization\Actions\SeedDefaultLanguageAction; class SettingsTest extends TestCase { @@ -40,7 +38,7 @@ class SettingsTest extends TestCase */ public function it_get_admin_settings() { - resolve(SeedDefaultSettingsAction::class)('Extended'); + resolve(SeedDefaultSettingsAction::class)(); $admin = User::factory() ->create(['role' => 'admin']); @@ -74,7 +72,7 @@ class SettingsTest extends TestCase */ public function it_update_settings() { - resolve(SeedDefaultSettingsAction::class)('Extended'); + resolve(SeedDefaultSettingsAction::class)(); $admin = User::factory() ->create(['role' => 'admin']); @@ -243,64 +241,4 @@ class SettingsTest extends TestCase 'host' => null, ])->assertStatus(200); } - - /** - * @test - */ - public function it_upgrade_license() - { - Http::fake([ - 'https://verify.vuefilemanager.com/api/verify-code/*' => Http::response('b6896a44017217c36f4a6fdc56699728'), - ]); - - collect([ - [ - 'name' => 'license', - 'value' => 'regular', - ], - [ - 'name' => 'purchase_code', - 'value' => '22b28b36-6d84-41b2-a920-a884b2bf63b6', - ], - ])->each(function ($col) { - Setting::updateOrCreate([ - 'name' => $col['name'], - ], [ - 'value' => $col['value'], - ]); - }); - - resolve(SeedDefaultLanguageAction::class)(); - - $admin = User::factory() - ->create(['role' => 'admin']); - - $this - ->actingAs($admin) - ->postJson('/api/admin/upgrade-license', [ - 'purchaseCode' => '6ab28b36-6d84-41b2-a920-a884b2bf63b6', - ])->assertStatus(201); - - collect([ - [ - 'name' => 'license', - 'value' => 'extended', - ], - [ - 'name' => 'purchase_code', - 'value' => '6ab28b36-6d84-41b2-a920-a884b2bf63b6', - ], - ])->each(function ($col) { - $this->assertDatabaseHas('settings', [ - 'name' => $col['name'], - 'value' => $col['value'], - ]); - }); - - $this->assertDatabaseHas('language_translations', [ - 'key' => 'go_to_subscription', - 'value' => 'Go to Subscription', - 'lang' => 'en', - ]); - } }