fix: add https support for local vite dev server

This commit is contained in:
Xiaohan-Tian
2026-04-18 14:27:07 -07:00
parent 474b68c494
commit 7e67ca9d10
5 changed files with 81 additions and 7 deletions
+7
View File
@@ -51,6 +51,13 @@ export class KGProjectStorage {
public async initialize(): Promise<void> {
if (this._initialized) return;
if (!navigator.storage?.getDirectory) {
throw new Error(
'OPFS is unavailable. K.G.Studio requires a secure context (HTTPS or localhost). ' +
'Access via https:// or use localhost/127.0.0.1 instead of an IP address.',
);
}
this.rootDirHandle = await navigator.storage.getDirectory();
this.projectsDirHandle = await this.rootDirHandle.getDirectoryHandle(
OPFS_CONSTANTS.ROOT_DIR,