Fixed #67
This commit is contained in:
parent
846131a001
commit
99f100c228
10 changed files with 22 additions and 16 deletions
|
@ -1,3 +1,8 @@
|
|||
## v2.6.3
|
||||
+ Fixed #67.
|
||||
+ Fixed bad preload statement.
|
||||
+ Fixed wrong redirect after install in subdirs.
|
||||
|
||||
## v2.6.2
|
||||
+ Use the font awesome web font for better performances.
|
||||
+ Changed background default color.
|
||||
|
|
|
@ -48,7 +48,7 @@ abstract class Controller
|
|||
*/
|
||||
protected function getUsedSpaceByUser($id): int
|
||||
{
|
||||
$medias = $this->database->query('SELECT `uploads`.`storage_path` FROM `uploads` WHERE `user_id` = ?', $id)->fetchAll();
|
||||
$medias = $this->database->query('SELECT `uploads`.`storage_path` FROM `uploads` WHERE `user_id` = ?', $id);
|
||||
|
||||
$totalSize = 0;
|
||||
|
||||
|
|
|
@ -29,18 +29,18 @@ class UploadController extends Controller
|
|||
'version' => PLATFORM_VERSION,
|
||||
];
|
||||
|
||||
if ($this->settings['maintenance'] && !$this->database->query('SELECT `id`, `is_admin` FROM `users` WHERE `id` = ? LIMIT 1', [$this->session->get('user_id')])->fetch()->is_admin) {
|
||||
if ($this->settings['maintenance']) {
|
||||
$json['message'] = 'Endpoint under maintenance.';
|
||||
return $response->withJson($json, 503);
|
||||
}
|
||||
|
||||
if ($request->getServerParam('CONTENT_LENGTH') > stringToBytes(ini_get('post_max_size'))) {
|
||||
$json['message'] = 'File too large (post_max_size too low).';
|
||||
$json['message'] = 'File too large (post_max_size too low?).';
|
||||
return $response->withJson($json, 400);
|
||||
}
|
||||
|
||||
if (isset($request->getUploadedFiles()['upload']) && $request->getUploadedFiles()['upload']->getError() === UPLOAD_ERR_INI_SIZE) {
|
||||
$json['message'] = 'File too large (upload_max_filesize too low).';
|
||||
$json['message'] = 'File too large (upload_max_filesize too low?).';
|
||||
return $response->withJson($json, 400);
|
||||
}
|
||||
|
||||
|
|
|
@ -140,7 +140,7 @@ if (!function_exists('route')) {
|
|||
function route(string $path, array $args = [], string $append = ''): string
|
||||
{
|
||||
global $app;
|
||||
$uri = $app->getContainer()->get('router')->pathFor($path, $args);
|
||||
$uri = $app->getContainer()->get('router')->relativePathFor($path, $args);
|
||||
return urlFor($uri, $append);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,6 +47,7 @@ $config = array_replace_recursive([
|
|||
],
|
||||
'storage' => [
|
||||
'driver' => 'local',
|
||||
'path' => realpath(__DIR__ . '/') . DIRECTORY_SEPARATOR . 'storage',
|
||||
],
|
||||
], require BASE_DIR . 'config.php');
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "sergix44/xbackbone",
|
||||
"version": "2.6.2",
|
||||
"version": "2.6.3",
|
||||
"description": "A lightweight ShareX PHP backend",
|
||||
"type": "project",
|
||||
"require": {
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
(PHP_MAJOR_VERSION >= 7 && PHP_MINOR_VERSION >= 1) ?: die('Sorry, PHP 7.1 or above is required to run XBackBone.');
|
||||
require __DIR__ . '/vendor/autoload.php';
|
||||
|
||||
define('BASE_DIR', __DIR__ . DIRECTORY_SEPARATOR);
|
||||
define('BASE_DIR', realpath(__DIR__) . DIRECTORY_SEPARATOR);
|
||||
define('PLATFORM_VERSION', json_decode(file_get_contents('composer.json'))->version);
|
||||
|
||||
$app = require_once __DIR__ . '/bootstrap/app.php';
|
||||
|
|
|
@ -24,17 +24,19 @@ use Superbalist\Flysystem\GoogleStorage\GoogleStorageAdapter;
|
|||
|
||||
define('PLATFORM_VERSION', json_decode(file_get_contents(__DIR__ . '/../composer.json'))->version);
|
||||
|
||||
// default config
|
||||
$config = [
|
||||
'base_url' => isset($_SERVER['HTTPS']) ? 'https://' . $_SERVER['HTTP_HOST'] : 'http://' . $_SERVER['HTTP_HOST'],
|
||||
'base_url' => str_replace('/install/', '', (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https' : 'http') . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"),
|
||||
'displayErrorDetails' => true,
|
||||
'db' => [
|
||||
'connection' => 'sqlite',
|
||||
'dsn' => 'resources/database/xbackbone.db',
|
||||
'dsn' => realpath(__DIR__ . '/../') . implode(DIRECTORY_SEPARATOR, ['resources', 'database', 'xbackbone.db']),
|
||||
'username' => null,
|
||||
'password' => null,
|
||||
],
|
||||
'storage' => [
|
||||
'driver' => 'local',
|
||||
'path' => realpath(__DIR__ . '/../') . DIRECTORY_SEPARATOR . 'storage',
|
||||
],
|
||||
];
|
||||
|
||||
|
@ -110,8 +112,7 @@ $container['storage'] = function ($container) use (&$config) {
|
|||
}
|
||||
};
|
||||
|
||||
function migrate($config)
|
||||
{
|
||||
function migrate($config) {
|
||||
$firstMigrate = false;
|
||||
if ($config['db']['connection'] === 'sqlite' && !file_exists(__DIR__ . '/../' . $config['db']['dsn'])) {
|
||||
touch(__DIR__ . '/../' . $config['db']['dsn']);
|
||||
|
@ -204,7 +205,6 @@ $app->get('/', function (Request $request, Response $response) {
|
|||
|
||||
return $this->view->render($response, 'install.twig', [
|
||||
'installed' => $installed,
|
||||
'default_local' => realpath(__DIR__ . '/../') . DIRECTORY_SEPARATOR . 'storage',
|
||||
]);
|
||||
});
|
||||
|
||||
|
@ -327,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 $response->withRedirect("{$config['base_url']}/?afterInstall=true");
|
||||
});
|
||||
|
||||
$app->run();
|
|
@ -80,7 +80,7 @@
|
|||
<div class="form-group row hook-storage">
|
||||
<label for="storage_path" class="col-sm-3 col-form-label">Storage path root</label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" class="form-control hook-storage-input" id="storage_path" name="storage_path" autocomplete="off" data-default-local="{{ default_local }}">
|
||||
<input type="text" class="form-control hook-storage-input" id="storage_path" name="storage_path" autocomplete="off" data-default-local="{{ config.storage.path }}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row hook-storage">
|
||||
|
|
|
@ -4,11 +4,11 @@
|
|||
<title>{% block title %}Default{% endblock %} | {{ config.app_name }}</title>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta name="description" content="{{ config.app_name }} File Manager">
|
||||
<meta name="description" content="{{ config.app_name }} - Proudly powered by XBackBone.">
|
||||
<link rel="shortcut icon" href="{{ urlFor('/favicon.ico') }}" type="image/x-icon">
|
||||
<link rel="icon" href="{{ urlFor('/favicon.ico') }}" type="image/x-icon">
|
||||
<link rel="preload" href="{{ asset('/static/bootstrap/css/bootstrap.min.css') }}" as="style">
|
||||
<link rel="preload" href="{{ asset('/static/fontawesome/css/all.min.css') }}" as="script">
|
||||
<link rel="preload" href="{{ asset('/static/fontawesome/css/all.min.css') }}" as="style">
|
||||
<link rel="preload" href="{{ asset('/static/app/app.css') }}" as="style">
|
||||
<link rel="preload" href="{{ asset('/static/jquery/jquery.min.js') }}" as="script">
|
||||
<link rel="preload" href="{{ asset('/static/bootstrap/js/bootstrap.bundle.min.js') }}" as="script">
|
||||
|
|
Loading…
Reference in a new issue