Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions app/Events/SlipProcessFinished.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ class SlipProcessFinished implements ShouldBroadcastNow
public function __construct(
public Slip $slip,
public bool $success = true
) {
//
}
) {}

/**
* Get the channels the event should broadcast on.
Expand Down
7 changes: 1 addition & 6 deletions app/Events/SlipProcessUpdate.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@

use Illuminate\Broadcasting\Channel;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Broadcasting\PresenceChannel;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
use Illuminate\Contracts\Broadcasting\ShouldBroadcastNow;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;
Expand All @@ -22,9 +19,7 @@ public function __construct(
public string $token,
public string $status,
public int $percentage
)
{
}
) {}

/**
* Get the channels the event should broadcast on.
Expand Down
8 changes: 0 additions & 8 deletions app/Events/SlipUploaded.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,6 @@ class SlipUploaded implements ShouldBroadcastNow
{
use Dispatchable, InteractsWithSockets, SerializesModels;

/**
* Create a new event instance.
*/
public function __construct()
{

}

/**
* Get the channels the event should broadcast on.
*
Expand Down
9 changes: 1 addition & 8 deletions app/Helpers/AppHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,7 @@ class AppHelper
{
public static function is_installed()
{
$usersCount = User::count();
// If there are no users, redirect to the installation
if ($usersCount === 0) {
return false;
}
return true;
return User::count() > 0;
}

public static function getVersion()
Expand All @@ -29,8 +24,6 @@ public static function getLatestVersion()
$output = [];
exec($command, $output);

$pattern = '/refs\/tags\/(.*)/';

preg_match('/refs\/tags\/(.*)/', Arr::last($output), $output_array);

return $output_array[1];
Expand Down
4 changes: 2 additions & 2 deletions app/Http/Controllers/Api/SupportedMimeTypesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
namespace App\Http\Controllers\Api;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Config;

class SupportedMimeTypesController extends Controller
{
public function __invoke()
{
return \Config::get('slipstream.supported_mimetypes');
return Config::get('slipstream.supported_mimetypes');
}
}
2 changes: 0 additions & 2 deletions app/Http/Controllers/JobController.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,9 @@ class JobController extends Controller
/* TODO: Optimize this */
public function requeue(Slip $slip)
{

$failedJobProvider = app(FailedJobProviderInterface::class);
$failedJob = $failedJobProvider->find($slip->job_uuid);


Queue::pushRaw($failedJob->payload);
$slip->setStatus(SlipStatus::QUEUED);

Expand Down
1 change: 0 additions & 1 deletion app/Http/Controllers/SlipShowController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace App\Http\Controllers;

use App\Models\Slip;
use Illuminate\Http\Request;

class SlipShowController extends Controller
{
Expand Down
4 changes: 2 additions & 2 deletions app/Http/Requests/SlipTempUploadRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ public function authorize(): bool
*/
public function rules(): array
{
// TODO: File size limit by settings
$max = app(GeneralSettings::class)->file_size_limit;
return [
'file' => ['file', 'max:999999', new SupportedMimeTypes()]
'file' => ['file', "max:{$max}", new SupportedMimeTypes()]
];
}
}
3 changes: 2 additions & 1 deletion app/Rules/SupportedMimeTypes.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace App\Rules;

use Closure;
use Config;
use Illuminate\Contracts\Validation\ValidationRule;
use Illuminate\Validation\ValidationException;

Expand All @@ -15,7 +16,7 @@ class SupportedMimeTypes implements ValidationRule
*/
public function validate(string $attribute, mixed $value, Closure $fail): void
{
$supportedMimeTypes = \Config::get('slipstream.supported_mimetypes');
$supportedMimeTypes = Config::get('slipstream.supported_mimetypes');

try {
$mimeType = $value->getClientMimeType();
Expand Down
3 changes: 2 additions & 1 deletion app/Settings/GeneralSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@

class GeneralSettings extends Settings
{

public string $site_name;

public bool $guests_can_see_video_info;

public int $file_size_limit;

public array $streaming_bitrates;

public static function group(): string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ public function up(): void
{
$this->migrator->add('general.site_name', 'Slipstream');
$this->migrator->add('general.guests_can_see_video_info', true);
$this->migrator->add('general.file_size_limit', 999999);
$this->migrator->add('general.streaming_bitrates', [
2160 => 4000,
1440 => 3000,
Expand Down
2 changes: 1 addition & 1 deletion resources/js/Composables/useCanvas.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {onMounted, ref} from 'vue'
import { onMounted, ref } from 'vue'

export default function useCanvas() {
let canvas = ref(null)
Expand Down
4 changes: 2 additions & 2 deletions resources/js/Composables/useHumanReadableSize.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*
* @return Formatted string.
*/
export const humanReadableSize = (bytes, si=false, dp=1) => {
export const humanReadableSize = (bytes, si = false, dp = 1) => {
const thresh = si ? 1000 : 1024

if (Math.abs(bytes) < thresh) {
Expand All @@ -19,7 +19,7 @@ export const humanReadableSize = (bytes, si=false, dp=1) => {
? ['kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']
: ['KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB']
let u = -1
const r = 10**dp
const r = 10 ** dp

do {
bytes /= thresh
Expand Down
20 changes: 10 additions & 10 deletions resources/js/Composables/useIconType.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ import OptimizedType from '~icons/ph/video'
import StreamableType from '~icons/solar/play-stream-bold'

const iconType = (type) => {
switch (type) {
case 1:
return OriginalType
case 2:
return OptimizedType
case 3:
return StreamableType
default:
return OriginalType
}
switch (type) {
case 1:
return OriginalType
case 2:
return OptimizedType
case 3:
return StreamableType
default:
return OriginalType
}
}

export default iconType
54 changes: 27 additions & 27 deletions resources/js/Composables/useInfiniteScrolling.js
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
import axios from 'axios'
import {onMounted, onUnmounted, ref} from 'vue'
import { onMounted, onUnmounted, ref } from 'vue'


const isFetching = ref(false)
const loadMoreIntersect = ref(null)
export const useInfiniteScrolling = (slips) => {
const fetchSlips = async () => {
const next_url = slips.value.next_page_url

if (!next_url) return

isFetching.value = true
await axios.get(next_url)
.then((response) => {
slips.value.data.push(...response.data.data)
slips.value.next_page_url = response.data.next_page_url
console.log(slips.value.meta)
isFetching.value = false
})
}

const observer = new IntersectionObserver(entries => {
entries.forEach(entry => {
if (entry.isIntersecting) {
fetchSlips()
}
const fetchSlips = async () => {
const next_url = slips.value.next_page_url
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wondering if this check can't be done above "fetchSlips", seems like unneeded code to run if next_page_url either way will stop it further ahead in callbacks


if (!next_url) return

isFetching.value = true
await axios.get(next_url)
.then((response) => {
slips.value.data.push(...response.data.data)
slips.value.next_page_url = response.data.next_page_url
console.log(slips.value.meta)
isFetching.value = false
})
}

const observer = new IntersectionObserver(entries => {
entries.forEach(entry => {
if (entry.isIntersecting) {
fetchSlips()
}
})
}, {
rootMargin: '-100px 0px 0px 0px',
})
}, {
rootMargin: '-100px 0px 0px 0px',
})
onMounted(() => observer.observe(loadMoreIntersect.value))
onMounted(() => observer.observe(loadMoreIntersect.value))

onUnmounted(() => observer.disconnect())
onUnmounted(() => observer.disconnect())

return {loadMoreIntersect, isFetching}
return { loadMoreIntersect, isFetching }
}


42 changes: 21 additions & 21 deletions resources/js/Composables/useSlipSockets.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
import {router} from '@inertiajs/vue3'
import { router } from '@inertiajs/vue3'

// TODO: Check if can work without snackbar and add toastr logic in

const useSlipSockets = (snackbar) => {
window.Echo.channel('ss').listen('SlipProcessFinished', (e) => {
router.reload({
preserveState: true,
only: ['slips'],
onSuccess: (page) => {
//I had to move this to success, so toastr doesn't appear double
if (e.success) {
$snackbar.add({
type: 'success',
text: 'Slip successfully processed',
})
} else {
$snackbar.add({
type: 'error',
text: 'Processing failed for ' + e.slip.title,
})
}
},
const useSlipSockets = () => {
window.Echo.channel('ss').listen('SlipProcessFinished', (e) => {
router.reload({
preserveState: true,
only: ['slips'],
onSuccess: (page) => {
//I had to move this to success, so toastr doesn't appear double
if (e.success) {
$snackbar.add({
type: 'success',
text: 'Slip successfully processed',
})
} else {
$snackbar.add({
type: 'error',
text: 'Processing failed for ' + e.slip.title,
})
}
},
})
})
})
}

export default useSlipSockets
5 changes: 3 additions & 2 deletions resources/js/Composables/useTimeManipulation.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import moment from 'moment/moment.js'

export const formattedDuration = (duration) =>moment.utc(duration*1000).format('mm:ss')
export const formattedDuration = (duration) => moment.utc(duration * 1000).format('mm:ss')

export const relativeTime = (time) => {
return moment(time).fromNow()}
return moment(time).fromNow()
}

2 changes: 1 addition & 1 deletion resources/js/Layouts/InstallLayout.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script setup>
import ApplicationLogo from '@/Components/UI/ApplicationLogo.vue'
import {Vue3Snackbar} from 'vue3-snackbar'
import { Vue3Snackbar } from 'vue3-snackbar'
</script>

<template>
Expand Down
Loading