[fix] sodium not loading

This commit is contained in:
kwaroran
2023-07-29 09:41:59 +09:00
parent 01914bb6c8
commit 07039862b5

View File

@@ -39,6 +39,12 @@ export const novelLogin = async () => {
alertWait('Logging in to NovelAI') alertWait('Logging in to NovelAI')
let tries = 0
let error = ''
while (tries < 3) {
try {
const _sodium = await import('libsodium-wrappers-sumo') const _sodium = await import('libsodium-wrappers-sumo')
await sleep(1000) await sleep(1000)
await _sodium.ready await _sodium.ready
@@ -86,8 +92,14 @@ export const novelLogin = async () => {
alertNormal('Logged in to NovelAI') alertNormal('Logged in to NovelAI')
setDatabase(db) setDatabase(db)
return
}
catch (error) {
error = (`Failed to authenticate with NovelAI: ${error}`)
tries++
}
}
alertError(error)
} catch (error) { } catch (error) {
alertError(`Failed to authenticate with NovelAI: ${error}`) alertError(`Failed to authenticate with NovelAI: ${error}`)
} }