fix: bootstrap portal list and set portal key
This commit is contained in:
parent
3ccbe7c8a1
commit
4a50742ea0
|
@ -3,6 +3,8 @@ import {
|
||||||
downloadObject,
|
downloadObject,
|
||||||
Err,
|
Err,
|
||||||
getActivePortals,
|
getActivePortals,
|
||||||
|
maybeInitDefaultPortals,
|
||||||
|
setActivePortalMasterKey,
|
||||||
} from "@lumeweb/libweb";
|
} from "@lumeweb/libweb";
|
||||||
import { log, logErr, sendAuthUpdate } from "./util.js";
|
import { log, logErr, sendAuthUpdate } from "./util.js";
|
||||||
import {
|
import {
|
||||||
|
@ -26,13 +28,21 @@ export function boot() {
|
||||||
}
|
}
|
||||||
|
|
||||||
log("user is already logged in, attempting to load kernel");
|
log("user is already logged in, attempting to load kernel");
|
||||||
setUserKey(userKey as Uint8Array);
|
setUserKey(userKey);
|
||||||
|
setActivePortalMasterKey(userKey);
|
||||||
setLoginComplete(true);
|
setLoginComplete(true);
|
||||||
sendAuthUpdate();
|
sendAuthUpdate();
|
||||||
loadKernel();
|
loadKernel();
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function loadKernel() {
|
export async function loadKernel() {
|
||||||
|
let [, portalLoadErr] = maybeInitDefaultPortals();
|
||||||
|
if (portalLoadErr) {
|
||||||
|
let err = addContextToErr(portalLoadErr, "unable to init portals");
|
||||||
|
setKernelLoaded(err);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
let [kernelCode, err] = await downloadDefaultKernel();
|
let [kernelCode, err] = await downloadDefaultKernel();
|
||||||
|
|
||||||
if (err !== null) {
|
if (err !== null) {
|
||||||
|
|
Reference in New Issue