Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
Vanessa 2023-01-05 18:41:56 +08:00
commit 55d4c30884
9 changed files with 91 additions and 12 deletions

View file

@ -746,7 +746,7 @@
"about5": "Access Authorization Code",
"about6": "After configuration, it will be used as the access authentication password, leave it blank to close the authentication",
"about7": "Workspace dir",
"about8": "After the workspace is switched, the data in the current workspace will not be copied to the target workspace<br>If you need to copy data, please manually copy the current workspace <code class='fn__code'>data</code> folder on the file system to the target workspace<br>The application will be closed automatically after modification, please restart manually",
"about8": "After the workspace is switched, the data in the current workspace will not be copied to the target workspace",
"about9": "Automatically upload error messages and diagnostic data",
"about10": "After enabling, it will automatically upload error information and diagnostic data through the <a href=\"https://sentry.io\" target=\"_blank\">Sentry</a> SDK, which does not involve personal privacy data so that developers can fix bugs. The application will be closed automatically after modification, please restart manually",
"about11": "Network serving",

View file

@ -746,7 +746,7 @@
"about5": "Código de autorización de acceso",
"about6": "Después de la configuración, se utilizará como contraseña de autenticación de acceso, déjelo en blanco para cerrar la autenticación",
"about7": "Directorio del espacio de trabajo",
"about8": "Después de cambiar el espacio de trabajo, los datos del espacio de trabajo actual no se copiarán en el espacio de trabajo de destino<br>Si necesita copiar datos, copie manualmente la carpeta <code class='fn__code'>data</code> del espacio de trabajo actual en el sistema de archivos al espacio de trabajo de destino<br>La aplicación se cerrará automáticamente después de la modificación, por favor reinicie manualmente",
"about8": "Después de cambiar el espacio de trabajo, los datos del espacio de trabajo actual no se copiarán en el espacio de trabajo de destino",
"about9": "Carga automática de mensajes de error y datos de diagnóstico",
"about10": "Después de habilitarlo, cargará automáticamente información de error y datos de diagnóstico a través del <a href=\"https://sentry.io\" target=\"_blank\">Sentry</a> SDK, que no involucra datos de privacidad personal para que los desarrolladores puede corregir errores. La aplicación se cerrará automáticamente después de la modificación, por favor, reinicie manualmente",
"about11": "Red de servicio",

View file

@ -746,7 +746,7 @@
"about5": "Accès Code d'autorisation",
"about6": "Configuré comme mot de passe d'authentification d'accès, laisser vide pour désactiver l'authentification.",
"about7": "Répertoire de l'espace de travail",
"about8": "Une fois l'espace de travail basculé, les données de l'espace de travail actuel ne seront pas copiées dans l'espace de travail cible<br>Si vous devez copier des données, veuillez copier manuellement le dossier <code class='fn__code'>data</code> de l'espace de travail actuel sur le système de fichiers vers l'espace de travail cible<br>L'application se fermera automatiquement après modification, merci de redémarrer manuellement",
"about8": "Une fois l'espace de travail basculé, les données de l'espace de travail actuel ne seront pas copiées dans l'espace de travail cible",
"about9": "Télécharger automatiquement les messages d'erreur et les données de diagnostic",
"about10": "Après l'activation, il télécharge automatiquement les informations d'erreur et les données de diagnostic via le SDK <a href=\"https://sentry.io\" target=\"_blank\">Sentry</a>, qui n'implique pas de données de confidentialité personnelles afin que les développeurs peut corriger des bogues. L'application sera fermée automatiquement après modification, veuillez la redémarrer manuellement.",
"about11": "Service de réseau",

View file

@ -746,7 +746,7 @@
"about5": "存取授權碼",
"about6": "配置後作為存取鑒權密碼,留空則關閉鑒權",
"about7": "工作空間目錄",
"about8": "切換工作空間後不會將當前工作空間的數據複製到目標工作空間中<br>如果需要復制數據,請手動在文件系統上將當前工作空間 <code class='fn__code'>data</code> 文件夾拷貝到目標工作空間下<br>修改後會自動關閉應用,請手動重啟",
"about8": "切換工作空間後不會將當前工作空間的數據複製到目標工作空間中",
"about9": "自動上傳報錯信息和診斷數據",
"about10": "啟用後會通過 <a href=\"https://sentry.io\" target=\"_blank\">Sentry</a> SDK 自動上傳報錯信息和診斷數據等不涉及個人隱私的數據,以便開發者修復缺陷。修改後會自動關閉應用,請手動重啟",
"about11": "網路伺服",

View file

@ -747,7 +747,7 @@
"about5": "访问授权码",
"about6": "配置后作为访问鉴权密码,留空则关闭鉴权",
"about7": "工作空间目录",
"about8": "切换工作空间后不会将当前工作空间的数据复制到目标工作空间中<br>如果需要复制数据,请手动在文件系统上将当前工作空间 <code class='fn__code'>data</code> 文件夹拷贝到目标工作空间下<br>修改后会自动关闭应用,请手动重启",
"about8": "切换工作空间后不会将当前工作空间的数据复制到目标工作空间中",
"about9": "自动上传报错信息和诊断数据",
"about10": "启用后会通过 <a href=\"https://sentry.io\" target=\"_blank\">Sentry</a> SDK 自动上传报错信息和诊断数据等不涉及个人隐私的数据,以便开发者修复缺陷。修改后会自动关闭应用,请手动重启",
"about11": "网络伺服",

View file

@ -56,10 +56,8 @@ try {
}
} catch (e) {
console.error(e)
require('electron').
dialog.
showErrorBox('创建配置目录失败 Failed to create config directory',
'思源需要在用户家目录下创建配置文件夹(~/.config/siyuan请确保该路径具有写入权限。\n\nSiYuan needs to create a configuration folder (~/.config/siyuan) in the user\'s home directory. Please make sure that the path has write permissions.')
require('electron').dialog.showErrorBox('创建配置目录失败 Failed to create config directory',
'思源需要在用户家目录下创建配置文件夹(~/.config/siyuan请确保该路径具有写入权限。\n\nSiYuan needs to create a configuration folder (~/.config/siyuan) in the user\'s home directory. Please make sure that the path has write permissions.')
app.exit()
}
@ -439,7 +437,7 @@ const initKernel = (workspace, lang) => {
},
)
kernelProcessPid = kernelProcess.pid
writeLog('booted kernel process [pid=' + kernelProcessPid + ']')
writeLog('booted kernel process [pid=' + kernelProcessPid + ', port=' + kernelPort + ']')
kernelProcess.on('close', (code) => {
writeLog(

View file

@ -32,7 +32,8 @@ export const mermaidRender = (element: Element, cdn = Constants.PROTYLE_CDN) =>
useMaxWidth: true,
diagramMarginX: 8,
diagramMarginY: 8,
boxMargin: 8
boxMargin: 8,
showSequenceNumbers: true // Mermaid 时序图增加序号 https://github.com/siyuan-note/siyuan/pull/6992 https://mermaid.js.org/syntax/sequenceDiagram.html#sequencenumbers
},
gantt: {
leftPadding: 75,

View file

@ -46,6 +46,8 @@ func ServeAPI(ginServer *gin.Engine) {
ginServer.Handle("POST", "/api/system/setNetworkProxy", model.CheckAuth, setNetworkProxy)
ginServer.Handle("POST", "/api/system/setWorkspaceDir", model.CheckAuth, setWorkspaceDir)
ginServer.Handle("POST", "/api/system/listWorkspaceDirs", model.CheckAuth, listWorkspaceDirs)
ginServer.Handle("POST", "/api/system/createWorkspaceDir", model.CheckAuth, createWorkspaceDir)
ginServer.Handle("POST", "/api/system/removeWorkspaceDir", model.CheckAuth, removeWorkspaceDir)
ginServer.Handle("POST", "/api/system/setAppearanceMode", model.CheckAuth, setAppearanceMode)
ginServer.Handle("POST", "/api/system/getSysFonts", model.CheckAuth, getSysFonts)
ginServer.Handle("POST", "/api/system/exit", model.CheckAuth, exit)

View file

@ -22,6 +22,7 @@ import (
"os"
"path/filepath"
"strings"
"time"
"github.com/88250/gulu"
"github.com/gin-gonic/gin"
@ -30,6 +31,79 @@ import (
"github.com/siyuan-note/siyuan/kernel/util"
)
func createWorkspaceDir(c *gin.Context) {
ret := gulu.Ret.NewResult()
defer c.JSON(http.StatusOK, ret)
arg, ok := util.JsonArg(c, ret)
if !ok {
return
}
path := arg["path"].(string)
if gulu.File.IsExist(path) {
ret.Code = -1
ret.Msg = model.Conf.Language(78)
return
}
if err := os.MkdirAll(path, 0755); nil != err {
ret.Code = -1
ret.Msg = fmt.Sprintf("create workspace dir [%s] failed: %s", path, err)
return
}
}
func removeWorkspaceDir(c *gin.Context) {
ret := gulu.Ret.NewResult()
defer c.JSON(http.StatusOK, ret)
arg, ok := util.JsonArg(c, ret)
if !ok {
return
}
path := arg["path"].(string)
var workspacePaths []string
workspaceConf := filepath.Join(util.HomeDir, ".config", "siyuan", "workspace.json")
data, err := os.ReadFile(workspaceConf)
if nil != err {
logging.LogErrorf("read workspace conf failed: %s", err)
} else {
if err = gulu.JSON.UnmarshalJSON(data, &workspacePaths); nil != err {
logging.LogErrorf("unmarshal workspace conf failed: %s", err)
}
}
workspacePaths = gulu.Str.RemoveElem(workspacePaths, path)
if data, err = gulu.JSON.MarshalJSON(workspacePaths); nil != err {
msg := fmt.Sprintf("marshal workspace conf [%s] failed: %s", workspaceConf, err)
ret.Code = -1
ret.Msg = msg
return
}
if err = gulu.File.WriteFileSafer(workspaceConf, data, 0644); nil != err {
msg := fmt.Sprintf("write workspace conf [%s] failed: %s", workspaceConf, err)
ret.Code = -1
ret.Msg = msg
return
}
if err = os.RemoveAll(path); nil != err {
msg := fmt.Sprintf("remove workspace dir [%s] failed: %s", path, err)
ret.Code = -1
ret.Msg = msg
return
}
if util.WorkspaceDir == path {
os.Exit(util.ExitCodeOk)
}
}
func listWorkspaceDirs(c *gin.Context) {
ret := gulu.Ret.NewResult()
defer c.JSON(http.StatusOK, ret)
@ -107,5 +181,9 @@ func setWorkspaceDir(c *gin.Context) {
}
}
util.PushMsg(model.Conf.Language(42), 1000*15)
if util.ContainerAndroid == util.Container || util.ContainerIOS == util.Container {
util.PushMsg(model.Conf.Language(42), 1000*15)
time.Sleep(time.Second * 2)
model.Close(false, 1)
}
}