mirror of
https://github.com/Kuingsmile/PicList.git
synced 2026-05-06 20:42:57 +08:00
🐛 Fix(custom): fix webdav backup bug for custom path close #347
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
LANG_DISPLAY_LABEL: 'English'
|
||||
ABOUT: About
|
||||
OPEN_MAIN_WINDOW: Open Main Window
|
||||
OPEN_MINI_WINDOW: Open Mini Window
|
||||
@@ -8,6 +9,7 @@ UPLOAD_FAILED: Upload Failed
|
||||
UPLOAD_SUCCEED: Upload Succeed
|
||||
UPLOAD_PROGRESS: Upload Progress
|
||||
OPERATION_SUCCEED: Operation Succeed
|
||||
OPERATION_FAILED: Operation Failed
|
||||
UPLOADING: Uploading
|
||||
QUICK_UPLOAD: Quick Upload
|
||||
UPLOAD_BY_CLIPBOARD: Upload by Clipboard
|
||||
@@ -924,6 +926,8 @@ TIPS_UPLOAD_NOT_PICTURES: The latest clipboard item is not a picture
|
||||
TIPS_PICGO_CONFIG_FILE_BROKEN_WITH_DEFAULT: PicList config file broken, has been restored to default
|
||||
TIPS_PICGO_CONFIG_FILE_BROKEN_WITH_BACKUP: PicList config file broken, has been restored to backup
|
||||
TIPS_PICGO_BACKUP_FILE_VERSION: 'Backup file version: ${v}'
|
||||
TIPS_SHORTCUT_MODIFIED_SUCCEED: Shortcut modified successfully
|
||||
TIPS_SHORTCUT_MODIFIED_CONFLICT: Shortcut conflict, please reset
|
||||
TIPS_CUSTOM_CONFIG_FILE_PATH_ERROR: Custom config file parse error, please check the path content
|
||||
TIPS_FIND_NEW_VERSION: Find new version ${v}, update many new features, do you want to download the latest version in the background?
|
||||
UPDATE_DOWNLOADED: Update downloaded
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
LANG_DISPLAY_LABEL: 中文
|
||||
ABOUT: 关于
|
||||
OPEN_MAIN_WINDOW: 打开主窗口
|
||||
OPEN_MINI_WINDOW: 打开mini窗口
|
||||
@@ -8,6 +9,7 @@ UPLOAD_SUCCEED: 上传成功
|
||||
UPLOAD_FAILED: 上传失败
|
||||
UPLOAD_PROGRESS: 上传进度
|
||||
OPERATION_SUCCEED: 操作成功
|
||||
OPERATION_FAILED: 操作失败
|
||||
UPLOADING: 正在上传
|
||||
QUICK_UPLOAD: 快捷上传
|
||||
UPLOAD_BY_CLIPBOARD: 剪贴板图片上传
|
||||
@@ -924,6 +926,8 @@ TIPS_UPLOAD_NOT_PICTURES: 剪贴板最新的一条记录不是图片
|
||||
TIPS_PICGO_CONFIG_FILE_BROKEN_WITH_DEFAULT: PicList 配置文件损坏,已经恢复为默认配置
|
||||
TIPS_PICGO_CONFIG_FILE_BROKEN_WITH_BACKUP: PicList 配置文件损坏,已经恢复为备份配置
|
||||
TIPS_PICGO_BACKUP_FILE_VERSION: '备份文件版本: ${v}'
|
||||
TIPS_SHORTCUT_MODIFIED_SUCCEED: 快捷键已经修改成功
|
||||
TIPS_SHORTCUT_MODIFIED_CONFLICT: 快捷键冲突,请重新设置
|
||||
TIPS_CUSTOM_CONFIG_FILE_PATH_ERROR: 自定义文件解析出错,请检查路径内容是否正确
|
||||
TIPS_FIND_NEW_VERSION: 发现新版本${v},更新了很多功能,是否后台下载最新的版本?
|
||||
UPDATE_DOWNLOADED: 更新已下载
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
LANG_DISPLAY_LABEL: 繁體中文
|
||||
ABOUT: 關於
|
||||
OPEN_MAIN_WINDOW: 打開主視窗
|
||||
OPEN_MINI_WINDOW: 打開mini視窗
|
||||
@@ -8,6 +9,7 @@ UPLOAD_SUCCEED: 上傳成功
|
||||
UPLOAD_FAILED: 上傳失敗
|
||||
UPLOAD_PROGRESS: 上傳進度
|
||||
OPERATION_SUCCEED: 操作成功
|
||||
OPERATION_FAILED: 操作失敗
|
||||
UPLOADING: 正在上傳
|
||||
QUICK_UPLOAD: 快速上傳
|
||||
UPLOAD_BY_CLIPBOARD: 剪貼簿圖片上傳
|
||||
@@ -924,6 +926,8 @@ TIPS_UPLOAD_NOT_PICTURES: 剪貼簿最新的一條記錄不是圖片
|
||||
TIPS_PICGO_CONFIG_FILE_BROKEN_WITH_DEFAULT: PicList設定檔案已損壞,已經恢復為預設設定
|
||||
TIPS_PICGO_CONFIG_FILE_BROKEN_WITH_BACKUP: PicList 設定檔案已損壞,已經恢復為備份設定
|
||||
TIPS_PICGO_BACKUP_FILE_VERSION: '備份檔案版本: ${v}'
|
||||
TIPS_SHORTCUT_MODIFIED_SUCCEED: 快捷鍵已經修改成功
|
||||
TIPS_SHORTCUT_MODIFIED_CONFLICT: 快捷鍵衝突,請重新設定
|
||||
TIPS_CUSTOM_CONFIG_FILE_PATH_ERROR: 自訂設定檔案解析出錯,請檢查路徑內容是否正確
|
||||
TIPS_FIND_NEW_VERSION: 發現新版本${v},更新了很多功能,是否後台下載最新的版本?
|
||||
UPDATE_DOWNLOADED: 更新已下載
|
||||
|
||||
@@ -141,7 +141,15 @@ async function uploadLocalToRemote(syncConfig: ISyncConfig, fileName: string) {
|
||||
}
|
||||
const client = createClient(webdavEndpointF, options)
|
||||
const fileContent = fs.readFileSync(localFilePath)
|
||||
const remoteFilePath = webdavSavePath ? path.join(webdavSavePath, fileName) : fileName
|
||||
const remoteFilePath = webdavSavePath
|
||||
? `${webdavSavePath}/${fileName}`.replace(/^\/+|\/+$/g, '').replace(/\/\/+/g, '/')
|
||||
: fileName
|
||||
console.log('remoteFilePath', remoteFilePath)
|
||||
const remoteDir = path.dirname(remoteFilePath)
|
||||
console.log('remoteDir', remoteDir)
|
||||
if (remoteDir !== '/') {
|
||||
await client.createDirectory(remoteDir, { recursive: true })
|
||||
}
|
||||
await client.putFileContents(remoteFilePath, fileContent, { overwrite: true })
|
||||
return true
|
||||
}
|
||||
@@ -255,7 +263,13 @@ async function updateLocalToRemote(syncConfig: ISyncConfig, fileName: string) {
|
||||
}
|
||||
const client = createClient(webdavEndpointF, options)
|
||||
const fileContent = fs.readFileSync(localFilePath)
|
||||
const remoteFilePath = webdavSavePath ? path.join(webdavSavePath, fileName) : fileName
|
||||
const remoteFilePath = webdavSavePath
|
||||
? `${webdavSavePath}/${fileName}`.replace(/^\/+|\/+$/g, '').replace(/\/\/+/g, '/')
|
||||
: fileName
|
||||
const remoteDir = path.dirname(remoteFilePath)
|
||||
if (remoteDir !== '/') {
|
||||
await client.createDirectory(remoteDir, { recursive: true })
|
||||
}
|
||||
await client.putFileContents(remoteFilePath, fileContent, { overwrite: true })
|
||||
return true
|
||||
}
|
||||
|
||||
4
src/universal/types/i18n.d.ts
vendored
4
src/universal/types/i18n.d.ts
vendored
@@ -1,4 +1,5 @@
|
||||
interface ILocales {
|
||||
LANG_DISPLAY_LABEL: string
|
||||
ABOUT: string
|
||||
OPEN_MAIN_WINDOW: string
|
||||
OPEN_MINI_WINDOW: string
|
||||
@@ -9,6 +10,7 @@ interface ILocales {
|
||||
UPLOAD_FAILED: string
|
||||
UPLOAD_PROGRESS: string
|
||||
OPERATION_SUCCEED: string
|
||||
OPERATION_FAILED: string
|
||||
UPLOADING: string
|
||||
QUICK_UPLOAD: string
|
||||
UPLOAD_BY_CLIPBOARD: string
|
||||
@@ -925,6 +927,8 @@ interface ILocales {
|
||||
TIPS_PICGO_CONFIG_FILE_BROKEN_WITH_DEFAULT: string
|
||||
TIPS_PICGO_CONFIG_FILE_BROKEN_WITH_BACKUP: string
|
||||
TIPS_PICGO_BACKUP_FILE_VERSION: string
|
||||
TIPS_SHORTCUT_MODIFIED_SUCCEED: string
|
||||
TIPS_SHORTCUT_MODIFIED_CONFLICT: string
|
||||
TIPS_CUSTOM_CONFIG_FILE_PATH_ERROR: string
|
||||
TIPS_FIND_NEW_VERSION: string
|
||||
UPDATE_DOWNLOADED: string
|
||||
|
||||
Reference in New Issue
Block a user