mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 15:10:12 +01:00
🔥 移除旧版云端同步和备份功能入口 https://github.com/siyuan-note/siyuan/issues/5405
This commit is contained in:
parent
bc046e7339
commit
8581f83e61
12 changed files with 54 additions and 312 deletions
|
|
@ -764,6 +764,7 @@
|
||||||
"8": "Check update failed",
|
"8": "Check update failed",
|
||||||
"9": "A new version is available, please browse the release announcement %s",
|
"9": "A new version is available, please browse the release announcement %s",
|
||||||
"10": "Is the latest version",
|
"10": "Is the latest version",
|
||||||
|
"11": "TODO",
|
||||||
"12": "Query asset failed [%s]",
|
"12": "Query asset failed [%s]",
|
||||||
"13": "Cannot create a file starting with .",
|
"13": "Cannot create a file starting with .",
|
||||||
"14": "Export failed: %s",
|
"14": "Export failed: %s",
|
||||||
|
|
@ -791,7 +792,7 @@
|
||||||
"36": "Please check the version update in the app store",
|
"36": "Please check the version update in the app store",
|
||||||
"37": "Do not include spaces and special symbols in the name of the cloud sync directory",
|
"37": "Do not include spaces and special symbols in the name of the cloud sync directory",
|
||||||
"38": "The number of mentioned keywords [%d] is too many, currently only supports up to [512] keywords",
|
"38": "The number of mentioned keywords [%d] is too many, currently only supports up to [512] keywords",
|
||||||
"39": "E2EE password can not be blank",
|
"39": "TODO",
|
||||||
"40": "Failed to decrypt data",
|
"40": "Failed to decrypt data",
|
||||||
"41": "Upload completed",
|
"41": "Upload completed",
|
||||||
"42": "The setting is complete, the application will be closed automatically, please restart later...",
|
"42": "The setting is complete, the application will be closed automatically, please restart later...",
|
||||||
|
|
@ -841,10 +842,10 @@
|
||||||
"86": "Please configure [Settings - About - Access authorization code]",
|
"86": "Please configure [Settings - About - Access authorization code]",
|
||||||
"87": "Cannot move to this location",
|
"87": "Cannot move to this location",
|
||||||
"88": "Finished parsing [%d] data files, remaining to be processed [%d]",
|
"88": "Finished parsing [%d] data files, remaining to be processed [%d]",
|
||||||
"89": "Local data will overwrite the data in the cloud sync directory <em>%s</em>",
|
"89": "TODO",
|
||||||
"90": "Cloud synchronization directory <em>%s</em> data will overwrite local data",
|
"90": "TODO",
|
||||||
"91": "The local data and the cloud synchronization directory <em>%s</em> have the same data",
|
"91": "TODO",
|
||||||
"92": "The end-to-end encryption password is set",
|
"92": "TODO",
|
||||||
"93": "Download failed: %s",
|
"93": "Download failed: %s",
|
||||||
"94": "Upload failed: %s",
|
"94": "Upload failed: %s",
|
||||||
"95": "Exiting...",
|
"95": "Exiting...",
|
||||||
|
|
@ -854,7 +855,7 @@
|
||||||
"99": "Data cleaning is complete",
|
"99": "Data cleaning is complete",
|
||||||
"100": "Cleaning data...",
|
"100": "Cleaning data...",
|
||||||
"101": "Done setting reminder [%s]",
|
"101": "Done setting reminder [%s]",
|
||||||
"102": "Setting end-to-end encryption password...",
|
"102": "TODO",
|
||||||
"103": "[%d] data files have been downloaded, and [%d] remaining to be downloaded",
|
"103": "[%d] data files have been downloaded, and [%d] remaining to be downloaded",
|
||||||
"104": "[%d] data files have been uploaded, and [%d] remaining to be uploaded",
|
"104": "[%d] data files have been uploaded, and [%d] remaining to be uploaded",
|
||||||
"105": "Network transmission completed",
|
"105": "Network transmission completed",
|
||||||
|
|
|
||||||
|
|
@ -764,6 +764,7 @@
|
||||||
"8": "Comprobar la actualización falló",
|
"8": "Comprobar la actualización falló",
|
||||||
"9": "Una nueva versión está disponible, por favor, busque el anuncio de lanzamiento %s",
|
"9": "Una nueva versión está disponible, por favor, busque el anuncio de lanzamiento %s",
|
||||||
"10": "Es la última versión",
|
"10": "Es la última versión",
|
||||||
|
"11": "TODO",
|
||||||
"12": "Fallo en la consulta de activos [%s]",
|
"12": "Fallo en la consulta de activos [%s]",
|
||||||
"13": "No se puede crear un archivo que empiece por .",
|
"13": "No se puede crear un archivo que empiece por .",
|
||||||
"14": "Exportación fallida: %s",
|
"14": "Exportación fallida: %s",
|
||||||
|
|
@ -791,7 +792,7 @@
|
||||||
"36": "Por favor, comprueba la actualización de la versión en la tienda de aplicaciones",
|
"36": "Por favor, comprueba la actualización de la versión en la tienda de aplicaciones",
|
||||||
"37": "No incluyas espacios ni símbolos especiales en el nombre del directorio de sincronización con la nube",
|
"37": "No incluyas espacios ni símbolos especiales en el nombre del directorio de sincronización con la nube",
|
||||||
"38": "El número de palabras clave mencionadas [%d] son demasiados, actualmente solo admite hasta [512] palabras clave",
|
"38": "El número de palabras clave mencionadas [%d] son demasiados, actualmente solo admite hasta [512] palabras clave",
|
||||||
"39": "La contraseña de E2EE no puede estar en blanco",
|
"39": "TODO",
|
||||||
"40": "Fallo en la desencriptación de datos",
|
"40": "Fallo en la desencriptación de datos",
|
||||||
"41": "Carga completada",
|
"41": "Carga completada",
|
||||||
"42": "La configuración se ha completado, la aplicación se cerrará automáticamente, por favor reinicie más tarde...",
|
"42": "La configuración se ha completado, la aplicación se cerrará automáticamente, por favor reinicie más tarde...",
|
||||||
|
|
@ -841,10 +842,10 @@
|
||||||
"86": "Por favor, configure [Configuración - Acerca de - Código de autorización de acceso]",
|
"86": "Por favor, configure [Configuración - Acerca de - Código de autorización de acceso]",
|
||||||
"87": "No se puede mover a esta ubicación",
|
"87": "No se puede mover a esta ubicación",
|
||||||
"88": "Se ha terminado de analizar [%d] archivos de datos, quedan por procesar [%d]",
|
"88": "Se ha terminado de analizar [%d] archivos de datos, quedan por procesar [%d]",
|
||||||
"89": "Los datos locales sobrescribirán los datos del directorio de sincronización en la nube <em>%s</em>",
|
"89": "TODO",
|
||||||
"90": "Los datos del directorio de sincronización en la nube <em>%s</em> sobrescribirán los datos locales",
|
"90": "TODO",
|
||||||
"91": "Los datos locales y el directorio de sincronización en la nube <em>%s</em> tienen los mismos datos",
|
"91": "TODO",
|
||||||
"92": "La contraseña de encriptación de extremo a extremo está establecida",
|
"92": "TODO",
|
||||||
"93": "Descarga fallida: %s",
|
"93": "Descarga fallida: %s",
|
||||||
"94": "Carga fallida: %s",
|
"94": "Carga fallida: %s",
|
||||||
"95": "Saliendo...",
|
"95": "Saliendo...",
|
||||||
|
|
@ -854,7 +855,7 @@
|
||||||
"99": "La limpieza de datos ha finalizado",
|
"99": "La limpieza de datos ha finalizado",
|
||||||
"100": "Limpieza de datos...",
|
"100": "Limpieza de datos...",
|
||||||
"101": "El recordatorio de configuración [%s] se ha completado",
|
"101": "El recordatorio de configuración [%s] se ha completado",
|
||||||
"102": "Configurando la contraseña de cifrado de extremo a extremo...",
|
"102": "TODO",
|
||||||
"103": "[%d] archivos de datos han sido descargados, y [%d] quedan por descargar",
|
"103": "[%d] archivos de datos han sido descargados, y [%d] quedan por descargar",
|
||||||
"104": "[%d] archivos de datos han sido cargados, y [%d] restantes por cargar",
|
"104": "[%d] archivos de datos han sido cargados, y [%d] restantes por cargar",
|
||||||
"105": "Transmisión de red completada",
|
"105": "Transmisión de red completada",
|
||||||
|
|
|
||||||
|
|
@ -764,6 +764,7 @@
|
||||||
"8": "La vérification de la mise à jour a échoué",
|
"8": "La vérification de la mise à jour a échoué",
|
||||||
"9": "Une nouvelle version est disponible, veuillez consulter l'annonce de la version %s",
|
"9": "Une nouvelle version est disponible, veuillez consulter l'annonce de la version %s",
|
||||||
"10": "C'est la dernière version",
|
"10": "C'est la dernière version",
|
||||||
|
"11": "TODO",
|
||||||
"12": "Échec de la requête asset [%s]",
|
"12": "Échec de la requête asset [%s]",
|
||||||
"13": "Impossible de créer un fichier commençant par .",
|
"13": "Impossible de créer un fichier commençant par .",
|
||||||
"14": "L'exportation a échoué : %s",
|
"14": "L'exportation a échoué : %s",
|
||||||
|
|
@ -791,7 +792,7 @@
|
||||||
"36": "Veuillez vérifier la mise à jour de la version dans l'App Store",
|
"36": "Veuillez vérifier la mise à jour de la version dans l'App Store",
|
||||||
"37": "N'incluez pas d'espaces et de symboles spéciaux dans le nom du répertoire de synchronisation cloud",
|
"37": "N'incluez pas d'espaces et de symboles spéciaux dans le nom du répertoire de synchronisation cloud",
|
||||||
"38": "Le nombre de mots-clés mentionnés [%d] est trop élevé, ne prend actuellement en charge que jusqu'à [512] mots-clés",
|
"38": "Le nombre de mots-clés mentionnés [%d] est trop élevé, ne prend actuellement en charge que jusqu'à [512] mots-clés",
|
||||||
"39": "Le mot de passe E2EE ne peut pas être vide",
|
"39": "TODO",
|
||||||
"40": "Échec du décryptage des données",
|
"40": "Échec du décryptage des données",
|
||||||
"41": "Transfert complété",
|
"41": "Transfert complété",
|
||||||
"42": "Le paramétrage est terminé, l'application se fermera automatiquement, merci de redémarrer plus tard...",
|
"42": "Le paramétrage est terminé, l'application se fermera automatiquement, merci de redémarrer plus tard...",
|
||||||
|
|
@ -841,10 +842,10 @@
|
||||||
"86": "Veuillez configurer [Paramètres - A propos de - Code d'autorisation d'accès]",
|
"86": "Veuillez configurer [Paramètres - A propos de - Code d'autorisation d'accès]",
|
||||||
"87": "Impossible de se déplacer vers cet endroit",
|
"87": "Impossible de se déplacer vers cet endroit",
|
||||||
"88": "Fin de l'analyse des fichiers de données [%d], restant à traiter [%d]",
|
"88": "Fin de l'analyse des fichiers de données [%d], restant à traiter [%d]",
|
||||||
"89": "Les données locales écraseront les données du répertoire de synchronisation cloud <em>%s</em>",
|
"89": "TODO",
|
||||||
"90": "Les données du répertoire de synchronisation cloud <em>%s</em> écraseront les données locales",
|
"90": "TODO",
|
||||||
"91": "Les données locales et le répertoire de synchronisation cloud <em>%s</em> ont les mêmes données",
|
"91": "TODO",
|
||||||
"92": "Le mot de passe de cryptage de bout en bout est défini",
|
"92": "TODO",
|
||||||
"93": "Le téléchargement a échoué : %s",
|
"93": "Le téléchargement a échoué : %s",
|
||||||
"94": "Échec du téléchargement : %s",
|
"94": "Échec du téléchargement : %s",
|
||||||
"95": "Quitter le programme...",
|
"95": "Quitter le programme...",
|
||||||
|
|
@ -854,7 +855,7 @@
|
||||||
"99": "Le nettoyage des données est terminé",
|
"99": "Le nettoyage des données est terminé",
|
||||||
"100": "Nettoyage des données...",
|
"100": "Nettoyage des données...",
|
||||||
"101": "Rappel de réglage terminé [%s]",
|
"101": "Rappel de réglage terminé [%s]",
|
||||||
"102": "Définition du mot de passe de cryptage de bout en bout...",
|
"102": "TODO",
|
||||||
"103": "[%d] fichiers de données ont été téléchargés, il reste à télécharger [%d]",
|
"103": "[%d] fichiers de données ont été téléchargés, il reste à télécharger [%d]",
|
||||||
"104": "[%d] fichiers de données ont été téléchargés, et [%d] reste à télécharger",
|
"104": "[%d] fichiers de données ont été téléchargés, et [%d] reste à télécharger",
|
||||||
"105": "Transmission réseau terminée",
|
"105": "Transmission réseau terminée",
|
||||||
|
|
|
||||||
|
|
@ -764,6 +764,7 @@
|
||||||
"8": "檢查更新失敗",
|
"8": "檢查更新失敗",
|
||||||
"9": "有新版本可用,請瀏覽發佈公告 %s",
|
"9": "有新版本可用,請瀏覽發佈公告 %s",
|
||||||
"10": "已是最新版",
|
"10": "已是最新版",
|
||||||
|
"11": "TODO",
|
||||||
"12": "查詢資料檔失敗 [%s]",
|
"12": "查詢資料檔失敗 [%s]",
|
||||||
"13": "無法創建 . 開頭的文件",
|
"13": "無法創建 . 開頭的文件",
|
||||||
"14": "匯出失敗:%s",
|
"14": "匯出失敗:%s",
|
||||||
|
|
@ -791,7 +792,7 @@
|
||||||
"36": "請在應用商店中檢查版本更新",
|
"36": "請在應用商店中檢查版本更新",
|
||||||
"37": "雲端同步目錄的名稱請勿包含空格和特殊符號",
|
"37": "雲端同步目錄的名稱請勿包含空格和特殊符號",
|
||||||
"38": "提及關鍵字數量 [%d] 過多,目前最多僅支援搜索 [512] 個關鍵字",
|
"38": "提及關鍵字數量 [%d] 過多,目前最多僅支援搜索 [512] 個關鍵字",
|
||||||
"39": "端到端加密密碼不能為空",
|
"39": "TODO",
|
||||||
"40": "解密數據失敗",
|
"40": "解密數據失敗",
|
||||||
"41": "上傳完畢",
|
"41": "上傳完畢",
|
||||||
"42": "設置完成,即將自動關閉應用,請稍後重新啟動...",
|
"42": "設置完成,即將自動關閉應用,請稍後重新啟動...",
|
||||||
|
|
@ -841,10 +842,10 @@
|
||||||
"86": "請先配置 [設置 - 關於 - 存取授權碼]",
|
"86": "請先配置 [設置 - 關於 - 存取授權碼]",
|
||||||
"87": "無法移動到該位置",
|
"87": "無法移動到該位置",
|
||||||
"88": "已完成解析 [%d] 個數據文件,剩餘待處理 [%d]",
|
"88": "已完成解析 [%d] 個數據文件,剩餘待處理 [%d]",
|
||||||
"89": "本地資料將覆蓋雲端同步目錄 <em>%s</em> 資料",
|
"89": "TODO",
|
||||||
"90": "雲端同步目錄 <em>%s</em> 資料將覆蓋本地資料",
|
"90": "TODO",
|
||||||
"91": "本地資料和雲端同步目錄 <em>%s</em> 資料一致",
|
"91": "TODO",
|
||||||
"92": "端到端加密密碼設置完畢",
|
"92": "TODO",
|
||||||
"93": "下載失敗:%s",
|
"93": "下載失敗:%s",
|
||||||
"94": "上傳失敗:%s",
|
"94": "上傳失敗:%s",
|
||||||
"95": "正在退出...",
|
"95": "正在退出...",
|
||||||
|
|
@ -854,7 +855,7 @@
|
||||||
"99": "清理數據完成",
|
"99": "清理數據完成",
|
||||||
"100": "正在清理數據...",
|
"100": "正在清理數據...",
|
||||||
"101": "設置提醒完畢 [%s]",
|
"101": "設置提醒完畢 [%s]",
|
||||||
"102": "正在設置端到端加密密碼...",
|
"102": "TODO",
|
||||||
"103": "已下載 [%d] 個資料檔案,剩餘待下載 [%d]",
|
"103": "已下載 [%d] 個資料檔案,剩餘待下載 [%d]",
|
||||||
"104": "已上傳 [%d] 個資料檔案,剩餘待上傳 [%d]",
|
"104": "已上傳 [%d] 個資料檔案,剩餘待上傳 [%d]",
|
||||||
"105": "網絡傳輸完畢",
|
"105": "網絡傳輸完畢",
|
||||||
|
|
|
||||||
|
|
@ -765,6 +765,7 @@
|
||||||
"8": "检查更新失败",
|
"8": "检查更新失败",
|
||||||
"9": "有新版本可用,请浏览发布公告 %s",
|
"9": "有新版本可用,请浏览发布公告 %s",
|
||||||
"10": "已是最新版",
|
"10": "已是最新版",
|
||||||
|
"11": "TODO",
|
||||||
"12": "查询资源文件失败 [%s]",
|
"12": "查询资源文件失败 [%s]",
|
||||||
"13": "无法创建 . 开头的文件",
|
"13": "无法创建 . 开头的文件",
|
||||||
"14": "导出失败:%s",
|
"14": "导出失败:%s",
|
||||||
|
|
@ -792,7 +793,7 @@
|
||||||
"36": "请在应用商店中检查版本更新",
|
"36": "请在应用商店中检查版本更新",
|
||||||
"37": "云端同步目录的名称请勿包含空格和特殊符号",
|
"37": "云端同步目录的名称请勿包含空格和特殊符号",
|
||||||
"38": "提及关键字数量 [%d] 过多,目前最多仅支持搜索 [512] 个关键字",
|
"38": "提及关键字数量 [%d] 过多,目前最多仅支持搜索 [512] 个关键字",
|
||||||
"39": "端到端加密密码不能为空",
|
"39": "TODO",
|
||||||
"40": "解密数据失败",
|
"40": "解密数据失败",
|
||||||
"41": "上传完毕",
|
"41": "上传完毕",
|
||||||
"42": "设置完成,即将自动关闭应用,请稍后重新启动...",
|
"42": "设置完成,即将自动关闭应用,请稍后重新启动...",
|
||||||
|
|
@ -842,10 +843,10 @@
|
||||||
"86": "请先配置 [设置 - 关于 - 访问授权码]",
|
"86": "请先配置 [设置 - 关于 - 访问授权码]",
|
||||||
"87": "无法移动到该位置",
|
"87": "无法移动到该位置",
|
||||||
"88": "已完成解析 [%d] 个数据文件,剩余待处理 [%d]",
|
"88": "已完成解析 [%d] 个数据文件,剩余待处理 [%d]",
|
||||||
"89": "本地数据将覆盖云端同步目录 <em>%s</em> 数据",
|
"89": "TODO",
|
||||||
"90": "云端同步目录 <em>%s</em> 数据将覆盖本地数据",
|
"90": "TODO",
|
||||||
"91": "本地数据和云端同步目录 <em>%s</em> 数据一致",
|
"91": "TODO",
|
||||||
"92": "端到端加密密码设置完毕",
|
"92": "TODO",
|
||||||
"93": "下载失败:%s",
|
"93": "下载失败:%s",
|
||||||
"94": "上传失败:%s",
|
"94": "上传失败:%s",
|
||||||
"95": "正在退出...",
|
"95": "正在退出...",
|
||||||
|
|
@ -855,7 +856,7 @@
|
||||||
"99": "清理数据完成",
|
"99": "清理数据完成",
|
||||||
"100": "正在清理数据...",
|
"100": "正在清理数据...",
|
||||||
"101": "设置提醒完毕 [%s]",
|
"101": "设置提醒完毕 [%s]",
|
||||||
"102": "正在设置端到端加密密码...",
|
"102": "TODO",
|
||||||
"103": "已下载 [%d] 个数据文件,剩余待下载 [%d]",
|
"103": "已下载 [%d] 个数据文件,剩余待下载 [%d]",
|
||||||
"104": "已上传 [%d] 个数据文件,剩余待上传 [%d]",
|
"104": "已上传 [%d] 个数据文件,剩余待上传 [%d]",
|
||||||
"105": "网络传输完毕",
|
"105": "网络传输完毕",
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,6 @@ func ServeAPI(ginServer *gin.Engine) {
|
||||||
ginServer.Handle("POST", "/api/system/listWorkspaceDirs", model.CheckAuth, listWorkspaceDirs)
|
ginServer.Handle("POST", "/api/system/listWorkspaceDirs", model.CheckAuth, listWorkspaceDirs)
|
||||||
ginServer.Handle("POST", "/api/system/setAppearanceMode", model.CheckAuth, setAppearanceMode)
|
ginServer.Handle("POST", "/api/system/setAppearanceMode", model.CheckAuth, setAppearanceMode)
|
||||||
ginServer.Handle("POST", "/api/system/getSysFonts", model.CheckAuth, getSysFonts)
|
ginServer.Handle("POST", "/api/system/getSysFonts", model.CheckAuth, getSysFonts)
|
||||||
ginServer.Handle("POST", "/api/system/setE2EEPasswd", model.CheckAuth, setE2EEPasswd)
|
|
||||||
ginServer.Handle("POST", "/api/system/exit", model.CheckAuth, exit)
|
ginServer.Handle("POST", "/api/system/exit", model.CheckAuth, exit)
|
||||||
ginServer.Handle("POST", "/api/system/setUILayout", model.CheckAuth, setUILayout)
|
ginServer.Handle("POST", "/api/system/setUILayout", model.CheckAuth, setUILayout)
|
||||||
ginServer.Handle("POST", "/api/system/getConf", model.CheckAuth, getConf)
|
ginServer.Handle("POST", "/api/system/getConf", model.CheckAuth, getConf)
|
||||||
|
|
@ -167,7 +166,6 @@ func ServeAPI(ginServer *gin.Engine) {
|
||||||
ginServer.Handle("POST", "/api/backup/removeCloudBackup", model.CheckAuth, model.CheckReadonly, removeCloudBackup)
|
ginServer.Handle("POST", "/api/backup/removeCloudBackup", model.CheckAuth, model.CheckReadonly, removeCloudBackup)
|
||||||
|
|
||||||
ginServer.Handle("POST", "/api/sync/setSyncEnable", model.CheckAuth, setSyncEnable)
|
ginServer.Handle("POST", "/api/sync/setSyncEnable", model.CheckAuth, setSyncEnable)
|
||||||
ginServer.Handle("POST", "/api/sync/setSyncUseDataRepo", model.CheckAuth, setSyncUseDataRepo)
|
|
||||||
ginServer.Handle("POST", "/api/sync/setSyncMode", model.CheckAuth, setSyncMode)
|
ginServer.Handle("POST", "/api/sync/setSyncMode", model.CheckAuth, setSyncMode)
|
||||||
ginServer.Handle("POST", "/api/sync/setCloudSyncDir", model.CheckAuth, setCloudSyncDir)
|
ginServer.Handle("POST", "/api/sync/setCloudSyncDir", model.CheckAuth, setCloudSyncDir)
|
||||||
ginServer.Handle("POST", "/api/sync/createCloudSyncDir", model.CheckAuth, model.CheckReadonly, createCloudSyncDir)
|
ginServer.Handle("POST", "/api/sync/createCloudSyncDir", model.CheckAuth, model.CheckReadonly, createCloudSyncDir)
|
||||||
|
|
|
||||||
|
|
@ -121,25 +121,6 @@ func createCloudSyncDir(c *gin.Context) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func setSyncUseDataRepo(c *gin.Context) {
|
|
||||||
ret := gulu.Ret.NewResult()
|
|
||||||
defer c.JSON(http.StatusOK, ret)
|
|
||||||
|
|
||||||
arg, ok := util.JsonArg(c, ret)
|
|
||||||
if !ok {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
enabled := arg["enabled"].(bool)
|
|
||||||
err := model.SetSyncUseDataRepo(enabled)
|
|
||||||
if nil != err {
|
|
||||||
ret.Code = 1
|
|
||||||
ret.Msg = err.Error()
|
|
||||||
ret.Data = map[string]interface{}{"closeTimeout": 5000}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func setSyncEnable(c *gin.Context) {
|
func setSyncEnable(c *gin.Context) {
|
||||||
ret := gulu.Ret.NewResult()
|
ret := gulu.Ret.NewResult()
|
||||||
defer c.JSON(http.StatusOK, ret)
|
defer c.JSON(http.StatusOK, ret)
|
||||||
|
|
|
||||||
|
|
@ -295,77 +295,6 @@ func setNetworkProxy(c *gin.Context) {
|
||||||
time.Sleep(time.Second * 3)
|
time.Sleep(time.Second * 3)
|
||||||
}
|
}
|
||||||
|
|
||||||
func setE2EEPasswd(c *gin.Context) {
|
|
||||||
ret := gulu.Ret.NewResult()
|
|
||||||
defer c.JSON(http.StatusOK, ret)
|
|
||||||
|
|
||||||
arg, ok := util.JsonArg(c, ret)
|
|
||||||
if !ok {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
var passwd string
|
|
||||||
mode := int(arg["mode"].(float64))
|
|
||||||
if 0 == mode { // 使用内建的密码生成
|
|
||||||
passwd = model.GetBuiltInE2EEPasswd()
|
|
||||||
} else { // 使用自定义密码
|
|
||||||
passwd = arg["e2eePasswd"].(string)
|
|
||||||
passwd = strings.TrimSpace(passwd)
|
|
||||||
}
|
|
||||||
|
|
||||||
if "" == passwd {
|
|
||||||
ret.Code = -1
|
|
||||||
ret.Msg = model.Conf.Language(39)
|
|
||||||
ret.Data = map[string]interface{}{"closeTimeout": 5000}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
newPasswd := util.AESEncrypt(passwd)
|
|
||||||
if model.Conf.E2EEPasswd == newPasswd {
|
|
||||||
util.PushMsg(model.Conf.Language(92), 3000)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
msgId := util.PushMsg(model.Conf.Language(102), 1000*7)
|
|
||||||
if err := os.RemoveAll(model.Conf.Backup.GetSaveDir()); nil != err {
|
|
||||||
ret.Code = -1
|
|
||||||
ret.Msg = err.Error()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if err := os.MkdirAll(model.Conf.Backup.GetSaveDir(), 0755); nil != err {
|
|
||||||
ret.Code = -1
|
|
||||||
ret.Msg = err.Error()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if err := os.RemoveAll(model.Conf.Sync.GetSaveDir()); nil != err {
|
|
||||||
ret.Code = -1
|
|
||||||
ret.Msg = err.Error()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if err := os.MkdirAll(model.Conf.Sync.GetSaveDir(), 0755); nil != err {
|
|
||||||
ret.Code = -1
|
|
||||||
ret.Msg = err.Error()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if err := os.RemoveAll(filepath.Join(util.TempDir, "incremental")); nil != err {
|
|
||||||
ret.Code = -1
|
|
||||||
ret.Msg = err.Error()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if err := os.MkdirAll(filepath.Join(util.TempDir, "incremental"), 0755); nil != err {
|
|
||||||
ret.Code = -1
|
|
||||||
ret.Msg = err.Error()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
time.Sleep(1 * time.Second)
|
|
||||||
model.Conf.E2EEPasswd = newPasswd
|
|
||||||
model.Conf.E2EEPasswdMode = mode
|
|
||||||
model.Conf.Save()
|
|
||||||
util.PushUpdateMsg(msgId, model.Conf.Language(92), 3000)
|
|
||||||
time.Sleep(1 * time.Second)
|
|
||||||
model.SyncData(false, false, true)
|
|
||||||
}
|
|
||||||
|
|
||||||
func addUIProcess(c *gin.Context) {
|
func addUIProcess(c *gin.Context) {
|
||||||
pid := c.Query("pid")
|
pid := c.Query("pid")
|
||||||
util.UIProcessIDs.Store(pid, true)
|
util.UIProcessIDs.Store(pid, true)
|
||||||
|
|
|
||||||
|
|
@ -23,22 +23,20 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
type Sync struct {
|
type Sync struct {
|
||||||
CloudName string `json:"cloudName"` // 云端同步目录名称
|
CloudName string `json:"cloudName"` // 云端同步目录名称
|
||||||
Enabled bool `json:"enabled"` // 是否开启同步
|
Enabled bool `json:"enabled"` // 是否开启同步
|
||||||
Mode int `json:"mode"` // 同步模式,0:未设置(为兼容已有配置,initConf 函数中会转换为 1),1:自动,2:手动 https://github.com/siyuan-note/siyuan/issues/5089
|
Mode int `json:"mode"` // 同步模式,0:未设置(为兼容已有配置,initConf 函数中会转换为 1),1:自动,2:手动 https://github.com/siyuan-note/siyuan/issues/5089
|
||||||
Uploaded int64 `json:"uploaded"` // 最近上传时间
|
Uploaded int64 `json:"uploaded"` // 最近上传时间
|
||||||
Downloaded int64 `json:"downloaded"` // 最近下载时间
|
Downloaded int64 `json:"downloaded"` // 最近下载时间
|
||||||
Synced int64 `json:"synced"` // 最近同步时间
|
Synced int64 `json:"synced"` // 最近同步时间
|
||||||
Stat string `json:"stat"` // 最近同步统计信息
|
Stat string `json:"stat"` // 最近同步统计信息
|
||||||
UseDataRepo bool `json:"useDataRepo"` // 是否使用数据仓库同步
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewSync() *Sync {
|
func NewSync() *Sync {
|
||||||
return &Sync{
|
return &Sync{
|
||||||
CloudName: "main",
|
CloudName: "main",
|
||||||
Enabled: false,
|
Enabled: false,
|
||||||
Mode: 1,
|
Mode: 1,
|
||||||
UseDataRepo: true,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,9 +18,7 @@ package model
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"crypto/sha256"
|
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
|
@ -63,8 +61,6 @@ type AppConf struct {
|
||||||
ReadOnly bool `json:"readonly"` // 是否是只读
|
ReadOnly bool `json:"readonly"` // 是否是只读
|
||||||
LocalIPs []string `json:"localIPs"` // 本地 IP 列表
|
LocalIPs []string `json:"localIPs"` // 本地 IP 列表
|
||||||
AccessAuthCode string `json:"accessAuthCode"` // 访问授权码
|
AccessAuthCode string `json:"accessAuthCode"` // 访问授权码
|
||||||
E2EEPasswd string `json:"e2eePasswd"` // 端到端加密密码,用于备份和同步
|
|
||||||
E2EEPasswdMode int `json:"e2eePasswdMode"` // 端到端加密密码生成方式,0:自动,1:自定义
|
|
||||||
System *conf.System `json:"system"` // 系统
|
System *conf.System `json:"system"` // 系统
|
||||||
Keymap *conf.Keymap `json:"keymap"` // 快捷键
|
Keymap *conf.Keymap `json:"keymap"` // 快捷键
|
||||||
Backup *conf.Backup `json:"backup"` // 备份配置
|
Backup *conf.Backup `json:"backup"` // 备份配置
|
||||||
|
|
@ -283,11 +279,6 @@ func InitConf() {
|
||||||
Conf.AccessAuthCode = util.AccessAuthCode
|
Conf.AccessAuthCode = util.AccessAuthCode
|
||||||
}
|
}
|
||||||
|
|
||||||
Conf.E2EEPasswdMode = 0
|
|
||||||
if !isBuiltInE2EEPasswd() {
|
|
||||||
Conf.E2EEPasswdMode = 1
|
|
||||||
}
|
|
||||||
|
|
||||||
Conf.LocalIPs = util.GetLocalIPs()
|
Conf.LocalIPs = util.GetLocalIPs()
|
||||||
|
|
||||||
Conf.Save()
|
Conf.Save()
|
||||||
|
|
@ -555,23 +546,6 @@ func IsSubscriber() bool {
|
||||||
return nil != Conf.User && (-1 == Conf.User.UserSiYuanProExpireTime || 0 < Conf.User.UserSiYuanProExpireTime) && 0 == Conf.User.UserSiYuanSubscriptionStatus
|
return nil != Conf.User && (-1 == Conf.User.UserSiYuanProExpireTime || 0 < Conf.User.UserSiYuanProExpireTime) && 0 == Conf.User.UserSiYuanSubscriptionStatus
|
||||||
}
|
}
|
||||||
|
|
||||||
func isBuiltInE2EEPasswd() bool {
|
|
||||||
if nil == Conf || nil == Conf.User || "" == Conf.E2EEPasswd {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
pwd := GetBuiltInE2EEPasswd()
|
|
||||||
return Conf.E2EEPasswd == util.AESEncrypt(pwd)
|
|
||||||
}
|
|
||||||
|
|
||||||
func GetBuiltInE2EEPasswd() (ret string) {
|
|
||||||
part1 := Conf.User.UserId[:7]
|
|
||||||
part2 := Conf.User.UserId[7:]
|
|
||||||
ret = part2 + part1
|
|
||||||
ret = fmt.Sprintf("%x", sha256.Sum256([]byte(ret)))[:7]
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func clearWorkspaceTemp() {
|
func clearWorkspaceTemp() {
|
||||||
os.RemoveAll(filepath.Join(util.TempDir, "bazaar"))
|
os.RemoveAll(filepath.Join(util.TempDir, "bazaar"))
|
||||||
os.RemoveAll(filepath.Join(util.TempDir, "export"))
|
os.RemoveAll(filepath.Join(util.TempDir, "export"))
|
||||||
|
|
|
||||||
|
|
@ -105,37 +105,6 @@ func removeCloudDirPath(dirPath string) (err error) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func createCloudSyncDirOSS(name string) (err error) {
|
|
||||||
result := map[string]interface{}{}
|
|
||||||
request := httpclient.NewCloudRequest()
|
|
||||||
resp, err := request.
|
|
||||||
SetResult(&result).
|
|
||||||
SetBody(map[string]string{"name": name, "token": Conf.User.UserToken}).
|
|
||||||
Post(util.AliyunServer + "/apis/siyuan/data/createSiYuanSyncDir")
|
|
||||||
if nil != err {
|
|
||||||
util.LogErrorf("create cloud sync dir failed: %s", err)
|
|
||||||
return ErrFailedToConnectCloudServer
|
|
||||||
}
|
|
||||||
|
|
||||||
if 200 != resp.StatusCode {
|
|
||||||
if 401 == resp.StatusCode {
|
|
||||||
err = errors.New(Conf.Language(31))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
msg := fmt.Sprintf("create cloud sync dir failed: %d", resp.StatusCode)
|
|
||||||
util.LogErrorf(msg)
|
|
||||||
err = errors.New(msg)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
code := result["code"].(float64)
|
|
||||||
if 0 != code {
|
|
||||||
util.LogErrorf("create cloud sync dir failed: %s", result["msg"])
|
|
||||||
return errors.New(result["msg"].(string))
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func listCloudSyncDirOSS() (dirs []map[string]interface{}, size int64, err error) {
|
func listCloudSyncDirOSS() (dirs []map[string]interface{}, size int64, err error) {
|
||||||
result := map[string]interface{}{}
|
result := map[string]interface{}{}
|
||||||
request := httpclient.NewCloudRequest()
|
request := httpclient.NewCloudRequest()
|
||||||
|
|
|
||||||
|
|
@ -84,12 +84,10 @@ func SyncData(boot, exit, byHand bool) {
|
||||||
if exit {
|
if exit {
|
||||||
ExitSyncSucc = 0
|
ExitSyncSucc = 0
|
||||||
}
|
}
|
||||||
if !IsSubscriber() || !Conf.Sync.Enabled || "" == Conf.Sync.CloudName || ("" == Conf.E2EEPasswd && !Conf.Sync.UseDataRepo) {
|
if !IsSubscriber() || !Conf.Sync.Enabled || "" == Conf.Sync.CloudName {
|
||||||
if byHand {
|
if byHand {
|
||||||
if "" == Conf.Sync.CloudName {
|
if "" == Conf.Sync.CloudName {
|
||||||
util.PushMsg(Conf.Language(123), 5000)
|
util.PushMsg(Conf.Language(123), 5000)
|
||||||
} else if "" == Conf.E2EEPasswd {
|
|
||||||
util.PushMsg(Conf.Language(11), 5000)
|
|
||||||
} else if !Conf.Sync.Enabled {
|
} else if !Conf.Sync.Enabled {
|
||||||
util.PushMsg(Conf.Language(124), 5000)
|
util.PushMsg(Conf.Language(124), 5000)
|
||||||
}
|
}
|
||||||
|
|
@ -513,15 +511,6 @@ func SetSyncEnable(b bool) (err error) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func SetSyncUseDataRepo(b bool) (err error) {
|
|
||||||
syncLock.Lock()
|
|
||||||
defer syncLock.Unlock()
|
|
||||||
|
|
||||||
Conf.Sync.UseDataRepo = b
|
|
||||||
Conf.Save()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func SetSyncMode(mode int) (err error) {
|
func SetSyncMode(mode int) (err error) {
|
||||||
syncLock.Lock()
|
syncLock.Lock()
|
||||||
defer syncLock.Unlock()
|
defer syncLock.Unlock()
|
||||||
|
|
@ -1009,83 +998,6 @@ func calcUnchangedSyncList() (ret map[string]bool, removes []string, err error)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// calcUnchangedDataList 计算 sync 和 data 一致(没有修改过)的文件列表 unchangedDataList,并删除 sync 中不存在于 data 中的多余文件 removeList。
|
|
||||||
func calcUnchangedDataList(passwd string) (unchangedDataList map[string]bool, removeList map[string]bool, err error) {
|
|
||||||
syncDir := Conf.Sync.GetSaveDir()
|
|
||||||
meta := filepath.Join(syncDir, pathJSON)
|
|
||||||
if !gulu.File.IsExist(meta) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
data, err := os.ReadFile(meta)
|
|
||||||
if nil != err {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
data, err = encryption.AESGCMDecryptBinBytes(data, passwd)
|
|
||||||
if nil != err {
|
|
||||||
err = errors.New(Conf.Language(40))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
metaJSON := map[string]string{}
|
|
||||||
if err = gulu.JSON.UnmarshalJSON(data, &metaJSON); nil != err {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
unchangedDataList = map[string]bool{}
|
|
||||||
removeList = map[string]bool{}
|
|
||||||
filepath.Walk(syncDir, func(path string, info fs.FileInfo, _ error) error {
|
|
||||||
if syncDir == path || pathJSON == info.Name() || "index.json" == info.Name() || info.IsDir() {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
encryptedP := strings.TrimPrefix(path, syncDir+string(os.PathSeparator))
|
|
||||||
encryptedP = filepath.ToSlash(encryptedP)
|
|
||||||
decryptedP := metaJSON[encryptedP]
|
|
||||||
if "" == decryptedP {
|
|
||||||
removeList[path] = true
|
|
||||||
if gulu.File.IsDir(path) {
|
|
||||||
return filepath.SkipDir
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
dataP := filepath.Join(util.DataDir, decryptedP)
|
|
||||||
dataP = filepath.FromSlash(dataP)
|
|
||||||
if !gulu.File.IsExist(dataP) { // data 已经删除的文件
|
|
||||||
removeList[path] = true
|
|
||||||
if gulu.File.IsDir(path) {
|
|
||||||
return filepath.SkipDir
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
stat, _ := os.Stat(dataP)
|
|
||||||
dataModTime := stat.ModTime()
|
|
||||||
if info.ModTime() == dataModTime {
|
|
||||||
unchangedDataList[dataP] = true
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
})
|
|
||||||
|
|
||||||
tmp := map[string]bool{}
|
|
||||||
// 在 sync 中删除 data 中已经删除的文件
|
|
||||||
for remove, _ := range removeList {
|
|
||||||
if strings.HasSuffix(remove, "index.json") {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
p := strings.TrimPrefix(remove, syncDir)
|
|
||||||
p = filepath.ToSlash(p)
|
|
||||||
tmp[p] = true
|
|
||||||
|
|
||||||
if err = os.RemoveAll(remove); nil != err {
|
|
||||||
util.LogErrorf("remove [%s] failed: %s", remove, err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
removeList = tmp
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func getWorkspaceDataConf() (conf *filesys.DataConf, err error) {
|
func getWorkspaceDataConf() (conf *filesys.DataConf, err error) {
|
||||||
conf = &filesys.DataConf{Updated: util.CurrentTimeMillis(), Device: Conf.System.ID}
|
conf = &filesys.DataConf{Updated: util.CurrentTimeMillis(), Device: Conf.System.ID}
|
||||||
confPath := filepath.Join(Conf.Sync.GetSaveDir(), ".siyuan", "conf.json")
|
confPath := filepath.Join(Conf.Sync.GetSaveDir(), ".siyuan", "conf.json")
|
||||||
|
|
@ -1157,17 +1069,13 @@ func CreateCloudSyncDir(name string) (err error) {
|
||||||
return errors.New(Conf.Language(37))
|
return errors.New(Conf.Language(37))
|
||||||
}
|
}
|
||||||
|
|
||||||
if Conf.Sync.UseDataRepo {
|
var cloudInfo *dejavu.CloudInfo
|
||||||
var cloudInfo *dejavu.CloudInfo
|
cloudInfo, err = buildCloudInfo()
|
||||||
cloudInfo, err = buildCloudInfo()
|
if nil != err {
|
||||||
if nil != err {
|
return
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
err = dejavu.CreateCloudRepo(name, cloudInfo)
|
|
||||||
} else {
|
|
||||||
err = createCloudSyncDirOSS(name)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
err = dejavu.CreateCloudRepo(name, cloudInfo)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1376,28 +1284,8 @@ func GetSyncDirection(cloudDirName string) (code int, msg string) { // 0:失
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if Conf.Sync.UseDataRepo {
|
// TODO: 彻底移除方向判断
|
||||||
return 40, ""
|
return 40, ""
|
||||||
}
|
|
||||||
|
|
||||||
syncConf, err := getWorkspaceDataConf()
|
|
||||||
if nil != err {
|
|
||||||
msg = fmt.Sprintf(Conf.Language(80), formatErrorMsg(err))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
cloudSyncVer, err := getCloudSyncVer(cloudDirName)
|
|
||||||
if nil != err {
|
|
||||||
msg = fmt.Sprintf(Conf.Language(24), err.Error())
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if cloudSyncVer < syncConf.SyncVer {
|
|
||||||
return 10, fmt.Sprintf(Conf.Language(89), cloudDirName) // 上传
|
|
||||||
}
|
|
||||||
if cloudSyncVer > syncConf.SyncVer {
|
|
||||||
return 20, fmt.Sprintf(Conf.Language(90), cloudDirName) // 下载
|
|
||||||
}
|
|
||||||
return 30, fmt.Sprintf(Conf.Language(91), cloudDirName) // 一致
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func IncWorkspaceDataVer() {
|
func IncWorkspaceDataVer() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue