From 111f220629499ed41efb409d632d985bce5af280 Mon Sep 17 00:00:00 2001 From: Sergio Brighenti Date: Wed, 4 Sep 2019 21:43:43 +0200 Subject: [PATCH] Fixed installed bad path check --- CHANGELOG.md | 1 + app/Controllers/ThemeController.php | 2 +- bin/clean | 2 +- bin/migrate | 2 +- bin/theme | 2 +- composer.json | 2 +- install/index.php | 14 +++++++++----- install/templates/install.twig | 2 +- resources/templates/auth/login.twig | 1 - resources/templates/base.twig | 21 +++++++++++---------- src/js/installer.js | 2 +- 11 files changed, 28 insertions(+), 23 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6ef8107..b580488 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ ## v2.6.1 + Fixed bad redirects on the web installer (#62). ++ Fixed login page with dark themes. + Improved shell commands. + Added alert if required extensions are not loaded. + Updated translations. diff --git a/app/Controllers/ThemeController.php b/app/Controllers/ThemeController.php index bed8afc..fa683de 100644 --- a/app/Controllers/ThemeController.php +++ b/app/Controllers/ThemeController.php @@ -38,7 +38,7 @@ class ThemeController extends Controller return redirect($response, 'system') ->withAddedHeader('Cache-Control', 'no-cache, no-store, must-revalidate') ->withAddedHeader('Pragma', 'no-cache') - ->withAddedHeader('Expire', '0'); + ->withAddedHeader('Expire', 'Mon, 26 Jul 1997 05:00:00 GMT'); } } \ No newline at end of file diff --git a/bin/clean b/bin/clean index 4fd81b5..9b9c6c3 100644 --- a/bin/clean +++ b/bin/clean @@ -1,6 +1,6 @@ #!/usr/bin/env php = 7 && PHP_MINOR_VERSION >= 1) ?: die('Sorry, PHP 7.1 or above is required to run XBackBone.'); if (php_sapi_name() !== 'cli') { die(); } diff --git a/bin/migrate b/bin/migrate index a0ff9fb..8874b69 100644 --- a/bin/migrate +++ b/bin/migrate @@ -1,6 +1,6 @@ #!/usr/bin/env php = 7 && PHP_MINOR_VERSION >= 1) ?: die('Sorry, PHP 7.1 or above is required to run XBackBone.'); if (php_sapi_name() !== 'cli') { die(); } diff --git a/bin/theme b/bin/theme index f44dd25..d5fdcd8 100644 --- a/bin/theme +++ b/bin/theme @@ -1,6 +1,6 @@ #!/usr/bin/env php = 7 && PHP_MINOR_VERSION >= 1) ?: die('Sorry, PHP 7.1 or above is required to run XBackBone.'); if (php_sapi_name() !== 'cli') { die(); } diff --git a/composer.json b/composer.json index 18bb585..ca64ef1 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "sergix44/xbackbone", - "version": "2.6", + "version": "2.6.1", "description": "A lightweight ShareX PHP backend", "type": "project", "require": { diff --git a/install/index.php b/install/index.php index 53d4b96..660f6f5 100644 --- a/install/index.php +++ b/install/index.php @@ -202,7 +202,10 @@ $app->get('/', function (Request $request, Response $response) { $installed = file_exists(__DIR__ . '/../config.php'); - return $this->view->render($response, 'install.twig', ['installed' => $installed]); + return $this->view->render($response, 'install.twig', [ + 'installed' => $installed, + 'default_local' => realpath(__DIR__ . '/../') . DIRECTORY_SEPARATOR . 'storage', + ]); }); $app->post('/', function (Request $request, Response $response) use (&$config) { @@ -255,17 +258,18 @@ $app->post('/', function (Request $request, Response $response) use (&$config) { } // check if the storage is valid + $storageTestFile = 'storage_test.xbackbone.txt'; try { try { - $success = $this->storage->write('storage_test.xbackbone.txt', 'XBACKBONE_TEST_FILE'); + $success = $this->storage->write($storageTestFile, 'XBACKBONE_TEST_FILE'); } catch (FileExistsException $fileExistsException) { - $success = $this->storage->update('storage_test.xbackbone.txt', 'XBACKBONE_TEST_FILE'); + $success = $this->storage->update($storageTestFile, 'XBACKBONE_TEST_FILE'); } if (!$success) { throw new Exception('The storage is not writable.'); } - $this->storage->readAndDelete('test.install.txt'); + $this->storage->readAndDelete($storageTestFile); } catch (Exception $e) { $this->session->alert("Storage setup error: {$e->getMessage()} [{$e->getCode()}]", 'danger'); return redirect($response, '/install'); @@ -323,7 +327,7 @@ $app->post('/', function (Request $request, Response $response) use (&$config) { // Installed successfully, destroy the installer session session_destroy(); - return redirect($response, '../?afterInstall=true'); + return redirect($response, '/../?afterInstall=true'); }); $app->run(); \ No newline at end of file diff --git a/install/templates/install.twig b/install/templates/install.twig index ee3a809..c52de74 100644 --- a/install/templates/install.twig +++ b/install/templates/install.twig @@ -80,7 +80,7 @@
- +
diff --git a/resources/templates/auth/login.twig b/resources/templates/auth/login.twig index f1c5481..c46c650 100644 --- a/resources/templates/auth/login.twig +++ b/resources/templates/auth/login.twig @@ -19,7 +19,6 @@ -webkit-box-pack: center; justify-content: center; padding-bottom: 40px; - background-color: #f5f5f5; margin-bottom: 0; } diff --git a/resources/templates/base.twig b/resources/templates/base.twig index 5d3877c..6130850 100644 --- a/resources/templates/base.twig +++ b/resources/templates/base.twig @@ -4,7 +4,7 @@ {% block title %}Default{% endblock %} | {{ config.app_name }} - + @@ -17,14 +17,6 @@ - - - - - - - - {% block head %}{% endblock %} @@ -33,8 +25,17 @@ {% block footer %}
{% endblock %} + + + + + + + + diff --git a/src/js/installer.js b/src/js/installer.js index be2f1c5..f89c057 100644 --- a/src/js/installer.js +++ b/src/js/installer.js @@ -27,7 +27,7 @@ $(document).ready(function () { $all_storage_inputs.prop('required', ''); switch ($(this).val()) { case 'local': - $('#storage_path').val('./storage').prop('required', 'required').parent().parent().show(); + $('#storage_path').val($('#storage_path').data('default-local')).prop('required', 'required').parent().parent().show(); break; case 'ftp': $('#storage_path').val('/storage').prop('required', 'required').parent().parent().show();