Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: https://ld246.com/article/1672811562871

Vanessa324ccc60c875
diff --git a/app/src/index.ts b/app/src/index.ts
index 4394c8708e..60b33cbcb4 100644
--- a/app/src/index.ts
+++ b/app/src/index.ts
@@ -127,17 +127,18 @@ class App {
};
fetchPost("/api/system/getConf", {}, response => {
window.siyuan.config = response.data.conf;
- getLocalStorage();
- fetchGet(`/appearance/langs/${window.siyuan.config.appearance.lang}.json?v=${Constants.SIYUAN_VERSION}`, (lauguages) => {
- window.siyuan.languages = lauguages;
- bootSync();
- fetchPost("/api/setting/getCloudUser", {}, userResponse => {
- window.siyuan.user = userResponse.data;
- onGetConfig(response.data.start);
- account.onSetaccount();
- resizeDrag();
- setTitle(window.siyuan.languages.siyuanNote);
- initMessage();
+ getLocalStorage(() => {
+ fetchGet(`/appearance/langs/${window.siyuan.config.appearance.lang}.json?v=${Constants.SIYUAN_VERSION}`, (lauguages) => {
+ window.siyuan.languages = lauguages;
+ bootSync();
+ fetchPost("/api/setting/getCloudUser", {}, userResponse => {
+ window.siyuan.user = userResponse.data;
+ onGetConfig(response.data.start);
+ account.onSetaccount();
+ resizeDrag();
+ setTitle(window.siyuan.languages.siyuanNote);
+ initMessage();
+ });
});
});
});
diff --git a/app/src/mobile/index.ts b/app/src/mobile/index.ts
index 817eb83f6e..c33cee426b 100644
--- a/app/src/mobile/index.ts
+++ b/app/src/mobile/index.ts
@@ -47,19 +47,20 @@ class App {
fetchPost("/api/system/getConf", {}, confResponse => {
confResponse.data.conf.keymap = Constants.SIYUAN_KEYMAP;
window.siyuan.config = confResponse.data.conf;
- getLocalStorage();
- fetchGet(`/appearance/langs/${window.siyuan.config.appearance.lang}.json?v=${Constants.SIYUAN_VERSION}`, (lauguages) => {
- window.siyuan.languages = lauguages;
- document.title = window.siyuan.languages.siyuanNote;
- bootSync();
- loadAssets(confResponse.data.conf.appearance);
- initMessage();
- initAssets();
- fetchPost("/api/system/getEmojiConf", {}, emojiResponse => {
- window.siyuan.emojis = emojiResponse.data as IEmoji[];
- initFramework();
+ getLocalStorage(() => {
+ fetchGet(`/appearance/langs/${window.siyuan.config.appearance.lang}.json?v=${Constants.SIYUAN_VERSION}`, (lauguages) => {
+ window.siyuan.languages = lauguages;
+ document.title = window.siyuan.languages.siyuanNote;
+ bootSync();
+ loadAssets(confResponse.data.conf.appearance);
+ initMessage();
+ initAssets();
+ fetchPost("/api/system/getEmojiConf", {}, emojiResponse => {
+ window.siyuan.emojis = emojiResponse.data as IEmoji[];
+ initFramework();
+ });
+ addGA();
});
- addGA();
});
if (navigator.userAgent.indexOf("iPhone") > -1) {
document.addEventListener("touchstart", handleTouchStart, false);
diff --git a/app/src/protyle/util/compatibility.ts b/app/src/protyle/util/compatibility.ts
index a1eb11aa59..85ab5a4dee 100644
--- a/app/src/protyle/util/compatibility.ts
+++ b/app/src/protyle/util/compatibility.ts
@@ -139,7 +139,7 @@ export const hotKey2Electron = (key: string) => {
return electronKey + key.substr(key.length - 1);
};
-export const getLocalStorage = () => {
+export const getLocalStorage = (cb:()=>void) => {
fetchPost("/api/storage/getLocalStorage", undefined, (response) => {
window.siyuan.storage = response.data;
// 历史数据迁移
@@ -212,6 +212,7 @@ export const getLocalStorage = () => {
window.siyuan.storage[key] = defaultStorage[key];
}
});
+ cb();
});
};