Added option to disable user import/export

This commit is contained in:
Julian Prieber 2023-03-08 17:46:40 +01:00
parent 4eca39e9ce
commit 06ba584a7c
7 changed files with 43 additions and 6 deletions

4
.env
View File

@ -114,3 +114,7 @@ HOME_FOOTER_LINK=""
HIDE_VERIFICATION_CHECKMARK=false
ALLOW_CUSTOM_BACKGROUNDS=true
ALLOW_USER_EXPORT=true
ALLOW_USER_IMPORT=true

View File

@ -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."

View File

@ -296,7 +296,6 @@ foreach($users as $user){if($user->littlelink_name != $configValue2){echo '<opti
{{toggle('ALLOW_CUSTOM_BACKGROUNDS')}}
<a name="Security"><h2 class="ch2">Security</h2></a>
@ -309,6 +308,13 @@ foreach($users as $user){if($user->littlelink_name != $configValue2){echo '<opti
{{toggle('ENABLE_THEME_UPDATER')}}
{{toggle('ALLOW_USER_EXPORT')}}
{{toggle('ALLOW_USER_IMPORT')}}
<a name="Advanced"><h2 class="ch2">Advanced</h2></a>
{{toggle('JOIN_BETA')}}

View File

@ -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');}

View File

@ -32,8 +32,8 @@
</form>
@endif
@if(env('ALLOW_USER_EXPORT') != false)
<br><br><br>
<div class="form-group col-lg-8">
<h4>Export user data</h4>
<label>Export your user data to transfer to a different instance.</label>
@ -41,7 +41,9 @@
<button class="mt-3 ml-3 btn btn-outline-secondary"><a href="{{ route('exportAll') }}" style="color:#fff;"><i class="bi bi-layer-backward"></i> Export all data</a></button>
<button class="mt-3 ml-3 btn btn-outline-secondary"><a href="{{ route('exportLinks') }}" style="color:#fff;"><i class="bi bi-layer-backward"></i> Export links only</a></button>
</div></div>
@endif
@if(env('ALLOW_USER_IMPORT') != false)
<form action="{{ route('importData') }}" enctype="multipart/form-data" method="post">
@csrf
<div class="form-group col-lg-8"><br><br><br>
@ -52,6 +54,7 @@
<button type="submit" class="mt-3 ml-3 btn btn-info" onclick="return confirm('Are you sure you want to import this file? This action will replace all your current data, including links!')">Import</button>
</form>
@endif
<br>

View File

@ -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');
});

View File

@ -113,4 +113,8 @@ HOME_FOOTER_LINK=""
HIDE_VERIFICATION_CHECKMARK=false
ALLOW_CUSTOM_BACKGROUNDS=true
ALLOW_CUSTOM_BACKGROUNDS=true
ALLOW_USER_EXPORT=true
ALLOW_USER_IMPORT=true