Fix playing deep linked item.
This commit is contained in:
parent
e75a7db6cc
commit
98fe1278c5
2 changed files with 15 additions and 12 deletions
|
|
@ -25,7 +25,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { onMounted, reactive, ref } from 'vue'
|
import { onMounted, reactive, ref, inject } from 'vue'
|
||||||
import PageHeader from './components/Page-Header'
|
import PageHeader from './components/Page-Header'
|
||||||
import formAdd from './components/Form-Add'
|
import formAdd from './components/Form-Add'
|
||||||
import pageTasks from './components/Page-Tasks'
|
import pageTasks from './components/Page-Tasks'
|
||||||
|
|
@ -47,6 +47,8 @@ const config = reactive({
|
||||||
tasks: [],
|
tasks: [],
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const makeDownload = inject('makeDownload')
|
||||||
|
|
||||||
const socket = ref()
|
const socket = ref()
|
||||||
const downloading = reactive({})
|
const downloading = reactive({})
|
||||||
const completed = reactive({})
|
const completed = reactive({})
|
||||||
|
|
@ -229,16 +231,7 @@ const addItem = (item) => {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const playItem = item => {
|
const playItem = item => video_link.value = makeDownload(config, item, 'm3u8');
|
||||||
let baseDir = 'player/playlist/';
|
|
||||||
|
|
||||||
if (item.folder) {
|
|
||||||
item.folder = item.folder.replace('#', '%23');
|
|
||||||
baseDir += item.folder + '/';
|
|
||||||
}
|
|
||||||
|
|
||||||
video_link.value = config.app.url_host + config.app.url_prefix + baseDir + encodeURIComponent(item.filename) + '.m3u8';
|
|
||||||
};
|
|
||||||
|
|
||||||
const reloadWindow = () => window.location.reload();
|
const reloadWindow = () => window.location.reload();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,14 @@ library.add(faCog, faTrash, faLink, faPlus, faTrashCan, faCircleXmark, faCircleC
|
||||||
faPowerOff, faPaperPlane, faBoxArchive)
|
faPowerOff, faPaperPlane, faBoxArchive)
|
||||||
const app = createApp(App);
|
const app = createApp(App);
|
||||||
|
|
||||||
|
app.config.globalProperties.encodePath = item => {
|
||||||
|
if (!item) {
|
||||||
|
return item
|
||||||
|
}
|
||||||
|
|
||||||
|
return item.split('/').map(decodeURIComponent).map(encodeURIComponent).join('/').replace(/#/g, '%23')
|
||||||
|
}
|
||||||
|
|
||||||
app.config.globalProperties.capitalize = s => s && s[0].toUpperCase() + s.slice(1);
|
app.config.globalProperties.capitalize = s => s && s[0].toUpperCase() + s.slice(1);
|
||||||
app.config.globalProperties.makeDownload = (config, item, base = 'download') => {
|
app.config.globalProperties.makeDownload = (config, item, base = 'download') => {
|
||||||
let baseDir = 'download' === base ? `${base}/` : 'player/playlist/';
|
let baseDir = 'download' === base ? `${base}/` : 'player/playlist/';
|
||||||
|
|
@ -37,7 +45,7 @@ app.config.globalProperties.makeDownload = (config, item, base = 'download') =>
|
||||||
baseDir += item.folder + '/';
|
baseDir += item.folder + '/';
|
||||||
}
|
}
|
||||||
|
|
||||||
let url = config.app.url_host + config.app.url_prefix + baseDir + encodeURIComponent(item.filename);
|
let url = config.app.url_host + app.config.globalProperties.encodePath(config.app.url_prefix + baseDir + item.filename);
|
||||||
return ('m3u8' === base) ? url + '.m3u8' : url;
|
return ('m3u8' === base) ? url + '.m3u8' : url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -53,6 +61,8 @@ app.config.globalProperties.formatBytes = (bytes, decimals = 2) => {
|
||||||
return `${parseFloat((bytes / Math.pow(k, i)).toFixed(dm))} ${sizes[i]}`
|
return `${parseFloat((bytes / Math.pow(k, i)).toFixed(dm))} ${sizes[i]}`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
app.provide('makeDownload', app.config.globalProperties.makeDownload)
|
||||||
|
|
||||||
app.use(Toast, {
|
app.use(Toast, {
|
||||||
transition: "Vue-Toastification__bounce",
|
transition: "Vue-Toastification__bounce",
|
||||||
position: "bottom-right",
|
position: "bottom-right",
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue