From da623bcd6d7d8384bf10edc25b1cc581989a4dd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=90=8C=E8=90=8C=E5=93=92=E8=B5=AB=E8=90=9D?= Date: Tue, 11 Jul 2023 20:18:44 -0700 Subject: [PATCH 1/8] :pencil: Docs: update README --- README.md | 3 ++- README_en.md | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 72ae152c..57f16762 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ PicList的内核使用的是原版PicGo-Core基础上修改的[PicList-core](htt ## 特色功能 - 保留了PicGo的所有功能,兼容已有的PicGo插件系统,包括和typora、obsidian等的搭配 -- 新增了对webdav上传,imgur账户上传等的支持 +- 新增了对webdav上传,imgur账户上传,本地文件夹上传等的支持 - 相册中可同步删除云端图片,同时新增了高级搜索和排序,批量修改URL等功能 - 内置水印添加、图片压缩、图片缩放、图片旋转和图片格式转换等功能,支持自定义配置,且可以通过CLI命令行调用 - 新增配置多端同步功能 @@ -91,6 +91,7 @@ MacOS: | 七牛云 | ✔️ | ✔️ | | S3 API兼容平台 | ✔️ | ✔️ | | WebDAV | ✔️ | ✔️ | +| 本地文件夹 | ✔️ | ✔️ | | 插件 | 相册云删除 | | :----------------------------------------------------------: | :--------: | diff --git a/README_en.md b/README_en.md index 82a4f083..31f0f8fe 100644 --- a/README_en.md +++ b/README_en.md @@ -31,7 +31,7 @@ if you want to use PicList-core, please go to [https://github.com/Kuingsmile/Pic ## Features - Maintain all the functions of PicGo, compatible with the existing PicGo plug-in system, including the combination with typora, obsidian and other software -- Add support for webdav upload, imgur account upload, etc. +- Add support for webdav upload, imgur account upload, local path upload, etc. - Synchronous cloud deletion of pictures in the album, advanced search and sorting features have been added, along with the ability to bulk modify URLs. - Built-in watermark addition, image compression, image scaling, image rotation and image format conversion functions, support custom configuration, and can be called through CLI command line - Add the configuration of multi-device synchronization function. @@ -93,6 +93,7 @@ Search and install `Image auto upload Plugin` in the community plugin, then ente | Qiniu | ✔️ | ✔️ | | S3 API compatible platform | ✔️ | ✔️ | | WebDAV | ✔️ | ✔️ | +| Local | ✔️ | ✔️ | | Plugin | Album cloud deletion | | :----------------------------------------------------------: | :------------------: | From 6a945031723f009c6d1e081a6a5faa29c934ad7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=90=8C=E8=90=8C=E5=93=92=E8=B5=AB=E8=90=9D?= Date: Wed, 12 Jul 2023 04:41:49 -0700 Subject: [PATCH 2/8] :sparkles: Feature: pictures uploaded using webdav and local path can be previewed in gallery now ISSUES CLOSED: #64 --- package.json | 2 +- src/main/fileServer/index.ts | 32 ++++++++++++++++++++++++++++++++ src/main/lifeCycle/index.ts | 2 ++ src/renderer/pages/Gallery.vue | 2 +- yarn.lock | 8 ++++---- 5 files changed, 40 insertions(+), 6 deletions(-) create mode 100644 src/main/fileServer/index.ts diff --git a/package.json b/package.json index c32e4250..9678f9cf 100644 --- a/package.json +++ b/package.json @@ -66,7 +66,7 @@ "mime-types": "^2.1.35", "mitt": "^3.0.0", "nodejs-file-downloader": "^4.12.1", - "piclist": "^0.7.4", + "piclist": "^0.7.6", "pinia": "^2.1.4", "pinia-plugin-persistedstate": "^3.1.0", "qiniu": "^7.8.0", diff --git a/src/main/fileServer/index.ts b/src/main/fileServer/index.ts new file mode 100644 index 00000000..34f9470e --- /dev/null +++ b/src/main/fileServer/index.ts @@ -0,0 +1,32 @@ +import http from 'http' +import fs from 'fs-extra' +import path from 'path' +import picgo from '@core/picgo' +import logger from '../apis/core/picgo/logger' + +export const imgFilePath = path.join(picgo.baseDir, 'imgTemp') +fs.ensureDirSync(imgFilePath) + +const serverPort = 36699 + +export function startFileServer () { + const server = http.createServer((req, res) => { + const requestPath = req.url?.split('?')[0] + const filePath = path.join(imgFilePath, requestPath!) + + fs.readFile(filePath, (err, data) => { + if (err) { + res.writeHead(404) + res.end('404 Not Found') + } else { + res.end(data) + } + }) + }) + + server.listen(serverPort, () => { + logger.info(`File server is running, http://localhost:${serverPort}`) + }).on('error', (err) => { + logger.error(err) + }) +} diff --git a/src/main/lifeCycle/index.ts b/src/main/lifeCycle/index.ts index 0899d5c3..c1c590e7 100644 --- a/src/main/lifeCycle/index.ts +++ b/src/main/lifeCycle/index.ts @@ -47,6 +47,7 @@ import clipboardPoll from '../utils/clipboardPoll' import path from 'path' import { CLIPBOARD_IMAGE_FOLDER } from '~/universal/utils/static' import fs from 'fs-extra' +import { startFileServer } from '../fileServer' const isDevelopment = process.env.NODE_ENV !== 'production' const handleStartUpFiles = (argv: string[], cwd: string) => { @@ -158,6 +159,7 @@ class LifeCycle { shortKeyHandler.init() }) server.startup() + startFileServer() if (process.env.NODE_ENV !== 'development') { handleStartUpFiles(process.argv, process.cwd()) } diff --git a/src/renderer/pages/Gallery.vue b/src/renderer/pages/Gallery.vue index f4af9d8d..9bab2e3f 100644 --- a/src/renderer/pages/Gallery.vue +++ b/src/renderer/pages/Gallery.vue @@ -242,7 +242,7 @@ @click="zoomImage(index)" > diff --git a/yarn.lock b/yarn.lock index a2af3256..3033b89a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -11054,10 +11054,10 @@ performance-now@^2.1.0: resolved "https://registry.npmmirror.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b" integrity sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow== -piclist@^0.7.4: - version "0.7.4" - resolved "https://registry.npmjs.org/piclist/-/piclist-0.7.4.tgz#125c9f337e2d7375ae0c5c17fafaf924134fd65f" - integrity sha512-PxE6S93uWP7sQNyMi6R7ZEs57oOXgm/nD14Moi0k0dbAlvtm1kWdrc4CboW/6e7hPVgeqT7pGi0+y0SF8iTxOA== +piclist@^0.7.6: + version "0.7.6" + resolved "https://registry.npmjs.org/piclist/-/piclist-0.7.6.tgz#93ac36f2f3fa067d014b4ff1e808bd6304fa29e3" + integrity sha512-aLoVhvl8A/Ez2I3T3rmqQ5MCBw6txTQ+5H0zGvgybEpHGpuTHct9MBplfJVj2eIyqwbbcWT24t5bkvaByma2gw== dependencies: "@picgo/i18n" "^1.0.0" "@picgo/store" "^2.0.4" From 58486a399772926e509339a8ca3fb811a370ddc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=90=8C=E8=90=8C=E5=93=92=E8=B5=AB=E8=90=9D?= Date: Wed, 12 Jul 2023 22:09:20 -0700 Subject: [PATCH 3/8] :bug: Fix: fix an issue related with yourls ISSUES CLOSED: #72 --- src/main/utils/common.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/utils/common.ts b/src/main/utils/common.ts index 99c1e06b..67450e3e 100644 --- a/src/main/utils/common.ts +++ b/src/main/utils/common.ts @@ -122,9 +122,12 @@ export const generateShortUrl = async (url: string) => { console.log(e) } } else if (server === 'yourls') { - const domain = db.get('settings.yourlsDomain') || '' + let domain = db.get('settings.yourlsDomain') || '' const signature = db.get('settings.yourlsSignature') || '' if (domain && signature) { + if (!/^https?:\/\//.test(domain)) { + domain = `http://${domain}` + } try { const res = await axios.get(`${domain}/yourls-api.php?signature=${signature}&action=shorturl&format=json&url=${url}`) if (res.data.shorturl) { From c1698e866123cf6a87b2f990047e82a414d6970c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=90=8C=E8=90=8C=E5=93=92=E8=B5=AB=E8=90=9D?= Date: Mon, 17 Jul 2023 23:54:50 -0700 Subject: [PATCH 4/8] :sparkles: Feature: add a new config item to close upload result notification ISSUES CLOSED: #74 --- public/i18n/en.yml | 1 + public/i18n/zh-CN.yml | 3 ++- public/i18n/zh-TW.yml | 1 + src/main/apis/app/system/index.ts | 19 +++++++++------ src/main/apis/app/uploader/apis.ts | 38 +++++++++++++++++------------ src/main/apis/gui/index.ts | 19 +++++++++------ src/main/events/ipcList.ts | 17 +++++++------ src/renderer/pages/PicGoSetting.vue | 18 ++++++++++++++ src/universal/types/i18n.d.ts | 1 + src/universal/types/view.d.ts | 1 + 10 files changed, 78 insertions(+), 40 deletions(-) diff --git a/public/i18n/en.yml b/public/i18n/en.yml index 6ffbf521..2d50bf96 100644 --- a/public/i18n/en.yml +++ b/public/i18n/en.yml @@ -172,6 +172,7 @@ SETTINGS_ADVANCED_RENAME: Advanced Rename SETTINGS_ADVANCED_RENAME_ENABLE: Enable Advanced Rename SETTINGS_ADVANCED_RENAME_FORMAT: Advanced Rename Format SETTINGS_OPEN_UPLOAD_TIPS: Open Upload Tips +SETTINGS_OPEN_UPLOAD_RESULT_TIPS: Open Upload Result Tips SETTINGS_MINI_WINDOW_ON_TOP: Mini Window On Top SETTINGS_AUTO_COPY_URL_AFTER_UPLOAD: Auto Copy URL After Upload SETTINGS_TIPS_PLACEHOLDER_URL: Use $url to represent url position diff --git a/public/i18n/zh-CN.yml b/public/i18n/zh-CN.yml index d32fe650..535255e6 100644 --- a/public/i18n/zh-CN.yml +++ b/public/i18n/zh-CN.yml @@ -173,7 +173,8 @@ SETTINGS_TIMESTAMP_RENAME: 时间戳重命名 SETTINGS_ADVANCED_RENAME: 高级重命名 SETTINGS_ADVANCED_RENAME_ENABLE: 开启高级重命名 SETTINGS_ADVANCED_RENAME_FORMAT: 重命名格式 -SETTINGS_OPEN_UPLOAD_TIPS: 开启上传提示 +SETTINGS_OPEN_UPLOAD_TIPS: 开启上传进度提示 +SETTINGS_OPEN_UPLOAD_RESULT_TIPS: 开启上传结果提示 SETTINGS_MINI_WINDOW_ON_TOP: Mini窗口置顶 SETTINGS_AUTO_COPY_URL_AFTER_UPLOAD: 上传后自动复制URL SETTINGS_TIPS_PLACEHOLDER_URL: 用占位符 $url 来表示url的位置 diff --git a/public/i18n/zh-TW.yml b/public/i18n/zh-TW.yml index 046a63ec..b259bab9 100644 --- a/public/i18n/zh-TW.yml +++ b/public/i18n/zh-TW.yml @@ -172,6 +172,7 @@ SETTINGS_ADVANCED_RENAME: 高級命名 SETTINGS_ADVANCED_RENAME_ENABLE: 啟用高級命名 SETTINGS_ADVANCED_RENAME_FORMAT: 高級命名格式 SETTINGS_OPEN_UPLOAD_TIPS: 開啟上傳提示 +SETTINGS_OPEN_UPLOAD_RESULT_TIPS: 開啟上傳結果提示 SETTINGS_MINI_WINDOW_ON_TOP: Mini視窗置頂 SETTINGS_AUTO_COPY_URL_AFTER_UPLOAD: 上傳後自動複製URL SETTINGS_TIPS_PLACEHOLDER_URL: 用佔位符 $url 來表示URL的位置 diff --git a/src/main/apis/app/system/index.ts b/src/main/apis/app/system/index.ts index 85d57090..a44e38c9 100644 --- a/src/main/apis/app/system/index.ts +++ b/src/main/apis/app/system/index.ts @@ -392,14 +392,17 @@ export function createTray () { await fs.remove(rawInput[i]) } pasteText.push(await (pasteTemplate(pasteStyle, imgs[i], db.get('settings.customLink')))) - const notification = new Notification({ - title: T('UPLOAD_SUCCEED'), - body: imgs[i].imgUrl! - // icon: files[i] - }) - setTimeout(() => { - notification.show() - }, i * 100) + const isShowResultNotification = db.get('settings.uploadResultNotification') === undefined ? true : !!db.get('settings.uploadResultNotification') + if (isShowResultNotification) { + const notification = new Notification({ + title: T('UPLOAD_SUCCEED'), + body: imgs[i].imgUrl! + // icon: files[i] + }) + setTimeout(() => { + notification.show() + }, i * 100) + } await GalleryDB.getInstance().insert(imgs[i]) } handleCopyUrl(pasteText.join('\n')) diff --git a/src/main/apis/app/uploader/apis.ts b/src/main/apis/app/uploader/apis.ts index 64944560..e8a600e8 100644 --- a/src/main/apis/app/uploader/apis.ts +++ b/src/main/apis/app/uploader/apis.ts @@ -32,14 +32,17 @@ export const uploadClipboardFiles = async (): Promise => { const trayWindow = windowManager.get(IWindowList.TRAY_WINDOW) const pasteStyle = db.get('settings.pasteStyle') || 'markdown' handleCopyUrl(await (pasteTemplate(pasteStyle, img[0], db.get('settings.customLink')))) - const notification = new Notification({ - title: T('UPLOAD_SUCCEED'), - body: img[0].imgUrl! - // icon: img[0].imgUrl - }) - setTimeout(() => { - notification.show() - }, 100) + const isShowResultNotification = db.get('settings.uploadResultNotification') === undefined ? true : !!db.get('settings.uploadResultNotification') + if (isShowResultNotification) { + const notification = new Notification({ + title: T('UPLOAD_SUCCEED'), + body: img[0].imgUrl! + // icon: img[0].imgUrl + }) + setTimeout(() => { + notification.show() + }, 100) + } await GalleryDB.getInstance().insert(img[0]) // trayWindow just be created in mac/windows, not in linux trayWindow?.webContents?.send('clipboardFiles', []) @@ -88,14 +91,17 @@ export const uploadChoosedFiles = async (webContents: WebContents, files: IFileW }) } pasteText.push(await (pasteTemplate(pasteStyle, imgs[i], db.get('settings.customLink')))) - const notification = new Notification({ - title: T('UPLOAD_SUCCEED'), - body: imgs[i].imgUrl! - // icon: files[i].path - }) - setTimeout(() => { - notification.show() - }, i * 100) + const isShowResultNotification = db.get('settings.uploadResultNotification') === undefined ? true : !!db.get('settings.uploadResultNotification') + if (isShowResultNotification) { + const notification = new Notification({ + title: T('UPLOAD_SUCCEED'), + body: imgs[i].imgUrl! + // icon: files[i].path + }) + setTimeout(() => { + notification.show() + }, i * 100) + } await GalleryDB.getInstance().insert(imgs[i]) result.push({ url: handleUrlEncodeWithSetting(imgs[i].imgUrl!), diff --git a/src/main/apis/gui/index.ts b/src/main/apis/gui/index.ts index b3aad3e3..2ae2c47c 100644 --- a/src/main/apis/gui/index.ts +++ b/src/main/apis/gui/index.ts @@ -89,14 +89,17 @@ class GuiApi implements IGuiApi { await fs.remove(rawInput[i]) } pasteText.push(await (pasteTemplate(pasteStyle, imgs[i], db.get('settings.customLink')))) - const notification = new Notification({ - title: T('UPLOAD_SUCCEED'), - body: imgs[i].imgUrl as string - // icon: imgs[i].imgUrl - }) - setTimeout(() => { - notification.show() - }, i * 100) + const isShowResultNotification = db.get('settings.uploadResultNotification') === undefined ? true : !!db.get('settings.uploadResultNotification') + if (isShowResultNotification) { + const notification = new Notification({ + title: T('UPLOAD_SUCCEED'), + body: imgs[i].imgUrl as string + // icon: imgs[i].imgUrl + }) + setTimeout(() => { + notification.show() + }, i * 100) + } await GalleryDB.getInstance().insert(imgs[i]) } handleCopyUrl(pasteText.join('\n')) diff --git a/src/main/events/ipcList.ts b/src/main/events/ipcList.ts index 3cf1b7d7..590b7900 100644 --- a/src/main/events/ipcList.ts +++ b/src/main/events/ipcList.ts @@ -58,13 +58,16 @@ export default { if (img !== false) { const pasteStyle = db.get('settings.pasteStyle') || 'markdown' handleCopyUrl(await (pasteTemplate(pasteStyle, img[0], db.get('settings.customLink')))) - const notification = new Notification({ - title: T('UPLOAD_SUCCEED'), - body: img[0].imgUrl! - // icon: file[0] - // icon: img[0].imgUrl - }) - notification.show() + const isShowResultNotification = db.get('settings.uploadResultNotification') === undefined ? true : !!db.get('settings.uploadResultNotification') + if (isShowResultNotification) { + const notification = new Notification({ + title: T('UPLOAD_SUCCEED'), + body: img[0].imgUrl! + // icon: file[0] + // icon: img[0].imgUrl + }) + notification.show() + } await GalleryDB.getInstance().insert(img[0]) trayWindow.webContents.send('clipboardFiles', []) if (windowManager.has(IWindowList.SETTING_WINDOW)) { diff --git a/src/renderer/pages/PicGoSetting.vue b/src/renderer/pages/PicGoSetting.vue index 2e56357d..b4a00796 100644 --- a/src/renderer/pages/PicGoSetting.vue +++ b/src/renderer/pages/PicGoSetting.vue @@ -287,6 +287,16 @@ @change="handleUploadNotification" /> + + + @@ -1527,6 +1537,7 @@ const form = reactive({ rename: false, autoRename: false, uploadNotification: false, + uploadResultNotification: true, miniWindowOntop: false, logLevel: ['all'], autoCopyUrl: true, @@ -1680,6 +1691,7 @@ async function initData () { form.rename = settings.rename || false form.autoRename = settings.autoRename || false form.uploadNotification = settings.uploadNotification || false + form.uploadResultNotification = settings.uploadResultNotification === undefined ? true : settings.uploadResultNotification form.miniWindowOntop = settings.miniWindowOntop || false form.logLevel = initLogLevel(settings.logLevel || []) form.autoCopyUrl = settings.autoCopy === undefined ? true : settings.autoCopy @@ -1952,6 +1964,12 @@ function handleUploadNotification (val: ICheckBoxValueType) { }) } +function handleUploadResultNotification (val: ICheckBoxValueType) { + saveConfig({ + 'settings.uploadResultNotification': val + }) +} + async function cancelWindowSize () { mainWindowSizeVisible.value = false mainWindowWidth.value = await getConfig('settings.mainWindowWidth') || 1200 diff --git a/src/universal/types/i18n.d.ts b/src/universal/types/i18n.d.ts index 78f3ad74..2ec48b9d 100644 --- a/src/universal/types/i18n.d.ts +++ b/src/universal/types/i18n.d.ts @@ -167,6 +167,7 @@ interface ILocales { SETTINGS_ADVANCED_RENAME_ENABLE: string SETTINGS_ADVANCED_RENAME_FORMAT: string SETTINGS_OPEN_UPLOAD_TIPS: string + SETTINGS_OPEN_UPLOAD_RESULT_TIPS: string SETTINGS_MINI_WINDOW_ON_TOP: string SETTINGS_AUTO_COPY_URL_AFTER_UPLOAD: string SETTINGS_TIPS_PLACEHOLDER_URL: string diff --git a/src/universal/types/view.d.ts b/src/universal/types/view.d.ts index 987bed65..ffe25155 100644 --- a/src/universal/types/view.d.ts +++ b/src/universal/types/view.d.ts @@ -5,6 +5,7 @@ interface ISettingForm { rename: boolean autoRename: boolean uploadNotification: boolean + uploadResultNotification: boolean miniWindowOntop: boolean logLevel: string[] autoCopyUrl: boolean From 48b13b20fec99d59886280f9fd938dd3ff198ba3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=90=8C=E8=90=8C=E5=93=92=E8=B5=AB=E8=90=9D?= Date: Tue, 18 Jul 2023 00:03:59 -0700 Subject: [PATCH 5/8] :bug: Fix: fix a bug of file server when the request path is url encoded --- src/main/fileServer/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/fileServer/index.ts b/src/main/fileServer/index.ts index 34f9470e..341a86de 100644 --- a/src/main/fileServer/index.ts +++ b/src/main/fileServer/index.ts @@ -12,7 +12,7 @@ const serverPort = 36699 export function startFileServer () { const server = http.createServer((req, res) => { const requestPath = req.url?.split('?')[0] - const filePath = path.join(imgFilePath, requestPath!) + const filePath = path.join(imgFilePath, decodeURIComponent(requestPath as string)) fs.readFile(filePath, (err, data) => { if (err) { From 1e0bb25d7398e2a13bd1462d5e046daafc53066b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=90=8C=E8=90=8C=E5=93=92=E8=B5=AB=E8=90=9D?= Date: Tue, 18 Jul 2023 00:14:58 -0700 Subject: [PATCH 6/8] :arrow_up: Upgrade: upgrade dependencies --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 9678f9cf..640c5ec4 100644 --- a/package.json +++ b/package.json @@ -51,7 +51,7 @@ "cos-nodejs-sdk-v5": "^2.12.1", "dexie": "^3.2.4", "electron-updater": "^6.1.1", - "element-plus": "^2.3.7", + "element-plus": "^2.3.8", "epipebomb": "^1.0.0", "fast-xml-parser": "^4.2.5", "form-data": "^4.0.0", diff --git a/yarn.lock b/yarn.lock index 3033b89a..c80d6d99 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6732,10 +6732,10 @@ electron@^22.0.2: "@types/node" "^16.11.26" extract-zip "^2.0.1" -element-plus@^2.3.7: - version "2.3.7" - resolved "https://registry.npmjs.org/element-plus/-/element-plus-2.3.7.tgz#544a127f0e65f51715e3b24ec3ebf545c46859cd" - integrity sha512-h6TxclbaLUJxg/Bv5j/ZKsK+K5yadQliw5+R30HWyE69pXlqXTX24oYx+yw3pA4Dy+lqEDi5501FQ0CORk3OSA== +element-plus@^2.3.8: + version "2.3.8" + resolved "https://registry.npmjs.org/element-plus/-/element-plus-2.3.8.tgz#46032abe1a712abfb65932f146ee19281312a9cf" + integrity sha512-yHQR0/tG2LvPkpGUt7Te/hPmP2XW/BytBNUbx+EFO54VnGCOE3upmQcVffNp1PLgwg9sthYDXontUWpnpmLPJw== dependencies: "@ctrl/tinycolor" "^3.4.1" "@element-plus/icons-vue" "^2.0.6" From 2eff77221e59f99f1580a9cc0eba775cec019f83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=90=8C=E8=90=8C=E5=93=92=E8=B5=AB=E8=90=9D?= Date: Wed, 19 Jul 2023 22:57:07 -0700 Subject: [PATCH 7/8] :sparkles: Feature: add two new config items to control mini window and main window --- public/i18n/en.yml | 2 ++ public/i18n/zh-CN.yml | 2 ++ public/i18n/zh-TW.yml | 2 ++ src/main/apis/app/system/index.ts | 28 ++++++++++++++++++++++++ src/main/events/ipcList.ts | 6 +++++ src/main/events/remotes/menu.ts | 6 +++++ src/renderer/pages/PicGoSetting.vue | 34 +++++++++++++++++++++++++++++ src/universal/types/i18n.d.ts | 2 ++ src/universal/types/view.d.ts | 2 ++ 9 files changed, 84 insertions(+) diff --git a/public/i18n/en.yml b/public/i18n/en.yml index 2d50bf96..5d474012 100644 --- a/public/i18n/en.yml +++ b/public/i18n/en.yml @@ -164,6 +164,8 @@ SETTINGS_CHECK_UPDATE: Check Update SETTINGS_OPEN_UPDATE_HELPER: Open Update Helper SETTINGS_OPEN: Open SETTINGS_CLOSE: Close +SETTINGS_CLOSE_MINI_WINDOW_SYNC: Close Mini Window When open Main Window +SETTINGS_CLOSE_MAIN_WINDOW_SYNC: Close Main Window When open Mini Window SETTINGS_ACCEPT_BETA_UPDATE: Accept Beta Update SETTINGS_LAUNCH_ON_BOOT: Launch On Boot SETTINGS_RENAME_BEFORE_UPLOAD: Rename Before Upload diff --git a/public/i18n/zh-CN.yml b/public/i18n/zh-CN.yml index 535255e6..995b71e3 100644 --- a/public/i18n/zh-CN.yml +++ b/public/i18n/zh-CN.yml @@ -166,6 +166,8 @@ SETTINGS_CHECK_UPDATE: 检查更新 SETTINGS_OPEN_UPDATE_HELPER: 打开更新助手 SETTINGS_OPEN: 开 SETTINGS_CLOSE: 关 +SETTINGS_CLOSE_MINI_WINDOW_SYNC: 打开主窗口时关闭mini窗口 +SETTINGS_CLOSE_MAIN_WINDOW_SYNC: 打开mini窗口时关闭主窗口 SETTINGS_ACCEPT_BETA_UPDATE: 接受Beta版本更新 SETTINGS_LAUNCH_ON_BOOT: 开机自启 SETTINGS_RENAME_BEFORE_UPLOAD: 上传前重命名 diff --git a/public/i18n/zh-TW.yml b/public/i18n/zh-TW.yml index b259bab9..d2bc9045 100644 --- a/public/i18n/zh-TW.yml +++ b/public/i18n/zh-TW.yml @@ -164,6 +164,8 @@ SETTINGS_CHECK_UPDATE: 檢查更新 SETTINGS_OPEN_UPDATE_HELPER: 打開更新助手 SETTINGS_OPEN: 開 SETTINGS_CLOSE: 關 +SETTINGS_CLOSE_MINI_WINDOW_SYNC: 開主窗口同步關閉mini窗口 +SETTINGS_CLOSE_MAIN_WINDOW_SYNC: 關mini窗口同步關閉主窗口 SETTINGS_ACCEPT_BETA_UPDATE: 接受Beta版本更新 SETTINGS_LAUNCH_ON_BOOT: 開機時啟動 SETTINGS_RENAME_BEFORE_UPLOAD: 上傳前重新命名 diff --git a/src/main/apis/app/system/index.ts b/src/main/apis/app/system/index.ts index a44e38c9..65d11564 100644 --- a/src/main/apis/app/system/index.ts +++ b/src/main/apis/app/system/index.ts @@ -28,6 +28,7 @@ let tray: Tray | null export function setDockMenu () { const isListeningClipboard = db.get('settings.isListeningClipboard') || false + const autoCloseMiniWindow = db.get('settings.autoCloseMiniWindow') || false const dockMenu = Menu.buildFromTemplate([ { label: T('OPEN_MAIN_WINDOW'), @@ -35,6 +36,9 @@ export function setDockMenu () { const settingWindow = windowManager.get(IWindowList.SETTING_WINDOW) settingWindow!.show() settingWindow!.focus() + if (windowManager.has(IWindowList.MINI_WINDOW) && autoCloseMiniWindow) { + windowManager.get(IWindowList.MINI_WINDOW)!.hide() + } } }, { @@ -74,8 +78,12 @@ export function createMenu () { label: T('OPEN_MAIN_WINDOW'), click () { const settingWindow = windowManager.get(IWindowList.SETTING_WINDOW) + const autoCloseMiniWindow = db.get('settings.autoCloseMiniWindow') || false settingWindow!.show() settingWindow!.focus() + if (windowManager.has(IWindowList.MINI_WINDOW) && autoCloseMiniWindow) { + windowManager.get(IWindowList.MINI_WINDOW)!.hide() + } } }, { @@ -135,8 +143,12 @@ export function createContextMenu () { label: T('OPEN_MAIN_WINDOW'), click () { const settingWindow = windowManager.get(IWindowList.SETTING_WINDOW) + const autoCloseMiniWindow = db.get('settings.autoCloseMiniWindow') || false settingWindow!.show() settingWindow!.focus() + if (windowManager.has(IWindowList.MINI_WINDOW) && autoCloseMiniWindow) { + windowManager.get(IWindowList.MINI_WINDOW)!.hide() + } } }, { @@ -206,6 +218,10 @@ export function createContextMenu () { miniWindow.on('move', setPositionFunc) miniWindow.show() miniWindow.focus() + const autoCloseMainWindow = db.get('settings.autoCloseMainWindow') || false + if (windowManager.has(IWindowList.SETTING_WINDOW) && autoCloseMainWindow) { + windowManager.get(IWindowList.SETTING_WINDOW)!.hide() + } } } ) @@ -224,8 +240,12 @@ export function createContextMenu () { label: T('OPEN_MAIN_WINDOW'), click () { const settingWindow = windowManager.get(IWindowList.SETTING_WINDOW) + const autoCloseMiniWindow = db.get('settings.autoCloseMiniWindow') || false settingWindow!.show() settingWindow!.focus() + if (windowManager.has(IWindowList.MINI_WINDOW) && autoCloseMiniWindow) { + windowManager.get(IWindowList.MINI_WINDOW)!.hide() + } } }, { @@ -251,6 +271,10 @@ export function createContextMenu () { miniWindow.on('move', setPositionFunc) miniWindow.show() miniWindow.focus() + const autoCloseMainWindow = db.get('settings.autoCloseMainWindow') || false + if (windowManager.has(IWindowList.SETTING_WINDOW) && autoCloseMainWindow) { + windowManager.get(IWindowList.SETTING_WINDOW)!.hide() + } } }, { @@ -358,8 +382,12 @@ export function createTray () { windowManager.get(IWindowList.TRAY_WINDOW)!.hide() } const settingWindow = windowManager.get(IWindowList.SETTING_WINDOW) + const autoCloseMiniWindow = db.get('settings.autoCloseMiniWindow') || false settingWindow!.show() settingWindow!.focus() + if (windowManager.has(IWindowList.MINI_WINDOW) && autoCloseMiniWindow) { + windowManager.get(IWindowList.MINI_WINDOW)!.hide() + } } }) diff --git a/src/main/events/ipcList.ts b/src/main/events/ipcList.ts index 590b7900..32000f7b 100644 --- a/src/main/events/ipcList.ts +++ b/src/main/events/ipcList.ts @@ -214,6 +214,12 @@ export default { ipcMain.on('openSettingWindow', () => { windowManager.get(IWindowList.SETTING_WINDOW)!.show() + const autoCloseMiniWindow = db.get('settings.autoCloseMiniWindow') || false + if (autoCloseMiniWindow) { + if (windowManager.has(IWindowList.MINI_WINDOW)) { + windowManager.get(IWindowList.MINI_WINDOW)!.hide() + } + } }) ipcMain.on('openMiniWindow', () => { diff --git a/src/main/events/remotes/menu.ts b/src/main/events/remotes/menu.ts index 93fb16e4..52da2b4d 100644 --- a/src/main/events/remotes/menu.ts +++ b/src/main/events/remotes/menu.ts @@ -30,6 +30,12 @@ const buildMiniPageMenu = () => { label: T('OPEN_MAIN_WINDOW'), click () { windowManager.get(IWindowList.SETTING_WINDOW)!.show() + const autoCloseMiniWindow = db.get('settings.autoCloseMiniWindow') || false + if (autoCloseMiniWindow) { + if (windowManager.has(IWindowList.MINI_WINDOW)) { + windowManager.get(IWindowList.MINI_WINDOW)!.hide() + } + } } }, { diff --git a/src/renderer/pages/PicGoSetting.vue b/src/renderer/pages/PicGoSetting.vue index b4a00796..30ed00f9 100644 --- a/src/renderer/pages/PicGoSetting.vue +++ b/src/renderer/pages/PicGoSetting.vue @@ -110,6 +110,28 @@ {{ $T('SETTINGS_CLICK_TO_SET') }} + + + + + + ({ uploadNotification: false, uploadResultNotification: true, miniWindowOntop: false, + autoCloseMiniWindow: false, + autoCloseMainWindow: false, logLevel: ['all'], autoCopyUrl: true, checkBetaUpdate: true, @@ -1693,6 +1717,8 @@ async function initData () { form.uploadNotification = settings.uploadNotification || false form.uploadResultNotification = settings.uploadResultNotification === undefined ? true : settings.uploadResultNotification form.miniWindowOntop = settings.miniWindowOntop || false + form.autoCloseMiniWindow = settings.autoCloseMiniWindow || false + form.autoCloseMainWindow = settings.autoCloseMainWindow || false form.logLevel = initLogLevel(settings.logLevel || []) form.autoCopyUrl = settings.autoCopy === undefined ? true : settings.autoCopy form.checkBetaUpdate = settings.checkBetaUpdate === undefined ? true : settings.checkBetaUpdate @@ -1993,6 +2019,14 @@ async function confirmWindowSize () { } } +function handleAutoCloseMainWindowChange (val: ICheckBoxValueType) { + saveConfig('settings.autoCloseMainWindow', val) +} + +function handleAutoCloseMiniWindowChange (val: ICheckBoxValueType) { + saveConfig('settings.autoCloseMiniWindow', val) +} + function handleMiniWindowOntop (val: ICheckBoxValueType) { saveConfig('settings.miniWindowOntop', val) $message.info($T('TIPS_NEED_RELOAD')) diff --git a/src/universal/types/i18n.d.ts b/src/universal/types/i18n.d.ts index 2ec48b9d..a33d9a22 100644 --- a/src/universal/types/i18n.d.ts +++ b/src/universal/types/i18n.d.ts @@ -159,6 +159,8 @@ interface ILocales { SETTINGS_OPEN_UPDATE_HELPER: string SETTINGS_OPEN: string SETTINGS_CLOSE: string + SETTINGS_CLOSE_MINI_WINDOW_SYNC: string + SETTINGS_CLOSE_MAIN_WINDOW_SYNC: string SETTINGS_ACCEPT_BETA_UPDATE: string SETTINGS_LAUNCH_ON_BOOT: string SETTINGS_RENAME_BEFORE_UPLOAD: string diff --git a/src/universal/types/view.d.ts b/src/universal/types/view.d.ts index ffe25155..70c690b2 100644 --- a/src/universal/types/view.d.ts +++ b/src/universal/types/view.d.ts @@ -7,6 +7,8 @@ interface ISettingForm { uploadNotification: boolean uploadResultNotification: boolean miniWindowOntop: boolean + autoCloseMiniWindow: boolean + autoCloseMainWindow: boolean logLevel: string[] autoCopyUrl: boolean checkBetaUpdate: boolean From bbe4ef709a5feadb31050f0ca6a7e53f03d3d69a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=90=8C=E8=90=8C=E5=93=92=E8=B5=AB=E8=90=9D?= Date: Wed, 19 Jul 2023 23:03:56 -0700 Subject: [PATCH 8/8] :tada: Release: v1.9.8 --- CHANGELOG.md | 17 +++++++++++++++++ package.json | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9cccdb6e..b9399d8b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,20 @@ +## :tada: 1.9.8 (2023-07-20) + + +### :sparkles: Features + +* add a new config item to close upload result notification ([c1698e8](https://github.com/Kuingsmile/PicList/commit/c1698e8)), closes [#74](https://github.com/Kuingsmile/PicList/issues/74) +* add two new config items to control mini window and main window ([2eff772](https://github.com/Kuingsmile/PicList/commit/2eff772)) +* pictures uploaded using webdav and local path can be previewed in gallery now ([6a94503](https://github.com/Kuingsmile/PicList/commit/6a94503)), closes [#64](https://github.com/Kuingsmile/PicList/issues/64) + + +### :bug: Bug Fixes + +* fix a bug of file server when the request path is url encoded ([48b13b2](https://github.com/Kuingsmile/PicList/commit/48b13b2)) +* fix an issue related with yourls ([58486a3](https://github.com/Kuingsmile/PicList/commit/58486a3)), closes [#72](https://github.com/Kuingsmile/PicList/issues/72) + + + ## :tada: 1.9.7 (2023-07-12) diff --git a/package.json b/package.json index 640c5ec4..f952cf2f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "piclist", - "version": "1.9.7", + "version": "1.9.8", "author": { "name": "Kuingsmile", "email": "pkukuing@gmail.com"