🎨 The Publishing service no longer support export https://github.com/siyuan-note/siyuan/issues/12928
This commit is contained in:
parent
4e407b0ef8
commit
4a33fa9a29
7 changed files with 51 additions and 33 deletions
|
@ -17,7 +17,9 @@ import {
|
|||
progressBackgroundTask,
|
||||
progressLoading,
|
||||
progressStatus,
|
||||
reloadSync, setDefRefCount, setRefDynamicText,
|
||||
reloadSync,
|
||||
setDefRefCount,
|
||||
setRefDynamicText,
|
||||
setTitle,
|
||||
transactionError
|
||||
} from "./dialog/processSystem";
|
||||
|
@ -166,6 +168,7 @@ export class App {
|
|||
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;
|
||||
window.siyuan.isPublish = response.data.isPublish;
|
||||
await loadPlugins(this);
|
||||
getLocalStorage(() => {
|
||||
fetchGet(`/appearance/langs/${window.siyuan.config.appearance.lang}.json?v=${Constants.SIYUAN_VERSION}`, (lauguages: IObject) => {
|
||||
|
|
|
@ -446,6 +446,9 @@ export const copySubMenu = (id: string, accelerator = true, focusElement?: Eleme
|
|||
};
|
||||
|
||||
export const exportMd = (id: string) => {
|
||||
if (window.siyuan.isPublish) {
|
||||
return;
|
||||
}
|
||||
return new MenuItem({
|
||||
id: "export",
|
||||
label: window.siyuan.languages.export,
|
||||
|
|
|
@ -97,6 +97,7 @@ class App {
|
|||
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 = confResponse.data.conf;
|
||||
window.siyuan.isPublish = confResponse.data.isPublish;
|
||||
correctHotkey(siyuanApp);
|
||||
await loadPlugins(this);
|
||||
getLocalStorage(() => {
|
||||
|
|
6
app/src/types/index.d.ts
vendored
6
app/src/types/index.d.ts
vendored
|
@ -432,7 +432,11 @@ interface ISiyuan {
|
|||
bookmarkLabel?: string[]
|
||||
blockPanels: import("../block/Panel").BlockPanel[],
|
||||
dialogs: import("../dialog").Dialog[],
|
||||
viewer?: Viewer
|
||||
viewer?: Viewer,
|
||||
/**
|
||||
* 是否在发布服务下访问
|
||||
*/
|
||||
isPublish?: boolean;
|
||||
}
|
||||
|
||||
interface IOperation {
|
||||
|
|
|
@ -9,9 +9,13 @@ import {fetchGet, fetchPost} from "../util/fetch";
|
|||
import {addBaseURL, setNoteBook} from "../util/pathName";
|
||||
import {openFileById} from "../editor/util";
|
||||
import {
|
||||
processSync, progressBackgroundTask,
|
||||
processSync,
|
||||
progressBackgroundTask,
|
||||
progressLoading,
|
||||
progressStatus, reloadSync, setDefRefCount, setRefDynamicText,
|
||||
progressStatus,
|
||||
reloadSync,
|
||||
setDefRefCount,
|
||||
setRefDynamicText,
|
||||
setTitle,
|
||||
transactionError
|
||||
} from "../dialog/processSystem";
|
||||
|
@ -151,6 +155,7 @@ class App {
|
|||
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;
|
||||
window.siyuan.isPublish = response.data.isPublish;
|
||||
await loadPlugins(this);
|
||||
getLocalStorage(() => {
|
||||
fetchGet(`/appearance/langs/${window.siyuan.config.appearance.lang}.json?v=${Constants.SIYUAN_VERSION}`, (lauguages: IObject) => {
|
||||
|
|
|
@ -90,7 +90,7 @@ func ServeAPI(ginServer *gin.Engine) {
|
|||
ginServer.Handle("POST", "/api/notebook/renameNotebook", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, renameNotebook)
|
||||
ginServer.Handle("POST", "/api/notebook/changeSortNotebook", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, changeSortNotebook)
|
||||
ginServer.Handle("POST", "/api/notebook/setNotebookIcon", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, setNotebookIcon)
|
||||
ginServer.Handle("POST", "/api/notebook/getNotebookInfo", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, getNotebookInfo)
|
||||
ginServer.Handle("POST", "/api/notebook/getNotebookInfo", model.CheckAuth, model.CheckReadonly, getNotebookInfo)
|
||||
|
||||
ginServer.Handle("POST", "/api/filetree/searchDocs", model.CheckAuth, searchDocs)
|
||||
ginServer.Handle("POST", "/api/filetree/listDocsByPath", model.CheckAuth, listDocsByPath)
|
||||
|
@ -276,33 +276,33 @@ func ServeAPI(ginServer *gin.Engine) {
|
|||
ginServer.Handle("POST", "/api/asset/fullReindexAssetContent", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, fullReindexAssetContent)
|
||||
ginServer.Handle("POST", "/api/asset/statAsset", model.CheckAuth, model.CheckAdminRole, statAsset)
|
||||
|
||||
ginServer.Handle("POST", "/api/export/batchExportMd", model.CheckAuth, batchExportMd)
|
||||
ginServer.Handle("POST", "/api/export/exportMd", model.CheckAuth, exportMd)
|
||||
ginServer.Handle("POST", "/api/export/exportSY", model.CheckAuth, exportSY)
|
||||
ginServer.Handle("POST", "/api/export/exportNotebookSY", model.CheckAuth, exportNotebookSY)
|
||||
ginServer.Handle("POST", "/api/export/exportMdContent", model.CheckAuth, exportMdContent)
|
||||
ginServer.Handle("POST", "/api/export/exportHTML", model.CheckAuth, exportHTML)
|
||||
ginServer.Handle("POST", "/api/export/exportPreviewHTML", model.CheckAuth, exportPreviewHTML)
|
||||
ginServer.Handle("POST", "/api/export/exportMdHTML", model.CheckAuth, exportMdHTML)
|
||||
ginServer.Handle("POST", "/api/export/exportDocx", model.CheckAuth, exportDocx)
|
||||
ginServer.Handle("POST", "/api/export/processPDF", model.CheckAuth, processPDF)
|
||||
ginServer.Handle("POST", "/api/export/batchExportMd", model.CheckAuth, model.CheckAdminRole, batchExportMd)
|
||||
ginServer.Handle("POST", "/api/export/exportMd", model.CheckAuth, model.CheckAdminRole, exportMd)
|
||||
ginServer.Handle("POST", "/api/export/exportSY", model.CheckAuth, model.CheckAdminRole, exportSY)
|
||||
ginServer.Handle("POST", "/api/export/exportNotebookSY", model.CheckAuth, model.CheckAdminRole, exportNotebookSY)
|
||||
ginServer.Handle("POST", "/api/export/exportMdContent", model.CheckAuth, model.CheckAdminRole, exportMdContent)
|
||||
ginServer.Handle("POST", "/api/export/exportHTML", model.CheckAuth, model.CheckAdminRole, exportHTML)
|
||||
ginServer.Handle("POST", "/api/export/exportPreviewHTML", model.CheckAuth, model.CheckAdminRole, exportPreviewHTML)
|
||||
ginServer.Handle("POST", "/api/export/exportMdHTML", model.CheckAuth, model.CheckAdminRole, exportMdHTML)
|
||||
ginServer.Handle("POST", "/api/export/exportDocx", model.CheckAuth, model.CheckAdminRole, exportDocx)
|
||||
ginServer.Handle("POST", "/api/export/processPDF", model.CheckAuth, model.CheckAdminRole, processPDF)
|
||||
ginServer.Handle("POST", "/api/export/preview", model.CheckAuth, exportPreview)
|
||||
ginServer.Handle("POST", "/api/export/exportResources", model.CheckAuth, exportResources)
|
||||
ginServer.Handle("POST", "/api/export/exportAsFile", model.CheckAuth, exportAsFile)
|
||||
ginServer.Handle("POST", "/api/export/exportData", model.CheckAuth, exportData)
|
||||
ginServer.Handle("POST", "/api/export/exportDataInFolder", model.CheckAuth, exportDataInFolder)
|
||||
ginServer.Handle("POST", "/api/export/exportTempContent", model.CheckAuth, exportTempContent)
|
||||
ginServer.Handle("POST", "/api/export/exportResources", model.CheckAuth, model.CheckAdminRole, exportResources)
|
||||
ginServer.Handle("POST", "/api/export/exportAsFile", model.CheckAuth, model.CheckAdminRole, exportAsFile)
|
||||
ginServer.Handle("POST", "/api/export/exportData", model.CheckAuth, model.CheckAdminRole, exportData)
|
||||
ginServer.Handle("POST", "/api/export/exportDataInFolder", model.CheckAuth, model.CheckAdminRole, exportDataInFolder)
|
||||
ginServer.Handle("POST", "/api/export/exportTempContent", model.CheckAuth, model.CheckAdminRole, exportTempContent)
|
||||
ginServer.Handle("POST", "/api/export/export2Liandi", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, export2Liandi)
|
||||
ginServer.Handle("POST", "/api/export/exportReStructuredText", model.CheckAuth, exportReStructuredText)
|
||||
ginServer.Handle("POST", "/api/export/exportAsciiDoc", model.CheckAuth, exportAsciiDoc)
|
||||
ginServer.Handle("POST", "/api/export/exportTextile", model.CheckAuth, exportTextile)
|
||||
ginServer.Handle("POST", "/api/export/exportOPML", model.CheckAuth, exportOPML)
|
||||
ginServer.Handle("POST", "/api/export/exportOrgMode", model.CheckAuth, exportOrgMode)
|
||||
ginServer.Handle("POST", "/api/export/exportMediaWiki", model.CheckAuth, exportMediaWiki)
|
||||
ginServer.Handle("POST", "/api/export/exportODT", model.CheckAuth, exportODT)
|
||||
ginServer.Handle("POST", "/api/export/exportRTF", model.CheckAuth, exportRTF)
|
||||
ginServer.Handle("POST", "/api/export/exportEPUB", model.CheckAuth, exportEPUB)
|
||||
ginServer.Handle("POST", "/api/export/exportAttributeView", model.CheckAuth, exportAttributeView)
|
||||
ginServer.Handle("POST", "/api/export/exportReStructuredText", model.CheckAuth, model.CheckAdminRole, exportReStructuredText)
|
||||
ginServer.Handle("POST", "/api/export/exportAsciiDoc", model.CheckAuth, model.CheckAdminRole, exportAsciiDoc)
|
||||
ginServer.Handle("POST", "/api/export/exportTextile", model.CheckAuth, model.CheckAdminRole, exportTextile)
|
||||
ginServer.Handle("POST", "/api/export/exportOPML", model.CheckAuth, model.CheckAdminRole, exportOPML)
|
||||
ginServer.Handle("POST", "/api/export/exportOrgMode", model.CheckAuth, model.CheckAdminRole, exportOrgMode)
|
||||
ginServer.Handle("POST", "/api/export/exportMediaWiki", model.CheckAuth, model.CheckAdminRole, exportMediaWiki)
|
||||
ginServer.Handle("POST", "/api/export/exportODT", model.CheckAuth, model.CheckAdminRole, exportODT)
|
||||
ginServer.Handle("POST", "/api/export/exportRTF", model.CheckAuth, model.CheckAdminRole, exportRTF)
|
||||
ginServer.Handle("POST", "/api/export/exportEPUB", model.CheckAuth, model.CheckAdminRole, exportEPUB)
|
||||
ginServer.Handle("POST", "/api/export/exportAttributeView", model.CheckAuth, model.CheckAdminRole, exportAttributeView)
|
||||
|
||||
ginServer.Handle("POST", "/api/import/importStdMd", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, importStdMd)
|
||||
ginServer.Handle("POST", "/api/import/importData", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, importData)
|
||||
|
|
|
@ -429,7 +429,8 @@ func getConf(c *gin.Context) {
|
|||
|
||||
// REF: https://github.com/siyuan-note/siyuan/issues/11364
|
||||
role := model.GetGinContextRole(c)
|
||||
if model.IsReadOnlyRole(role) {
|
||||
isPublish := model.IsReadOnlyRole(role)
|
||||
if isPublish {
|
||||
maskedConf.ReadOnly = true
|
||||
}
|
||||
if !model.IsValidRole(role, []model.Role{
|
||||
|
@ -439,8 +440,9 @@ func getConf(c *gin.Context) {
|
|||
}
|
||||
|
||||
ret.Data = map[string]interface{}{
|
||||
"conf": maskedConf,
|
||||
"start": !util.IsUILoaded,
|
||||
"conf": maskedConf,
|
||||
"start": !util.IsUILoaded,
|
||||
"isPublish": isPublish,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue