mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 07:00:12 +01:00
🧑💻 Kernel API /api/ui/reloadUI adds mode parameter https://github.com/siyuan-note/siyuan/issues/15308
This commit is contained in:
parent
21bac6f112
commit
c0841160b3
3 changed files with 15 additions and 2 deletions
|
|
@ -64,7 +64,6 @@ func ServeAPI(ginServer *gin.Engine) {
|
||||||
ginServer.Handle("POST", "/api/system/exportConf", model.CheckAuth, model.CheckAdminRole, exportConf)
|
ginServer.Handle("POST", "/api/system/exportConf", model.CheckAuth, model.CheckAdminRole, exportConf)
|
||||||
ginServer.Handle("POST", "/api/system/importConf", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, importConf)
|
ginServer.Handle("POST", "/api/system/importConf", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, importConf)
|
||||||
ginServer.Handle("POST", "/api/system/getWorkspaceInfo", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, getWorkspaceInfo)
|
ginServer.Handle("POST", "/api/system/getWorkspaceInfo", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, getWorkspaceInfo)
|
||||||
ginServer.Handle("POST", "/api/system/reloadUI", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, reloadUI)
|
|
||||||
ginServer.Handle("POST", "/api/system/addMicrosoftDefenderExclusion", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, addMicrosoftDefenderExclusion)
|
ginServer.Handle("POST", "/api/system/addMicrosoftDefenderExclusion", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, addMicrosoftDefenderExclusion)
|
||||||
ginServer.Handle("POST", "/api/system/ignoreAddMicrosoftDefenderExclusion", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, ignoreAddMicrosoftDefenderExclusion)
|
ginServer.Handle("POST", "/api/system/ignoreAddMicrosoftDefenderExclusion", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, ignoreAddMicrosoftDefenderExclusion)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -69,5 +69,15 @@ func reloadUI(c *gin.Context) {
|
||||||
ret := gulu.Ret.NewResult()
|
ret := gulu.Ret.NewResult()
|
||||||
defer c.JSON(http.StatusOK, ret)
|
defer c.JSON(http.StatusOK, ret)
|
||||||
|
|
||||||
|
arg, ok := util.JsonArg(c, ret)
|
||||||
|
if !ok {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
modeArg := arg["mode"]
|
||||||
|
if nil != modeArg {
|
||||||
|
util.ReloadUIWithMode(modeArg.(string))
|
||||||
|
} else {
|
||||||
util.ReloadUI()
|
util.ReloadUI()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -148,6 +148,10 @@ func ReloadUI() {
|
||||||
BroadcastByType("main", "reloadui", 0, "", nil)
|
BroadcastByType("main", "reloadui", 0, "", nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func ReloadUIWithMode(mode string) {
|
||||||
|
BroadcastByType("main", "reloadui", 0, "", map[string]interface{}{"mode": mode})
|
||||||
|
}
|
||||||
|
|
||||||
func PushTxErr(msg string, code int, data interface{}) {
|
func PushTxErr(msg string, code int, data interface{}) {
|
||||||
BroadcastByType("main", "txerr", code, msg, data)
|
BroadcastByType("main", "txerr", code, msg, data)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue