Skip to content

Commit

Permalink
Fixed bad redirects (closes #62)
Browse files Browse the repository at this point in the history
Improved installer extensions recognitions
Improved cli commands
  • Loading branch information
sergix44 committed Sep 3, 2019
1 parent 8cbef5e commit 4288341
Show file tree
Hide file tree
Showing 10 changed files with 132 additions and 83 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,9 @@
## v2.6.1
+ Fixed bad redirects on the web installer (#62).
+ Improved shell commands.
+ Added alert if required extensions are not loaded.
+ Updated translations.

## v2.6
+ Added support to use AWS S3, Google Cloud Storage, Dropbox and FTP(s) accounts as storage location.
+ Fixed missing icon.
Expand Down
13 changes: 11 additions & 2 deletions README.md
Expand Up @@ -5,9 +5,11 @@ XBackBone is a simple, self-hosted, lightweight PHP backend for the instant shar
## Features

+ Supports every upload type from ShareX.
+ Low memory footprint.
+ Multiple backends support: Local storage, AWS S3, Google Cloud, Dropbox, FTP.
+ Code uploads syntax highlighting.
+ Video uploads player.
+ Files upload download page.
+ Files preview page.
+ Multi language support.
+ User management, multi user features and roles.
+ Public and private uploads.
Expand All @@ -16,9 +18,15 @@ XBackBone is a simple, self-hosted, lightweight PHP backend for the instant shar
+ Auto config generator for ShareX.
+ Share to Telegram.
+ Linux client tools supported via a custom script.
+ Direct downloads using curl or wget commands.

## How to Install
XBackBone require PHP >= `7.1`, writable storage path and PDO, with installed the required extensions (ex. `php-sqlite3` for SQLite, `php-gd` and `php-json`).
XBackBone require PHP >= `7.1`, writable storage path and PDO, with installed the required extensions:
+ `php-sqlite3` for SQLite
+ `php-mysql` for MariaDB/MySQL
+ `php-gd`
+ `php-json`
+ `php-intl`

### Web installation
+ **[release, stable]** Download latest release from GitHub: [Latest Release](https://github.com/SergiX44/XBackBone/releases/latest)
Expand Down Expand Up @@ -56,6 +64,7 @@ return [
```sh
php bin/migrate --install
```
+ Delete the `/install` directory.
+ Now just login with `admin/admin`, **be sure to change these credentials after your first login**.

## How to update
Expand Down
2 changes: 1 addition & 1 deletion app/helpers.php
Expand Up @@ -92,7 +92,7 @@ function cleanDirectory($path)
*/
function redirect(\Slim\Http\Response $response, string $path, $args = [], $status = null)
{
if ($path === '/' || $path === './' || substr($path, 0, 1) === '/') {
if (substr($path, 0, 1) === '/' || substr($path, 0, 3) === '../' || substr($path, 0, 2) === './') {
$url = urlFor($path);
} else {
$url = route($path, $args);
Expand Down
4 changes: 2 additions & 2 deletions bin/clean
@@ -1,12 +1,12 @@
#!/usr/bin/env php
<?php

require __DIR__ . '/../vendor/autoload.php';

if (php_sapi_name() !== 'cli') {
die();
}

require __DIR__ . '/../vendor/autoload.php';

$action = isset($argv[1]) ? $argv[1] : 'all';

switch ($action) {
Expand Down
21 changes: 15 additions & 6 deletions bin/migrate
@@ -1,20 +1,22 @@
#!/usr/bin/env php
<?php

use App\Database\DB;

require __DIR__ . '/../vendor/autoload.php';

if (php_sapi_name() !== 'cli') {
die();
}

$config = include 'config.php';
use App\Database\DB;

require __DIR__ . '/../vendor/autoload.php';

$config = include __DIR__ . '/../config.php';

if (!$config) {
die('config.php not found. Please create a new one.');
}

chdir(__DIR__ . '/../');

DB::setDsn($config['db']['connection'] . ':' . $config['db']['dsn'], $config['db']['username'], $config['db']['password']);

$firstMigrate = false;
Expand Down Expand Up @@ -56,7 +58,7 @@ foreach ($files as $file) {
if (basename($file) === $migration->name && $migration->migrated) {
$continue = true;
break;
} elseif (basename($file) === $migration->name && !$migration->migrated) {
} else if (basename($file) === $migration->name && !$migration->migrated) {
$exists = true;
break;
}
Expand Down Expand Up @@ -86,4 +88,11 @@ if (isset($argv[1]) && $argv[1] === '--install') {
DB::doQuery("INSERT INTO `users` (`email`, `username`, `password`, `is_admin`, `user_code`) VALUES ('admin@example.com', 'admin', ?, 1, ?)", [password_hash('admin', PASSWORD_DEFAULT), substr(md5(microtime()), rand(0, 26), 5)]);
}

if (file_exists(__DIR__ . '/../install')) {
removeDirectory(__DIR__ . '/../install');
}

include __DIR__ . '/clean';

echo 'Done.' . PHP_EOL;
exit(0);
6 changes: 4 additions & 2 deletions bin/theme
@@ -1,12 +1,14 @@
#!/usr/bin/env php
<?php

require __DIR__ . '/../vendor/autoload.php';

if (php_sapi_name() !== 'cli') {
die();
}

require __DIR__ . '/../vendor/autoload.php';

chdir(__DIR__ . '/../');

$json = json_decode(file_get_contents('https://bootswatch.com/api/4.json'));

if (!isset($argv[1])) {
Expand Down

0 comments on commit 4288341

Please sign in to comment.