perf: 优化私密分享链接中m3u8文件的播放
This commit is contained in:
parent
1770bc8005
commit
571b7a8a32
@ -132,7 +132,7 @@ export default {
|
||||
if (this.file.m3u8) {
|
||||
videoUrl = `${fileConfig.baseUrl}/video/hls/${this.file.m3u8}`
|
||||
if (this.shareId) {
|
||||
videoUrl = `${fileConfig.baseUrl}/public/video/hls/${this.file.m3u8}?share-token=${this.$store.getters.shareToken}`
|
||||
videoUrl = `${fileConfig.baseUrl}/public/video/hls/${this.file.m3u8}`
|
||||
}
|
||||
}
|
||||
this.option.url = videoUrl
|
||||
|
||||
@ -121,7 +121,7 @@ const actions = {
|
||||
fileApi.validShareCode({ shareId: shareId, shareCode: shareCode }).then(response => {
|
||||
const { data } = response
|
||||
commit('SET_SHARE_TOKEN', data)
|
||||
setShareToken(data)
|
||||
setShareToken(data, shareId)
|
||||
resolve()
|
||||
}).catch(error => {
|
||||
reject(error)
|
||||
|
||||
@ -3,6 +3,7 @@ import Cookies from 'js-cookie'
|
||||
const tokenKey = 'jmal-token'
|
||||
const usernameKey = 'username'
|
||||
const shareTokenKey = 'share-token'
|
||||
const shareIdKey = 'shareId'
|
||||
const consumerId = 'consumerId'
|
||||
const rememberName = 'rememberName'
|
||||
|
||||
@ -34,8 +35,13 @@ export function getShareToken() {
|
||||
return Cookies.get(shareTokenKey)
|
||||
}
|
||||
|
||||
export function setShareToken(token) {
|
||||
return Cookies.set(shareTokenKey, token)
|
||||
export function getShareId() {
|
||||
return Cookies.get(shareIdKey)
|
||||
}
|
||||
|
||||
export function setShareToken(token, shareId) {
|
||||
Cookies.set(shareTokenKey, token)
|
||||
Cookies.set(shareIdKey, shareId)
|
||||
}
|
||||
|
||||
export function setToken(token) {
|
||||
@ -48,7 +54,8 @@ export function removeToken() {
|
||||
}
|
||||
|
||||
export function removeShareToken() {
|
||||
return Cookies.remove(shareTokenKey)
|
||||
Cookies.remove(shareTokenKey)
|
||||
Cookies.remove(shareIdKey)
|
||||
}
|
||||
|
||||
export function getConsumerId() {
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
// import { MessageBox, Message } from 'element-ui'
|
||||
import store from '@/store'
|
||||
import {getShareToken, getToken, getUsername} from '@/utils/auth'
|
||||
import {getShareId, getShareToken, getToken, getUsername} from '@/utils/auth'
|
||||
|
||||
// create an axios instance
|
||||
const service = axios.create({
|
||||
@ -21,6 +21,7 @@ service.interceptors.request.use(
|
||||
}
|
||||
if (store.getters.shareToken) {
|
||||
config.headers['share-token'] = getShareToken()
|
||||
config.headers['shareId'] = getShareId()
|
||||
}
|
||||
return config
|
||||
},
|
||||
|
||||
@ -295,7 +295,6 @@ export default {
|
||||
return {
|
||||
prompt: '文件分享已被撤销',// 文件分享已被撤销
|
||||
isLoading: true,
|
||||
//imageUrl: this.$store.getters.shareToken ? `${process.env.VUE_APP_BASE_API}/public/s/view/thumbnail?id=` : `${process.env.VUE_APP_BASE_API}/public/s/view/thumbnail?share-token=${this.$store.getters.shareToken}&id=`,
|
||||
fileMenuActive: '',
|
||||
path: this.$route.query.path,
|
||||
showNewFolder: false,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user