mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-28 19:10:40 +00:00
extended license restrictions removed
This commit is contained in:
@@ -6,7 +6,6 @@ use DB;
|
||||
class SeedDefaultLanguageTranslationsAction
|
||||
{
|
||||
public function __invoke(
|
||||
string $license,
|
||||
string $locale
|
||||
): void {
|
||||
$translations = collect([
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -48,7 +48,6 @@ class Language extends Model
|
||||
$language->id = Str::uuid();
|
||||
|
||||
resolve(SeedDefaultLanguageTranslationsAction::class)(
|
||||
license: get_settings('license') ?? 'extended',
|
||||
locale: $language->locale
|
||||
);
|
||||
});
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -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')
|
||||
|
||||
@@ -1,107 +0,0 @@
|
||||
<?php
|
||||
namespace Domain\Settings\Controllers;
|
||||
|
||||
use DB;
|
||||
use Artisan;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Domain\Settings\Models\Setting;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Domain\Localization\Models\Language;
|
||||
use Domain\Settings\Requests\UpgradeLicenseRequest;
|
||||
|
||||
class UpgradeLicenseController extends Controller
|
||||
{
|
||||
public function __invoke(
|
||||
UpgradeLicenseRequest $request
|
||||
): JsonResponse {
|
||||
// Verify purchase code
|
||||
$response = Http::get("https://verify.vuefilemanager.com/api/verify-code/{$request->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 <span class="text-theme">Best Plan</span> 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);
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user