Disable some menu items in read-only mode (#11733)

* 🎨 kernel supports read-only publishing services

* 🐛 Fix authentication vulnerabilities

* 🎨 Protect secret information

* 🎨 Adjust the permission control

* 🎨 Adjust the permission control

* 🎨 Fixed the vulnerability that `getFile` gets file `conf.json`

* 🎨 Add API `/api/setting/setPublish`

* 🎨 Add API `/api/setting/getPublish`

* 🐛 Fixed the issue that PWA-related files could not pass BasicAuth

* 🎨 Add a settings panel for publishing features

* 📝 Add guide for `Publish Service`

* 📝 Update Japanese user guide

* 🎨 Merge fixed static file services

* 🎨 Disable some menu items in read-only mode

* 🎨 Disable some menu items in read-only mode

* Update router.go
This commit is contained in:
Yingyi / 颖逸 2024-07-05 20:01:43 +08:00 committed by GitHub
parent 1260b14875
commit f25b36ff38
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
18 changed files with 150 additions and 80 deletions

View file

@ -38,6 +38,8 @@ export class App {
registerServiceWorker(`${Constants.SERVICE_WORKER_PATH}?v=${Constants.SIYUAN_VERSION}`);
/// #endif
addBaseURL();
addScriptSync(`${Constants.PROTYLE_CDN}/js/lute/lute.min.js?v=${Constants.SIYUAN_VERSION}`, "protyleLuteScript"),
addScript(`${Constants.PROTYLE_CDN}/js/protyle-html.js?v=${Constants.SIYUAN_VERSION}`, "protyleWcHtmlScript"),
this.appId = Constants.SIYUAN_APPID;
window.siyuan = {
@ -158,24 +160,40 @@ export class App {
};
fetchPost("/api/system/getConf", {}, async (response) => {
addScriptSync(`${Constants.PROTYLE_CDN}/js/lute/lute.min.js?v=${Constants.SIYUAN_VERSION}`, "protyleLuteScript");
addScript(`${Constants.PROTYLE_CDN}/js/protyle-html.js?v=${Constants.SIYUAN_VERSION}`, "protyleWcHtmlScript");
window.siyuan.config = response.data.conf;
await loadPlugins(this);
getLocalStorage(() => {
fetchGet(`/appearance/langs/${window.siyuan.config.appearance.lang}.json?v=${Constants.SIYUAN_VERSION}`, (lauguages: IObject) => {
window.siyuan.languages = lauguages;
window.siyuan.menus = new Menus(this);
bootSync();
const promises = [
loadPlugins(this),
new Promise<void>(resolve => getLocalStorage(resolve)),
new Promise<void>(resolve => fetchGet(
`/appearance/langs/${window.siyuan.config.appearance.lang}.json?v=${Constants.SIYUAN_VERSION}`,
(lauguages: IObject) => {
window.siyuan.languages = lauguages;
resolve();
},
)),
];
if (!window.siyuan.config.readonly) {
promises.push(new Promise<void>(resolve => {
fetchPost("/api/setting/getCloudUser", {}, userResponse => {
window.siyuan.user = userResponse.data;
onGetConfig(response.data.start, this);
account.onSetaccount();
setTitle(window.siyuan.languages.siyuanNote);
initMessage();
resolve();
});
});
});
}));
}
await Promise.all(promises);
if (!window.siyuan.config.readonly) {
bootSync();
}
window.siyuan.menus = new Menus(this);
onGetConfig(response.data.start, this);
account.onSetaccount();
setTitle(window.siyuan.languages.siyuanNote);
initMessage();
});
setNoteBook();
initBlockPopover(this);