mirror of
https://github.com/axeloz/filesharing.git
synced 2025-05-07 02:23:55 +02:00
Fixing relative URLs bug + Adding EasyMDE
This commit is contained in:
parent
d675b8efda
commit
b418163269
12 changed files with 2019 additions and 246 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -19,3 +19,4 @@ yarn-error.log
|
||||||
/.vscode
|
/.vscode
|
||||||
/storage/content
|
/storage/content
|
||||||
/storage/clockwork
|
/storage/clockwork
|
||||||
|
.DS_Store
|
||||||
|
|
|
@ -7,6 +7,7 @@ use App\Helpers\Upload;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Http\Resources\Json\JsonResource;
|
use Illuminate\Http\Resources\Json\JsonResource;
|
||||||
use Illuminate\Support\Facades\Route;
|
use Illuminate\Support\Facades\Route;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
use App\Http\Resources\UserResource;
|
use App\Http\Resources\UserResource;
|
||||||
use App\Http\Resources\FileResource;
|
use App\Http\Resources\FileResource;
|
||||||
|
@ -37,6 +38,7 @@ class BundleResource extends JsonResource
|
||||||
'fullsize' => (int)$this->fullsize,
|
'fullsize' => (int)$this->fullsize,
|
||||||
'title' => $this->title,
|
'title' => $this->title,
|
||||||
'description' => $this->description,
|
'description' => $this->description,
|
||||||
|
'description_html' => ! empty($this->description) ? Str::markdown($this->description) : null,
|
||||||
'max_downloads' => (int)$this->max_downloads,
|
'max_downloads' => (int)$this->max_downloads,
|
||||||
'downloads' => (int)$this->downloads,
|
'downloads' => (int)$this->downloads,
|
||||||
'files' => FileResource::collection($this->files),
|
'files' => FileResource::collection($this->files),
|
||||||
|
|
1793
package-lock.json
generated
Normal file
1793
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load diff
|
@ -13,6 +13,7 @@
|
||||||
"alpinejs": "^3.12.0",
|
"alpinejs": "^3.12.0",
|
||||||
"autoprefixer": "^10.4.14",
|
"autoprefixer": "^10.4.14",
|
||||||
"dropzone": "^6.0.0-beta.2",
|
"dropzone": "^6.0.0-beta.2",
|
||||||
|
"easymde": "^2.18.0",
|
||||||
"global": "^4.4.0",
|
"global": "^4.4.0",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
"moment": "^2.29.4",
|
"moment": "^2.29.4",
|
||||||
|
|
|
@ -130,7 +130,7 @@
|
||||||
<span class="font-title text-xs text-primary uppercase mr-1">
|
<span class="font-title text-xs text-primary uppercase mr-1">
|
||||||
@lang('app.upload-description')
|
@lang('app.upload-description')
|
||||||
</span>
|
</span>
|
||||||
<span x-text="metadata.description"></span>
|
<span x-html="metadata.description_html"></span>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<header class="relative bg-gradient-to-r from-primary-light to-primary px-2 py-4 text-center">
|
<header class="relative bg-gradient-to-r from-primary-light to-primary px-2 py-4 text-center">
|
||||||
<h1 class="relative font-title font-medium font-body text-4xl text-center text-white uppercase">
|
<h1 class="relative font-title font-medium font-body text-4xl text-center text-white uppercase">
|
||||||
<div class="grow text-center">
|
<div class="grow text-center">
|
||||||
<a href="/">
|
<a href="{{ route('homepage') }}">
|
||||||
{{ config('app.name') }}
|
{{ config('app.name') }}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -50,7 +50,7 @@
|
||||||
|
|
||||||
newBundle: function() {
|
newBundle: function() {
|
||||||
axios({
|
axios({
|
||||||
url: '/new',
|
url: BASE_URL+'/new',
|
||||||
method: 'POST'
|
method: 'POST'
|
||||||
})
|
})
|
||||||
.then( (response) => {
|
.then( (response) => {
|
||||||
|
@ -144,7 +144,7 @@
|
||||||
</select>
|
</select>
|
||||||
@else
|
@else
|
||||||
<p class="text-center">
|
<p class="text-center">
|
||||||
<a href="/login" class="text-primary font-bold hover:underline">@lang('app.do-login')</a>
|
<a href="{{ route('login') }}" class="text-primary font-bold hover:underline">@lang('app.do-login')</a>
|
||||||
@lang('app.to-get-bundles')
|
@lang('app.to-get-bundles')
|
||||||
</p>
|
</p>
|
||||||
@endif
|
@endif
|
||||||
|
|
|
@ -12,6 +12,10 @@
|
||||||
@stack('styles')
|
@stack('styles')
|
||||||
@vite('resources/js/app.js')
|
@vite('resources/js/app.js')
|
||||||
|
|
||||||
|
<script>
|
||||||
|
const BASE_URL = '{{ route('homepage') }}'
|
||||||
|
</script>
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body class="font-display text-[13px] selection:bg-purple-100 outline-none select-none">
|
<body class="font-display text-[13px] selection:bg-purple-100 outline-none select-none">
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
axios({
|
axios({
|
||||||
url: '/login',
|
url: BASE_URL+'/login',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data: {
|
data: {
|
||||||
login: this.user.login,
|
login: this.user.login,
|
||||||
|
|
|
@ -3,8 +3,11 @@
|
||||||
@section('page_title', __('app.upload-files-title'))
|
@section('page_title', __('app.upload-files-title'))
|
||||||
|
|
||||||
@push('scripts')
|
@push('scripts')
|
||||||
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/easymde/dist/easymde.min.css">
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/easymde/dist/easymde.min.js"></script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
let baseUrl = @js($baseUrl);
|
let baseUrl = @js($baseUrl);
|
||||||
let bundle = @js($bundle);
|
let bundle = @js($bundle);
|
||||||
let maxFiles = @js(config('sharing.max_files'));
|
let maxFiles = @js(config('sharing.max_files'));
|
||||||
|
@ -14,6 +17,7 @@
|
||||||
Alpine.data('upload', () => ({
|
Alpine.data('upload', () => ({
|
||||||
bundle: null,
|
bundle: null,
|
||||||
dropzone: null,
|
dropzone: null,
|
||||||
|
easymde: null,
|
||||||
uploadedFiles: [],
|
uploadedFiles: [],
|
||||||
completed: false,
|
completed: false,
|
||||||
step: 0,
|
step: 0,
|
||||||
|
@ -55,6 +59,15 @@
|
||||||
else {
|
else {
|
||||||
this.step = 1
|
this.step = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.easymde = new EasyMDE({
|
||||||
|
maxHeight: '50px',
|
||||||
|
forceSync: false,
|
||||||
|
initialValue: this.bundle.description,
|
||||||
|
spellChecker: false,
|
||||||
|
status: false,
|
||||||
|
autofocus: false
|
||||||
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -90,12 +103,12 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
axios({
|
axios({
|
||||||
url: '/upload/'+this.bundle.slug,
|
url: BASE_URL+'/upload/'+this.bundle.slug,
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data: {
|
data: {
|
||||||
expiry: this.bundle.expiry,
|
expiry: this.bundle.expiry,
|
||||||
title: this.bundle.title,
|
title: this.bundle.title,
|
||||||
description: this.bundle.description,
|
description: this.easymde.value(),
|
||||||
max_downloads: this.bundle.max_downloads,
|
max_downloads: this.bundle.max_downloads,
|
||||||
password: this.bundle.password,
|
password: this.bundle.password,
|
||||||
auth: this.bundle.owner_token
|
auth: this.bundle.owner_token
|
||||||
|
@ -119,7 +132,7 @@
|
||||||
|
|
||||||
this.showModal('{{ __('app.confirm-complete') }}', () => {
|
this.showModal('{{ __('app.confirm-complete') }}', () => {
|
||||||
axios({
|
axios({
|
||||||
url: '/upload/'+this.bundle.slug+'/complete',
|
url: BASE_URL+'/upload/'+this.bundle.slug+'/complete',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data: {
|
data: {
|
||||||
auth: this.bundle.owner_token
|
auth: this.bundle.owner_token
|
||||||
|
@ -147,7 +160,7 @@
|
||||||
this.maxFiles = this.maxFiles - this.countFilesOnServer() >= 0 ? this.maxFiles - this.countFilesOnServer() : 0
|
this.maxFiles = this.maxFiles - this.countFilesOnServer() >= 0 ? this.maxFiles - this.countFilesOnServer() : 0
|
||||||
|
|
||||||
this.dropzone = new Dropzone('#upload-frm', {
|
this.dropzone = new Dropzone('#upload-frm', {
|
||||||
url: '/upload/'+this.bundle.slug+'/file',
|
url: BASE_URL+'/upload/'+this.bundle.slug+'/file',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
'X-Upload-Auth': this.bundle.owner_token
|
'X-Upload-Auth': this.bundle.owner_token
|
||||||
|
@ -223,7 +236,7 @@
|
||||||
let lfile = file
|
let lfile = file
|
||||||
|
|
||||||
axios({
|
axios({
|
||||||
url: '/upload/'+this.bundle.slug+'/file',
|
url: BASE_URL+'/upload/'+this.bundle.slug+'/file',
|
||||||
method: 'DELETE',
|
method: 'DELETE',
|
||||||
data: {
|
data: {
|
||||||
uuid: lfile.uuid,
|
uuid: lfile.uuid,
|
||||||
|
@ -252,7 +265,7 @@
|
||||||
deleteBundle: function() {
|
deleteBundle: function() {
|
||||||
this.showModal('{{ __('app.confirm-delete-bundle') }}', () => {
|
this.showModal('{{ __('app.confirm-delete-bundle') }}', () => {
|
||||||
axios({
|
axios({
|
||||||
url: '/upload/'+this.bundle.slug+'/delete',
|
url: BASE_URL+'/upload/'+this.bundle.slug+'/delete',
|
||||||
method: 'DELETE',
|
method: 'DELETE',
|
||||||
data: {
|
data: {
|
||||||
auth: this.bundle.owner_token
|
auth: this.bundle.owner_token
|
||||||
|
|
|
@ -24,8 +24,8 @@ use App\Http\Middleware\UploadAccess;
|
||||||
Public route for login
|
Public route for login
|
||||||
*/
|
*/
|
||||||
Route::controller(WebController::class)->group(function() {
|
Route::controller(WebController::class)->group(function() {
|
||||||
Route::get('/login', 'login');
|
Route::get('/login', 'login')->name('login');
|
||||||
Route::post('/login', 'doLogin');
|
Route::post('/login', 'doLogin')->name('login.post');
|
||||||
Route::get('/logout', 'logout')->name('logout');
|
Route::get('/logout', 'logout')->name('logout');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue