-
-
-
-
-
-
ffplayout
-
- {{ stat.system }}
- {{ stat.node }}
- {{ stat.machine }}
-
-
-
-
-
-
-
- CPU
-
-
-
-
- Usage: {{ stat.cpu_usage }}%
- Load: {{ stat.cpu_load[0] }} {{ stat.cpu_load[1] }} {{ stat.cpu_load[2] }}
-
-
-
-
-
-
-
-
- RAM
-
-
-
-
- Total: {{ stat.ram_total[1] }}
- Used: {{ stat.ram_used[1] }}
- Free: {{ stat.ram_free[1] }}
- Cached: {{ stat.ram_cached[1] }}
-
-
-
-
-
-
-
-
- SWAP
-
-
-
-
- Total: {{ stat.swap_total[1] }}
- Used: {{ stat.swap_used[1] }}
- Free: {{ stat.swap_free[1] }}
-
-
-
-
-
-
-
-
- DISK
-
-
-
-
- Total: {{ stat.disk_total[1] }}
- Used: {{ stat.disk_used[1] }}
- Free: {{ stat.disk_free[1] }}
-
-
-
-
-
-
-
-
- NET
-
-
-
-
- Download: {{ stat.net_speed_recv[1] }}/s
- Upload: {{ stat.net_speed_send[1] }}/s
- Downloaded: {{ stat.net_recv[1] }}
- Uploaded: {{ stat.net_send[1] }}
- Recived Errors: {{ stat.net_errin }}
- Sended Errors: {{ stat.net_errout }}
-
-
-
-
-
-
-
+
+
+
@@ -183,7 +91,6 @@ export default {
methods: {
async init () {
await this.$store.dispatch('auth/inspectToken')
- this.checkLogin()
},
async login () {
try {
@@ -195,12 +102,11 @@ export default {
this.formPassword = ''
this.formError = null
- if (status === 401) {
+ if (status === 401 || status === 400) {
this.formError = 'Wrong user or password!'
this.showError = true
}
- this.checkLogin()
await this.$store.dispatch('config/nuxtClientInit')
} catch (e) {
this.formError = e.message
@@ -215,31 +121,6 @@ export default {
} catch (e) {
this.formError = e.message
}
- },
- checkLogin () {
- if (this.$store.state.auth.isLogin) {
- this.sysStats()
- }
- },
-
- async sysStats () {
- const response = await this.$axios.get('api/player/stats/?stats=all')
-
- if (!response.data) {
- this.$router.push('/configure')
- }
- this.stat = response.data
-
- if (process.browser && !this.interval) {
- this.interval = setInterval(async () => {
- if (this.$store.state.auth.isLogin && this.$route.path === '/') {
- const response = await this.$axios.get('api/player/stats/?stats=all')
- this.stat = response.data
- } else {
- clearInterval(this.interval)
- }
- }, 2000)
- }
}
}
}
@@ -258,6 +139,12 @@ export default {
margin-bottom: 3em;
}
+.logo-div {
+ width: 100%;
+ text-align: center;
+ margin-bottom: 5em;
+}
+
.login-form {
min-width: 300px;
}
diff --git a/pages/logging.vue b/pages/logging.vue
index a7781899..d2ab9b36 100644
--- a/pages/logging.vue
+++ b/pages/logging.vue
@@ -81,11 +81,17 @@ export default {
methods: {
async getLog () {
- const response = await this.$axios.get(
- `api/player/log/?date=${this.listDate}&channel=${this.$store.state.config.configGui[this.$store.state.config.configID].id}`)
+ let date = this.listDate
- if (response.data.log) {
- this.currentLog = response.data.log
+ if (date === this.$dayjs().tz(this.timezone).format('YYYY-MM-DD')) {
+ date = ''
+ }
+
+ const response = await this.$axios.get(
+ `api/log/${this.$store.state.config.configGui[this.$store.state.config.configID].id}/${date}`)
+
+ if (response.data) {
+ this.currentLog = response.data
} else {
this.currentLog = ''
}
diff --git a/pages/media.vue b/pages/media.vue
index 8699e0bd..608e3ea4 100644
--- a/pages/media.vue
+++ b/pages/media.vue
@@ -14,7 +14,7 @@
-
+
@@ -43,12 +43,12 @@
-
+
{{ folder }}
-
+
@@ -70,8 +70,8 @@
@@ -79,10 +79,10 @@
- {{ file.file }}
+ {{ file }}
-
+
@@ -90,12 +90,12 @@
{{ file.duration | toMin }}
-
+
-
+
diff --git a/pages/message.vue b/pages/message.vue
index 02c93704..02711139 100644
--- a/pages/message.vue
+++ b/pages/message.vue
@@ -99,21 +99,6 @@
/>
-
-
-
-
-
@@ -138,21 +123,6 @@
/>
-
-
-
-
-
{
- if (res.status === 201 || res.status === 200) {
- store.commit('auth/UPADTE_TOKEN', { token: res.data.access })
- originalRequest.headers.Authorization = `Bearer ${res.data.access}`
- return $axios(originalRequest)
- }
- })
- .catch((error) => {
- if (error.response.status === 401) {
- store.commit('auth/REMOVE_TOKEN')
- store.commit('auth/UPDATE_IS_LOGIN', false)
- redirect('/')
- return Promise.reject(error)
- }
- })
+
+ store.commit('auth/REMOVE_TOKEN')
+ store.commit('auth/UPDATE_IS_LOGIN', false)
+ redirect('/')
}
return Promise.reject(error)
})
diff --git a/static/images/ffplayout.png b/static/images/ffplayout.png
new file mode 100644
index 00000000..549c4298
Binary files /dev/null and b/static/images/ffplayout.png differ
diff --git a/store/auth.js b/store/auth.js
index dbbd16b2..8cdd101e 100644
--- a/store/auth.js
+++ b/store/auth.js
@@ -3,37 +3,25 @@ import jwt_decode from 'jwt-decode'
export const state = () => ({
jwtToken: '',
- jwtRefresh: '',
isLogin: false
})
// mutate values in state
export const mutations = {
- UPADTE_TOKEN (state, obj) {
+ UPDATE_TOKEN (state, obj) {
state.jwtToken = obj.token
this.$cookies.set('token', obj.token, {
path: '/',
maxAge: 60 * 60 * 24 * 365,
sameSite: 'lax'
})
-
- if (obj.refresh) {
- state.jwtRefresh = obj.refresh
- this.$cookies.set('refresh', obj.refresh, {
- path: '/',
- maxAge: 60 * 60 * 24 * 365,
- sameSite: 'lax'
- })
- }
},
UPDATE_IS_LOGIN (state, bool) {
state.isLogin = bool
},
REMOVE_TOKEN (state) {
this.$cookies.remove('token')
- this.$cookies.remove('refresh')
state.jwtToken = null
- state.jwtRefresh = null
}
}
@@ -44,9 +32,9 @@ export const actions = {
password
}
let code = null
- await this.$axios.post('auth/token/', payload)
+ await this.$axios.post('auth/login/', payload)
.then((response) => {
- commit('UPADTE_TOKEN', { token: response.data.access, refresh: response.data.refresh })
+ commit('UPDATE_TOKEN', { token: response.data.user.token })
commit('UPDATE_IS_LOGIN', true)
code = response.status
})
@@ -56,43 +44,18 @@ export const actions = {
return code
},
- async refreshToken ({ commit, state }) {
- const payload = {
- refresh: state.jwtRefresh,
- progress: false
- }
- await this.$axios.post('auth/token/refresh/', payload)
- .then((response) => {
- commit('UPADTE_TOKEN', { token: response.data.access })
- commit('UPDATE_IS_LOGIN', true)
- })
- .catch((error) => {
- if (error.response.status === 401) {
- commit('REMOVE_TOKEN')
- commit('UPDATE_IS_LOGIN', false)
- }
- })
- },
-
- async inspectToken ({ commit, dispatch, state }) {
+ inspectToken ({ commit, dispatch, state }) {
const token = this.$cookies.get('token')
- const refresh = this.$cookies.get('refresh')
- if (token && refresh) {
- commit('UPADTE_TOKEN', { token, refresh })
+ if (token) {
+ commit('UPDATE_TOKEN', { token })
const decoded_token = jwt_decode(token)
- const decoded_refresh = jwt_decode(refresh)
const timestamp = Date.now() / 1000
const expire_token = decoded_token.exp
- const expire_refresh = decoded_refresh.exp
if (state.jwtToken && expire_token - timestamp > 15) {
- // DO NOTHING, DO NOT REFRESH
commit('UPDATE_IS_LOGIN', true)
- } else if (!state.jwtToken || expire_refresh - timestamp > 0) {
- commit('UPADTE_TOKEN', { token, refresh })
- await dispatch('refreshToken')
} else {
// PROMPT USER TO RE-LOGIN, THIS ELSE CLAUSE COVERS THE CONDITION WHERE A TOKEN IS EXPIRED AS WELL
commit('UPDATE_IS_LOGIN', false)
diff --git a/store/config.js b/store/config.js
index f2550dce..3fb1e044 100644
--- a/store/config.js
+++ b/store/config.js
@@ -5,7 +5,6 @@ export const state = () => ({
configCount: 0,
configGui: null,
configGuiRaw: null,
- netChoices: [],
startInSec: 0,
playlistLength: 86400.0,
configPlayout: {},
@@ -28,9 +27,6 @@ export const mutations = {
UPDATE_GUI_CONFIG_RAW (state, config) {
state.configGuiRaw = config
},
- UPDATE_NET_CHOICES (state, list) {
- state.netChoices = list
- },
UPDATE_START_TIME (state, sec) {
state.startInSec = sec
},
@@ -48,9 +44,6 @@ export const mutations = {
},
UPDATE_TIMEZONE (state, zone) {
state.timezone = zone
- },
- UPDATE_MULTI_CHANNEL (state, bool) {
- state.multiChannel = bool
}
}
@@ -58,38 +51,16 @@ export const actions = {
async nuxtClientInit ({ commit, dispatch, rootState }) {
await dispatch('auth/inspectToken', null, { root: true })
if (rootState.auth.isLogin) {
- await dispatch('getTimezone')
await dispatch('getGuiConfig')
await dispatch('getPlayoutConfig')
await dispatch('getUserConfig')
}
},
- async getTimezone ({ commit, state }) {
- const response = await this.$axios.get('api/player/stats/?stats=settings')
+ async getGuiConfig ({ commit, state }) {
+ const response = await this.$axios.get('api/settings')
if (response.data) {
- commit('UPDATE_TIMEZONE', response.data.timezone)
- commit('UPDATE_MULTI_CHANNEL', response.data.multi_channel)
- } else {
- commit('UPDATE_TIMEZONE', this.$dayjs.tz.guess())
- }
- },
-
- async getGuiConfig ({ commit, state }) {
- const options = await this.$axios.options('api/player/guisettings/')
- const response = await this.$axios.get('api/player/guisettings/')
-
- if (options.data) {
- const choices = options.data.actions.POST.net_interface.choices.map(function (obj) {
- obj.text = obj.display_name
- delete obj.display_name
- return obj
- })
- commit('UPDATE_NET_CHOICES', choices)
- }
-
- if (response.data && response.data[0]) {
for (const data of response.data) {
if (data.extra_extensions) {
data.extra_extensions = data.extra_extensions.split(',')
@@ -98,6 +69,7 @@ export const actions = {
}
}
+ commit('UPDATE_TIMEZONE', response.data.timezone)
commit('UPDATE_GUI_CONFIG', response.data)
commit('UPDATE_GUI_CONFIG_RAW', _.cloneDeep(response.data))
commit('UPDATE_CONFIG_COUNT', response.data.length)
@@ -105,10 +77,8 @@ export const actions = {
commit('UPDATE_GUI_CONFIG', [{
id: 1,
channel: '',
- player_url: '',
+ preview_url: '',
playout_config: '',
- net_interface: '',
- media_disk: '',
extra_extensions: []
}])
}
@@ -146,7 +116,7 @@ export const actions = {
async getPlayoutConfig ({ commit, state, rootState }) {
const channel = state.configGui[state.configID].id
- const response = await this.$axios.get(`api/player/config/?configPlayout&channel=${channel}`)
+ const response = await this.$axios.get(`api/playout/config/${channel}`)
if (response.data) {
if (response.data.playlist.day_start) {
@@ -165,27 +135,24 @@ export const actions = {
},
async setPlayoutConfig ({ commit, state }, obj) {
- const update = await this.$axios.post('api/player/config/?configPlayout', {
- data: obj,
- channel: state.configGui[state.configID].id
- })
+ const channel = state.configGui[state.configID].id
+ const update = await this.$axios.put(`api/playout/config/${channel}`, obj)
return update
},
async getUserConfig ({ commit, state }) {
- const user = await this.$axios.get('api/player/user/current/')
- const response = await this.$axios.get(`api/player/user/users/?username=${user.data.username}`)
+ const user = await this.$axios.get('api/user')
if (user.data) {
commit('SET_CURRENT_USER', user.data.username)
}
- if (response.data) {
- commit('UPDATE_USER_CONFIG', response.data[0])
+ if (user.data) {
+ commit('UPDATE_USER_CONFIG', user.data)
}
},
async setUserConfig ({ commit, state }, obj) {
- const update = await this.$axios.put(`api/player/user/users/${obj.id}/`, obj)
+ const update = await this.$axios.put(`api/user/${obj.id}`, obj)
return update
}
}
diff --git a/store/media.js b/store/media.js
index c3ee4ed3..a05b1ea0 100644
--- a/store/media.js
+++ b/store/media.js
@@ -21,25 +21,24 @@ export const actions = {
const crumbs = []
let root = '/'
const channel = rootState.config.configGui[rootState.config.configID].id
- const response = await this.$axios.get(
- `api/player/media/?extensions=${extensions}&channel=${channel}&path=${path}`)
+ const response = await this.$axios.post(
+ `api/file/${channel}/browse/`, { source: path })
- if (response.data.tree) {
- const pathArr = response.data.tree[0].split('/')
-
- if (response.data.tree[1].length === 0) {
- response.data.tree[1].push(pathArr[pathArr.length - 1])
- }
+ if (response.data) {
+ const pathStr = 'Home/' + response.data.source
+ const pathArr = pathStr.split('/')
if (path) {
for (const crumb of pathArr) {
- if (crumb) {
+ if (crumb === 'Home') {
+ crumbs.push({ text: crumb, path: root })
+ } else if (crumb) {
root += crumb + '/'
crumbs.push({ text: crumb, path: root })
}
}
} else {
- crumbs.push({ text: pathArr[pathArr.length - 1], path: '' })
+ crumbs.push({ text: 'Home', path: '' })
}
commit('UPDATE_CURRENT_PATH', path)