From 06ba584a7c58c3f32ce271847454242f7e636fec Mon Sep 17 00:00:00 2001 From: Julian Prieber Date: Wed, 8 Mar 2023 17:46:40 +0100 Subject: [PATCH] Added option to disable user import/export --- .env | 4 ++++ config/config-legends.json | 10 ++++++++++ resources/views/components/config/config.blade.php | 8 +++++++- resources/views/components/finishing.blade.php | 6 ++++++ resources/views/studio/profile.blade.php | 5 ++++- routes/web.php | 10 +++++++--- storage/backups/default_settings | 6 +++++- 7 files changed, 43 insertions(+), 6 deletions(-) diff --git a/.env b/.env index 921dcdd..3a0953b 100644 --- a/.env +++ b/.env @@ -114,3 +114,7 @@ HOME_FOOTER_LINK="" HIDE_VERIFICATION_CHECKMARK=false ALLOW_CUSTOM_BACKGROUNDS=true + +ALLOW_USER_EXPORT=true + +ALLOW_USER_IMPORT=true \ No newline at end of file diff --git a/config/config-legends.json b/config/config-legends.json index 19672fe..aba73a0 100644 --- a/config/config-legends.json +++ b/config/config-legends.json @@ -219,6 +219,16 @@ "description": "Allow users to upload custom background images for their pages." }, + {"value": "ALLOW_USER_IMPORT", + "title": "Allow users to import profiles from other instances", + "description": "Allows users to import their profile and links from an external file." + }, + + {"value": "ALLOW_USER_EXPORT", + "title": "Allow users to export their profile", + "description": "Allows users to export their own links and profile." + }, + {"value": "HIDE_VERIFICATION_CHECKMARK", "title": "Hide verification checkmark", "description": "Hides verification badge displayed on admin and VIP pages." diff --git a/resources/views/components/config/config.blade.php b/resources/views/components/config/config.blade.php index 2afa3de..4cf09bb 100644 --- a/resources/views/components/config/config.blade.php +++ b/resources/views/components/config/config.blade.php @@ -296,7 +296,6 @@ foreach($users as $user){if($user->littlelink_name != $configValue2){echo '

Security

@@ -309,6 +308,13 @@ foreach($users as $user){if($user->littlelink_name != $configValue2){echo '

Advanced

{{toggle('JOIN_BETA')}} diff --git a/resources/views/components/finishing.blade.php b/resources/views/components/finishing.blade.php index f31f801..830db57 100644 --- a/resources/views/components/finishing.blade.php +++ b/resources/views/components/finishing.blade.php @@ -39,6 +39,12 @@ use Illuminate\Support\Facades\File; if(EnvEditor::keyExists('ALLOW_CUSTOM_BACKGROUNDS')){ /* Do nothing if key already exists */ } else {EnvEditor::addKey('ALLOW_CUSTOM_BACKGROUNDS', 'true');} + if(EnvEditor::keyExists('ALLOW_USER_IMPORT')){ /* Do nothing if key already exists */ + } else {EnvEditor::addKey('ALLOW_USER_IMPORT', 'true');} + + if(EnvEditor::keyExists('ALLOW_USER_EXPORT')){ /* Do nothing if key already exists */ + } else {EnvEditor::addKey('ALLOW_USER_EXPORT', 'true');} + // Footer page customization if(EnvEditor::keyExists('DISPLAY_FOOTER_HOME')){} else {EnvEditor::addKey('DISPLAY_FOOTER_HOME', 'true');} diff --git a/resources/views/studio/profile.blade.php b/resources/views/studio/profile.blade.php index 89d8340..7bde683 100755 --- a/resources/views/studio/profile.blade.php +++ b/resources/views/studio/profile.blade.php @@ -32,8 +32,8 @@ @endif +@if(env('ALLOW_USER_EXPORT') != false)


-

Export user data

@@ -41,7 +41,9 @@
+@endif +@if(env('ALLOW_USER_IMPORT') != false)
@csrf



@@ -52,6 +54,7 @@ +@endif
diff --git a/routes/web.php b/routes/web.php index b845733..a4d1744 100755 --- a/routes/web.php +++ b/routes/web.php @@ -123,9 +123,13 @@ Route::post('/edit-icons', [UserController::class, 'editIcons'])->name('editIcon Route::get('/clearIcon/{id}', [UserController::class, 'clearIcon'])->name('clearIcon'); Route::get('/studio/page/delprofilepicture', [UserController::class, 'delProfilePicture'])->name('delProfilePicture'); Route::get('/studio/delete-user/{id}', [UserController::class, 'deleteUser'])->name('deleteUser')->middleware('verified'); -Route::get('/export-links', [UserController::class, 'exportLinks'])->name('exportLinks'); -Route::get('/export-all', [UserController::class, 'exportAll'])->name('exportAll'); -Route::post('/import-data', [UserController::class, 'importData'])->name('importData'); +if(env('ALLOW_USER_EXPORT') != false){ + Route::get('/export-links', [UserController::class, 'exportLinks'])->name('exportLinks'); + Route::get('/export-all', [UserController::class, 'exportAll'])->name('exportAll'); +} +if(env('ALLOW_USER_IMPORT') != false){ + Route::post('/import-data', [UserController::class, 'importData'])->name('importData'); +} Route::get('/studio/linkparamform_part/{typeid}/{linkid}', [LinkTypeViewController::class, 'getParamForm'])->name('linkparamform.part'); }); diff --git a/storage/backups/default_settings b/storage/backups/default_settings index 60f2bc5..1f5aa92 100644 --- a/storage/backups/default_settings +++ b/storage/backups/default_settings @@ -113,4 +113,8 @@ HOME_FOOTER_LINK="" HIDE_VERIFICATION_CHECKMARK=false -ALLOW_CUSTOM_BACKGROUNDS=true \ No newline at end of file +ALLOW_CUSTOM_BACKGROUNDS=true + +ALLOW_USER_EXPORT=true + +ALLOW_USER_IMPORT=true \ No newline at end of file