Make SSL variable local since we only need it on api.js
Former-commit-id: 8005ade6f3e0fe8bf4fcbe203ba791c3f8d21c6c [formerly cc41379f62eb83be78b1594babf83ac3056059c6] [formerly c89bc32b1092ded27b4172cbfa33f79ffe25413f [formerly cdcaa9102b
]]
Former-commit-id: 355f7675be000235114bbdb0d1c56e98937f0e05 [formerly 125dc4631d149cd5ab1c345e9c2130fba0dae141]
Former-commit-id: 7d3d9748908f5884e61899d78155e4cde9ca9fcf
This commit is contained in:
parent
bb3fc9f562
commit
520e5c7763
|
@ -9,7 +9,6 @@ const state = {
|
||||||
user: {},
|
user: {},
|
||||||
req: {},
|
req: {},
|
||||||
baseURL: document.querySelector('meta[name="base"]').getAttribute('content'),
|
baseURL: document.querySelector('meta[name="base"]').getAttribute('content'),
|
||||||
ssl: (window.location.protocol === 'https:'),
|
|
||||||
jwt: '',
|
jwt: '',
|
||||||
reload: false,
|
reload: false,
|
||||||
selected: [],
|
selected: [],
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
import store from '../store/store'
|
import store from '../store/store'
|
||||||
|
|
||||||
|
const ssl = (window.location.protocol === 'https:')
|
||||||
|
|
||||||
function removePrefix (url) {
|
function removePrefix (url) {
|
||||||
if (url.startsWith('/files')) {
|
if (url.startsWith('/files')) {
|
||||||
return url.slice(6)
|
return url.slice(6)
|
||||||
|
@ -120,7 +122,7 @@ function checksum (url, algo) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function command (url, command, onmessage, onclose) {
|
function command (url, command, onmessage, onclose) {
|
||||||
let protocol = (store.state.ssl ? 'wss:' : 'ws:')
|
let protocol = (ssl ? 'wss:' : 'ws:')
|
||||||
url = removePrefix(url)
|
url = removePrefix(url)
|
||||||
url = `${protocol}//${window.location.hostname}${store.state.baseURL}/api/command${url}?token=${store.state.jwt}`
|
url = `${protocol}//${window.location.hostname}${store.state.baseURL}/api/command${url}?token=${store.state.jwt}`
|
||||||
|
|
||||||
|
@ -131,7 +133,7 @@ function command (url, command, onmessage, onclose) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function search (url, search, onmessage, onclose) {
|
function search (url, search, onmessage, onclose) {
|
||||||
let protocol = (store.state.ssl ? 'wss:' : 'ws:')
|
let protocol = (ssl ? 'wss:' : 'ws:')
|
||||||
url = removePrefix(url)
|
url = removePrefix(url)
|
||||||
url = `${protocol}//${window.location.hostname}${store.state.baseURL}/api/search${url}?token=${store.state.jwt}`
|
url = `${protocol}//${window.location.hostname}${store.state.baseURL}/api/search${url}?token=${store.state.jwt}`
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue