ios: attempt to fix cookie related issue

server: fail-safe in case client id is not found in http cookies
This commit is contained in:
jean-emmanuel 2022-03-20 18:59:21 +01:00
parent 85b7b43928
commit a60c1423a7
4 changed files with 40 additions and 13 deletions

View file

@ -10,27 +10,37 @@ document.addEventListener('DOMContentLoaded', function(event) {
var uiLoading = require('./ui/ui-loading')
uiLoading(locales('loading_server'))
setTimeout(()=>{
function init() {
var ipc = require('./ipc/'),
backup = require('./backup')
setTimeout(()=>{
ipc.init()
var ipc = require('./ipc/'),
backup = require('./backup')
ipc.init()
require('./ui/init')
require('./ui/init')
document.title = TITLE
document.title = TITLE
ipc.send('open', {hotReload: backup.exists})
ipc.send('open', {hotReload: backup.exists})
window.onunload = ()=>{
ipc.send('close')
}
window.onunload = ()=>{
ipc.send('close')
}
backup.load()
backup.load()
}, 100)
}, 100)
}
if (document.requestStorageAccess) {
document.requestStorageAccess().then(init, init)
} else {
init()
}
})

View file

@ -45,6 +45,18 @@ resolveDirs.push(settings.read('remote-root') || '') // remote-root / absolute
function resolvePath(url, clientId) {
if (clientId === undefined) {
// safari seems to be picky with cookies
console.error(`(ERROR, HTTP) Could not resolve requested url ${url} (client id not found in http cookies)`)
return false
}
if (!ipc.clients[clientId]) {
// this should never happen, but just in case...
console.error(`(ERROR, HTTP) Could not resolve requested url ${url} (unregistered client id ${clientId})`)
return false
}
var sessionPath = path.dirname(ipc.clients[clientId].sessionPath)
url = resolveHomeDir(url)