This commit is contained in:
Vanessa 2023-01-04 15:37:37 +08:00
parent c0b63dffe9
commit 324ccc60c8
3 changed files with 27 additions and 24 deletions

View file

@ -127,17 +127,18 @@ class App {
}; };
fetchPost("/api/system/getConf", {}, response => { fetchPost("/api/system/getConf", {}, response => {
window.siyuan.config = response.data.conf; window.siyuan.config = response.data.conf;
getLocalStorage(); getLocalStorage(() => {
fetchGet(`/appearance/langs/${window.siyuan.config.appearance.lang}.json?v=${Constants.SIYUAN_VERSION}`, (lauguages) => { fetchGet(`/appearance/langs/${window.siyuan.config.appearance.lang}.json?v=${Constants.SIYUAN_VERSION}`, (lauguages) => {
window.siyuan.languages = lauguages; window.siyuan.languages = lauguages;
bootSync(); bootSync();
fetchPost("/api/setting/getCloudUser", {}, userResponse => { fetchPost("/api/setting/getCloudUser", {}, userResponse => {
window.siyuan.user = userResponse.data; window.siyuan.user = userResponse.data;
onGetConfig(response.data.start); onGetConfig(response.data.start);
account.onSetaccount(); account.onSetaccount();
resizeDrag(); resizeDrag();
setTitle(window.siyuan.languages.siyuanNote); setTitle(window.siyuan.languages.siyuanNote);
initMessage(); initMessage();
});
}); });
}); });
}); });

View file

@ -47,19 +47,20 @@ class App {
fetchPost("/api/system/getConf", {}, confResponse => { fetchPost("/api/system/getConf", {}, confResponse => {
confResponse.data.conf.keymap = Constants.SIYUAN_KEYMAP; confResponse.data.conf.keymap = Constants.SIYUAN_KEYMAP;
window.siyuan.config = confResponse.data.conf; window.siyuan.config = confResponse.data.conf;
getLocalStorage(); getLocalStorage(() => {
fetchGet(`/appearance/langs/${window.siyuan.config.appearance.lang}.json?v=${Constants.SIYUAN_VERSION}`, (lauguages) => { fetchGet(`/appearance/langs/${window.siyuan.config.appearance.lang}.json?v=${Constants.SIYUAN_VERSION}`, (lauguages) => {
window.siyuan.languages = lauguages; window.siyuan.languages = lauguages;
document.title = window.siyuan.languages.siyuanNote; document.title = window.siyuan.languages.siyuanNote;
bootSync(); bootSync();
loadAssets(confResponse.data.conf.appearance); loadAssets(confResponse.data.conf.appearance);
initMessage(); initMessage();
initAssets(); initAssets();
fetchPost("/api/system/getEmojiConf", {}, emojiResponse => { fetchPost("/api/system/getEmojiConf", {}, emojiResponse => {
window.siyuan.emojis = emojiResponse.data as IEmoji[]; window.siyuan.emojis = emojiResponse.data as IEmoji[];
initFramework(); initFramework();
});
addGA();
}); });
addGA();
}); });
if (navigator.userAgent.indexOf("iPhone") > -1) { if (navigator.userAgent.indexOf("iPhone") > -1) {
document.addEventListener("touchstart", handleTouchStart, false); document.addEventListener("touchstart", handleTouchStart, false);

View file

@ -139,7 +139,7 @@ export const hotKey2Electron = (key: string) => {
return electronKey + key.substr(key.length - 1); return electronKey + key.substr(key.length - 1);
}; };
export const getLocalStorage = () => { export const getLocalStorage = (cb:()=>void) => {
fetchPost("/api/storage/getLocalStorage", undefined, (response) => { fetchPost("/api/storage/getLocalStorage", undefined, (response) => {
window.siyuan.storage = response.data; window.siyuan.storage = response.data;
// 历史数据迁移 // 历史数据迁移
@ -212,6 +212,7 @@ export const getLocalStorage = () => {
window.siyuan.storage[key] = defaultStorage[key]; window.siyuan.storage[key] = defaultStorage[key];
} }
}); });
cb();
}); });
}; };