Refactor input validation and add torrent state
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
f71519ecae
commit
285d35bc2a
18
src/App.vue
18
src/App.vue
|
@ -9,21 +9,9 @@
|
|||
export default {
|
||||
setup () {
|
||||
const items = [
|
||||
{
|
||||
label: 'Home',
|
||||
icon: 'pi pi-home',
|
||||
to: '/'
|
||||
},
|
||||
{
|
||||
label: 'Host',
|
||||
icon: 'pi pi-upload',
|
||||
to: '/host'
|
||||
},
|
||||
{
|
||||
label: 'Join',
|
||||
icon: 'pi pi-video',
|
||||
to: '/join'
|
||||
}
|
||||
{ label: 'Home', icon: 'pi pi-home', to: '/' },
|
||||
{ label: 'Host', icon: 'pi pi-upload', to: '/host' },
|
||||
{ label: 'Join', icon: 'pi pi-video', to: '/join' }
|
||||
]
|
||||
|
||||
return {
|
||||
|
|
12
src/main.js
12
src/main.js
|
@ -34,5 +34,17 @@ app.component('Toast', Toast)
|
|||
// Register VCinemaApp components.
|
||||
app.component('FileSelect', FileSelect)
|
||||
|
||||
app.provide('trackers', [
|
||||
'wss://tracker.sloppyta.co:443/announce',
|
||||
'wss://tracker.files.fm:7073/announce',
|
||||
'wss://open.tube:443/tracker/socket',
|
||||
'wss://hub.bugout.link:443/announce',
|
||||
'ws://tracker.sloppyta.co:80/announce',
|
||||
'ws://tracker.lab.vvc.niif.hu:80/announce',
|
||||
'ws://tracker.files.fm:7072/announce',
|
||||
'ws://tracker.btsync.cf:6969/announce',
|
||||
'ws://hub.bugout.link:80/announce'
|
||||
])
|
||||
|
||||
// Render to DOM.
|
||||
app.mount('#app')
|
||||
|
|
|
@ -7,31 +7,39 @@
|
|||
|
||||
<script>
|
||||
import { useToast } from 'primevue/usetoast'
|
||||
import { ref } from 'vue'
|
||||
import { inject, ref, reactive } from 'vue'
|
||||
|
||||
const validateFileInput = (files) => {
|
||||
if (files?.length !== 1 || !files[0].name.endsWith('.mp4') || files[0].type !== 'video/mp4') {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
export default {
|
||||
setup () {
|
||||
const toast = useToast()
|
||||
|
||||
const trackers = inject('trackers')
|
||||
const file = ref()
|
||||
const torrentState = reactive({
|
||||
active: false
|
||||
})
|
||||
|
||||
const filesSelected = (files) => {
|
||||
if (files?.length !== 1) {
|
||||
toast.add({ severity: 'error', summary: 'Bad file input', detail: 'You must select only one file.', life: 3000 })
|
||||
return
|
||||
if (!validateFileInput(files)) {
|
||||
toast.add({ severity: 'error', summary: 'Bad file input', detail: 'You must select a single H.264 encoded MP4.', life: 3000 })
|
||||
} else {
|
||||
file.value = files[0]
|
||||
}
|
||||
|
||||
if (!files[0].name.endsWith('.mp4') || files[0].type !== 'video/mp4') {
|
||||
toast.add({ severity: 'error', summary: 'Bad file input', detail: 'Only H.264 encoded MP4s are supported.', life: 3000 })
|
||||
return
|
||||
}
|
||||
|
||||
file.value = files[0]
|
||||
console.log(trackers)
|
||||
}
|
||||
|
||||
return {
|
||||
filesSelected,
|
||||
file
|
||||
file,
|
||||
torrentState
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue