Added nginx.conf

improved templates
This commit is contained in:
Sergio Brighenti 2019-02-06 22:34:56 +01:00
parent df712e43b5
commit 1df8ae9592
21 changed files with 93 additions and 71 deletions

View file

@ -1,9 +1,10 @@
## v2.5
+ Updated project license to <a href="https://choosealicense.com/licenses/agpl-3.0/">GNU AGPLv3</a>.
+ Updated project license to <a href="https://choosealicense.com/licenses/agpl-3.0/">AGPL v3.0</a> (now releases ships with the new license).
+ **[BETA]** Added self update feature.
+ Added partial content implementation (stream seeking on chromium based browsers).
+ Improved video.js alignment with large videos.
+ Optimized output zip release size.
+ Templates cleanup and optimizations.
## v2.4.1
+ Fixed error message when the file is too large. (#15)

View file

@ -68,7 +68,12 @@ module.exports = function (grunt) {
src: ['bootstrap.bundle.min.js'],
dest: 'static/bootstrap/js'
},
{expand: true, cwd: 'node_modules/clipboard/dist', src: ['clipboard.min.js'], dest: 'static/clipboardjs'},
{
expand: true,
cwd: 'node_modules/clipboard/dist',
src: ['clipboard.min.js'],
dest: 'static/clipboardjs'
},
{
expand: true,
cwd: 'node_modules/video.js/dist',
@ -106,15 +111,14 @@ module.exports = function (grunt) {
'config.example.php',
'index.php',
'composer.json',
'composer.lock'
'composer.lock',
'LICENSE',
]
}
});
require('load-grunt-tasks')(grunt);
grunt.registerTask('default', ['jshint', 'cssmin', 'uglify', 'copy']);
grunt.registerTask('test', ['jshint']);
grunt.registerTask('build-release', ['default', 'zip']);
};

View file

@ -1,5 +1,5 @@
# XBackBone 📤 [![Build Status](https://travis-ci.org/SergiX44/XBackBone.svg?branch=master)](https://travis-ci.org/SergiX44/XBackBone)
# XBackBone 📤 [![Build Status](https://travis-ci.org/SergiX44/XBackBone.svg?branch=master)](https://travis-ci.org/SergiX44/XBackBone) [![Donations](https://i.imgur.com/bAqVIw8.png?2)](http://bit.ly/XBackBoneDonate)
XBackBone is a simple, self-hosted, lightweight PHP backend for the instant sharing tool ShareX. It supports uploading and displaying images, GIF, video, code, formatted text, and file downloading and uploading. Also have a web UI with multi user management and past uploads history.
## Features
@ -105,48 +105,10 @@ The script requires `xclip`, `curl`, and `notify-send`.
*Note: XXX is the username of your XBackBone account.*
## Notes
## Web server configuration notes
If you do not use Apache, or the Apache `.htaccess` is not enabled, set your web server so that the `static/` folder is the only one accessible from the outside, otherwise even private uploads and logs will be accessible!
The NGINX configuration should be something like this:
```
# nginx configuration
location /app {
return 403;
}
location /bin {
return 403;
}
location /bootstrap {
return 403;
}
location /resources {
return 403;
}
location /storage {
return 403;
}
location /vendor {
return 403;
}
location /logs {
return 403;
}
autoindex off;
location / {
if (!-e $request_filename){
rewrite ^(.*)$ /index.php break;
}
}
```
You can find an example configuration nginx.conf in the project repository.
## Screenshots
<p align="center">
<img src="https://i.imgur.com/zEHL5U3.png" width="400" title="Installation">

View file

@ -24,7 +24,10 @@ class UploadController extends Controller
public function upload(Request $request, Response $response): Response
{
$json = ['message' => null];
$json = [
'message' => null,
'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) {
$json['message'] = 'Endpoint under maintenance.';

43
nginx.conf Normal file
View file

@ -0,0 +1,43 @@
autoindex off;
location /app {
return 403;
}
location /bin {
return 403;
}
location /bootstrap {
return 403;
}
location /resources {
return 403;
}
location /storage {
return 403;
}
location /vendor {
return 403;
}
location /logs {
return 403;
}
location / {
try_files $uri /index.php$is_args$args;
}
location ~ \.php {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_index index.php;
fastcgi_pass 127.0.0.1:9000;
}

View file

@ -49,5 +49,4 @@
</div>
</form>
</div>
{% include 'comp/footer.twig' %}
{% endblock %}

View file

@ -9,7 +9,7 @@
<link href="{{ urlFor('/static/highlightjs/styles/monokai.css') }}" rel="stylesheet">
<link href="{{ urlFor('/static/videojs/video-js.min.css') }}" rel="stylesheet">
<link href="{{ urlFor('/static/app/app.css') }}" rel="stylesheet">
<script src="{{ urlFor('/static/jquery/jquery.min.js') }}"></script>
<script src="{{ urlFor('/static/jquery/jquery.min.js') }}"></script>
<script src="{{ urlFor('/static/bootstrap/js/bootstrap.bundle.min.js') }}"></script>
<script src="{{ urlFor('/static/fontawesome/js/all.min.js') }}"></script>
<script src="{{ urlFor('/static/highlightjs/highlight.pack.min.js') }}"></script>
@ -22,5 +22,11 @@
</head>
<body>
{% block content %}{% endblock %}
{% block footer %}
<div class="container-fluid footer" style="display: none; font-size: 0.8rem">
<div class="text-muted">Proudly powered by <a href="https://github.com/SergiX44/XBackBone">XBackBone{% if session.admin %} v{{ PLATFORM_VERSION }}{% endif %}</a>
— <i class="fas fa-fw fa-balance-scale"></i> <a href="{{ urlFor('/LICENSE') }}" target="_blank">AGPL v3.0</a></div>
</div>
{% endblock %}
</body>
</html>

View file

@ -1,5 +0,0 @@
<footer class="footer">
<div class="container-fluid">
<div class="text-muted">Proudly powered by <a href="https://github.com/SergiX44/XBackBone">XBackBone{% if session.logged %} v{{ PLATFORM_VERSION }}{% endif %}</a></div>
</div>
</footer>

View file

@ -7,18 +7,18 @@
<div class="collapse navbar-collapse" id="navbarCollapse">
<ul class="navbar-nav mr-auto">
<li class="nav-item">
<a href="{{ route('home') }}" class="nav-link {{ request.uri.path starts with '/home' ? 'active' }}"><i class="fas fa-fw fa-home"></i>
<a href="{{ route('home') }}" class="nav-link {{ is_current_path('home') ? 'active' }}"><i class="fas fa-fw fa-home"></i>
{{ lang('home') }}
</a>
</li>
{% if session.admin %}
<li class="nav-item">
<a href="{{ route('user.index') }}" class="nav-link {{ request.uri.path starts with '/user' ? 'active' }}"><i class="fas fa-fw fa-users"></i>
<a href="{{ route('user.index') }}" class="nav-link {{ is_current_path('user.index') ? 'active' }}"><i class="fas fa-fw fa-users"></i>
{{ lang('users') }}
</a>
</li>
<li class="nav-item">
<a href="{{ route('system') }}" class="nav-link {{ request.uri.path starts with '/system' ? 'active' }}"><i class="fas fa-fw fa-cog"></i>
<a href="{{ route('system') }}" class="nav-link {{ is_current_path('system') ? 'active' }}"><i class="fas fa-fw fa-cog"></i>
{{ lang('system') }}
</a>
</li>

View file

@ -85,5 +85,4 @@
</div>
</div>
</div>
{% include 'comp/footer.twig' %}
{% endblock %}

View file

@ -59,5 +59,4 @@
<div class="text-center text-muted"><i>{{ lang('no_media') }}</i></div>
{% endif %}
</div>
{% include 'comp/footer.twig' %}
{% endblock %}

View file

@ -113,5 +113,4 @@
</div>
</div>
</div>
{% include 'comp/footer.twig' %}
{% endblock %}

View file

@ -9,4 +9,6 @@
<p class="lead">Access denied to the requested resource.</p>
</div>
</div>
{% endblock %}
{% endblock %}
{% block footer %}{% endblock %}

View file

@ -12,4 +12,5 @@
</button>
</div>
</div>
{% endblock %}
{% endblock %}
{% block footer %}{% endblock %}

View file

@ -26,4 +26,5 @@
</div>
{% endif %}
</div>
{% endblock %}
{% endblock %}
{% block footer %}{% endblock %}

View file

@ -100,5 +100,4 @@
</div>
</div>
</div>
{% include 'comp/footer.twig' %}
{% endblock %}

View file

@ -65,5 +65,4 @@
</div>
</div>
</div>
{% include 'comp/footer.twig' %}
{% endblock %}

View file

@ -94,5 +94,4 @@
</div>
</div>
</div>
{% include 'comp/footer.twig' %}
{% endblock %}

View file

@ -87,5 +87,4 @@
</div>
</div>
</div>
{% include 'comp/footer.twig' %}
{% endblock %}

View file

@ -82,8 +82,18 @@ body {
text-align: right;
}
.media-player {
width: 80%;
margin-right: auto;
margin-left: auto;
@media (min-width: 576px) {
.media-player {
width: 100%;
margin-right: auto;
margin-left: auto;
}
}
@media (min-width: 768px) {
.media-player {
width: 77%;
margin-right: auto;
margin-left: auto;
}
}

View file

@ -22,6 +22,8 @@ var app = {
});
}
$('.footer').fadeIn(600);
console.log('Application is ready.');
},
modalDelete: function () {