Merge pull request #851 from LinkStackOrg/beta

Beta
This commit is contained in:
Julian Prieber 2024-11-27 14:28:06 +01:00 committed by GitHub
commit db2408d29d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 683 additions and 638 deletions

View File

@ -7,7 +7,6 @@
"require": { "require": {
"php": ">=8.0", "php": ">=8.0",
"awssat/laravel-visits": "^6.0", "awssat/laravel-visits": "^6.0",
"codedge/laravel-selfupdater": "^3.6",
"cohensive/oembed": "^0.17", "cohensive/oembed": "^0.17",
"doctrine/dbal": "^3.0", "doctrine/dbal": "^3.0",
"fideloper/proxy": "^4.4", "fideloper/proxy": "^4.4",

View File

@ -1,161 +0,0 @@
<?php
declare(strict_types=1);
if (env('JOIN_BETA') == true) {
$userver = 'https://beta.linkstack.org/';
} else {
$userver = 'https://update.linkstack.org/';
}
return [
/*
|--------------------------------------------------------------------------
| Default source repository type
|--------------------------------------------------------------------------
|
| The default source repository type you want to pull your updates from.
|
*/
'default' => env('SELF_UPDATER_SOURCE', 'http'),
/*
|--------------------------------------------------------------------------
| Version installed
|--------------------------------------------------------------------------
|
| Set this to the version of your software installed on your system.
|
*/
'version_installed' => file_get_contents(base_path("version.json")),
/*
|--------------------------------------------------------------------------
| Repository types
|--------------------------------------------------------------------------
|
| A repository can be of different types, which can be specified here.
| Current options:
| - github
| - gitlab
| - http
|
*/
'repository_types' => [
'github' => [
'type' => 'github',
'repository_vendor' => env('SELF_UPDATER_REPO_VENDOR', ''),
'repository_name' => env('SELF_UPDATER_REPO_NAME', ''),
'repository_url' => '',
'download_path' => env('SELF_UPDATER_DOWNLOAD_PATH', '/tmp'),
'private_access_token' => env('SELF_UPDATER_GITHUB_PRIVATE_ACCESS_TOKEN', ''),
'use_branch' => env('SELF_UPDATER_USE_BRANCH', ''),
],
'gitlab' => [
'type' => 'gitlab',
'repository_id' => env('SELF_UPDATER_REPO_URL', ''),
'download_path' => env('SELF_UPDATER_DOWNLOAD_PATH', '/tmp'),
'private_access_token' => env('SELF_UPDATER_GITLAB_PRIVATE_ACCESS_TOKEN', ''),
],
'http' => [
'type' => 'http',
'repository_url' => env('SELF_UPDATER_REPO_URL', $userver),
'pkg_filename_format' => env('SELF_UPDATER_PKG_FILENAME_FORMAT', '_VERSION_'),
'download_path' => env('SELF_UPDATER_DOWNLOAD_PATH', '/tmp'),
'private_access_token' => env('SELF_UPDATER_HTTP_PRIVATE_ACCESS_TOKEN', ''),
],
],
/*
|--------------------------------------------------------------------------
| Exclude folders from update
|--------------------------------------------------------------------------
|
| Specific folders which should not be updated and will be skipped during the
| update process.
|
| Here's already a list of good examples to skip. You may want to keep those.
|
*/
'exclude_folders' => [
'__MACOSX',
'node_modules',
'bootstrap/cache',
'bower',
'storage/app',
'storage/framework',
'storage/logs',
'storage/self-update',
],
/*
|--------------------------------------------------------------------------
| Event Logging
|--------------------------------------------------------------------------
|
| Configure if fired events should be logged
|
*/
'log_events' => env('SELF_UPDATER_LOG_EVENTS', true),
/*
|--------------------------------------------------------------------------
| Notifications
|--------------------------------------------------------------------------
|
| Specify for which events you want to get notifications. Out of the box you can use 'mail'.
|
*/
'notifications' => [
'notifications' => [
\Codedge\Updater\Notifications\Notifications\UpdateSucceeded::class => ['mail'],
\Codedge\Updater\Notifications\Notifications\UpdateFailed::class => ['mail'],
\Codedge\Updater\Notifications\Notifications\UpdateAvailable::class => ['mail'],
],
/*
* Here you can specify the notifiable to which the notifications should be sent. The default
* notifiable will use the variables specified in this config file.
*/
'notifiable' => \Codedge\Updater\Notifications\Notifiable::class,
'mail' => [
'to' => [
'address' => env('SELF_UPDATER_MAILTO_ADDRESS', 'notifications@example.com'),
'name' => env('SELF_UPDATER_MAILTO_NAME', ''),
],
'from' => [
'address' => env('SELF_UPDATER_MAIL_FROM_ADDRESS', 'updater@example.com'),
'name' => env('SELF_UPDATER_MAIL_FROM_NAME', 'Update'),
],
],
],
/*
|---------------------------------------------------------------------------
| Register custom artisan commands
|---------------------------------------------------------------------------
*/
'artisan_commands' => [
'pre_update' => [
//'command:signature' => [
// 'class' => Command class
// 'params' => []
//]
],
'post_update' => [
],
],
];

View File

@ -8,76 +8,144 @@ use Illuminate\Support\Facades\File;
use Database\Seeders\ButtonSeeder; use Database\Seeders\ButtonSeeder;
use App\Models\Page; use App\Models\Page;
set_time_limit(0);
//run before finishing: //run before finishing:
if(EnvEditor::keyExists('JOIN_BETA')){ /* Do nothing if key already exists */ if (EnvEditor::keyExists('JOIN_BETA')) {
} else { EnvEditor::addKey('JOIN_BETA', 'false');} // Adds key to .env file /* Do nothing if key already exists */
} else {
EnvEditor::addKey('JOIN_BETA', 'false');
} // Adds key to .env file
if(EnvEditor::keyExists('SKIP_UPDATE_BACKUP')){ /* Do nothing if key already exists */ if (EnvEditor::keyExists('SKIP_UPDATE_BACKUP')) {
} else { EnvEditor::addKey('SKIP_UPDATE_BACKUP', 'false');} // Adds key to .env file /* Do nothing if key already exists */
} else {
EnvEditor::addKey('SKIP_UPDATE_BACKUP', 'false');
} // Adds key to .env file
if(EnvEditor::keyExists('CUSTOM_META_TAGS')){ /* Do nothing if key already exists */ if (EnvEditor::keyExists('CUSTOM_META_TAGS')) {
} else {EnvEditor::addKey('CUSTOM_META_TAGS', 'false');} /* Do nothing if key already exists */
} else {
EnvEditor::addKey('CUSTOM_META_TAGS', 'false');
}
if(EnvEditor::keyExists('MAINTENANCE_MODE')){ /* Do nothing if key already exists */ if (EnvEditor::keyExists('MAINTENANCE_MODE')) {
} else {EnvEditor::addKey('MAINTENANCE_MODE', 'false');} /* Do nothing if key already exists */
} else {
EnvEditor::addKey('MAINTENANCE_MODE', 'false');
}
if(EnvEditor::keyExists('ALLOW_CUSTOM_CODE_IN_THEMES')){ /* Do nothing if key already exists */ if (EnvEditor::keyExists('ALLOW_CUSTOM_CODE_IN_THEMES')) {
} else {EnvEditor::addKey('ALLOW_CUSTOM_CODE_IN_THEMES', 'true');} /* Do nothing if key already exists */
} else {
EnvEditor::addKey('ALLOW_CUSTOM_CODE_IN_THEMES', 'true');
}
if(EnvEditor::keyExists('ENABLE_THEME_UPDATER')){ /* Do nothing if key already exists */ if (EnvEditor::keyExists('ENABLE_THEME_UPDATER')) {
} else {EnvEditor::addKey('ENABLE_THEME_UPDATER', 'true');} /* Do nothing if key already exists */
} else {
EnvEditor::addKey('ENABLE_THEME_UPDATER', 'true');
}
if(EnvEditor::keyExists('ENABLE_SOCIAL_LOGIN')){ /* Do nothing if key already exists */ if (EnvEditor::keyExists('ENABLE_SOCIAL_LOGIN')) {
} else {EnvEditor::addKey('ENABLE_SOCIAL_LOGIN', 'false');} /* Do nothing if key already exists */
} else {
EnvEditor::addKey('ENABLE_SOCIAL_LOGIN', 'false');
}
if(EnvEditor::keyExists('USE_THEME_PREVIEW_IFRAME')){ /* Do nothing if key already exists */ if (EnvEditor::keyExists('USE_THEME_PREVIEW_IFRAME')) {
} else {EnvEditor::addKey('USE_THEME_PREVIEW_IFRAME', 'true');} /* Do nothing if key already exists */
} else {
EnvEditor::addKey('USE_THEME_PREVIEW_IFRAME', 'true');
}
if(EnvEditor::keyExists('FORCE_ROUTE_HTTPS')){ /* Do nothing if key already exists */ if (EnvEditor::keyExists('FORCE_ROUTE_HTTPS')) {
} else {EnvEditor::addKey('FORCE_ROUTE_HTTPS', 'false');} /* Do nothing if key already exists */
} else {
EnvEditor::addKey('FORCE_ROUTE_HTTPS', 'false');
}
if(EnvEditor::keyExists('HIDE_VERIFICATION_CHECKMARK')){ /* Do nothing if key already exists */ if (EnvEditor::keyExists('HIDE_VERIFICATION_CHECKMARK')) {
} else {EnvEditor::addKey('HIDE_VERIFICATION_CHECKMARK', 'false');} /* Do nothing if key already exists */
} else {
EnvEditor::addKey('HIDE_VERIFICATION_CHECKMARK', 'false');
}
if(EnvEditor::keyExists('ALLOW_CUSTOM_BACKGROUNDS')){ /* Do nothing if key already exists */ if (EnvEditor::keyExists('ALLOW_CUSTOM_BACKGROUNDS')) {
} else {EnvEditor::addKey('ALLOW_CUSTOM_BACKGROUNDS', 'true');} /* 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 */ if (EnvEditor::keyExists('ALLOW_USER_IMPORT')) {
} else {EnvEditor::addKey('ALLOW_USER_IMPORT', 'true');} /* 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 */ if (EnvEditor::keyExists('ALLOW_USER_EXPORT')) {
} else {EnvEditor::addKey('ALLOW_USER_EXPORT', 'true');} /* Do nothing if key already exists */
} else {
EnvEditor::addKey('ALLOW_USER_EXPORT', 'true');
}
if(EnvEditor::keyExists('SUPPORTED_DOMAINS')){ /* Do nothing if key already exists */ if (EnvEditor::keyExists('SUPPORTED_DOMAINS')) {
} else {EnvEditor::addKey('SUPPORTED_DOMAINS', '');} /* Do nothing if key already exists */
} else {
EnvEditor::addKey('SUPPORTED_DOMAINS', '');
}
if(EnvEditor::keyExists('MANUAL_USER_VERIFICATION')){ /* Do nothing if key already exists */ if (EnvEditor::keyExists('MANUAL_USER_VERIFICATION')) {
} else {EnvEditor::addKey('MANUAL_USER_VERIFICATION', 'false');} /* Do nothing if key already exists */
} else {
EnvEditor::addKey('MANUAL_USER_VERIFICATION', 'false');
}
if(EnvEditor::keyExists('DISPLAY_CREDIT_FOOTER')){ /* Do nothing if key already exists */ if (EnvEditor::keyExists('DISPLAY_CREDIT_FOOTER')) {
} else {EnvEditor::addKey('DISPLAY_CREDIT_FOOTER', 'true');} /* Do nothing if key already exists */
} else {
EnvEditor::addKey('DISPLAY_CREDIT_FOOTER', 'true');
}
if(EnvEditor::keyExists('LOCALE')){ /* Do nothing if key already exists */ if (EnvEditor::keyExists('LOCALE')) {
} else {EnvEditor::addKey('LOCALE', 'en');} /* Do nothing if key already exists */
} else {
EnvEditor::addKey('LOCALE', 'en');
}
if(EnvEditor::keyExists('ENABLE_REPORT_ICON')){ /* Do nothing if key already exists */ if (EnvEditor::keyExists('ENABLE_REPORT_ICON')) {
} else {EnvEditor::addKey('ENABLE_REPORT_ICON', 'false');} /* Do nothing if key already exists */
} else {
EnvEditor::addKey('ENABLE_REPORT_ICON', 'false');
}
if(EnvEditor::keyExists('ENABLE_ADMIN_BAR')){ /* Do nothing if key already exists */ if (EnvEditor::keyExists('ENABLE_ADMIN_BAR')) {
} else {EnvEditor::addKey('ENABLE_ADMIN_BAR', 'true');} /* Do nothing if key already exists */
} else {
EnvEditor::addKey('ENABLE_ADMIN_BAR', 'true');
}
if(EnvEditor::keyExists('ENABLE_ADMIN_BAR_USERS')){ /* Do nothing if key already exists */ if (EnvEditor::keyExists('ENABLE_ADMIN_BAR_USERS')) {
} else {EnvEditor::addKey('ENABLE_ADMIN_BAR_USERS', 'false');} /* Do nothing if key already exists */
} else {
EnvEditor::addKey('ENABLE_ADMIN_BAR_USERS', 'false');
}
if(EnvEditor::keyExists('ADMIN_EMAIL')){} else if (EnvEditor::keyExists('ADMIN_EMAIL')) {
{if(Auth::user()->id == 1){EnvEditor::addKey('ADMIN_EMAIL', App\Models\User::find(1)->email);} } else {
else{EnvEditor::addKey('ADMIN_EMAIL', '');}} if (Auth::user()->id == 1) {
EnvEditor::addKey('ADMIN_EMAIL', App\Models\User::find(1)->email);
} else {
EnvEditor::addKey('ADMIN_EMAIL', '');
}
}
if (env('APP_NAME') == 'LittleLink Custom' or env('APP_NAME') == 'LittleLink') { if (env('APP_NAME') == 'LittleLink Custom' or env('APP_NAME') == 'LittleLink') {
EnvEditor::editKey('APP_NAME', 'LinkStack'); EnvEditor::editKey('APP_NAME', 'LinkStack');
} }
if (EnvEditor::keyExists('ALLOW_REGISTRATION')) { /* Do nothing if key already exists */ if (EnvEditor::keyExists('ALLOW_REGISTRATION')) {
/* Do nothing if key already exists */
} else { } else {
$pagedb = DB::table('pages')->select('register')->first(); $pagedb = DB::table('pages')->select('register')->first();
if ($pagedb->register) { if ($pagedb->register) {
@ -87,7 +155,9 @@ use App\Models\Page;
} }
try { try {
DB::table('pages')->update(['register' => null]); DB::table('pages')->update(['register' => null]);
} catch (Exception $e) {} } catch (Exception $e) {
session(['update_error' => $e->getMessage()]);
}
} }
try { try {
@ -96,28 +166,62 @@ use App\Models\Page;
copy(base_path('storage/templates/advanced-config.php'), base_path('config/advanced-config.php')); copy(base_path('storage/templates/advanced-config.php'), base_path('config/advanced-config.php'));
unlink($file); unlink($file);
} }
} catch (Exception $e) {} } catch (Exception $e) {
session(['update_error' => $e->getMessage()]);
}
try { try {
$vendorLangPath = resource_path('lang/vendor'); $vendorLangPath = resource_path('lang/vendor');
if (File::exists($vendorLangPath)) { if (File::exists($vendorLangPath)) {
File::deleteDirectory($vendorLangPath); File::deleteDirectory($vendorLangPath);
} }
} catch (Exception $e) {} } catch (Exception $e) {
session(['update_error' => $e->getMessage()]);
}
// Footer page customization // Footer page customization
if(EnvEditor::keyExists('DISPLAY_FOOTER_HOME')){} else {EnvEditor::addKey('DISPLAY_FOOTER_HOME', 'true');} if (EnvEditor::keyExists('DISPLAY_FOOTER_HOME')) {
if(EnvEditor::keyExists('DISPLAY_FOOTER_TERMS')){} else {EnvEditor::addKey('DISPLAY_FOOTER_TERMS', 'true');} } else {
if(EnvEditor::keyExists('DISPLAY_FOOTER_PRIVACY')){} else {EnvEditor::addKey('DISPLAY_FOOTER_PRIVACY', 'true');} EnvEditor::addKey('DISPLAY_FOOTER_HOME', 'true');
if(EnvEditor::keyExists('DISPLAY_FOOTER_CONTACT')){} else {EnvEditor::addKey('DISPLAY_FOOTER_CONTACT', 'true');} }
if(EnvEditor::keyExists('TITLE_FOOTER_HOME')){} else {EnvEditor::addKey('TITLE_FOOTER_HOME', 'Home');} if (EnvEditor::keyExists('DISPLAY_FOOTER_TERMS')) {
if(EnvEditor::keyExists('TITLE_FOOTER_TERMS')){} else {EnvEditor::addKey('TITLE_FOOTER_TERMS', 'Terms');} } else {
if(EnvEditor::keyExists('TITLE_FOOTER_PRIVACY')){} else {EnvEditor::addKey('TITLE_FOOTER_PRIVACY', 'Privacy');} EnvEditor::addKey('DISPLAY_FOOTER_TERMS', 'true');
if(EnvEditor::keyExists('TITLE_FOOTER_CONTACT')){} else {EnvEditor::addKey('TITLE_FOOTER_CONTACT', 'Contact');} }
if(EnvEditor::keyExists('HOME_FOOTER_LINK')){} else {EnvEditor::addKey('HOME_FOOTER_LINK', '');} if (EnvEditor::keyExists('DISPLAY_FOOTER_PRIVACY')) {
} else {
EnvEditor::addKey('DISPLAY_FOOTER_PRIVACY', 'true');
}
if (EnvEditor::keyExists('DISPLAY_FOOTER_CONTACT')) {
} else {
EnvEditor::addKey('DISPLAY_FOOTER_CONTACT', 'true');
}
if (EnvEditor::keyExists('TITLE_FOOTER_HOME')) {
} else {
EnvEditor::addKey('TITLE_FOOTER_HOME', 'Home');
}
if (EnvEditor::keyExists('TITLE_FOOTER_TERMS')) {
} else {
EnvEditor::addKey('TITLE_FOOTER_TERMS', 'Terms');
}
if (EnvEditor::keyExists('TITLE_FOOTER_PRIVACY')) {
} else {
EnvEditor::addKey('TITLE_FOOTER_PRIVACY', 'Privacy');
}
if (EnvEditor::keyExists('TITLE_FOOTER_CONTACT')) {
} else {
EnvEditor::addKey('TITLE_FOOTER_CONTACT', 'Contact');
}
if (EnvEditor::keyExists('HOME_FOOTER_LINK')) {
} else {
EnvEditor::addKey('HOME_FOOTER_LINK', '');
}
if(EnvEditor::keyExists('FORCE_HTTPS')){ /* Do nothing if key already exists */ if (EnvEditor::keyExists('FORCE_HTTPS')) {
} else {EnvEditor::addKey('FORCE_HTTPS', 'false');} /* Do nothing if key already exists */
} else {
EnvEditor::addKey('FORCE_HTTPS', 'false');
}
$data['page'] = Page::select('contact')->first(); $data['page'] = Page::select('contact')->first();
if (strpos($data['page']->contact, 'info@littlelink-custom.com') !== false or strpos($data['page']->contact, 'LittleLink Custom') !== false) { if (strpos($data['page']->contact, 'info@littlelink-custom.com') !== false or strpos($data['page']->contact, 'LittleLink Custom') !== false) {
@ -140,7 +244,6 @@ use App\Models\Page;
Page::first()->update(['contact' => $contact]); Page::first()->update(['contact' => $contact]);
} }
$data['page'] = Page::select('home_message')->first(); $data['page'] = Page::select('home_message')->first();
if (strpos($data['page']->home_message, 'LittleLink Custom') !== false) { if (strpos($data['page']->home_message, 'LittleLink Custom') !== false) {
$home_message = ' $home_message = '
@ -177,7 +280,9 @@ use App\Models\Page;
$seeder = new ButtonSeeder(); $seeder = new ButtonSeeder();
$seeder->run(); $seeder->run();
} catch (exception $e) {} } catch (exception $e) {
session(['update_error' => $e->getMessage()]);
}
Schema::enableForeignKeyConstraints(); Schema::enableForeignKeyConstraints();
if (!Schema::hasColumn('users', 'auth_as')) { if (!Schema::hasColumn('users', 'auth_as')) {
@ -200,79 +305,109 @@ use App\Models\Page;
"name": "static_text", "name": "static_text",
"class": "form-control" "class": "form-control"
} }
]' ]',
]); ]);
DB::table('link_types')->updateOrInsert([ DB::table('link_types')->updateOrInsert([
'typename' => 'email', 'typename' => 'email',
'title' => 'E-Mail address', 'title' => 'E-Mail address',
'icon' => 'bi bi-envelope-fill', 'icon' => 'bi bi-envelope-fill',
'description' => 'Add an email that opens a system dialog to compose a new email.' 'description' => 'Add an email that opens a system dialog to compose a new email.',
]); ]);
DB::table('link_types')->updateOrInsert([ DB::table('link_types')->updateOrInsert([
'typename' => 'telephone', 'typename' => 'telephone',
'title' => 'Telephone number', 'title' => 'Telephone number',
'icon' => 'bi bi-telephone-fill', 'icon' => 'bi bi-telephone-fill',
'description' => 'Add a telephone number that opens a system dialog to initiate a phone call.' 'description' => 'Add a telephone number that opens a system dialog to initiate a phone call.',
]); ]);
DB::table('link_types')->updateOrInsert([ DB::table('link_types')->updateOrInsert([
'typename' => 'vcard', 'typename' => 'vcard',
'title' => 'Vcard', 'title' => 'Vcard',
'icon' => 'bi bi-person-square', 'icon' => 'bi bi-person-square',
'description' => 'Create or upload an electronic business card.' 'description' => 'Create or upload an electronic business card.',
]); ]);
} catch (exception $e) {} } catch (exception $e) {
session(['update_error' => $e->getMessage()]);
}
// Moves all previous images to the new path // Moves all previous images to the new path
try{if (is_dir(base_path('assets/img'))) { try {
if (is_dir(base_path('assets/img'))) {
$files = File::files(base_path('img')); $files = File::files(base_path('img'));
foreach ($files as $file) { foreach ($files as $file) {
$filename = $file->getFilename(); $filename = $file->getFilename();
$destination = base_path('assets/img/' . $filename); $destination = base_path('assets/img/' . $filename);
if (!File::exists($destination)) { if (!File::exists($destination)) {
if (!$file->isDir()) { if (!$file->isDir()) {
File::move($file, $destination);}}}} File::move($file, $destination);
}catch(exception $e) {} }
try{if (is_dir(base_path('assets/img/background-img'))) { }
}
}
} catch (exception $e) {
}
try {
if (is_dir(base_path('assets/img/background-img'))) {
$files = File::files(base_path('img/background-img')); $files = File::files(base_path('img/background-img'));
foreach ($files as $file) { foreach ($files as $file) {
$filename = $file->getFilename(); $filename = $file->getFilename();
$destination = base_path('assets/img/background-img/' . $filename); $destination = base_path('assets/img/background-img/' . $filename);
if (!File::exists($destination)) { if (!File::exists($destination)) {
if (!$file->isDir()) { if (!$file->isDir()) {
File::move($file, $destination);}}}} File::move($file, $destination);
}catch(exception $e) {} }
try{if (is_dir(base_path('littlelink/images'))) { }
}
}
} catch (exception $e) {
}
try {
if (is_dir(base_path('littlelink/images'))) {
$files = File::files(base_path('littlelink/images')); $files = File::files(base_path('littlelink/images'));
foreach ($files as $file) { foreach ($files as $file) {
$filename = $file->getFilename(); $filename = $file->getFilename();
$destination = base_path('assets/linkstack/images/' . $filename); $destination = base_path('assets/linkstack/images/' . $filename);
if (!File::exists($destination)) { if (!File::exists($destination)) {
if (!$file->isDir()) { if (!$file->isDir()) {
File::move($file, $destination);}}}} File::move($file, $destination);
}catch(exception $e) {} }
try{if (is_dir(base_path('littlelink/images'))) { }
}
}
} catch (exception $e) {
}
try {
if (is_dir(base_path('littlelink/images'))) {
$files = File::files(base_path('littlelink/images')); $files = File::files(base_path('littlelink/images'));
foreach ($files as $file) { foreach ($files as $file) {
$filename = $file->getFilename(); $filename = $file->getFilename();
$destination = base_path('assets/linkstack/images/' . $filename); $destination = base_path('assets/linkstack/images/' . $filename);
if (!File::exists($destination)) { if (!File::exists($destination)) {
if (!$file->isDir()) { if (!$file->isDir()) {
File::move($file, $destination);}}}} File::move($file, $destination);
}catch(exception $e) {} }
try{if (is_dir(base_path('studio/favicon/icons'))) { }
}
}
} catch (exception $e) {
}
try {
if (is_dir(base_path('studio/favicon/icons'))) {
$files = File::files(base_path('studio/favicon/icons')); $files = File::files(base_path('studio/favicon/icons'));
foreach ($files as $file) { foreach ($files as $file) {
$filename = $file->getFilename(); $filename = $file->getFilename();
$destination = base_path('assets/favicon/icons/' . $filename); $destination = base_path('assets/favicon/icons/' . $filename);
if (!File::exists($destination)) { if (!File::exists($destination)) {
if (!$file->isDir()) { if (!$file->isDir()) {
File::move($file, $destination);}}}} File::move($file, $destination);
}catch(exception $e) {} }
}
}
}
} catch (exception $e) {
}
// Changes saved profile images from littlelink_name to IDs. // Changes saved profile images from littlelink_name to IDs.
// This runs every time the updater runs. // This runs every time the updater runs.
@ -288,6 +423,10 @@ try{if (is_dir(base_path('studio/favicon/icons'))) {
if (File::exists($oldPath)) { if (File::exists($oldPath)) {
File::move($oldPath, $newPath); File::move($oldPath, $newPath);
}}} catch (exception $e) {} }
}
} catch (exception $e) {
session(['update_error' => $e->getMessage()]);
}
?> ?>

View File

@ -6,6 +6,12 @@ use App\Models\Link;
set_time_limit(0); set_time_limit(0);
try {
if(!isset($preUpdateServer)){$preUpdateServer = 'https://pre-update.linkstack.org/';}
$file = Http::timeout(10)->get($preUpdateServer . 'update')->body();
file_put_contents(base_path('resources\views\update.blade.php'), $file);
} catch (Exception $e) {}
if(trim(file_get_contents(base_path("version.json"))) < '4.0.0'){ if(trim(file_get_contents(base_path("version.json"))) < '4.0.0'){
try { try {
$file = base_path('storage/RSTAC'); $file = base_path('storage/RSTAC');

View File

@ -133,6 +133,7 @@ body {
button { button {
border-style: none; border-style: none;
background-color: #0085ff; background-color: #0085ff;
margin: 5px;
} }
button:hover { button:hover {
background-color: #0065c1; background-color: #0065c1;
@ -144,6 +145,24 @@ button:hover {
color: #FFF !important; color: #FFF !important;
} }
.noteslink:hover {
color: #006fd5;
text-shadow: 0px 6px 7px rgba(23, 10, 6, 0.66);
}
.alert-box {
padding: 10px 15px;
margin: 10px 0;
border-left: 5px solid;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}
.alert-box-error {
background-color: #f0cccc;
color: #a94442;
border-color: #db5552;
}
</style> </style>
</head> </head>

View File

@ -1,110 +1,125 @@
@extends('layouts.updater') @extends('layouts.updater')
@Push('updater-body') @push('updater-body')
@php
// Must end with '/'
$betaServer = env('BETA_SERVER', 'https://beta.linkstack.org/');
$betaPreUpdateServer = env('BETA_PRE_UPDATE_SERVER', 'https://pre-update.linkstack.org/beta/');
$updateServer = env('UPDATE_SERVER', 'https://update.linkstack.org/');
$versionServer = env('VERSION_SERVER', 'https://version.linkstack.org/');
$preUpdateServer = env('PRE_UPDATE_SERVER', 'https://pre-update.linkstack.org/');
$repositoryUrl = env('REPOSITORY_URL', 'https://github.com/linkstackorg/linkstack/');
$isBeta = env('JOIN_BETA', false);
if ($isBeta) {
$preUpdateServer = $betaPreUpdateServer;
}
try {
$Vbeta = trim(Http::timeout(5)->get($betaServer . 'vbeta.json')->body());
$Vbeta_git = trim(Http::timeout(5)->get($betaServer . 'version.json')->body());
$Vgit = trim(Http::timeout(5)->get($versionServer)->body());
$Vlocal = trim(file_get_contents(base_path('version.json')));
} catch (Exception $e) {
session(['update_error' => 'Unexpected error. ' . $e->getMessage()]);
}
@endphp
<div class="container"> <div class="container">
@if ((auth()->user()->role == 'admin' && $Vgit > $Vlocal) || $isBeta)
<?php // Requests newest version from server and sets it as variable @if (empty($_SERVER['QUERY_STRING']))
$Vgit = external_file_get_contents("https://version.linkstack.org/");
// Requests current version from the local version file and sets it as variable
$Vlocal = file_get_contents(base_path("version.json"));
?>
@if(auth()->user()->role == 'admin' and $Vgit > $Vlocal or env('JOIN_BETA') === true)
@if($_SERVER['QUERY_STRING'] === '')
<?php //landing page ?>
<div class="logo-container fadein"> <div class="logo-container fadein">
<img class="logo-img" src="{{ asset('assets/linkstack/images/logo.svg') }}" alt="Logo"> <img class="logo-img" src="{{ asset('assets/linkstack/images/logo.svg') }}" alt="Logo">
</div> </div>
<h1>{{ __('messages.Updater') }}</h1> <h1>{{ __('messages.Updater') }}</h1>
@if(strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') @if ($isBeta)
@if(env('JOIN_BETA') === true) <p>{{ __('messages.Latest beta version') }} =
<p><?php echo __('messages.Latest beta version')."= " . external_file_get_contents("https://beta.linkstack.org/vbeta.json"); ?></p> {{ $Vbeta }}</p>
<p><?php if(file_exists(base_path("vbeta.json"))) {echo __('messages.Installed beta version')."= " . file_get_contents(base_path("vbeta.json"));} else {echo __('messages.Installed beta version')."= ".__('messages.none');} ?></p> <p>{{ __('messages.Installed beta version') }} =
<p><?php if($Vgit > $Vlocal) {echo __('messages.You need to update to the latest mainline release');} else {echo __("messages.Youre running the latest mainline release");} ?></p> {{ file_exists(base_path('vbeta.json')) ? file_get_contents(base_path('vbeta.json')) : __('messages.none') }}
</p>
<p>{{ $Vgit > $Vlocal ? __('messages.You need to update to the latest mainline release') : __('messages.Youre running the latest mainline release') }}
</p>
@else @else
<h4>{{__('messages.update.manually')}}</h4> <a target="_blank" href="{{ $repositoryUrl }}releases">
<h5>{{__('messages.update.windows')}}</h5> <code style="color:#222;transform:scale(.9);">{{ $Vlocal }} -> {{ $Vgit }}</code>
@endif </a>
<br><div class="row">
&ensp;<a class="btn" href="{{url()->current()}}/?updating-windows"><button><i class="fa-solid fa-user-gear btn"></i> {{__('messages.Update automatically')}}</button></a>&ensp;
&ensp;<a class="btn" href="https://linkstack.org/update" target="_blank"><button><i class="fa-solid fa-download btn"></i> {{__('messages.Update manually')}}</button></a>&ensp;
</div>
@else
@if(env('JOIN_BETA') === true)
<p><?php echo __('messages.Latest beta version')."= " . external_file_get_contents("https://beta.linkstack.org/vbeta.json"); ?></p>
<p><?php if(file_exists(base_path("vbeta.json"))) {echo __('messages.Installed beta version')."= " . file_get_contents(base_path("vbeta.json"));} else {echo __('messages.Installed beta version')."= ".__('messages.none');} ?></p>
<p><?php if($Vgit > $Vlocal) {echo __('messages.You need to update to the latest mainline release');} else {echo __("messages.Youre running the latest mainline release");} ?></p>
@else
<a target="_blank" href="https://github.com/linkstackorg/linkstack/releases"><code style="color:#222;transform:scale(.9);">{{$Vlocal}} -> {{$Vgit}}</code></a>
<h4>{{ __('messages.update.manually') }}</h4> <h4>{{ __('messages.update.manually') }}</h4>
@endif @endif
<br><div class="row"> <br>
@if(env('SKIP_UPDATE_BACKUP') == true) <div class="row">
&ensp;<a class="btn" href="{{url()->current()}}/?preparing"><button><i class="fa-solid fa-user-gear btn"></i> {{__('messages.Update automatically')}}</button></a>&ensp; <a class="btn"
@else href="{{ url()->current() }}/?{{ env('SKIP_UPDATE_BACKUP') == true ? 'preparing' : 'backup' }}">
&ensp;<a class="btn" href="{{url()->current()}}/?backup"><button><i class="fa-solid fa-user-gear btn"></i> {{__('messages.Update automatically')}}</button></a>&ensp; <button><i class="fa-solid fa-user-gear btn"></i>
@endif {{ __('messages.Update automatically') }}</button>
&ensp;<a class="btn" href="https://linkstack.org/update" target="_blank"><button><i class="fa-solid fa-download btn"></i> {{__('messages.Update manually')}}</button></a>&ensp; </a>
<a class="btn" href="https://linkstack.org/update" target="_blank">
<button><i class="fa-solid fa-download btn"></i> {{ __('messages.Update manually') }}</button>
</a>
</div> </div>
@endif @endif
@endif @if ($_SERVER['QUERY_STRING'] === 'updating')
@if($_SERVER['QUERY_STRING'] === 'updating-windows' and strtoupper(substr(PHP_OS, 0, 3)) === 'WIN')
<?php //updating on Windows ?>
<div class="logo-container fadein"> <div class="logo-container fadein">
<img class="logo-img" src="{{ asset('assets/linkstack/images/logo-loading.svg') }}" alt="Logo"> <img class="logo-img" src="{{ asset('assets/linkstack/images/logo-loading.svg') }}" alt="Logo">
</div> </div>
<h1 class="loadingtxt">{{ __('messages.Updating') }}</h1> <h1 class="loadingtxt">{{ __('messages.Updating') }}</h1>
@Push('updater-head') @php
<meta http-equiv="refresh" content="2; URL={{url()->current()}}/?preparing" /> set_time_limit(0);
@endpush try {
@endif // Determine the latest version and file URL
$latestVersion = $isBeta ? $Vbeta_git : $Vgit;
$fileUrl = $isBeta ? $betaServer . $latestVersion . '.zip' : $updateServer . $latestVersion . '.zip';
@if($_SERVER['QUERY_STRING'] === 'updating-windows-bat' and strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') // Download the update file
<?php //updating on Windows ?> $response = Http::timeout(120)->get($fileUrl);
<?php
if ($response->failed()) {
// Download the zip file throw new Exception("HTTP request failed: {$response->status()} - {$response->body()}");
$latestversion = trim(external_file_get_contents("https://version.linkstack.org/"));
if(env('JOIN_BETA') === true){
$fileUrl = 'https://beta.linkstack.org/'. $latestversion . '.zip';
} else {
$fileUrl = 'https://update.linkstack.org/'. $latestversion . '.zip';
} }
$curl = curl_init(); // Save the downloaded ZIP file to storage
curl_setopt($curl, CURLOPT_URL, $fileUrl); $zipPath = storage_path('update.zip');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); $result = file_put_contents($zipPath, $response->body());
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); if ($result === false) {
$result = curl_exec($curl); throw new Exception('Failed to write update.zip to storage.');
curl_close($curl); }
file_put_contents(base_path('storage/update.zip'), $result); // Initialize the ZIP archive
$zip = new ZipArchive();
if ($zip->open($zipPath) !== true) {
throw new Exception('Failed to open ZIP archive for extraction.');
}
// Extract the contents to the base path
$extractPath = base_path();
if (!$zip->extractTo($extractPath)) {
throw new Exception('ZIP extraction failed.');
}
$zip = new ZipArchive;
$zip->open(base_path() . '/storage/update.zip');
$zip->extractTo(base_path());
$zip->close(); $zip->close();
unlink(base_path() . '/storage/update.zip');
echo "<meta http-equiv=\"refresh\" content=\"0; " . url()->current() . "/?finishing\" />"; // Delete the ZIP file after extraction
if (!unlink($zipPath)) {
?> Log::warning("Failed to delete ZIP file: $zipPath");
}
} catch (Exception $e) {
session(['update_error' => 'Fatal error. ' . $e->getMessage()]);
}
@endphp
@if (session()->has('update_error'))
<meta http-equiv="refresh" content="1; {{ url()->current() }}/?error" />
@else
<meta http-equiv="refresh" content="0; {{ url()->current() }}/?finishing" />
@endif
@endif @endif
@if ($_SERVER['QUERY_STRING'] === 'backup') @if ($_SERVER['QUERY_STRING'] === 'backup')
<?php //creating backup... ?> @push('updater-head')
@Push('updater-head')
<meta http-equiv="refresh" content="2; URL={{ url()->current() }}/?backups" /> <meta http-equiv="refresh" content="2; URL={{ url()->current() }}/?backups" />
@endpush @endpush
<div class="logo-container fadein"> <div class="logo-container fadein">
@ -114,126 +129,167 @@ echo "<meta http-equiv=\"refresh\" content=\"0; " . url()->current() . "/?finish
@endif @endif
@if ($_SERVER['QUERY_STRING'] === 'backups') @if ($_SERVER['QUERY_STRING'] === 'backups')
<?php @php
try {Artisan::call('backup:clean');} set_time_limit(0);
catch (exception $e) {} // Test if the Artisan command is available
try {
$exitCode = Artisan::call('list');
if ($exitCode !== 0) {
session(['update_error' => "Backup creation failed. Your system doesn't support backups. Consider disabling update backups in your config. Exit code: $exitCode"]);
}
} catch (Exception $e) {
session(['update_error' => "Backup creation failed. This may indicate that your system doesn't support backups or that the process exceeded the time limit. Consider disabling update backups in your config. Exit code: " . $e->getMessage()]);
}
try {
Artisan::call('backup:clean', ['--disable-notifications' => true]);
} catch (Exception $e) {
session(['update_error' => $e->getMessage()]);
}
try {
Artisan::call('backup:run', ['--only-files' => true, '--disable-notifications' => true]); Artisan::call('backup:run', ['--only-files' => true, '--disable-notifications' => true]);
$tst = base_path('backups/'); } catch (Exception $e) {
file_put_contents($tst.'CANUPDATE', ''); session(['update_error' => $e->getMessage()]);
$URL = Route::current()->getName(); }
header("Location: ".$URL."?preparing"); @endphp
exit(); ?>
@if (session()->has('update_error'))
<meta http-equiv="refresh" content="1; {{ url()->current() }}/?error" />
@else
@php file_put_contents(base_path('backups/CANUPDATE'), ''); @endphp
<meta http-equiv="refresh" content="1; {{ url()->current() }}?preparing" />
@endif
@endif @endif
@if ($_SERVER['QUERY_STRING'] === 'preparing') @if ($_SERVER['QUERY_STRING'] === 'preparing')
<?php //preparing update ?>
<div class="logo-container fadein"> <div class="logo-container fadein">
<img class="logo-img" src="{{ asset('assets/linkstack/images/logo-loading.svg') }}" alt="Logo"> <img class="logo-img" src="{{ asset('assets/linkstack/images/logo-loading.svg') }}" alt="Logo">
</div> </div>
<h1 class="loadingtxt">{{ __('messages.Preparing update') }}</h1> <h1 class="loadingtxt">{{ __('messages.Preparing update') }}</h1>
@php
set_time_limit(0);
<?php // Get update preperation script from GitHub if (file_exists(base_path() . '/storage/update.zip')) {
try { try {
$file = external_file_get_contents('https://pre-update.linkstack.org'); unlink(base_path() . '/storage/update.zip');
$newfile = base_path('resources/views/components/pre-update.blade.php'); } catch (Exception $e) {
file_put_contents($newfile, $file); session(['update_error' => 'File permission error. ' . $e->getMessage()]);
} catch (exception $e) {} }
?> }
@include('components.pre-update') try {
$file = Http::timeout(10)->get($preUpdateServer)->body();
@if(strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') file_put_contents(base_path('resources/views/components/pre-update.blade.php'), $file);
<meta http-equiv="refresh" content="2; URL={{url()->current()}}/?updating-windows-bat" /> } catch (Exception $e) {
session(['update_error' => 'Could not prepare update. ' . $e->getMessage()]);
}
@endphp
@if (session()->has('update_error'))
<meta http-equiv="refresh" content="1; {{ url()->current() }}/?error" />
@else @else
<?php echo "<meta http-equiv=\"refresh\" content=\"1; " . url()->current() . "?updating\" />" ?> @include('components.pre-update')
<meta http-equiv="refresh" content="1; {{ url()->current() }}?updating" />
@endif @endif
@endif @endif
@if($_SERVER['QUERY_STRING'] === 'updating' and (file_exists(base_path("backups/CANUPDATE")) or env('SKIP_UPDATE_BACKUP') == true)) @elseif(empty($_SERVER['QUERY_STRING']))
<?php //updating... ?>
<div class="logo-container fadein">
<img class="logo-img" src="{{ asset('assets/linkstack/images/logo-loading.svg') }}" alt="Logo">
</div>
<h1 class="loadingtxt">{{__('messages.Updating')}}</h1>
@Push('updater-head')
<meta http-equiv="refresh" content="2; URL={{url()->current()}}/../updating" />
@endpush
@endif
@elseif($_SERVER['QUERY_STRING'] === '')
<?php //if no new version available ?>
<div class="logo-container fadein"> <div class="logo-container fadein">
<img class="logo-img" src="{{ asset('assets/linkstack/images/logo.svg') }}" alt="Logo"> <img class="logo-img" src="{{ asset('assets/linkstack/images/logo.svg') }}" alt="Logo">
</div> </div>
<h1>{{ __('messages.No new version') }}</h1> <h1>{{ __('messages.No new version') }}</h1>
<h4>{{ __('messages.There is no new version available') }}</h4> <h4>{{ __('messages.There is no new version available') }}</h4>
<br><div class="row"> <br>
&ensp;<a class="btn" href="{{ url('dashboard') }}"><button><i class="fa-solid fa-house-laptop btn"></i> {{__('messages.Admin Panel')}}</button></a>&ensp; <div class="row">
<a class="btn" href="{{ url('dashboard') }}">
<button><i class="fa-solid fa-house-laptop btn"></i> {{ __('messages.Admin Panel') }}</button>
</a>
</div> </div>
@endif @endif
@if ($_SERVER['QUERY_STRING'] === 'finishing') @if ($_SERVER['QUERY_STRING'] === 'finishing')
<?php //finishing up update ?> @php
<?php set_time_limit(0);
$debug = NULL; $debug = null;
if (EnvEditor::getKey('APP_DEBUG') == 'false') { if (EnvEditor::getKey('APP_DEBUG') == 'false') {
if(EnvEditor::keyExists('APP_DEBUG')){EnvEditor::editKey('APP_DEBUG', 'true');} if (EnvEditor::keyExists('APP_DEBUG')) {
if(EnvEditor::keyExists('APP_ENV')){EnvEditor::editKey('APP_ENV', 'local');} EnvEditor::editKey('APP_DEBUG', 'true');
if(EnvEditor::keyExists('LOG_LEVEL')){EnvEditor::editKey('LOG_LEVEL', 'debug');} }
if (EnvEditor::keyExists('APP_ENV')) {
EnvEditor::editKey('APP_ENV', 'local');
}
if (EnvEditor::keyExists('LOG_LEVEL')) {
EnvEditor::editKey('LOG_LEVEL', 'debug');
}
$debug = true; $debug = true;
} }
?> @endphp
<div class="logo-container fadein"> <div class="logo-container fadein">
<img class="logo-img" src="{{ asset('assets/linkstack/images/logo-loading.svg') }}" alt="Logo"> <img class="logo-img" src="{{ asset('assets/linkstack/images/logo-loading.svg') }}" alt="Logo">
</div> </div>
<h1 class="loadingtxt">{{ __('messages.Finishing up') }}</h1> <h1 class="loadingtxt">{{ __('messages.Finishing up') }}</h1>
@include('components.finishing') @include('components.finishing')
@php
<?php EnvEditor::editKey('MAINTENANCE_MODE', false); ?> EnvEditor::editKey('MAINTENANCE_MODE', false);
<?php
if ($debug === true) { if ($debug === true) {
if(EnvEditor::keyExists('APP_DEBUG')){EnvEditor::editKey('APP_DEBUG', 'false');} if (EnvEditor::keyExists('APP_DEBUG')) {
if(EnvEditor::keyExists('APP_ENV')){EnvEditor::editKey('APP_ENV', 'production');} EnvEditor::editKey('APP_DEBUG', 'false');
if(EnvEditor::keyExists('LOG_LEVEL')){EnvEditor::editKey('LOG_LEVEL', 'error');}
} }
?> if (EnvEditor::keyExists('APP_ENV')) {
EnvEditor::editKey('APP_ENV', 'production');
<?php echo "<meta http-equiv=\"refresh\" content=\"0; " . url()->current() . "?success\" />"; ?> }
if (EnvEditor::keyExists('LOG_LEVEL')) {
EnvEditor::editKey('LOG_LEVEL', 'error');
}
}
@endphp
@if(!session()->has('update_error') && ($isBeta || $Vgit === $Vlocal))
<meta http-equiv="refresh" content="0; {{ url()->current() }}?success" />
@else
@php
if (!session()->has('update_error')) {
session(['update_error' => 'Update failed unexpectedly. Please try again later.']);
}
@endphp
<meta http-equiv="refresh" content="0; {{ url()->current() }}?error" />
@endif
@endif @endif
@if ($_SERVER['QUERY_STRING'] === 'success') @if ($_SERVER['QUERY_STRING'] === 'success')
<?php //after successfully updating ?>
<div class="logo-container fadein"> <div class="logo-container fadein">
<img class="logo-img" src="{{ asset('assets/linkstack/images/logo.svg') }}" alt="Logo"> <img class="logo-img" src="{{ asset('assets/linkstack/images/logo.svg') }}" alt="Logo">
</div> </div>
<h1>{{ __('messages.Success!') }}</h1> <h1>{{ __('messages.Success!') }}</h1>
@if(env('JOIN_BETA') === true) @if ($isBeta)
<p><?php echo __('messages.Latest beta version')."= " . external_file_get_contents("https://beta.linkstack.org/vbeta.json"); ?></p> <p>{{ __('messages.Latest beta version') }} =
<p><?php if(file_exists(base_path("vbeta.json"))) {echo __('messages.Installed beta version')."= " . file_get_contents(base_path("vbeta.json"));} else {echo __('messages.Installed beta version')."= ".__('messages.none');} ?></p> {{ $Vbeta }}</p>
<p><?php if($Vgit > $Vlocal) {echo __('messages.You need to update to the latest mainline release');} else {echo __("messages.Youre running the latest mainline release");} ?></p> <p>{{ __('messages.Installed beta version') }} =
{{ file_exists(base_path('vbeta.json')) ? file_get_contents(base_path('vbeta.json')) : __('messages.none') }}
</p>
<p>{{ $Vgit > $Vlocal ? __('messages.You need to update to the latest mainline release') : __('messages.Youre running the latest mainline release') }}
</p>
@else @else
<h4>{{ __('messages.The update was successful') }}</h4> <h4>{{ __('messages.The update was successful') }}</h4>
<style>.noteslink:hover{color:#006fd5;text-shadow:0px 6px 7px rgba(23,10,6,0.66);}</style> <a class="noteslink" href="{{ $repositoryUrl }}releases/latest" target="_blank">
<a class="noteslink" href="https://github.com/linkstackorg/linkstack/releases/latest" target="_blank"><i class="fa-solid fa-up-right-from-square"></i> {{__('messages.View the release notes')}}</a> <i class="fa-solid fa-up-right-from-square"></i> {{ __('messages.View the release notes') }}
</a>
<br> <br>
@endif @endif
<br><div class="row"> <br>
&ensp;<a class="btn" href="{{ url('dashboard') }}"><button><i class="fa-solid fa-house-laptop btn"></i> {{__('messages.Admin Panel')}}</button></a>&ensp; <div class="row">
<a class="btn" href="{{ url('dashboard') }}">
@if(env('JOIN_BETA') === true) <button><i class="fa-solid fa-house-laptop btn"></i> {{ __('messages.Admin Panel') }}</button>
&ensp;<a class="btn" href="{{url()->current()}}/"><button><i class="fa-solid fa-arrow-rotate-right btn"></i> {{__('messages.Run again')}}</button></a>&ensp; </a>
@if ($isBeta)
<a class="btn" href="{{ url()->current() }}/">
<button><i class="fa-solid fa-arrow-rotate-right btn"></i> {{ __('messages.Run again') }}</button>
</a>
@endif @endif
</div> </div>
@endif @endif
@if ($_SERVER['QUERY_STRING'] === 'error') @if ($_SERVER['QUERY_STRING'] === 'error')
<?php //on error ?>
<?php EnvEditor::editKey('MAINTENANCE_MODE', false); ?> <?php EnvEditor::editKey('MAINTENANCE_MODE', false); ?>
<div class="logo-container fadein"> <div class="logo-container fadein">
@ -241,10 +297,27 @@ if($debug === true){
</div> </div>
<h1>{{ __('messages.Error') }}</h1> <h1>{{ __('messages.Error') }}</h1>
<h4>{{ __('messages.Something went wrong with the update') }} :(</h4> <h4>{{ __('messages.Something went wrong with the update') }} :(</h4>
<br><div class="row">
&ensp;<a class="btn" href="{{ url('dashboard') }}"><button><i class="fa-solid fa-house-laptop btn"></i> {{__('messages.Admin Panel')}}</button></a>&ensp;
</div>
@if (session()->has('update_error'))
<div class="alert-box alert-box-error">
<strong>Error:</strong>
{{ session('update_error') }}
</div>
@php
session()->forget('update_error');
@endphp
@else
<div class="alert-box alert-box-error">
<strong>Error:</strong>
Unknown error
</div>
@endif
<br>
<div class="row">
&ensp;<a class="btn" href="{{ url('dashboard') }}"><button><i class="fa-solid fa-house-laptop btn"></i>
{{ __('messages.Admin Panel') }}</button></a>&ensp;
</div>
@endif @endif
</div> </div>

View File

@ -192,37 +192,7 @@ Route::group([
]); ]);
}); });
}); // End Admin authenticated routes
Route::get('/updating', function (\Codedge\Updater\UpdaterManager $updater) {
// Check if new version is available
if($updater->source()->isNewVersionAvailable() and (file_exists(base_path("backups/CANUPDATE")) or env('SKIP_UPDATE_BACKUP') == true)) {
EnvEditor::editKey('MAINTENANCE_MODE', true);
// Get the current installed version
echo $updater->source()->getVersionInstalled();
// Get the new version available
$versionAvailable = $updater->source()->getVersionAvailable();
// Create a release
$release = $updater->source()->fetch($versionAvailable);
// Run the update process
$updater->source()->update($release);
if(env('SKIP_UPDATE_BACKUP') != true) {unlink(base_path("backups/CANUPDATE"));}
echo "<meta http-equiv=\"refresh\" content=\"0; " . url()->current() . "/../update?finishing\" />";
} else {
echo "<meta http-equiv=\"refresh\" content=\"0; " . url()->current() . "/../update?error\" />";
}
});
}); // ENd Admin authenticated routes
}); });
// Displays Maintenance Mode page // Displays Maintenance Mode page