mirror of
https://github.com/Kuingsmile/PicList.git
synced 2026-05-06 20:42:57 +08:00
✨ Feature(custom): rewrite setting page, WIP
This commit is contained in:
9
.vscode/settings.json
vendored
9
.vscode/settings.json
vendored
@@ -20,5 +20,14 @@
|
|||||||
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
||||||
"editor.formatOnSave": true
|
"editor.formatOnSave": true
|
||||||
},
|
},
|
||||||
|
"i18n-ally.localesPaths": ["src\\renderer\\i18n\\locales"],
|
||||||
|
"i18n-ally.keystyle": "nested",
|
||||||
|
"i18n-ally.sortKeys": true,
|
||||||
|
"i18n-ally.namespace": true,
|
||||||
|
"i18n-ally.enabledParsers": ["json"],
|
||||||
|
"i18n-ally.sourceLanguage": "en",
|
||||||
|
"i18n-ally.displayLanguage": "zh-CN",
|
||||||
|
"i18n-ally.enabledFrameworks": ["vue"],
|
||||||
|
"i18n-ally.editor.preferEditor": true,
|
||||||
"typescript.tsdk": "node_modules\\typescript\\lib"
|
"typescript.tsdk": "node_modules\\typescript\\lib"
|
||||||
}
|
}
|
||||||
0
UI_COMPONENTS_README.md
Normal file
0
UI_COMPONENTS_README.md
Normal file
@@ -27,6 +27,7 @@
|
|||||||
"link": "node ./scripts/link.js",
|
"link": "node ./scripts/link.js",
|
||||||
"lint": "eslint --ext .js,.jsx,.ts,.tsx,.vue src/",
|
"lint": "eslint --ext .js,.jsx,.ts,.tsx,.vue src/",
|
||||||
"lint:dpdm": "dpdm -T --tsconfig ./tsconfig.json --no-tree --no-warning --exit-code circular:1 src/main/index.ts",
|
"lint:dpdm": "dpdm -T --tsconfig ./tsconfig.json --no-tree --no-warning --exit-code circular:1 src/main/index.ts",
|
||||||
|
"lint:dpdm:renderer": "dpdm -T --tsconfig ./tsconfig.json --no-tree --no-warning --exit-code circular:1 src/renderer/main.ts",
|
||||||
"lint:fix": "eslint --fix --ext .js,.jsx,.ts,.tsx,.vue src/",
|
"lint:fix": "eslint --fix --ext .js,.jsx,.ts,.tsx,.vue src/",
|
||||||
"ncu": "node ./scripts/check-dep.js",
|
"ncu": "node ./scripts/check-dep.js",
|
||||||
"postinstall": "electron-builder install-app-deps",
|
"postinstall": "electron-builder install-app-deps",
|
||||||
|
|||||||
@@ -65,3 +65,5 @@ TIPS_FIND_NEW_VERSION: Find new version ${v}, update many new features, do you w
|
|||||||
UPDATE_DOWNLOADED: Update downloaded
|
UPDATE_DOWNLOADED: Update downloaded
|
||||||
TIPS_UPDATE_DOWNLOADED: The update has been downloaded and will be installed on the next app restart. Would you like to restart now?
|
TIPS_UPDATE_DOWNLOADED: The update has been downloaded and will be installed on the next app restart. Would you like to restart now?
|
||||||
QUIT: Quit
|
QUIT: Quit
|
||||||
|
OPERATION_SUCCEED: "Operation Succeed"
|
||||||
|
OPERATION_FAILED: "Operation Failed"
|
||||||
@@ -65,3 +65,5 @@ TIPS_FIND_NEW_VERSION: 发现新版本${v},更新了很多功能,是否后
|
|||||||
UPDATE_DOWNLOADED: 更新已下载
|
UPDATE_DOWNLOADED: 更新已下载
|
||||||
TIPS_UPDATE_DOWNLOADED: 更新已下载,将在下次启动时安装,是否现在重启?
|
TIPS_UPDATE_DOWNLOADED: 更新已下载,将在下次启动时安装,是否现在重启?
|
||||||
QUIT: 退出
|
QUIT: 退出
|
||||||
|
OPERATION_SUCCEED: "操作成功"
|
||||||
|
OPERATION_FAILED: "操作失败"
|
||||||
@@ -65,3 +65,5 @@ TIPS_FIND_NEW_VERSION: 發現新版本${v},更新了很多功能,是否後
|
|||||||
UPDATE_DOWNLOADED: 更新已下載
|
UPDATE_DOWNLOADED: 更新已下載
|
||||||
TIPS_UPDATE_DOWNLOADED: 更新已下載,将在下次啟動時安裝,是否立即重啟?
|
TIPS_UPDATE_DOWNLOADED: 更新已下載,将在下次啟動時安裝,是否立即重啟?
|
||||||
QUIT: 退出
|
QUIT: 退出
|
||||||
|
OPERATION_SUCCEED: "操作成功"
|
||||||
|
OPERATION_FAILED: "操作失敗"
|
||||||
@@ -6,9 +6,9 @@ import { app, clipboard, dialog, shell } from 'electron'
|
|||||||
import fs from 'fs-extra'
|
import fs from 'fs-extra'
|
||||||
import { gte, lte } from 'semver'
|
import { gte, lte } from 'semver'
|
||||||
|
|
||||||
import { IRemoteNoticeActionType, IRemoteNoticeTriggerCount, IRemoteNoticeTriggerHook } from '#/types/enum'
|
import type { IRemoteNotice, IRemoteNoticeAction, IRemoteNoticeLocalCountStorage } from '#/types/types'
|
||||||
import { IRemoteNotice, IRemoteNoticeAction, IRemoteNoticeLocalCountStorage } from '#/types/types'
|
|
||||||
import { showNotification } from '~/utils/common'
|
import { showNotification } from '~/utils/common'
|
||||||
|
import { IRemoteNoticeActionType, IRemoteNoticeTriggerCount } from '~/utils/enum'
|
||||||
|
|
||||||
// for test
|
// for test
|
||||||
const REMOTE_NOTICE_URL = 'https://release.piclist.cn/remote-notice.json'
|
const REMOTE_NOTICE_URL = 'https://release.piclist.cn/remote-notice.json'
|
||||||
@@ -163,7 +163,7 @@ class RemoteNoticeHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
triggerHook (hook: IRemoteNoticeTriggerHook) {
|
triggerHook (hook: string) {
|
||||||
if (!this.remoteNotice || !this.remoteNotice.list) {
|
if (!this.remoteNotice || !this.remoteNotice.list) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ import shortKeyService from 'apis/app/shortKey/shortKeyService'
|
|||||||
import GuiApi from 'apis/gui'
|
import GuiApi from 'apis/gui'
|
||||||
import { globalShortcut } from 'electron'
|
import { globalShortcut } from 'electron'
|
||||||
|
|
||||||
import { TOGGLE_SHORTKEY_MODIFIED_MODE } from '#/events/constants'
|
import type { IKeyCommandType, IPluginShortKeyConfig, IShortKeyConfig, IShortKeyConfigs, IShortKeyHandler } from '#/types/types'
|
||||||
import { IKeyCommandType, IPluginShortKeyConfig, IShortKeyConfig, IShortKeyConfigs, IShortKeyHandler } from '#/types/types'
|
import { TOGGLE_SHORTKEY_MODIFIED_MODE } from '~/events/constant'
|
||||||
import { configPaths } from '#/utils/configPaths'
|
import { configPaths } from '~/utils/configPaths'
|
||||||
|
|
||||||
class ShortKeyHandler {
|
class ShortKeyHandler {
|
||||||
private isInModifiedMode: boolean = false
|
private isInModifiedMode: boolean = false
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import logger from '@core/picgo/logger'
|
import logger from '@core/picgo/logger'
|
||||||
|
|
||||||
import { IShortKeyHandler } from '#/types/types'
|
import type { IShortKeyHandler } from '#/types/types'
|
||||||
|
|
||||||
class ShortKeyService {
|
class ShortKeyService {
|
||||||
private commandList: Map<string, IShortKeyHandler> = new Map()
|
private commandList: Map<string, IShortKeyHandler> = new Map()
|
||||||
|
|||||||
@@ -18,13 +18,13 @@ import fs from 'fs-extra'
|
|||||||
import { cloneDeep } from 'lodash-es'
|
import { cloneDeep } from 'lodash-es'
|
||||||
import pkg from 'root/package.json'
|
import pkg from 'root/package.json'
|
||||||
|
|
||||||
import { IPasteStyle, IWindowList } from '#/types/enum'
|
import type { IBounds, ImgInfo } from '#/types/types'
|
||||||
import { IBounds, ImgInfo } from '#/types/types'
|
|
||||||
import { configPaths } from '#/utils/configPaths'
|
|
||||||
import { buildPicBedListMenu } from '~/events/remotes/menu'
|
import { buildPicBedListMenu } from '~/events/remotes/menu'
|
||||||
import { T as $t } from '~/i18n'
|
import { T as $t } from '~/i18n'
|
||||||
import clipboardPoll from '~/utils/clipboardPoll'
|
import clipboardPoll from '~/utils/clipboardPoll'
|
||||||
import { ensureFilePath, handleCopyUrl, setTray, tray } from '~/utils/common'
|
import { ensureFilePath, handleCopyUrl, setTray, tray } from '~/utils/common'
|
||||||
|
import { configPaths } from '~/utils/configPaths'
|
||||||
|
import { IPasteStyle, IWindowList } from '~/utils/enum'
|
||||||
import { isMacOSVersionGreaterThanOrEqualTo } from '~/utils/getMacOSVersion'
|
import { isMacOSVersionGreaterThanOrEqualTo } from '~/utils/getMacOSVersion'
|
||||||
import pasteTemplate from '~/utils/pasteTemplate'
|
import pasteTemplate from '~/utils/pasteTemplate'
|
||||||
import { hideMiniWindow, openMainWindow, openMiniWindow } from '~/utils/windowHelper'
|
import { hideMiniWindow, openMainWindow, openMiniWindow } from '~/utils/windowHelper'
|
||||||
|
|||||||
@@ -5,13 +5,13 @@ import windowManager from 'apis/app/window/windowManager'
|
|||||||
import { Notification, WebContents } from 'electron'
|
import { Notification, WebContents } from 'electron'
|
||||||
import fs from 'fs-extra'
|
import fs from 'fs-extra'
|
||||||
import { cloneDeep } from 'lodash-es'
|
import { cloneDeep } from 'lodash-es'
|
||||||
import { IPicGo } from 'piclist'
|
import type { IPicGo } from 'piclist'
|
||||||
|
|
||||||
import { IPasteStyle, IWindowList } from '#/types/enum'
|
import type { IFileWithPath, ImgInfo, IStringKeyMap, IUploadOption } from '#/types/types'
|
||||||
import { IFileWithPath, ImgInfo, IStringKeyMap, IUploadOption } from '#/types/types'
|
|
||||||
import { configPaths } from '#/utils/configPaths'
|
|
||||||
import { T as $t } from '~/i18n/index'
|
import { T as $t } from '~/i18n/index'
|
||||||
import { handleCopyUrl, handleUrlEncodeWithSetting } from '~/utils/common'
|
import { handleCopyUrl, handleUrlEncodeWithSetting } from '~/utils/common'
|
||||||
|
import { configPaths } from '~/utils/configPaths'
|
||||||
|
import { IPasteStyle, IWindowList } from '~/utils/enum'
|
||||||
import { changeCurrentUploader } from '~/utils/handleUploaderConfig'
|
import { changeCurrentUploader } from '~/utils/handleUploaderConfig'
|
||||||
import pasteTemplate from '~/utils/pasteTemplate'
|
import pasteTemplate from '~/utils/pasteTemplate'
|
||||||
|
|
||||||
|
|||||||
@@ -11,13 +11,13 @@ import fs from 'fs-extra'
|
|||||||
import type { IPicGo } from 'piclist'
|
import type { IPicGo } from 'piclist'
|
||||||
import writeFile from 'write-file-atomic'
|
import writeFile from 'write-file-atomic'
|
||||||
|
|
||||||
import { GET_RENAME_FILE_NAME, RENAME_FILE_NAME } from '#/events/constants'
|
import type { ImgInfo, IUploadOption } from '#/types/types'
|
||||||
import { ICOREBuildInEvent, IWindowList } from '#/types/enum'
|
import { GET_RENAME_FILE_NAME, RENAME_FILE_NAME } from '~/events/constant'
|
||||||
import { ImgInfo, IUploadOption } from '#/types/types'
|
|
||||||
import { configPaths } from '#/utils/configPaths'
|
|
||||||
import { CLIPBOARD_IMAGE_FOLDER } from '#/utils/static'
|
|
||||||
import { T as $t } from '~/i18n'
|
import { T as $t } from '~/i18n'
|
||||||
import { getClipboardFilePath, showNotification } from '~/utils/common'
|
import { getClipboardFilePath, showNotification } from '~/utils/common'
|
||||||
|
import { configPaths } from '~/utils/configPaths'
|
||||||
|
import { ICOREBuildInEvent, IWindowList } from '~/utils/enum'
|
||||||
|
import { CLIPBOARD_IMAGE_FOLDER } from '~/utils/static'
|
||||||
|
|
||||||
const waitForRename = (window: BrowserWindow, id: number): Promise<string | null> => {
|
const waitForRename = (window: BrowserWindow, id: number): Promise<string | null> => {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
|
|||||||
@@ -6,16 +6,16 @@ import { CREATE_APP_MENU } from '@core/bus/constants'
|
|||||||
import db from '@core/datastore'
|
import db from '@core/datastore'
|
||||||
import { app, BrowserWindow, Rectangle } from 'electron'
|
import { app, BrowserWindow, Rectangle } from 'electron'
|
||||||
|
|
||||||
import { TOGGLE_SHORTKEY_MODIFIED_MODE } from '#/events/constants'
|
import type { IWindowListItem } from '#/types/electron'
|
||||||
import { IWindowListItem } from '#/types/electron'
|
import type { IBrowserWindowOptions } from '#/types/types'
|
||||||
import { IWindowList } from '#/types/enum'
|
import { TOGGLE_SHORTKEY_MODIFIED_MODE } from '~/events/constant'
|
||||||
import { IBrowserWindowOptions } from '#/types/types'
|
|
||||||
import { configPaths } from '#/utils/configPaths'
|
|
||||||
import { T as $t } from '~/i18n'
|
import { T as $t } from '~/i18n'
|
||||||
|
import { configPaths } from '~/utils/configPaths'
|
||||||
|
import { IWindowList } from '~/utils/enum'
|
||||||
|
|
||||||
import logo from '../../../../../resources/logo.png?asset'
|
import logo from '../../../../../resources/logo.png?asset'
|
||||||
|
|
||||||
const windowList = new Map<IWindowList, IWindowListItem>()
|
const windowList = new Map<string, IWindowListItem>()
|
||||||
|
|
||||||
const getDefaultWindowSizes = (): { width: number; height: number } => {
|
const getDefaultWindowSizes = (): { width: number; height: number } => {
|
||||||
const [mainWindowWidth, mainWindowHeight] = db.get([
|
const [mainWindowWidth, mainWindowHeight] = db.get([
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
import windowList from 'apis/app/window/windowList'
|
import windowList from 'apis/app/window/windowList'
|
||||||
import { BrowserWindow } from 'electron'
|
import { BrowserWindow } from 'electron'
|
||||||
|
|
||||||
import { IWindowListItem, IWindowManager } from '#/types/electron'
|
import type { IWindowListItem, IWindowManager } from '#/types/electron'
|
||||||
import { IWindowList } from '#/types/enum'
|
import { IWindowList } from '~/utils/enum'
|
||||||
|
|
||||||
class WindowManager implements IWindowManager {
|
class WindowManager implements IWindowManager {
|
||||||
#windowMap: Map<IWindowList | string, BrowserWindow> = new Map()
|
#windowMap: Map< string, BrowserWindow> = new Map()
|
||||||
#windowIdMap: Map<number, IWindowList | string> = new Map()
|
#windowIdMap: Map<number, string> = new Map()
|
||||||
|
|
||||||
create (name: IWindowList) {
|
create (name: string) {
|
||||||
const windowConfig: IWindowListItem = windowList.get(name)!
|
const windowConfig: IWindowListItem = windowList.get(name)!
|
||||||
if (!windowConfig.isValid) return null
|
if (!windowConfig.isValid) return null
|
||||||
|
|
||||||
@@ -30,14 +30,14 @@ class WindowManager implements IWindowManager {
|
|||||||
return window
|
return window
|
||||||
}
|
}
|
||||||
|
|
||||||
get (name: IWindowList) {
|
get (name: string) {
|
||||||
if (this.has(name)) {
|
if (this.has(name)) {
|
||||||
return this.#windowMap.get(name)!
|
return this.#windowMap.get(name)!
|
||||||
}
|
}
|
||||||
return this.create(name)
|
return this.create(name)
|
||||||
}
|
}
|
||||||
|
|
||||||
has (name: IWindowList) {
|
has (name: string) {
|
||||||
return this.#windowMap.has(name)
|
return this.#windowMap.has(name)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import {
|
|||||||
} from '@core/bus/constants'
|
} from '@core/bus/constants'
|
||||||
import bus from '@core/bus/index'
|
import bus from '@core/bus/index'
|
||||||
|
|
||||||
import { IFileWithPath } from '#/types/types'
|
import type { IFileWithPath } from '#/types/types'
|
||||||
|
|
||||||
export const uploadWithClipboardFiles = (): Promise<{
|
export const uploadWithClipboardFiles = (): Promise<{
|
||||||
success: boolean
|
success: boolean
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ import { app } from 'electron'
|
|||||||
import fs from 'fs-extra'
|
import fs from 'fs-extra'
|
||||||
import writeFile from 'write-file-atomic'
|
import writeFile from 'write-file-atomic'
|
||||||
|
|
||||||
import { notificationList } from '#/utils/notification'
|
|
||||||
import { T as $t } from '~/i18n'
|
import { T as $t } from '~/i18n'
|
||||||
|
import { notificationList } from '~/utils/notification'
|
||||||
|
|
||||||
const STORE_PATH = app.getPath('userData')
|
const STORE_PATH = app.getPath('userData')
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import { dbPathChecker, dbPathDir, getGalleryDBPath } from '@core/datastore/dbChecker'
|
import { dbPathChecker, dbPathDir, getGalleryDBPath } from '@core/datastore/dbChecker'
|
||||||
import { DBStore, JSONStore } from '@piclist/store'
|
import { DBStore, JSONStore } from '@piclist/store'
|
||||||
import fs from 'fs-extra'
|
import fs from 'fs-extra'
|
||||||
import { IConfig } from 'piclist'
|
import type { IConfig } from 'piclist'
|
||||||
|
|
||||||
import { configPaths } from '#/utils/configPaths'
|
|
||||||
import { T as $t } from '~/i18n'
|
import { T as $t } from '~/i18n'
|
||||||
|
import { configPaths } from '~/utils/configPaths'
|
||||||
interface IJSON {
|
interface IJSON {
|
||||||
[propsName: string]: string | number | IJSON
|
[propsName: string]: string | number | IJSON
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { debounce } from 'lodash-es'
|
|||||||
import { PicGo } from 'piclist'
|
import { PicGo } from 'piclist'
|
||||||
import pkg from 'root/package.json'
|
import pkg from 'root/package.json'
|
||||||
|
|
||||||
import { IStringKeyMap } from '#/types/types'
|
import type { IStringKeyMap } from '#/types/types'
|
||||||
|
|
||||||
const CONFIG_PATH = dbPathChecker()
|
const CONFIG_PATH = dbPathChecker()
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import util from 'node:util'
|
|||||||
import dayjs from 'dayjs'
|
import dayjs from 'dayjs'
|
||||||
import fs from 'fs-extra'
|
import fs from 'fs-extra'
|
||||||
|
|
||||||
import { ILogArgvTypeWithError } from '#/types/types'
|
import type { ILogArgvTypeWithError } from '#/types/types'
|
||||||
|
|
||||||
const MB = 1024 * 1024
|
const MB = 1024 * 1024
|
||||||
const DEFAULT_LOG_FILE_SIZE_LIMIT = 10 * MB
|
const DEFAULT_LOG_FILE_SIZE_LIMIT = 10 * MB
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import OSS from 'ali-oss'
|
import OSS from 'ali-oss'
|
||||||
|
|
||||||
import { IAliYunConfig, PartialKeys } from '#/types/types'
|
import type { IAliYunConfig, PartialKeys } from '#/types/types'
|
||||||
import { deleteFailedLog, deleteLog } from '~/utils/deleteLog'
|
import { deleteFailedLog, deleteLog } from '~/utils/deleteLog'
|
||||||
|
|
||||||
interface IConfigMap {
|
interface IConfigMap {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { IStringKeyMap } from '#/types/types'
|
import type { IStringKeyMap } from '#/types/types'
|
||||||
import AlistApi from '~/apis/delete/alist'
|
import AlistApi from '~/apis/delete/alist'
|
||||||
import AlistplistApi from '~/apis/delete/alistplist'
|
import AlistplistApi from '~/apis/delete/alistplist'
|
||||||
import AliyunApi from '~/apis/delete/aliyun'
|
import AliyunApi from '~/apis/delete/aliyun'
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { getRawData } from '@/utils/common'
|
import type { IStringKeyMap } from '#/types/types'
|
||||||
import { IStringKeyMap } from '#/types/types'
|
import { getRawData } from '~/utils/common'
|
||||||
import { removeFileFromS3InMain } from '~/utils/deleteFunc'
|
import { removeFileFromS3InMain } from '~/utils/deleteFunc'
|
||||||
import { deleteFailedLog } from '~/utils/deleteLog'
|
import { deleteFailedLog } from '~/utils/deleteLog'
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { getRawData } from '@/utils/common'
|
import type { IStringKeyMap } from '#/types/types'
|
||||||
import { IStringKeyMap } from '#/types/types'
|
import { getRawData } from '~/utils/common'
|
||||||
import { removeFileFromDogeInMain } from '~/utils/deleteFunc'
|
import { removeFileFromDogeInMain } from '~/utils/deleteFunc'
|
||||||
import { deleteFailedLog } from '~/utils/deleteLog'
|
import { deleteFailedLog } from '~/utils/deleteLog'
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { Octokit } from '@octokit/rest'
|
import { Octokit } from '@octokit/rest'
|
||||||
|
|
||||||
import { IGitHubConfig, PartialKeys } from '#/types/types'
|
import type { IGitHubConfig, PartialKeys } from '#/types/types'
|
||||||
import { deleteFailedLog, deleteLog } from '~/utils/deleteLog'
|
import { deleteFailedLog, deleteLog } from '~/utils/deleteLog'
|
||||||
|
|
||||||
interface IConfigMap {
|
interface IConfigMap {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { getRawData } from '@/utils/common'
|
import type { IStringKeyMap } from '#/types/types'
|
||||||
import { IStringKeyMap } from '#/types/types'
|
import { getRawData } from '~/utils/common'
|
||||||
import { removeFileFromHuaweiInMain } from '~/utils/deleteFunc'
|
import { removeFileFromHuaweiInMain } from '~/utils/deleteFunc'
|
||||||
import { deleteFailedLog } from '~/utils/deleteLog'
|
import { deleteFailedLog } from '~/utils/deleteLog'
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import axios, { AxiosResponse } from 'axios'
|
import axios, { AxiosResponse } from 'axios'
|
||||||
|
|
||||||
import { IImgurConfig } from '#/types/types'
|
import type { IImgurConfig } from '#/types/types'
|
||||||
import { deleteFailedLog, deleteLog } from '~/utils/deleteLog'
|
import { deleteFailedLog, deleteLog } from '~/utils/deleteLog'
|
||||||
|
|
||||||
interface IConfigMap {
|
interface IConfigMap {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import https from 'node:https'
|
|||||||
|
|
||||||
import axios, { AxiosResponse } from 'axios'
|
import axios, { AxiosResponse } from 'axios'
|
||||||
|
|
||||||
import { IStringKeyMap } from '#/types/types'
|
import type { IStringKeyMap } from '#/types/types'
|
||||||
import { deleteFailedLog, deleteLog } from '~/utils/deleteLog'
|
import { deleteFailedLog, deleteLog } from '~/utils/deleteLog'
|
||||||
|
|
||||||
export default class LskyplistApi {
|
export default class LskyplistApi {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import axios, { AxiosResponse } from 'axios'
|
import axios, { AxiosResponse } from 'axios'
|
||||||
|
|
||||||
import { IStringKeyMap } from '#/types/types'
|
import type { IStringKeyMap } from '#/types/types'
|
||||||
import { deleteFailedLog, deleteLog } from '~/utils/deleteLog'
|
import { deleteFailedLog, deleteLog } from '~/utils/deleteLog'
|
||||||
|
|
||||||
export default class PiclistApi {
|
export default class PiclistApi {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import qiniu from 'qiniu'
|
import qiniu from 'qiniu'
|
||||||
|
|
||||||
import { IQiniuConfig, PartialKeys } from '#/types/types'
|
import type { IQiniuConfig, PartialKeys } from '#/types/types'
|
||||||
import { deleteFailedLog, deleteLog } from '~/utils/deleteLog'
|
import { deleteFailedLog, deleteLog } from '~/utils/deleteLog'
|
||||||
interface IConfigMap {
|
interface IConfigMap {
|
||||||
fileName: string
|
fileName: string
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { getRawData } from '@/utils/common'
|
import type { IStringKeyMap } from '#/types/types'
|
||||||
import { IStringKeyMap } from '#/types/types'
|
import { getRawData } from '~/utils/common'
|
||||||
import { removeFileFromSFTPInMain } from '~/utils/deleteFunc'
|
import { removeFileFromSFTPInMain } from '~/utils/deleteFunc'
|
||||||
import { deleteFailedLog } from '~/utils/deleteLog'
|
import { deleteFailedLog } from '~/utils/deleteLog'
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import axios, { AxiosResponse } from 'axios'
|
import axios, { AxiosResponse } from 'axios'
|
||||||
|
|
||||||
import { ISMMSConfig } from '#/types/types'
|
import type { ISMMSConfig } from '#/types/types'
|
||||||
import { deleteFailedLog, deleteLog } from '~/utils/deleteLog'
|
import { deleteFailedLog, deleteLog } from '~/utils/deleteLog'
|
||||||
|
|
||||||
interface IConfigMap {
|
interface IConfigMap {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import COS from 'cos-nodejs-sdk-v5'
|
import COS from 'cos-nodejs-sdk-v5'
|
||||||
|
|
||||||
import { ITcYunConfig, PartialKeys } from '#/types/types'
|
import type { ITcYunConfig, PartialKeys } from '#/types/types'
|
||||||
import { deleteFailedLog, deleteLog } from '~/utils/deleteLog'
|
import { deleteFailedLog, deleteLog } from '~/utils/deleteLog'
|
||||||
interface IConfigMap {
|
interface IConfigMap {
|
||||||
fileName: string
|
fileName: string
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import Upyun from 'upyun'
|
import Upyun from 'upyun'
|
||||||
|
|
||||||
import { IUpYunConfig, PartialKeys } from '#/types/types'
|
import type { IUpYunConfig, PartialKeys } from '#/types/types'
|
||||||
import { deleteFailedLog, deleteLog } from '~/utils/deleteLog'
|
import { deleteFailedLog, deleteLog } from '~/utils/deleteLog'
|
||||||
|
|
||||||
interface IConfigMap {
|
interface IConfigMap {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { AuthType, createClient, WebDAVClientOptions } from 'webdav'
|
import { AuthType, createClient, WebDAVClientOptions } from 'webdav'
|
||||||
|
|
||||||
import { IWebdavPlistConfig, PartialKeys } from '#/types/types'
|
import type { IWebdavPlistConfig, PartialKeys } from '#/types/types'
|
||||||
import { formatEndpoint } from '#/utils/common'
|
import { formatEndpoint } from '~/utils/common'
|
||||||
import { deleteFailedLog, deleteLog } from '~/utils/deleteLog'
|
import { deleteFailedLog, deleteLog } from '~/utils/deleteLog'
|
||||||
|
|
||||||
interface IConfigMap {
|
interface IConfigMap {
|
||||||
|
|||||||
@@ -8,12 +8,12 @@ import { BrowserWindow, dialog, ipcMain, IpcMainEvent, MessageBoxOptions, Notifi
|
|||||||
import fs from 'fs-extra'
|
import fs from 'fs-extra'
|
||||||
import { cloneDeep } from 'lodash-es'
|
import { cloneDeep } from 'lodash-es'
|
||||||
|
|
||||||
import { SHOW_INPUT_BOX } from '#/events/constants'
|
import type { IGuiApi, ImgInfo, IShowFileExplorerOption, IShowInputBoxOption, IShowMessageBoxOption, IShowMessageBoxResult, IShowNotificationOption, IUploadOption } from '#/types/types'
|
||||||
import { IPasteStyle } from '#/types/enum'
|
import { SHOW_INPUT_BOX } from '~/events/constant'
|
||||||
import { IGuiApi, ImgInfo, IShowFileExplorerOption, IShowInputBoxOption, IShowMessageBoxOption, IShowMessageBoxResult, IShowNotificationOption, IUploadOption } from '#/types/types'
|
|
||||||
import { configPaths } from '#/utils/configPaths'
|
|
||||||
import { T as $t } from '~/i18n'
|
import { T as $t } from '~/i18n'
|
||||||
import { handleCopyUrl } from '~/utils/common'
|
import { handleCopyUrl } from '~/utils/common'
|
||||||
|
import { configPaths } from '~/utils/configPaths'
|
||||||
|
import { IPasteStyle } from '~/utils/enum'
|
||||||
import pasteTemplate from '~/utils/pasteTemplate'
|
import pasteTemplate from '~/utils/pasteTemplate'
|
||||||
|
|
||||||
// Cross-process support may be required in the future
|
// Cross-process support may be required in the future
|
||||||
|
|||||||
@@ -14,8 +14,8 @@ import { createMenu } from 'apis/app/system'
|
|||||||
import { uploadChoosedFiles, uploadClipboardFiles } from 'apis/app/uploader/apis'
|
import { uploadChoosedFiles, uploadClipboardFiles } from 'apis/app/uploader/apis'
|
||||||
import windowManager from 'apis/app/window/windowManager'
|
import windowManager from 'apis/app/window/windowManager'
|
||||||
|
|
||||||
import { IWindowList } from '#/types/enum'
|
import type { IFileWithPath } from '#/types/types'
|
||||||
import { IFileWithPath } from '#/types/types'
|
import { IWindowList } from '~/utils/enum'
|
||||||
|
|
||||||
function initEventCenter () {
|
function initEventCenter () {
|
||||||
const eventList: any = {
|
const eventList: any = {
|
||||||
|
|||||||
@@ -13,5 +13,3 @@ export const SHOW_MAIN_PAGE_QRCODE = 'SHOW_MAIN_PAGE_QRCODE'
|
|||||||
// rpc
|
// rpc
|
||||||
export const RPC_ACTIONS = 'RPC_ACTIONS'
|
export const RPC_ACTIONS = 'RPC_ACTIONS'
|
||||||
export const RPC_ACTIONS_INVOKE = 'RPC_ACTIONS_INVOKE'
|
export const RPC_ACTIONS_INVOKE = 'RPC_ACTIONS_INVOKE'
|
||||||
// i18n
|
|
||||||
export const SET_CURRENT_LANGUAGE = 'SET_CURRENT_LANGUAGE'
|
|
||||||
@@ -7,20 +7,20 @@ import { app, BrowserWindow, dialog, Menu, MenuItem, MenuItemConstructorOptions,
|
|||||||
import { PicGo as PicGoCore } from 'piclist'
|
import { PicGo as PicGoCore } from 'piclist'
|
||||||
import pkg from 'root/package.json'
|
import pkg from 'root/package.json'
|
||||||
|
|
||||||
|
import type { IPicGoPlugin, IUploaderConfig } from '#/types/types'
|
||||||
import {
|
import {
|
||||||
PICGO_CONFIG_PLUGIN,
|
PICGO_CONFIG_PLUGIN,
|
||||||
PICGO_HANDLE_PLUGIN_DONE,
|
PICGO_HANDLE_PLUGIN_DONE,
|
||||||
PICGO_HANDLE_PLUGIN_ING,
|
PICGO_HANDLE_PLUGIN_ING,
|
||||||
PICGO_TOGGLE_PLUGIN,
|
PICGO_TOGGLE_PLUGIN,
|
||||||
SHOW_MAIN_PAGE_QRCODE
|
SHOW_MAIN_PAGE_QRCODE
|
||||||
} from '#/events/constants'
|
} from '~/events/constant'
|
||||||
import { IWindowList } from '#/types/enum'
|
|
||||||
import { IPicGoPlugin, IUploaderConfig } from '#/types/types'
|
|
||||||
import { configPaths } from '#/utils/configPaths'
|
|
||||||
import { handlePluginUninstall, handlePluginUpdate } from '~/events/rpc/routes/plugin/utils'
|
import { handlePluginUninstall, handlePluginUpdate } from '~/events/rpc/routes/plugin/utils'
|
||||||
import { T as $t } from '~/i18n'
|
import { T as $t } from '~/i18n'
|
||||||
import clipboardPoll from '~/utils/clipboardPoll'
|
import clipboardPoll from '~/utils/clipboardPoll'
|
||||||
import { setTrayToolTip } from '~/utils/common'
|
import { setTrayToolTip } from '~/utils/common'
|
||||||
|
import { configPaths } from '~/utils/configPaths'
|
||||||
|
import { IWindowList } from '~/utils/enum'
|
||||||
import getPicBeds from '~/utils/getPicBeds'
|
import getPicBeds from '~/utils/getPicBeds'
|
||||||
import { changeCurrentUploader, changeSecondUploader } from '~/utils/handleUploaderConfig'
|
import { changeCurrentUploader, changeSecondUploader } from '~/utils/handleUploaderConfig'
|
||||||
import { openMainWindow } from '~/utils/windowHelper'
|
import { openMainWindow } from '~/utils/windowHelper'
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
import logger from '@core/picgo/logger'
|
import logger from '@core/picgo/logger'
|
||||||
import { ipcMain, IpcMainEvent, IpcMainInvokeEvent } from 'electron'
|
import { ipcMain, IpcMainEvent, IpcMainInvokeEvent } from 'electron'
|
||||||
|
|
||||||
import { RPC_ACTIONS, RPC_ACTIONS_INVOKE } from '#/events/constants'
|
import type { IRPCRoutes, IRPCServer } from '#/types/rpc'
|
||||||
import { IRPCActionType, IRPCType } from '#/types/enum'
|
import { RPC_ACTIONS, RPC_ACTIONS_INVOKE } from '~/events/constant'
|
||||||
import { IRPCRoutes, IRPCServer } from '#/types/rpc'
|
|
||||||
import { galleryRouter } from '~/events/rpc/routes/gallery'
|
import { galleryRouter } from '~/events/rpc/routes/gallery'
|
||||||
import { manageRouter } from '~/events/rpc/routes/manage'
|
import { manageRouter } from '~/events/rpc/routes/manage'
|
||||||
import { picbedRouter } from '~/events/rpc/routes/picbed'
|
import { picbedRouter } from '~/events/rpc/routes/picbed'
|
||||||
@@ -13,12 +12,13 @@ import { systemRouter } from '~/events/rpc/routes/system'
|
|||||||
import { toolboxRouter } from '~/events/rpc/routes/toolbox'
|
import { toolboxRouter } from '~/events/rpc/routes/toolbox'
|
||||||
import { trayRouter } from '~/events/rpc/routes/tray'
|
import { trayRouter } from '~/events/rpc/routes/tray'
|
||||||
import { uploadRouter } from '~/events/rpc/routes/upload'
|
import { uploadRouter } from '~/events/rpc/routes/upload'
|
||||||
|
import { IRPCType } from '~/utils/enum'
|
||||||
|
|
||||||
class RPCServer implements IRPCServer {
|
class RPCServer implements IRPCServer {
|
||||||
private routes: IRPCRoutes = new Map()
|
private routes: IRPCRoutes = new Map()
|
||||||
private routesWithResponse: IRPCRoutes = new Map()
|
private routesWithResponse: IRPCRoutes = new Map()
|
||||||
|
|
||||||
private rpcEventHandler = async (event: IpcMainEvent, action: IRPCActionType, args: any[]) => {
|
private rpcEventHandler = async (event: IpcMainEvent, action: string, args: any[]) => {
|
||||||
try {
|
try {
|
||||||
const route = this.routes.get(action)
|
const route = this.routes.get(action)
|
||||||
await route?.handler?.(event, args)
|
await route?.handler?.(event, args)
|
||||||
@@ -27,7 +27,7 @@ class RPCServer implements IRPCServer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private rpcEventHandlerWithResponse = async (event: IpcMainInvokeEvent, action: IRPCActionType, args: any[]) => {
|
private rpcEventHandlerWithResponse = async (event: IpcMainInvokeEvent, action: string, args: any[]) => {
|
||||||
try {
|
try {
|
||||||
const route = this.routesWithResponse.get(action)
|
const route = this.routesWithResponse.get(action)
|
||||||
return await route?.handler?.(event, args)
|
return await route?.handler?.(event, args)
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
import { IRPCActionType, IRPCType } from '#/types/enum'
|
import type { IRPCHandler, IRPCRouter, IRPCRoutes } from '#/types/rpc'
|
||||||
import { IRPCHandler, IRPCRouter, IRPCRoutes } from '#/types/rpc'
|
import { IRPCType } from '~/utils/enum'
|
||||||
|
|
||||||
interface IBatchAddParams {
|
interface IBatchAddParams {
|
||||||
action: IRPCActionType
|
action: string
|
||||||
handler: IRPCHandler<any>
|
handler: IRPCHandler<any>
|
||||||
type?: IRPCType
|
type?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export class RPCRouter implements IRPCRouter {
|
export class RPCRouter implements IRPCRouter {
|
||||||
private routeMap: IRPCRoutes = new Map()
|
private routeMap: IRPCRoutes = new Map()
|
||||||
add = <T>(action: IRPCActionType, handler: IRPCHandler<T>, type: IRPCType = IRPCType.SEND): this => {
|
add = <T>(action: string, handler: IRPCHandler<T>, type: string = IRPCType.SEND): this => {
|
||||||
this.routeMap.set(action, { handler, type })
|
this.routeMap.set(action, { handler, type })
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,11 +3,11 @@ import picgo from '@core/picgo'
|
|||||||
import GuiApi from 'apis/gui'
|
import GuiApi from 'apis/gui'
|
||||||
import { clipboard } from 'electron'
|
import { clipboard } from 'electron'
|
||||||
|
|
||||||
import { ICOREBuildInEvent, IPasteStyle, IRPCActionType, IRPCType } from '#/types/enum'
|
import type { IIPCEvent } from '#/types/rpc'
|
||||||
import { IIPCEvent } from '#/types/rpc'
|
import type { ImgInfo } from '#/types/types'
|
||||||
import { ImgInfo } from '#/types/types'
|
|
||||||
import { configPaths } from '#/utils/configPaths'
|
|
||||||
import { RPCRouter } from '~/events/rpc/router'
|
import { RPCRouter } from '~/events/rpc/router'
|
||||||
|
import { configPaths } from '~/utils/configPaths'
|
||||||
|
import { ICOREBuildInEvent, IPasteStyle, IRPCActionType, IRPCType } from '~/utils/enum'
|
||||||
import pasteTemplate from '~/utils/pasteTemplate'
|
import pasteTemplate from '~/utils/pasteTemplate'
|
||||||
interface IFilter {
|
interface IFilter {
|
||||||
orderBy?: 'asc' | 'desc'
|
orderBy?: 'asc' | 'desc'
|
||||||
@@ -26,7 +26,7 @@ const galleryRoutes = [
|
|||||||
action: IRPCActionType.GALLERY_PASTE_TEXT,
|
action: IRPCActionType.GALLERY_PASTE_TEXT,
|
||||||
handler: async (_: IIPCEvent, args: [item: ImgInfo, copy?: boolean]) => {
|
handler: async (_: IIPCEvent, args: [item: ImgInfo, copy?: boolean]) => {
|
||||||
const [item, copy = true] = args
|
const [item, copy = true] = args
|
||||||
const pasteStyle = picgo.getConfig<IPasteStyle>(configPaths.settings.pasteStyle) || IPasteStyle.MARKDOWN
|
const pasteStyle = picgo.getConfig<string>(configPaths.settings.pasteStyle) || IPasteStyle.MARKDOWN
|
||||||
const customLink = picgo.getConfig<string>(configPaths.settings.customLink)
|
const customLink = picgo.getConfig<string>(configPaths.settings.customLink)
|
||||||
const [txt, shortUrl] = await pasteTemplate(pasteStyle, item, customLink)
|
const [txt, shortUrl] = await pasteTemplate(pasteStyle, item, customLink)
|
||||||
if (copy) {
|
if (copy) {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { IRPCActionType, IRPCType } from '#/types/enum'
|
import type { IIPCEvent } from '#/types/rpc'
|
||||||
import { IIPCEvent } from '#/types/rpc'
|
import type { IStringKeyMap } from '#/types/types'
|
||||||
import { IStringKeyMap } from '#/types/types'
|
|
||||||
import { ManageApi } from '~/manage/manageApi'
|
import { ManageApi } from '~/manage/manageApi'
|
||||||
|
import { IRPCActionType, IRPCType } from '~/utils/enum'
|
||||||
|
|
||||||
export default [
|
export default [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { IRPCActionType, IRPCType } from '#/types/enum'
|
import type { IIPCEvent } from '#/types/rpc'
|
||||||
import { IIPCEvent } from '#/types/rpc'
|
import type { IObj } from '#/types/types'
|
||||||
import { IObj } from '#/types/types'
|
|
||||||
import getManageApi from '~/manage/Main'
|
import getManageApi from '~/manage/Main'
|
||||||
|
import { IRPCActionType, IRPCType } from '~/utils/enum'
|
||||||
|
|
||||||
const manageApi = getManageApi()
|
const manageApi = getManageApi()
|
||||||
|
|
||||||
|
|||||||
@@ -3,10 +3,10 @@ import path from 'node:path'
|
|||||||
import { app, dialog, shell } from 'electron'
|
import { app, dialog, shell } from 'electron'
|
||||||
import fs from 'fs-extra'
|
import fs from 'fs-extra'
|
||||||
|
|
||||||
import { IRPCActionType, IRPCType } from '#/types/enum'
|
import type { IIPCEvent } from '#/types/rpc'
|
||||||
import { IIPCEvent } from '#/types/rpc'
|
|
||||||
import UpDownTaskQueue from '~/manage/datastore/upDownTaskQueue'
|
import UpDownTaskQueue from '~/manage/datastore/upDownTaskQueue'
|
||||||
import { downloadFileFromUrl } from '~/manage/utils/common'
|
import { downloadFileFromUrl } from '~/manage/utils/common'
|
||||||
|
import { IRPCActionType, IRPCType } from '~/utils/enum'
|
||||||
|
|
||||||
export default [
|
export default [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import ALLApi from 'apis/delete/allApi'
|
import ALLApi from 'apis/delete/allApi'
|
||||||
|
|
||||||
import { IRPCActionType, IRPCType } from '#/types/enum'
|
import type { IIPCEvent } from '#/types/rpc'
|
||||||
import { IIPCEvent } from '#/types/rpc'
|
import type { ImgInfo } from '#/types/types'
|
||||||
import { ImgInfo } from '#/types/types'
|
import { IRPCActionType, IRPCType } from '~/utils/enum'
|
||||||
|
|
||||||
export default [
|
export default [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import picgo from '@core/picgo'
|
import picgo from '@core/picgo'
|
||||||
|
|
||||||
import { IRPCActionType, IRPCType } from '#/types/enum'
|
import type { IIPCEvent } from '#/types/rpc'
|
||||||
import { IIPCEvent } from '#/types/rpc'
|
import type { IStringKeyMap } from '#/types/types'
|
||||||
import { IStringKeyMap } from '#/types/types'
|
|
||||||
import { RPCRouter } from '~/events/rpc/router'
|
import { RPCRouter } from '~/events/rpc/router'
|
||||||
import deleteRoutes from '~/events/rpc/routes/picbed/delete'
|
import deleteRoutes from '~/events/rpc/routes/picbed/delete'
|
||||||
|
import { IRPCActionType, IRPCType } from '~/utils/enum'
|
||||||
import {
|
import {
|
||||||
deleteUploaderConfig,
|
deleteUploaderConfig,
|
||||||
getUploaderConfigList,
|
getUploaderConfigList,
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import { IRPCActionType } from '#/types/enum'
|
|
||||||
import { RPCRouter } from '~/events/rpc/router'
|
import { RPCRouter } from '~/events/rpc/router'
|
||||||
import {
|
import {
|
||||||
pluginGetListFunc,
|
pluginGetListFunc,
|
||||||
@@ -6,6 +5,7 @@ import {
|
|||||||
pluginInstallFunc,
|
pluginInstallFunc,
|
||||||
pluginUpdateAllFunc
|
pluginUpdateAllFunc
|
||||||
} from '~/events/rpc/routes/plugin/utils'
|
} from '~/events/rpc/routes/plugin/utils'
|
||||||
|
import { IRPCActionType } from '~/utils/enum'
|
||||||
|
|
||||||
const pluginRouter = new RPCRouter()
|
const pluginRouter = new RPCRouter()
|
||||||
|
|
||||||
|
|||||||
@@ -8,17 +8,16 @@ import { dialog, shell } from 'electron'
|
|||||||
import fs from 'fs-extra'
|
import fs from 'fs-extra'
|
||||||
import { IGuiMenuItem, PicGo as PicGoCore } from 'piclist'
|
import { IGuiMenuItem, PicGo as PicGoCore } from 'piclist'
|
||||||
|
|
||||||
import { ICOREBuildInEvent, IPicGoHelperType, IWindowList } from '#/types/enum'
|
import type { IIPCEvent } from '#/types/rpc'
|
||||||
import { IIPCEvent } from '#/types/rpc'
|
import type { IDispose, IPicGoPlugin } from '#/types/types'
|
||||||
import { IDispose, IPicGoPlugin } from '#/types/types'
|
|
||||||
import { handleStreamlinePluginName, simpleClone } from '#/utils/common'
|
|
||||||
import { T as $t } from '~/i18n'
|
import { T as $t } from '~/i18n'
|
||||||
import { showNotification } from '~/utils/common'
|
import { handleStreamlinePluginName, showNotification, simpleClone } from '~/utils/common'
|
||||||
|
import { ICOREBuildInEvent, IPicGoHelperType, IWindowList } from '~/utils/enum'
|
||||||
|
|
||||||
const STORE_PATH = dbPathDir()
|
const STORE_PATH = dbPathDir()
|
||||||
|
|
||||||
// get uploader or transformer config
|
// get uploader or transformer config
|
||||||
const getConfig = (name: string, type: IPicGoHelperType, ctx: PicGoCore) => {
|
const getConfig = (name: string, type: keyof typeof IPicGoHelperType, ctx: PicGoCore) => {
|
||||||
let config: any[] = []
|
let config: any[] = []
|
||||||
if (name === '') {
|
if (name === '') {
|
||||||
return config
|
return config
|
||||||
@@ -86,11 +85,11 @@ const getPluginList = async (): Promise<IPicGoPlugin[]> => {
|
|||||||
},
|
},
|
||||||
uploader: {
|
uploader: {
|
||||||
name: uploaderName,
|
name: uploaderName,
|
||||||
config: handleConfigWithFunction(getConfig(uploaderName, IPicGoHelperType.uploader, picgo))
|
config: handleConfigWithFunction(getConfig(uploaderName, IPicGoHelperType.uploader as keyof typeof IPicGoHelperType, picgo))
|
||||||
},
|
},
|
||||||
transformer: {
|
transformer: {
|
||||||
name: transformerName,
|
name: transformerName,
|
||||||
config: handleConfigWithFunction(getConfig(uploaderName, IPicGoHelperType.transformer, picgo))
|
config: handleConfigWithFunction(getConfig(uploaderName, IPicGoHelperType.transformer as keyof typeof IPicGoHelperType, picgo))
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
enabled: picgo.getConfig(`picgoPlugins.${pluginList[i]}`),
|
enabled: picgo.getConfig(`picgoPlugins.${pluginList[i]}`),
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { IRPCActionType } from '#/types/enum'
|
|
||||||
import server from '~/server'
|
import server from '~/server'
|
||||||
import webServer from '~/server/webServer'
|
import webServer from '~/server/webServer'
|
||||||
|
import { IRPCActionType } from '~/utils/enum'
|
||||||
|
|
||||||
export default [
|
export default [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import logger from '@core/picgo/logger'
|
|||||||
import { app } from 'electron'
|
import { app } from 'electron'
|
||||||
import fs from 'fs-extra'
|
import fs from 'fs-extra'
|
||||||
|
|
||||||
import { IRPCActionType, IRPCType } from '#/types/enum'
|
import { IRPCActionType, IRPCType } from '~/utils/enum'
|
||||||
import { downloadFile, uploadFile } from '~/utils/syncSettings'
|
import { downloadFile, uploadFile } from '~/utils/syncSettings'
|
||||||
|
|
||||||
const STORE_PATH = app.getPath('userData')
|
const STORE_PATH = app.getPath('userData')
|
||||||
|
|||||||
@@ -5,9 +5,9 @@ import picgo from '@core/picgo'
|
|||||||
import { app, IpcMainEvent, shell } from 'electron'
|
import { app, IpcMainEvent, shell } from 'electron'
|
||||||
import fs from 'fs-extra'
|
import fs from 'fs-extra'
|
||||||
|
|
||||||
import { IRPCActionType, IRPCType } from '#/types/enum'
|
import type { IIPCEvent } from '#/types/rpc'
|
||||||
import { IIPCEvent } from '#/types/rpc'
|
import type { IObj } from '#/types/types'
|
||||||
import { IObj } from '#/types/types'
|
import { IRPCActionType, IRPCType } from '~/utils/enum'
|
||||||
|
|
||||||
const STORE_PATH = dbPathDir()
|
const STORE_PATH = dbPathDir()
|
||||||
|
|
||||||
|
|||||||
@@ -2,11 +2,11 @@ import bus from '@core/bus'
|
|||||||
import shortKeyHandler from 'apis/app/shortKey/shortKeyHandler'
|
import shortKeyHandler from 'apis/app/shortKey/shortKeyHandler'
|
||||||
import { Notification } from 'electron'
|
import { Notification } from 'electron'
|
||||||
|
|
||||||
import { TOGGLE_SHORTKEY_MODIFIED_MODE } from '#/events/constants'
|
import type { IIPCEvent } from '#/types/rpc'
|
||||||
import { IRPCActionType, IRPCType } from '#/types/enum'
|
import type { IShortKeyConfig } from '#/types/types'
|
||||||
import { IIPCEvent } from '#/types/rpc'
|
import { TOGGLE_SHORTKEY_MODIFIED_MODE } from '~/events/constant'
|
||||||
import { IShortKeyConfig } from '#/types/types'
|
|
||||||
import { T as $t } from '~/i18n'
|
import { T as $t } from '~/i18n'
|
||||||
|
import { IRPCActionType, IRPCType } from '~/utils/enum'
|
||||||
|
|
||||||
const notificationFunc = (result: boolean) => {
|
const notificationFunc = (result: boolean) => {
|
||||||
const notification = new Notification({
|
const notification = new Notification({
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import picgo from '@core/picgo'
|
import picgo from '@core/picgo'
|
||||||
import { app, shell } from 'electron'
|
import { app, shell } from 'electron'
|
||||||
|
|
||||||
import { IRPCActionType } from '#/types/enum'
|
import type { IIPCEvent } from '#/types/rpc'
|
||||||
import { IIPCEvent } from '#/types/rpc'
|
|
||||||
import { i18nManager } from '~/i18n'
|
import { i18nManager } from '~/i18n'
|
||||||
|
import { IRPCActionType } from '~/utils/enum'
|
||||||
|
|
||||||
export default [
|
export default [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
import windowManager from 'apis/app/window/windowManager'
|
import windowManager from 'apis/app/window/windowManager'
|
||||||
import { app, BrowserWindow } from 'electron'
|
import { app, BrowserWindow } from 'electron'
|
||||||
|
|
||||||
import { IRPCActionType, IWindowList } from '#/types/enum'
|
import type { IIPCEvent } from '#/types/rpc'
|
||||||
import { IIPCEvent } from '#/types/rpc'
|
import type { IMiniWindowPos, IPicGoPlugin } from '#/types/types'
|
||||||
import { IMiniWindowPos, IPicGoPlugin } from '#/types/types'
|
|
||||||
import {
|
import {
|
||||||
buildMainPageMenu,
|
buildMainPageMenu,
|
||||||
buildMiniPageMenu,
|
buildMiniPageMenu,
|
||||||
@@ -11,6 +10,7 @@ import {
|
|||||||
buildPluginPageMenu,
|
buildPluginPageMenu,
|
||||||
buildSecondPicBedMenu
|
buildSecondPicBedMenu
|
||||||
} from '~/events/remotes/menu'
|
} from '~/events/remotes/menu'
|
||||||
|
import { IRPCActionType, IWindowList } from '~/utils/enum'
|
||||||
import { openMiniWindow } from '~/utils/windowHelper'
|
import { openMiniWindow } from '~/utils/windowHelper'
|
||||||
|
|
||||||
export default [
|
export default [
|
||||||
@@ -22,7 +22,7 @@ export default [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
action: IRPCActionType.OPEN_WINDOW,
|
action: IRPCActionType.OPEN_WINDOW,
|
||||||
handler: async (_: IIPCEvent, args: [windowName: IWindowList]) => {
|
handler: async (_: IIPCEvent, args: [windowName: string]) => {
|
||||||
const window = windowManager.get(args[0])
|
const window = windowManager.get(args[0])
|
||||||
if (window) {
|
if (window) {
|
||||||
window.show()
|
window.show()
|
||||||
|
|||||||
@@ -3,17 +3,17 @@ import path from 'node:path'
|
|||||||
import { dbPathChecker, defaultConfigPath } from '@core/datastore/dbChecker'
|
import { dbPathChecker, defaultConfigPath } from '@core/datastore/dbChecker'
|
||||||
import fs from 'fs-extra'
|
import fs from 'fs-extra'
|
||||||
|
|
||||||
import { IToolboxItemCheckStatus, IToolboxItemType } from '#/types/enum'
|
import type { IToolboxCheckerMap, IToolboxFixMap } from '#/types/rpc'
|
||||||
import { IToolboxCheckerMap, IToolboxFixMap } from '#/types/rpc'
|
|
||||||
import { CLIPBOARD_IMAGE_FOLDER } from '#/utils/static'
|
|
||||||
import { sendToolboxResWithType } from '~/events/rpc/routes/toolbox/utils'
|
import { sendToolboxResWithType } from '~/events/rpc/routes/toolbox/utils'
|
||||||
import { T as $t } from '~/i18n'
|
import { T as $t } from '~/i18n'
|
||||||
|
import { IToolboxItemCheckStatus, IToolboxItemType } from '~/utils/enum'
|
||||||
|
import { CLIPBOARD_IMAGE_FOLDER } from '~/utils/static'
|
||||||
|
|
||||||
const sendToolboxRes = sendToolboxResWithType(IToolboxItemType.HAS_PROBLEM_WITH_CLIPBOARD_PIC_UPLOAD)
|
const sendToolboxRes = sendToolboxResWithType(IToolboxItemType.HAS_PROBLEM_WITH_CLIPBOARD_PIC_UPLOAD)
|
||||||
|
|
||||||
const defaultClipboardImagePath = path.join(defaultConfigPath, CLIPBOARD_IMAGE_FOLDER)
|
const defaultClipboardImagePath = path.join(defaultConfigPath, CLIPBOARD_IMAGE_FOLDER)
|
||||||
|
|
||||||
export const checkClipboardUploadMap: IToolboxCheckerMap<IToolboxItemType.HAS_PROBLEM_WITH_CLIPBOARD_PIC_UPLOAD> = {
|
export const checkClipboardUploadMap: IToolboxCheckerMap<string> = {
|
||||||
[IToolboxItemType.HAS_PROBLEM_WITH_CLIPBOARD_PIC_UPLOAD]: async event => {
|
[IToolboxItemType.HAS_PROBLEM_WITH_CLIPBOARD_PIC_UPLOAD]: async event => {
|
||||||
sendToolboxRes(event, {
|
sendToolboxRes(event, {
|
||||||
status: IToolboxItemCheckStatus.LOADING
|
status: IToolboxItemCheckStatus.LOADING
|
||||||
@@ -51,7 +51,7 @@ export const checkClipboardUploadMap: IToolboxCheckerMap<IToolboxItemType.HAS_PR
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const fixClipboardUploadMap: IToolboxFixMap<IToolboxItemType.HAS_PROBLEM_WITH_CLIPBOARD_PIC_UPLOAD> = {
|
export const fixClipboardUploadMap: IToolboxFixMap<string> = {
|
||||||
[IToolboxItemType.HAS_PROBLEM_WITH_CLIPBOARD_PIC_UPLOAD]: async () => {
|
[IToolboxItemType.HAS_PROBLEM_WITH_CLIPBOARD_PIC_UPLOAD]: async () => {
|
||||||
const configFilePath = dbPathChecker()
|
const configFilePath = dbPathChecker()
|
||||||
const dirPath = path.dirname(configFilePath)
|
const dirPath = path.dirname(configFilePath)
|
||||||
|
|||||||
@@ -5,13 +5,13 @@ import { dbPathChecker } from '@core/datastore/dbChecker'
|
|||||||
import type { IpcMainEvent } from 'electron'
|
import type { IpcMainEvent } from 'electron'
|
||||||
import fs from 'fs-extra'
|
import fs from 'fs-extra'
|
||||||
|
|
||||||
import { IToolboxItemCheckStatus, IToolboxItemType } from '#/types/enum'
|
|
||||||
import type { IToolboxCheckerMap, IToolboxFixMap } from '#/types/rpc'
|
import type { IToolboxCheckerMap, IToolboxFixMap } from '#/types/rpc'
|
||||||
import { sendToolboxResWithType } from '~/events/rpc/routes/toolbox/utils'
|
import { sendToolboxResWithType } from '~/events/rpc/routes/toolbox/utils'
|
||||||
import { T as $t } from '~/i18n'
|
import { T as $t } from '~/i18n'
|
||||||
|
import { IToolboxItemCheckStatus, IToolboxItemType } from '~/utils/enum'
|
||||||
|
|
||||||
export const checkFileMap: IToolboxCheckerMap<
|
export const checkFileMap: IToolboxCheckerMap<
|
||||||
IToolboxItemType.IS_CONFIG_FILE_BROKEN | IToolboxItemType.IS_GALLERY_FILE_BROKEN
|
string
|
||||||
> = {
|
> = {
|
||||||
[IToolboxItemType.IS_CONFIG_FILE_BROKEN]: async (event: IpcMainEvent) => {
|
[IToolboxItemType.IS_CONFIG_FILE_BROKEN]: async (event: IpcMainEvent) => {
|
||||||
const sendToolboxRes = sendToolboxResWithType(IToolboxItemType.IS_CONFIG_FILE_BROKEN)
|
const sendToolboxRes = sendToolboxResWithType(IToolboxItemType.IS_CONFIG_FILE_BROKEN)
|
||||||
@@ -63,7 +63,7 @@ export const checkFileMap: IToolboxCheckerMap<
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const fixFileMap: IToolboxFixMap<
|
export const fixFileMap: IToolboxFixMap<
|
||||||
IToolboxItemType.IS_CONFIG_FILE_BROKEN | IToolboxItemType.IS_GALLERY_FILE_BROKEN
|
string
|
||||||
> = {
|
> = {
|
||||||
[IToolboxItemType.IS_CONFIG_FILE_BROKEN]: async () => {
|
[IToolboxItemType.IS_CONFIG_FILE_BROKEN]: async () => {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -4,10 +4,10 @@ import fs from 'fs-extra'
|
|||||||
import { IConfig } from 'piclist'
|
import { IConfig } from 'piclist'
|
||||||
import tunnel from 'tunnel'
|
import tunnel from 'tunnel'
|
||||||
|
|
||||||
import { IToolboxItemCheckStatus, IToolboxItemType } from '#/types/enum'
|
import type { IToolboxCheckerMap } from '#/types/rpc'
|
||||||
import { IToolboxCheckerMap } from '#/types/rpc'
|
|
||||||
import { sendToolboxResWithType } from '~/events/rpc/routes/toolbox/utils'
|
import { sendToolboxResWithType } from '~/events/rpc/routes/toolbox/utils'
|
||||||
import { T as $t } from '~/i18n'
|
import { T as $t } from '~/i18n'
|
||||||
|
import { IToolboxItemCheckStatus, IToolboxItemType } from '~/utils/enum'
|
||||||
|
|
||||||
function getProxy (proxyStr: string): AxiosRequestConfig['proxy'] | null {
|
function getProxy (proxyStr: string): AxiosRequestConfig['proxy'] | null {
|
||||||
if (proxyStr) {
|
if (proxyStr) {
|
||||||
@@ -25,7 +25,7 @@ function getProxy (proxyStr: string): AxiosRequestConfig['proxy'] | null {
|
|||||||
|
|
||||||
const sendToolboxRes = sendToolboxResWithType(IToolboxItemType.HAS_PROBLEM_WITH_PROXY)
|
const sendToolboxRes = sendToolboxResWithType(IToolboxItemType.HAS_PROBLEM_WITH_PROXY)
|
||||||
|
|
||||||
export const checkProxyMap: IToolboxCheckerMap<IToolboxItemType.HAS_PROBLEM_WITH_PROXY> = {
|
export const checkProxyMap: IToolboxCheckerMap<string> = {
|
||||||
[IToolboxItemType.HAS_PROBLEM_WITH_PROXY]: async event => {
|
[IToolboxItemType.HAS_PROBLEM_WITH_PROXY]: async event => {
|
||||||
sendToolboxRes(event, {
|
sendToolboxRes(event, {
|
||||||
status: IToolboxItemCheckStatus.LOADING
|
status: IToolboxItemCheckStatus.LOADING
|
||||||
|
|||||||
@@ -1,21 +1,21 @@
|
|||||||
import { IpcMainEvent } from 'electron'
|
import { IpcMainEvent } from 'electron'
|
||||||
|
|
||||||
import { IRPCActionType, IRPCType, IToolboxItemType } from '#/types/enum'
|
import type { IToolboxCheckArgs, IToolboxCheckerMap, IToolboxFixMap } from '#/types/rpc'
|
||||||
import { IToolboxCheckArgs, IToolboxCheckerMap, IToolboxFixMap } from '#/types/rpc'
|
|
||||||
import { RPCRouter } from '~/events/rpc/router'
|
import { RPCRouter } from '~/events/rpc/router'
|
||||||
import { checkClipboardUploadMap, fixClipboardUploadMap } from '~/events/rpc/routes/toolbox/checkClipboardUpload'
|
import { checkClipboardUploadMap, fixClipboardUploadMap } from '~/events/rpc/routes/toolbox/checkClipboardUpload'
|
||||||
import { checkFileMap, fixFileMap } from '~/events/rpc/routes/toolbox/checkFile'
|
import { checkFileMap, fixFileMap } from '~/events/rpc/routes/toolbox/checkFile'
|
||||||
import { checkProxyMap } from '~/events/rpc/routes/toolbox/checkProxy'
|
import { checkProxyMap } from '~/events/rpc/routes/toolbox/checkProxy'
|
||||||
|
import { IRPCActionType, IRPCType } from '~/utils/enum'
|
||||||
|
|
||||||
const toolboxRouter = new RPCRouter()
|
const toolboxRouter = new RPCRouter()
|
||||||
|
|
||||||
const toolboxCheckMap: Partial<IToolboxCheckerMap<IToolboxItemType>> = {
|
const toolboxCheckMap: Partial<IToolboxCheckerMap<string>> = {
|
||||||
...checkFileMap,
|
...checkFileMap,
|
||||||
...checkClipboardUploadMap,
|
...checkClipboardUploadMap,
|
||||||
...checkProxyMap
|
...checkProxyMap
|
||||||
}
|
}
|
||||||
|
|
||||||
const toolboxFixMap: Partial<IToolboxFixMap<IToolboxItemType>> = {
|
const toolboxFixMap: Partial<IToolboxFixMap<string>> = {
|
||||||
...fixFileMap,
|
...fixFileMap,
|
||||||
...fixClipboardUploadMap
|
...fixClipboardUploadMap
|
||||||
}
|
}
|
||||||
@@ -33,7 +33,7 @@ toolboxRouter
|
|||||||
} else {
|
} else {
|
||||||
// do check all
|
// do check all
|
||||||
for (const key in toolboxCheckMap) {
|
for (const key in toolboxCheckMap) {
|
||||||
const handler = toolboxCheckMap[key as IToolboxItemType]
|
const handler = toolboxCheckMap[key]
|
||||||
if (handler) {
|
if (handler) {
|
||||||
handler(event as IpcMainEvent)
|
handler(event as IpcMainEvent)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import { IpcMainEvent } from 'electron'
|
import { IpcMainEvent } from 'electron'
|
||||||
|
|
||||||
import { IRPCActionType, IToolboxItemType } from '#/types/enum'
|
import type { IToolboxCheckRes } from '#/types/rpc'
|
||||||
import { IToolboxCheckRes } from '#/types/rpc'
|
import { IRPCActionType } from '~/utils/enum'
|
||||||
|
|
||||||
export function sendToolboxResWithType (type: IToolboxItemType) {
|
export function sendToolboxResWithType (type: string) {
|
||||||
return (event: IpcMainEvent, res?: Omit<IToolboxCheckRes, 'type'>) => {
|
return (event: IpcMainEvent, res?: Omit<IToolboxCheckRes, 'type'>) => {
|
||||||
return event.sender.send(IRPCActionType.TOOLBOX_CHECK_RES, {
|
return event.sender.send(IRPCActionType.TOOLBOX_CHECK_RES, {
|
||||||
...res,
|
...res,
|
||||||
|
|||||||
@@ -3,12 +3,12 @@ import uploader from 'apis/app/uploader'
|
|||||||
import windowManager from 'apis/app/window/windowManager'
|
import windowManager from 'apis/app/window/windowManager'
|
||||||
import { Notification } from 'electron'
|
import { Notification } from 'electron'
|
||||||
|
|
||||||
import { IPasteStyle, IRPCActionType, IRPCType, IWindowList } from '#/types/enum'
|
import type { IIPCEvent } from '#/types/rpc'
|
||||||
import { IIPCEvent } from '#/types/rpc'
|
|
||||||
import { configPaths } from '#/utils/configPaths'
|
|
||||||
import { RPCRouter } from '~/events/rpc/router'
|
import { RPCRouter } from '~/events/rpc/router'
|
||||||
import { T as $t } from '~/i18n'
|
import { T as $t } from '~/i18n'
|
||||||
import { generateShortUrl, handleCopyUrl, setTrayToolTip } from '~/utils/common'
|
import { generateShortUrl, handleCopyUrl, setTrayToolTip } from '~/utils/common'
|
||||||
|
import { configPaths } from '~/utils/configPaths'
|
||||||
|
import { IPasteStyle, IRPCActionType, IRPCType, IWindowList } from '~/utils/enum'
|
||||||
import pasteTemplate from '~/utils/pasteTemplate'
|
import pasteTemplate from '~/utils/pasteTemplate'
|
||||||
|
|
||||||
const trayRouter = new RPCRouter()
|
const trayRouter = new RPCRouter()
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import { uploadChoosedFiles, uploadClipboardFiles } from 'apis/app/uploader/apis'
|
import { uploadChoosedFiles, uploadClipboardFiles } from 'apis/app/uploader/apis'
|
||||||
|
|
||||||
import { IRPCActionType, IRPCType } from '#/types/enum'
|
import type { IIPCEvent } from '#/types/rpc'
|
||||||
import { IIPCEvent } from '#/types/rpc'
|
import type { IFileWithPath } from '#/types/types'
|
||||||
import { IFileWithPath } from '#/types/types'
|
|
||||||
import { RPCRouter } from '~/events/rpc/router'
|
import { RPCRouter } from '~/events/rpc/router'
|
||||||
|
import { IRPCActionType, IRPCType } from '~/utils/enum'
|
||||||
import getPicBeds from '~/utils/getPicBeds'
|
import getPicBeds from '~/utils/getPicBeds'
|
||||||
|
|
||||||
const uploadRouter = new RPCRouter()
|
const uploadRouter = new RPCRouter()
|
||||||
|
|||||||
@@ -4,10 +4,23 @@ import { I18n, ObjectAdapter } from '@piclist/i18n'
|
|||||||
import fs from 'fs-extra'
|
import fs from 'fs-extra'
|
||||||
import yaml from 'js-yaml'
|
import yaml from 'js-yaml'
|
||||||
|
|
||||||
import { builtinI18nList } from '#/i18n'
|
import type { ILocales, ILocalesKey } from '#/types/i18n'
|
||||||
import { ILocales, ILocalesKey } from '#/types/i18n'
|
import type { II18nItem, IStringKeyMap } from '#/types/types'
|
||||||
import { II18nItem, IStringKeyMap } from '#/types/types'
|
|
||||||
|
|
||||||
|
const builtinI18nList: II18nItem[] = [
|
||||||
|
{
|
||||||
|
label: '简体中文',
|
||||||
|
value: 'zh-CN'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '繁體中文',
|
||||||
|
value: 'zh-TW'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'English',
|
||||||
|
value: 'en'
|
||||||
|
}
|
||||||
|
]
|
||||||
class I18nManager {
|
class I18nManager {
|
||||||
private i18n: I18n | null = null
|
private i18n: I18n | null = null
|
||||||
private builtinI18nFolder = path.join('./resources', 'i18n')
|
private builtinI18nFolder = path.join('./resources', 'i18n')
|
||||||
|
|||||||
@@ -16,10 +16,6 @@ import { app, dialog, globalShortcut, Notification, protocol, screen, shell } fr
|
|||||||
import updater from 'electron-updater'
|
import updater from 'electron-updater'
|
||||||
import fs from 'fs-extra'
|
import fs from 'fs-extra'
|
||||||
|
|
||||||
import { II18nLanguage, IRemoteNoticeTriggerHook, ISartMode, IWindowList } from '#/types/enum'
|
|
||||||
import { configPaths } from '#/utils/configPaths'
|
|
||||||
import { notificationList } from '#/utils/notification'
|
|
||||||
import { CLIPBOARD_IMAGE_FOLDER } from '#/utils/static'
|
|
||||||
import busEventList from '~/events/busEventList'
|
import busEventList from '~/events/busEventList'
|
||||||
import { rpcServer } from '~/events/rpc'
|
import { rpcServer } from '~/events/rpc'
|
||||||
import { startFileServer, stopFileServer } from '~/fileServer'
|
import { startFileServer, stopFileServer } from '~/fileServer'
|
||||||
@@ -32,8 +28,12 @@ import server from '~/server/index'
|
|||||||
import webServer from '~/server/webServer'
|
import webServer from '~/server/webServer'
|
||||||
import beforeOpen from '~/utils/beforeOpen'
|
import beforeOpen from '~/utils/beforeOpen'
|
||||||
import clipboardPoll from '~/utils/clipboardPoll'
|
import clipboardPoll from '~/utils/clipboardPoll'
|
||||||
|
import { configPaths } from '~/utils/configPaths'
|
||||||
|
import { II18nLanguage, IRemoteNoticeTriggerHook, ISartMode, IWindowList } from '~/utils/enum'
|
||||||
import { getUploadFiles } from '~/utils/handleArgv'
|
import { getUploadFiles } from '~/utils/handleArgv'
|
||||||
import { initI18n } from '~/utils/handleI18n'
|
import { initI18n } from '~/utils/handleI18n'
|
||||||
|
import { notificationList } from '~/utils/notification'
|
||||||
|
import { CLIPBOARD_IMAGE_FOLDER } from '~/utils/static'
|
||||||
import updateChecker from '~/utils/updateChecker'
|
import updateChecker from '~/utils/updateChecker'
|
||||||
|
|
||||||
const isDevelopment = process.env.NODE_ENV !== 'production'
|
const isDevelopment = process.env.NODE_ENV !== 'production'
|
||||||
@@ -169,6 +169,8 @@ class LifeCycle {
|
|||||||
const readyFunction = async () => {
|
const readyFunction = async () => {
|
||||||
windowManager.create(IWindowList.TRAY_WINDOW)
|
windowManager.create(IWindowList.TRAY_WINDOW)
|
||||||
windowManager.create(IWindowList.SETTING_WINDOW)
|
windowManager.create(IWindowList.SETTING_WINDOW)
|
||||||
|
const setwin = windowManager.get(IWindowList.SETTING_WINDOW)
|
||||||
|
setwin?.webContents?.openDevTools({ mode: 'detach' })
|
||||||
const isAutoListenClipboard = db.get(configPaths.settings.isAutoListenClipboard) || false
|
const isAutoListenClipboard = db.get(configPaths.settings.isAutoListenClipboard) || false
|
||||||
const ClipboardWatcher = clipboardPoll
|
const ClipboardWatcher = clipboardPoll
|
||||||
if (isAutoListenClipboard) {
|
if (isAutoListenClipboard) {
|
||||||
|
|||||||
@@ -6,9 +6,7 @@ import axios from 'axios'
|
|||||||
import { ipcMain, IpcMainEvent } from 'electron'
|
import { ipcMain, IpcMainEvent } from 'electron'
|
||||||
import * as fastxml from 'fast-xml-parser'
|
import * as fastxml from 'fast-xml-parser'
|
||||||
|
|
||||||
import { commonTaskStatus, IWindowList, uploadTaskSpecialStatus } from '#/types/enum'
|
import type { IStringKeyMap } from '#/types/types'
|
||||||
import { IStringKeyMap } from '#/types/types'
|
|
||||||
import { cancelDownloadLoadingFileList, refreshDownloadFileTransferList } from '#/utils/static'
|
|
||||||
import UpDownTaskQueue from '~/manage/datastore/upDownTaskQueue'
|
import UpDownTaskQueue from '~/manage/datastore/upDownTaskQueue'
|
||||||
import {
|
import {
|
||||||
ConcurrencyPromisePool,
|
ConcurrencyPromisePool,
|
||||||
@@ -19,6 +17,8 @@ import {
|
|||||||
} from '~/manage/utils/common'
|
} from '~/manage/utils/common'
|
||||||
import { ManageLogger } from '~/manage/utils/logger'
|
import { ManageLogger } from '~/manage/utils/logger'
|
||||||
import { isImage } from '~/utils/common'
|
import { isImage } from '~/utils/common'
|
||||||
|
import { commonTaskStatus, IWindowList, uploadTaskSpecialStatus } from '~/utils/enum'
|
||||||
|
import { cancelDownloadLoadingFileList, refreshDownloadFileTransferList } from '~/utils/static'
|
||||||
|
|
||||||
// 坑爹阿里云 返回数据类型标注和实际各种不一致
|
// 坑爹阿里云 返回数据类型标注和实际各种不一致
|
||||||
class AliyunApi {
|
class AliyunApi {
|
||||||
|
|||||||
@@ -5,10 +5,7 @@ import { ipcMain, IpcMainEvent } from 'electron'
|
|||||||
import fs from 'fs-extra'
|
import fs from 'fs-extra'
|
||||||
import got from 'got'
|
import got from 'got'
|
||||||
|
|
||||||
import { commonTaskStatus, IWindowList } from '#/types/enum'
|
import type { IStringKeyMap } from '#/types/types'
|
||||||
import { IStringKeyMap } from '#/types/types'
|
|
||||||
import { formatHttpProxy, trimPath } from '#/utils/common'
|
|
||||||
import { cancelDownloadLoadingFileList, refreshDownloadFileTransferList } from '#/utils/static'
|
|
||||||
import UpDownTaskQueue from '~/manage/datastore/upDownTaskQueue'
|
import UpDownTaskQueue from '~/manage/datastore/upDownTaskQueue'
|
||||||
import {
|
import {
|
||||||
ConcurrencyPromisePool,
|
ConcurrencyPromisePool,
|
||||||
@@ -19,7 +16,9 @@ import {
|
|||||||
NewDownloader
|
NewDownloader
|
||||||
} from '~/manage/utils/common'
|
} from '~/manage/utils/common'
|
||||||
import { ManageLogger } from '~/manage/utils/logger'
|
import { ManageLogger } from '~/manage/utils/logger'
|
||||||
import { isImage } from '~/utils/common'
|
import { formatHttpProxy, isImage, trimPath } from '~/utils/common'
|
||||||
|
import { commonTaskStatus, IWindowList } from '~/utils/enum'
|
||||||
|
import { cancelDownloadLoadingFileList, refreshDownloadFileTransferList } from '~/utils/static'
|
||||||
|
|
||||||
class GithubApi {
|
class GithubApi {
|
||||||
token: string
|
token: string
|
||||||
|
|||||||
@@ -6,9 +6,7 @@ import FormData from 'form-data'
|
|||||||
import fs from 'fs-extra'
|
import fs from 'fs-extra'
|
||||||
import got from 'got'
|
import got from 'got'
|
||||||
|
|
||||||
import { commonTaskStatus, IWindowList } from '#/types/enum'
|
import type { IStringKeyMap } from '#/types/types'
|
||||||
import { IStringKeyMap } from '#/types/types'
|
|
||||||
import { formatHttpProxy } from '#/utils/common'
|
|
||||||
import UpDownTaskQueue from '~/manage/datastore/upDownTaskQueue'
|
import UpDownTaskQueue from '~/manage/datastore/upDownTaskQueue'
|
||||||
import {
|
import {
|
||||||
ConcurrencyPromisePool,
|
ConcurrencyPromisePool,
|
||||||
@@ -20,7 +18,8 @@ import {
|
|||||||
NewDownloader
|
NewDownloader
|
||||||
} from '~/manage/utils/common'
|
} from '~/manage/utils/common'
|
||||||
import ManageLogger from '~/manage/utils/logger'
|
import ManageLogger from '~/manage/utils/logger'
|
||||||
import { isImage } from '~/utils/common'
|
import { formatHttpProxy, isImage } from '~/utils/common'
|
||||||
|
import { commonTaskStatus, IWindowList } from '~/utils/enum'
|
||||||
|
|
||||||
class ImgurApi {
|
class ImgurApi {
|
||||||
userName: string
|
userName: string
|
||||||
|
|||||||
@@ -5,13 +5,13 @@ import windowManager from 'apis/app/window/windowManager'
|
|||||||
import { ipcMain, IpcMainEvent } from 'electron'
|
import { ipcMain, IpcMainEvent } from 'electron'
|
||||||
import fs from 'fs-extra'
|
import fs from 'fs-extra'
|
||||||
|
|
||||||
import { commonTaskStatus, downloadTaskSpecialStatus, IWindowList, uploadTaskSpecialStatus } from '#/types/enum'
|
import type { IStringKeyMap } from '#/types/types'
|
||||||
import { IStringKeyMap } from '#/types/types'
|
|
||||||
import { cancelDownloadLoadingFileList, refreshDownloadFileTransferList } from '#/utils/static'
|
|
||||||
import UpDownTaskQueue from '~/manage/datastore/upDownTaskQueue'
|
import UpDownTaskQueue from '~/manage/datastore/upDownTaskQueue'
|
||||||
import { formatError } from '~/manage/utils/common'
|
import { formatError } from '~/manage/utils/common'
|
||||||
import ManageLogger from '~/manage/utils/logger'
|
import ManageLogger from '~/manage/utils/logger'
|
||||||
import { isImage } from '~/utils/common'
|
import { isImage } from '~/utils/common'
|
||||||
|
import { commonTaskStatus, downloadTaskSpecialStatus, IWindowList, uploadTaskSpecialStatus } from '~/utils/enum'
|
||||||
|
import { cancelDownloadLoadingFileList, refreshDownloadFileTransferList } from '~/utils/static'
|
||||||
|
|
||||||
class LocalApi {
|
class LocalApi {
|
||||||
logger: ManageLogger
|
logger: ManageLogger
|
||||||
|
|||||||
@@ -5,9 +5,7 @@ import axios from 'axios'
|
|||||||
import { ipcMain, IpcMainEvent } from 'electron'
|
import { ipcMain, IpcMainEvent } from 'electron'
|
||||||
import qiniu from 'qiniu'
|
import qiniu from 'qiniu'
|
||||||
|
|
||||||
import { commonTaskStatus, IWindowList, uploadTaskSpecialStatus } from '#/types/enum'
|
import type { IStringKeyMap } from '#/types/types'
|
||||||
import { IStringKeyMap } from '#/types/types'
|
|
||||||
import { cancelDownloadLoadingFileList, refreshDownloadFileTransferList } from '#/utils/static'
|
|
||||||
import UpDownTaskQueue from '~/manage/datastore/upDownTaskQueue'
|
import UpDownTaskQueue from '~/manage/datastore/upDownTaskQueue'
|
||||||
import {
|
import {
|
||||||
ConcurrencyPromisePool,
|
ConcurrencyPromisePool,
|
||||||
@@ -18,6 +16,8 @@ import {
|
|||||||
} from '~/manage/utils/common'
|
} from '~/manage/utils/common'
|
||||||
import { ManageLogger } from '~/manage/utils/logger'
|
import { ManageLogger } from '~/manage/utils/logger'
|
||||||
import { isImage } from '~/utils/common'
|
import { isImage } from '~/utils/common'
|
||||||
|
import { commonTaskStatus, IWindowList, uploadTaskSpecialStatus } from '~/utils/enum'
|
||||||
|
import { cancelDownloadLoadingFileList, refreshDownloadFileTransferList } from '~/utils/static'
|
||||||
|
|
||||||
class QiniuApi {
|
class QiniuApi {
|
||||||
mac: qiniu.auth.digest.Mac
|
mac: qiniu.auth.digest.Mac
|
||||||
|
|||||||
@@ -27,15 +27,14 @@ import windowManager from 'apis/app/window/windowManager'
|
|||||||
import { ipcMain, IpcMainEvent } from 'electron'
|
import { ipcMain, IpcMainEvent } from 'electron'
|
||||||
import fs from 'fs-extra'
|
import fs from 'fs-extra'
|
||||||
|
|
||||||
import { commonTaskStatus, IWindowList, uploadTaskSpecialStatus } from '#/types/enum'
|
import type { IStringKeyMap } from '#/types/types'
|
||||||
import { IStringKeyMap } from '#/types/types'
|
|
||||||
import { formatEndpoint, formatHttpProxy } from '#/utils/common'
|
|
||||||
import { cancelDownloadLoadingFileList, refreshDownloadFileTransferList } from '#/utils/static'
|
|
||||||
import UpDownTaskQueue from '~/manage/datastore/upDownTaskQueue'
|
import UpDownTaskQueue from '~/manage/datastore/upDownTaskQueue'
|
||||||
import { ConcurrencyPromisePool, formatError, getAgent, getFileMimeType, NewDownloader } from '~/manage/utils/common'
|
import { ConcurrencyPromisePool, formatError, getAgent, getFileMimeType, NewDownloader } from '~/manage/utils/common'
|
||||||
import { dogecloudApi, DogecloudToken, getTempToken } from '~/manage/utils/dogeAPI'
|
import { dogecloudApi, DogecloudToken, getTempToken } from '~/manage/utils/dogeAPI'
|
||||||
import { ManageLogger } from '~/manage/utils/logger'
|
import { ManageLogger } from '~/manage/utils/logger'
|
||||||
import { isImage } from '~/utils/common'
|
import { formatEndpoint, formatHttpProxy, isImage } from '~/utils/common'
|
||||||
|
import { commonTaskStatus, IWindowList, uploadTaskSpecialStatus } from '~/utils/enum'
|
||||||
|
import { cancelDownloadLoadingFileList, refreshDownloadFileTransferList } from '~/utils/static'
|
||||||
|
|
||||||
class S3plistApi {
|
class S3plistApi {
|
||||||
baseOptions: S3ClientConfig
|
baseOptions: S3ClientConfig
|
||||||
|
|||||||
@@ -3,15 +3,15 @@ import path from 'node:path'
|
|||||||
import windowManager from 'apis/app/window/windowManager'
|
import windowManager from 'apis/app/window/windowManager'
|
||||||
import { ipcMain, IpcMainEvent } from 'electron'
|
import { ipcMain, IpcMainEvent } from 'electron'
|
||||||
|
|
||||||
import { commonTaskStatus, downloadTaskSpecialStatus, IWindowList, uploadTaskSpecialStatus } from '#/types/enum'
|
import type { Undefinable } from '#/types/manage'
|
||||||
import { Undefinable } from '#/types/manage'
|
import type { IStringKeyMap } from '#/types/types'
|
||||||
import { IStringKeyMap } from '#/types/types'
|
|
||||||
import { cancelDownloadLoadingFileList, refreshDownloadFileTransferList } from '#/utils/static'
|
|
||||||
import UpDownTaskQueue from '~/manage/datastore/upDownTaskQueue'
|
import UpDownTaskQueue from '~/manage/datastore/upDownTaskQueue'
|
||||||
import { formatError } from '~/manage/utils/common'
|
import { formatError } from '~/manage/utils/common'
|
||||||
import ManageLogger from '~/manage/utils/logger'
|
import ManageLogger from '~/manage/utils/logger'
|
||||||
import { isImage } from '~/utils/common'
|
import { isImage } from '~/utils/common'
|
||||||
|
import { commonTaskStatus, downloadTaskSpecialStatus, IWindowList, uploadTaskSpecialStatus } from '~/utils/enum'
|
||||||
import SSHClient from '~/utils/sshClient'
|
import SSHClient from '~/utils/sshClient'
|
||||||
|
import { cancelDownloadLoadingFileList, refreshDownloadFileTransferList } from '~/utils/static'
|
||||||
|
|
||||||
interface listDirResult {
|
interface listDirResult {
|
||||||
permissions: string
|
permissions: string
|
||||||
|
|||||||
@@ -7,12 +7,12 @@ import { ipcMain, IpcMainEvent } from 'electron'
|
|||||||
import FormData from 'form-data'
|
import FormData from 'form-data'
|
||||||
import fs from 'fs-extra'
|
import fs from 'fs-extra'
|
||||||
|
|
||||||
import { commonTaskStatus, IWindowList } from '#/types/enum'
|
import type { IStringKeyMap } from '#/types/types'
|
||||||
import { IStringKeyMap } from '#/types/types'
|
|
||||||
import UpDownTaskQueue from '~/manage/datastore/upDownTaskQueue'
|
import UpDownTaskQueue from '~/manage/datastore/upDownTaskQueue'
|
||||||
import { ConcurrencyPromisePool, formatError, getFileMimeType, gotUpload, NewDownloader } from '~/manage/utils/common'
|
import { ConcurrencyPromisePool, formatError, getFileMimeType, gotUpload, NewDownloader } from '~/manage/utils/common'
|
||||||
import { ManageLogger } from '~/manage/utils/logger'
|
import { ManageLogger } from '~/manage/utils/logger'
|
||||||
import { isImage } from '~/utils/common'
|
import { isImage } from '~/utils/common'
|
||||||
|
import { commonTaskStatus, IWindowList } from '~/utils/enum'
|
||||||
|
|
||||||
class SmmsApi {
|
class SmmsApi {
|
||||||
baseUrl = 'https://smms.app/api/v2'
|
baseUrl = 'https://smms.app/api/v2'
|
||||||
|
|||||||
@@ -5,14 +5,13 @@ import COS from 'cos-nodejs-sdk-v5'
|
|||||||
import { ipcMain, IpcMainEvent } from 'electron'
|
import { ipcMain, IpcMainEvent } from 'electron'
|
||||||
import fs from 'fs-extra'
|
import fs from 'fs-extra'
|
||||||
|
|
||||||
import { commonTaskStatus, downloadTaskSpecialStatus, IWindowList, uploadTaskSpecialStatus } from '#/types/enum'
|
import type { IStringKeyMap } from '#/types/types'
|
||||||
import { IStringKeyMap } from '#/types/types'
|
|
||||||
import { handleUrlEncode } from '#/utils/common'
|
|
||||||
import { cancelDownloadLoadingFileList, refreshDownloadFileTransferList } from '#/utils/static'
|
|
||||||
import UpDownTaskQueue from '~/manage/datastore/upDownTaskQueue'
|
import UpDownTaskQueue from '~/manage/datastore/upDownTaskQueue'
|
||||||
import { formatError, getFileMimeType } from '~/manage/utils/common'
|
import { formatError, getFileMimeType } from '~/manage/utils/common'
|
||||||
import { ManageLogger } from '~/manage/utils/logger'
|
import { ManageLogger } from '~/manage/utils/logger'
|
||||||
import { isImage } from '~/utils/common'
|
import { handleUrlEncode, isImage } from '~/utils/common'
|
||||||
|
import { commonTaskStatus, downloadTaskSpecialStatus, IWindowList, uploadTaskSpecialStatus } from '~/utils/enum'
|
||||||
|
import { cancelDownloadLoadingFileList, refreshDownloadFileTransferList } from '~/utils/static'
|
||||||
|
|
||||||
class TcyunApi {
|
class TcyunApi {
|
||||||
ctx: COS
|
ctx: COS
|
||||||
|
|||||||
@@ -7,9 +7,7 @@ import FormData from 'form-data'
|
|||||||
import fs from 'fs-extra'
|
import fs from 'fs-extra'
|
||||||
import Upyun from 'upyun'
|
import Upyun from 'upyun'
|
||||||
|
|
||||||
import { commonTaskStatus, IWindowList } from '#/types/enum'
|
import type { IStringKeyMap } from '#/types/types'
|
||||||
import { IStringKeyMap } from '#/types/types'
|
|
||||||
import { cancelDownloadLoadingFileList, refreshDownloadFileTransferList } from '#/utils/static'
|
|
||||||
import UpDownTaskQueue from '~/manage/datastore/upDownTaskQueue'
|
import UpDownTaskQueue from '~/manage/datastore/upDownTaskQueue'
|
||||||
import {
|
import {
|
||||||
ConcurrencyPromisePool,
|
ConcurrencyPromisePool,
|
||||||
@@ -22,6 +20,8 @@ import {
|
|||||||
} from '~/manage/utils/common'
|
} from '~/manage/utils/common'
|
||||||
import { ManageLogger } from '~/manage/utils/logger'
|
import { ManageLogger } from '~/manage/utils/logger'
|
||||||
import { isImage } from '~/utils/common'
|
import { isImage } from '~/utils/common'
|
||||||
|
import { commonTaskStatus, IWindowList } from '~/utils/enum'
|
||||||
|
import { cancelDownloadLoadingFileList, refreshDownloadFileTransferList } from '~/utils/static'
|
||||||
|
|
||||||
class UpyunApi {
|
class UpyunApi {
|
||||||
ser: Upyun.Service
|
ser: Upyun.Service
|
||||||
|
|||||||
@@ -7,15 +7,14 @@ import { ipcMain, IpcMainEvent } from 'electron'
|
|||||||
import fs from 'fs-extra'
|
import fs from 'fs-extra'
|
||||||
import { AuthType, createClient, FileStat, ProgressEvent, WebDAVClient, WebDAVClientOptions } from 'webdav'
|
import { AuthType, createClient, FileStat, ProgressEvent, WebDAVClient, WebDAVClientOptions } from 'webdav'
|
||||||
|
|
||||||
import { commonTaskStatus, IWindowList, uploadTaskSpecialStatus } from '#/types/enum'
|
import type { IStringKeyMap } from '#/types/types'
|
||||||
import { IStringKeyMap } from '#/types/types'
|
|
||||||
import { formatEndpoint, formatHttpProxy } from '#/utils/common'
|
|
||||||
import { cancelDownloadLoadingFileList, refreshDownloadFileTransferList } from '#/utils/static'
|
|
||||||
import UpDownTaskQueue from '~/manage/datastore/upDownTaskQueue'
|
import UpDownTaskQueue from '~/manage/datastore/upDownTaskQueue'
|
||||||
import { ConcurrencyPromisePool, formatError, getInnerAgent, NewDownloader } from '~/manage/utils/common'
|
import { ConcurrencyPromisePool, formatError, getInnerAgent, NewDownloader } from '~/manage/utils/common'
|
||||||
import ManageLogger from '~/manage/utils/logger'
|
import ManageLogger from '~/manage/utils/logger'
|
||||||
import { isImage } from '~/utils/common'
|
import { formatEndpoint, formatHttpProxy, isImage } from '~/utils/common'
|
||||||
import { getAuthHeader } from '~/utils/digestAuth'
|
import { getAuthHeader } from '~/utils/digestAuth'
|
||||||
|
import { commonTaskStatus, IWindowList, uploadTaskSpecialStatus } from '~/utils/enum'
|
||||||
|
import { cancelDownloadLoadingFileList, refreshDownloadFileTransferList } from '~/utils/static'
|
||||||
|
|
||||||
class WebdavplistApi {
|
class WebdavplistApi {
|
||||||
endpoint: string
|
endpoint: string
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { JSONStore } from '@piclist/store'
|
import { JSONStore } from '@piclist/store'
|
||||||
|
|
||||||
import { IManageApiType, IManageConfigType } from '#/types/manage'
|
import type { IManageApiType, IManageConfigType } from '#/types/manage'
|
||||||
import { IStringKeyMap } from '#/types/types'
|
import type { IStringKeyMap } from '#/types/types'
|
||||||
interface IJSON {
|
interface IJSON {
|
||||||
[propsName: string]: string | number | IJSON
|
[propsName: string]: string | number | IJSON
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import { app } from 'electron'
|
|||||||
import fs from 'fs-extra'
|
import fs from 'fs-extra'
|
||||||
import writeFile from 'write-file-atomic'
|
import writeFile from 'write-file-atomic'
|
||||||
|
|
||||||
import { notificationList } from '#/utils/notification'
|
import { notificationList } from '~/utils/notification'
|
||||||
import { T as $t } from '~/i18n'
|
import { T as $t } from '~/i18n'
|
||||||
|
|
||||||
const STORE_PATH = app.getPath('userData')
|
const STORE_PATH = app.getPath('userData')
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ import path from 'node:path'
|
|||||||
import { app } from 'electron'
|
import { app } from 'electron'
|
||||||
import fs from 'fs-extra'
|
import fs from 'fs-extra'
|
||||||
|
|
||||||
import { commonTaskStatus, downloadTaskSpecialStatus, uploadTaskSpecialStatus } from '#/types/enum'
|
import type { IDownloadTask, IUploadTask } from '#/types/manage'
|
||||||
import { IDownloadTask, IUploadTask } from '#/types/manage'
|
import { commonTaskStatus, downloadTaskSpecialStatus, uploadTaskSpecialStatus } from '~/utils/enum'
|
||||||
|
|
||||||
class UpDownTaskQueue {
|
class UpDownTaskQueue {
|
||||||
private static instance: UpDownTaskQueue
|
private static instance: UpDownTaskQueue
|
||||||
|
|||||||
@@ -7,15 +7,15 @@ import { ipcMain } from 'electron'
|
|||||||
import fs from 'fs-extra'
|
import fs from 'fs-extra'
|
||||||
import { get, set, unset } from 'lodash-es'
|
import { get, set, unset } from 'lodash-es'
|
||||||
|
|
||||||
import { IWindowList } from '#/types/enum'
|
import type { IManageApiType, IManageConfigType, IManageError, IPicBedMangeConfig } from '#/types/manage'
|
||||||
import { IManageApiType, IManageConfigType, IManageError, IPicBedMangeConfig } from '#/types/manage'
|
import type { IStringKeyMap } from '#/types/types'
|
||||||
import { IStringKeyMap } from '#/types/types'
|
|
||||||
import { cancelDownloadLoadingFileList, refreshDownloadFileTransferList } from '#/utils/static'
|
|
||||||
import API from '~/manage/apis/api'
|
import API from '~/manage/apis/api'
|
||||||
import ManageDB from '~/manage/datastore/db'
|
import ManageDB from '~/manage/datastore/db'
|
||||||
import { managePathChecker } from '~/manage/datastore/dbChecker'
|
import { managePathChecker } from '~/manage/datastore/dbChecker'
|
||||||
import { formatError, isInputConfigValid } from '~/manage/utils/common'
|
import { formatError, isInputConfigValid } from '~/manage/utils/common'
|
||||||
import { ManageLogger } from '~/manage/utils/logger'
|
import { ManageLogger } from '~/manage/utils/logger'
|
||||||
|
import { IWindowList } from '~/utils/enum'
|
||||||
|
import { cancelDownloadLoadingFileList, refreshDownloadFileTransferList } from '~/utils/static'
|
||||||
|
|
||||||
export class ManageApi extends EventEmitter implements IManageApiType {
|
export class ManageApi extends EventEmitter implements IManageApiType {
|
||||||
private _config!: Partial<IManageConfigType>
|
private _config!: Partial<IManageConfigType>
|
||||||
|
|||||||
@@ -13,11 +13,11 @@ import { HttpProxyAgent, HttpsProxyAgent } from 'hpagent'
|
|||||||
import mime from 'mime-types'
|
import mime from 'mime-types'
|
||||||
import Downloader from 'nodejs-file-downloader'
|
import Downloader from 'nodejs-file-downloader'
|
||||||
|
|
||||||
import { commonTaskStatus, downloadTaskSpecialStatus, uploadTaskSpecialStatus } from '#/types/enum'
|
import type { IHTTPProxy, IStringKeyMap } from '#/types/types'
|
||||||
import { IHTTPProxy, IStringKeyMap } from '#/types/types'
|
|
||||||
import { formatHttpProxy } from '#/utils/common'
|
|
||||||
import UpDownTaskQueue from '~/manage/datastore/upDownTaskQueue'
|
import UpDownTaskQueue from '~/manage/datastore/upDownTaskQueue'
|
||||||
import { ManageLogger } from '~/manage/utils/logger'
|
import { ManageLogger } from '~/manage/utils/logger'
|
||||||
|
import { formatHttpProxy } from '~/utils/common'
|
||||||
|
import { commonTaskStatus, downloadTaskSpecialStatus, uploadTaskSpecialStatus } from '~/utils/enum'
|
||||||
|
|
||||||
export const getFSFile = async (filePath: string, stream: boolean = false): Promise<IStringKeyMap> => {
|
export const getFSFile = async (filePath: string, stream: boolean = false): Promise<IStringKeyMap> => {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import querystring from 'node:querystring'
|
|||||||
import picgo from '@core/picgo'
|
import picgo from '@core/picgo'
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
|
|
||||||
import { IObj } from '#/types/types'
|
import type { IObj } from '#/types/types'
|
||||||
|
|
||||||
export interface DogecloudToken {
|
export interface DogecloudToken {
|
||||||
accessKeyId: string
|
accessKeyId: string
|
||||||
|
|||||||
@@ -6,11 +6,11 @@ import dayjs from 'dayjs'
|
|||||||
import fs from 'fs-extra'
|
import fs from 'fs-extra'
|
||||||
import { ILogColor, ILogger } from 'piclist/dist/types'
|
import { ILogColor, ILogger } from 'piclist/dist/types'
|
||||||
|
|
||||||
import { ILogType } from '#/types/enum'
|
import type { IManageApiType, Undefinable } from '#/types/manage'
|
||||||
import { IManageApiType, Undefinable } from '#/types/manage'
|
import type { ILogArgvType, ILogArgvTypeWithError } from '#/types/types'
|
||||||
import { ILogArgvType, ILogArgvTypeWithError } from '#/types/types'
|
import { enforceNumber } from '~/utils/common'
|
||||||
import { enforceNumber } from '#/utils/common'
|
import { configPaths } from '~/utils/configPaths'
|
||||||
import { configPaths } from '#/utils/configPaths'
|
import { ILogType } from '~/utils/enum'
|
||||||
|
|
||||||
export class ManageLogger implements ILogger {
|
export class ManageLogger implements ILogger {
|
||||||
readonly #level = {
|
readonly #level = {
|
||||||
@@ -28,7 +28,7 @@ export class ManageLogger implements ILogger {
|
|||||||
this.#ctx = ctx
|
this.#ctx = ctx
|
||||||
}
|
}
|
||||||
|
|
||||||
#handleLog (type: ILogType, ...msg: ILogArgvTypeWithError[]): void {
|
#handleLog (type: string, ...msg: ILogArgvTypeWithError[]): void {
|
||||||
const logHeader = chalk[this.#level[type] as ILogColor](`[PicList ${type.toUpperCase()}]`)
|
const logHeader = chalk[this.#level[type] as ILogColor](`[PicList ${type.toUpperCase()}]`)
|
||||||
console.log(logHeader, ...msg)
|
console.log(logHeader, ...msg)
|
||||||
this.#logLevel = this.#ctx.getConfig(configPaths.settings.logLevel)
|
this.#logLevel = this.#ctx.getConfig(configPaths.settings.logLevel)
|
||||||
|
|||||||
@@ -8,10 +8,10 @@ import { app } from 'electron'
|
|||||||
import fs from 'fs-extra'
|
import fs from 'fs-extra'
|
||||||
import multer from 'multer'
|
import multer from 'multer'
|
||||||
|
|
||||||
import { ErrnoException, IObj, IServerConfig } from '#/types/types'
|
import type { ErrnoException, IObj, IServerConfig } from '#/types/types'
|
||||||
import { configPaths } from '#/utils/configPaths'
|
|
||||||
import routers from '~/server/routerManager'
|
import routers from '~/server/routerManager'
|
||||||
import { ensureHTTPLink, handleResponse } from '~/server/utils'
|
import { ensureHTTPLink, handleResponse } from '~/server/utils'
|
||||||
|
import { configPaths } from '~/utils/configPaths'
|
||||||
|
|
||||||
const DEFAULT_PORT = 36677
|
const DEFAULT_PORT = 36677
|
||||||
const DEFAULT_HOST = '0.0.0.0'
|
const DEFAULT_HOST = '0.0.0.0'
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { routeHandler } from '#/types/types'
|
import type { routeHandler } from '#/types/types'
|
||||||
|
|
||||||
type HttpMethod = 'GET' | 'POST'
|
type HttpMethod = 'GET' | 'POST'
|
||||||
|
|
||||||
|
|||||||
@@ -10,12 +10,12 @@ import { app } from 'electron'
|
|||||||
import fs from 'fs-extra'
|
import fs from 'fs-extra'
|
||||||
import { marked } from 'marked'
|
import { marked } from 'marked'
|
||||||
|
|
||||||
import { IHttpResponse, IStringKeyMap } from '#/types/types'
|
import type { IHttpResponse, IStringKeyMap } from '#/types/types'
|
||||||
import { configPaths } from '#/utils/configPaths'
|
|
||||||
import { markdownContent } from '~/server/apiDoc'
|
import { markdownContent } from '~/server/apiDoc'
|
||||||
import router from '~/server/router'
|
import router from '~/server/router'
|
||||||
import { deleteChoosedFiles, handleResponse } from '~/server/utils'
|
import { deleteChoosedFiles, handleResponse } from '~/server/utils'
|
||||||
import { AESHelper } from '~/utils/aesHelper'
|
import { AESHelper } from '~/utils/aesHelper'
|
||||||
|
import { configPaths } from '~/utils/configPaths'
|
||||||
import { changeCurrentUploader } from '~/utils/handleUploaderConfig'
|
import { changeCurrentUploader } from '~/utils/handleUploaderConfig'
|
||||||
|
|
||||||
const appPath = app.getPath('userData')
|
const appPath = app.getPath('userData')
|
||||||
|
|||||||
@@ -6,11 +6,11 @@ import ALLApi from 'apis/delete/allApi'
|
|||||||
import GuiApi from 'apis/gui'
|
import GuiApi from 'apis/gui'
|
||||||
import { Notification } from 'electron'
|
import { Notification } from 'electron'
|
||||||
|
|
||||||
import { ICOREBuildInEvent, IWindowList } from '#/types/enum'
|
import type { IHttpResponse, ImgInfo, IObj } from '#/types/types'
|
||||||
import { IHttpResponse, ImgInfo, IObj } from '#/types/types'
|
|
||||||
import { configPaths } from '#/utils/configPaths'
|
|
||||||
import { picBedsCanbeDeleted } from '#/utils/static'
|
|
||||||
import { T as $t } from '~/i18n/index'
|
import { T as $t } from '~/i18n/index'
|
||||||
|
import { configPaths } from '~/utils/configPaths'
|
||||||
|
import { ICOREBuildInEvent, IWindowList } from '~/utils/enum'
|
||||||
|
import { picBedsCanbeDeleted } from '~/utils/static'
|
||||||
|
|
||||||
export const handleResponse = ({
|
export const handleResponse = ({
|
||||||
response,
|
response,
|
||||||
|
|||||||
@@ -5,9 +5,9 @@ import picgo from '@core/picgo'
|
|||||||
import logger from '@core/picgo/logger'
|
import logger from '@core/picgo/logger'
|
||||||
import fs from 'fs-extra'
|
import fs from 'fs-extra'
|
||||||
|
|
||||||
import { IStringKeyMap } from '#/types/types'
|
import type { IStringKeyMap } from '#/types/types'
|
||||||
import { encodeFilePath } from '#/utils/common'
|
import { encodeFilePath } from '~/utils/common'
|
||||||
import { configPaths } from '#/utils/configPaths'
|
import { configPaths } from '~/utils/configPaths'
|
||||||
|
|
||||||
const defaultPath = process.platform === 'win32' ? 'C:\\Users' : '/'
|
const defaultPath = process.platform === 'win32' ? 'C:\\Users' : '/'
|
||||||
|
|
||||||
|
|||||||
@@ -2,12 +2,11 @@ import crypto from 'node:crypto'
|
|||||||
|
|
||||||
import picgo from '@core/picgo'
|
import picgo from '@core/picgo'
|
||||||
|
|
||||||
import { configPaths } from '#/utils/configPaths'
|
import { configPaths } from '~/utils/configPaths'
|
||||||
import { DEFAULT_AES_PASSWORD } from '#/utils/static'
|
|
||||||
|
|
||||||
export class AESHelper {
|
export class AESHelper {
|
||||||
private key: Buffer = crypto.pbkdf2Sync(
|
private key: Buffer = crypto.pbkdf2Sync(
|
||||||
picgo.getConfig<string>(configPaths.settings.aesPassword) || DEFAULT_AES_PASSWORD,
|
picgo.getConfig<string>(configPaths.settings.aesPassword) || 'aesPassword',
|
||||||
Buffer.from('a8b3c4d2e4f5098712345678feedc0de', 'hex'),
|
Buffer.from('a8b3c4d2e4f5098712345678feedc0de', 'hex'),
|
||||||
100000,
|
100000,
|
||||||
32,
|
32,
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { dbPathChecker } from '@core/datastore/dbChecker'
|
|||||||
import fs from 'fs-extra'
|
import fs from 'fs-extra'
|
||||||
import yaml from 'js-yaml'
|
import yaml from 'js-yaml'
|
||||||
|
|
||||||
import { ILocales } from '#/types/i18n'
|
import type { ILocales } from '#/types/i18n'
|
||||||
import { i18nManager } from '~/i18n'
|
import { i18nManager } from '~/i18n'
|
||||||
|
|
||||||
const configPath = dbPathChecker()
|
const configPath = dbPathChecker()
|
||||||
|
|||||||
@@ -6,11 +6,28 @@ import axios from 'axios'
|
|||||||
import { clipboard, dialog, Notification, Tray } from 'electron'
|
import { clipboard, dialog, Notification, Tray } from 'electron'
|
||||||
import FormData from 'form-data'
|
import FormData from 'form-data'
|
||||||
import fs from 'fs-extra'
|
import fs from 'fs-extra'
|
||||||
|
import { isReactive, isRef, toRaw, unref } from 'vue'
|
||||||
|
|
||||||
import { IShortUrlServer } from '#/types/enum'
|
import type { IHTTPProxy, IPrivateShowNotificationOption, IShowMessageBoxResult, IStringKeyMap } from '#/types/types'
|
||||||
import { IPrivateShowNotificationOption, IShowMessageBoxResult } from '#/types/types'
|
import { configPaths } from '~/utils/configPaths'
|
||||||
import { handleUrlEncode } from '#/utils/common'
|
import { IShortUrlServer } from '~/utils/enum'
|
||||||
import { configPaths } from '#/utils/configPaths'
|
|
||||||
|
/**
|
||||||
|
* get raw data from reactive or ref
|
||||||
|
*/
|
||||||
|
export const getRawData = (args: any): any => {
|
||||||
|
if (isRef(args)) return unref(args)
|
||||||
|
if (isReactive(args)) return toRaw(args)
|
||||||
|
if (Array.isArray(args)) return args.map(getRawData)
|
||||||
|
if (typeof args === 'object' && args !== null) {
|
||||||
|
const data = {} as Record<string, any>
|
||||||
|
for (const key in args) {
|
||||||
|
data[key] = getRawData(args[key])
|
||||||
|
}
|
||||||
|
return data
|
||||||
|
}
|
||||||
|
return args
|
||||||
|
}
|
||||||
|
|
||||||
const getExtension = (fileName: string) => path.extname(fileName).slice(1)
|
const getExtension = (fileName: string) => path.extname(fileName).slice(1)
|
||||||
|
|
||||||
@@ -123,9 +140,6 @@ export const getClipboardFilePath = (): string => {
|
|||||||
return ''
|
return ''
|
||||||
}
|
}
|
||||||
|
|
||||||
export const handleUrlEncodeWithSetting = (url: string) =>
|
|
||||||
db.get(configPaths.settings.encodeOutputURL) ? handleUrlEncode(url) : url
|
|
||||||
|
|
||||||
const c1nApi = 'https://c1n.cn/link/short'
|
const c1nApi = 'https://c1n.cn/link/short'
|
||||||
|
|
||||||
const generateC1NShortUrl = async (url: string) => {
|
const generateC1NShortUrl = async (url: string) => {
|
||||||
@@ -246,3 +260,76 @@ export const generateShortUrl = async (url: string) => {
|
|||||||
return url
|
return url
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const isUrl = (url: string): boolean => {
|
||||||
|
try {
|
||||||
|
return Boolean(new URL(url))
|
||||||
|
} catch {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const isUrlEncode = (url: string): boolean => {
|
||||||
|
url = url || ''
|
||||||
|
try {
|
||||||
|
return url !== decodeURI(url)
|
||||||
|
} catch {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const handleUrlEncode = (url: string): string => (isUrlEncode(url) ? url : encodeURI(url))
|
||||||
|
|
||||||
|
export const handleUrlEncodeWithSetting = (url: string) =>
|
||||||
|
db.get(configPaths.settings.encodeOutputURL) ? handleUrlEncode(url) : url
|
||||||
|
|
||||||
|
export const handleStreamlinePluginName = (name: string) => name.replace(/(@[^/]+\/)?picgo-plugin-/, '')
|
||||||
|
export const simpleClone = (obj: any) => JSON.parse(JSON.stringify(obj))
|
||||||
|
export const enforceNumber = (num: number | string) => (isNaN(+num) ? 0 : +num)
|
||||||
|
|
||||||
|
export const trimValues = <T extends IStringKeyMap>(
|
||||||
|
obj: T
|
||||||
|
): { [K in keyof T]: T[K] extends string ? string : T[K] } => {
|
||||||
|
return Object.fromEntries(
|
||||||
|
Object.entries(obj).map(([key, value]) => [key, typeof value === 'string' ? value.trim() : value])
|
||||||
|
) as { [K in keyof T]: T[K] extends string ? string : T[K] }
|
||||||
|
}
|
||||||
|
|
||||||
|
export const formatEndpoint = (endpoint: string, sslEnabled: boolean): string => {
|
||||||
|
const hasProtocol = /^https?:\/\//.test(endpoint)
|
||||||
|
if (!hasProtocol) {
|
||||||
|
return `${sslEnabled ? 'https' : 'http'}://${endpoint}`
|
||||||
|
}
|
||||||
|
return sslEnabled ? endpoint.replace(/^http:\/\//, 'https://') : endpoint.replace(/^https:\/\//, 'http://')
|
||||||
|
}
|
||||||
|
|
||||||
|
export const formatHttpProxy = (
|
||||||
|
proxy: string | undefined,
|
||||||
|
type: 'object' | 'string'
|
||||||
|
): IHTTPProxy | undefined | string => {
|
||||||
|
if (!proxy) return undefined
|
||||||
|
if (/^https?:\/\//.test(proxy)) {
|
||||||
|
const { protocol, hostname, port } = new URL(proxy)
|
||||||
|
return type === 'string'
|
||||||
|
? `${protocol}//${hostname}:${port}`
|
||||||
|
: {
|
||||||
|
host: hostname,
|
||||||
|
port: Number(port),
|
||||||
|
protocol: protocol.slice(0, -1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const [host, port] = proxy.split(':')
|
||||||
|
return type === 'string'
|
||||||
|
? `http://${host}:${port}`
|
||||||
|
: {
|
||||||
|
host,
|
||||||
|
port: port ? Number(port) : 80,
|
||||||
|
protocol: 'http'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export function encodeFilePath (filePath: string) {
|
||||||
|
return filePath.replace(/\\/g, '/').split('/').map(encodeURIComponent).join('/')
|
||||||
|
}
|
||||||
|
|
||||||
|
export const trimPath = (path: string) => path.replace(/^\/+|\/+$/g, '').replace(/\/+/g, '/')
|
||||||
|
|||||||
@@ -1,13 +1,7 @@
|
|||||||
import type { IBuildInCompressOptions, IBuildInWaterMarkOptions } from 'piclist'
|
import type { IBuildInCompressOptions, IBuildInWaterMarkOptions } from 'piclist'
|
||||||
|
|
||||||
import { II18nLanguage, IPasteStyle, ISartMode, IShortUrlServer } from '#/types/enum'
|
import type { IAliYunConfig, IAwsS3PListUserConfig, IGitHubConfig, IImgurConfig, ILocalConfig, ILskyConfig, IPicBedType, IQiniuConfig, IServerConfig, ISftpPlistConfig, IShortKeyConfig, ISMMSConfig, ISyncConfig, ITcYunConfig, IUploaderConfig, IUpYunConfig, IWebdavPlistConfig } from '#/types/types'
|
||||||
|
|
||||||
import { IAliYunConfig, IAwsS3PListUserConfig, IGitHubConfig, IImgurConfig, ILocalConfig, ILskyConfig, IPicBedType, IQiniuConfig, IServerConfig, ISftpPlistConfig, IShortKeyConfig, ISMMSConfig, ISyncConfig, ITcYunConfig, IUploaderConfig, IUpYunConfig, IWebdavPlistConfig } from '../types/types'
|
|
||||||
|
|
||||||
export type ISartModeValues = (typeof ISartMode)[keyof typeof ISartMode]
|
|
||||||
export type IPasteStyleValues = (typeof IPasteStyle)[keyof typeof IPasteStyle]
|
|
||||||
export type II18nLanguageValues = (typeof II18nLanguage)[keyof typeof II18nLanguage]
|
|
||||||
export type IShortUrlServerValues = (typeof IShortUrlServer)[keyof typeof IShortUrlServer]
|
|
||||||
export type manualPageOpenType = 'window' | 'browser'
|
export type manualPageOpenType = 'window' | 'browser'
|
||||||
|
|
||||||
interface IPicGoPlugins {
|
interface IPicGoPlugins {
|
||||||
@@ -54,22 +48,22 @@ export interface IConfigStruct {
|
|||||||
autoCloseMainWindow: boolean
|
autoCloseMainWindow: boolean
|
||||||
isCustomMiniIcon: boolean
|
isCustomMiniIcon: boolean
|
||||||
customMiniIcon: string
|
customMiniIcon: string
|
||||||
startMode: ISartModeValues
|
startMode: string
|
||||||
autoRename: boolean
|
autoRename: boolean
|
||||||
deleteCloudFile: boolean
|
deleteCloudFile: boolean
|
||||||
server: IServerConfig
|
server: IServerConfig
|
||||||
serverKey: string
|
serverKey: string
|
||||||
pasteStyle: IPasteStyleValues
|
pasteStyle: string
|
||||||
aesPassword: string
|
aesPassword: string
|
||||||
rename: boolean
|
rename: boolean
|
||||||
sync: ISyncConfig
|
sync: ISyncConfig
|
||||||
tempDirPath: string
|
tempDirPath: string
|
||||||
language: II18nLanguageValues
|
language: string
|
||||||
customLink: string
|
customLink: string
|
||||||
manualPageOpen: manualPageOpenType
|
manualPageOpen: manualPageOpenType
|
||||||
encodeOutputURL: boolean
|
encodeOutputURL: boolean
|
||||||
useShortUrl: boolean
|
useShortUrl: boolean
|
||||||
shortUrlServer: IShortUrlServerValues
|
shortUrlServer: string
|
||||||
c1nToken: string
|
c1nToken: string
|
||||||
cfWorkerHost: string
|
cfWorkerHost: string
|
||||||
yourlsDomain: string
|
yourlsDomain: string
|
||||||
@@ -9,7 +9,7 @@ import { NodeHttpHandler } from '@smithy/node-http-handler'
|
|||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
import { ISftpPlistConfig } from 'piclist'
|
import { ISftpPlistConfig } from 'piclist'
|
||||||
|
|
||||||
import { IObj, IStringKeyMap } from '#/types/types'
|
import type { IObj, IStringKeyMap } from '#/types/types'
|
||||||
import { getAgent } from '~/manage/utils/common'
|
import { getAgent } from '~/manage/utils/common'
|
||||||
import SSHClient from '~/utils/sshClient'
|
import SSHClient from '~/utils/sshClient'
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,8 @@ import crypto from 'node:crypto'
|
|||||||
|
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
|
|
||||||
import { IStringKeyMap } from '#/types/types'
|
import type { IStringKeyMap } from '#/types/types'
|
||||||
|
|
||||||
const AUTH_KEY_VALUE_RE = /(\w+)=["']?([^'"]{1,10000})["']?/
|
const AUTH_KEY_VALUE_RE = /(\w+)=["']?([^'"]{1,10000})["']?/
|
||||||
let NC = 0
|
let NC = 0
|
||||||
const NC_PAD = '00000000'
|
const NC_PAD = '00000000'
|
||||||
|
|||||||
242
src/main/utils/enum.ts
Normal file
242
src/main/utils/enum.ts
Normal file
@@ -0,0 +1,242 @@
|
|||||||
|
export const ILogType = {
|
||||||
|
success: 'success',
|
||||||
|
info: 'info',
|
||||||
|
warn: 'warn',
|
||||||
|
error: 'error'
|
||||||
|
}
|
||||||
|
|
||||||
|
export const ICOREBuildInEvent = {
|
||||||
|
UPLOAD_PROGRESS: 'uploadProgress',
|
||||||
|
FAILED: 'failed',
|
||||||
|
BEFORE_TRANSFORM: 'beforeTransform',
|
||||||
|
BEFORE_UPLOAD: 'beforeUpload',
|
||||||
|
AFTER_UPLOAD: 'afterUpload',
|
||||||
|
FINISHED: 'finished',
|
||||||
|
INSTALL: 'install',
|
||||||
|
UNINSTALL: 'uninstall',
|
||||||
|
UPDATE: 'update',
|
||||||
|
NOTIFICATION: 'notification',
|
||||||
|
REMOVE: 'remove'
|
||||||
|
}
|
||||||
|
|
||||||
|
export const IPicGoHelperType = {
|
||||||
|
afterUploadPlugins: 'afterUploadPlugins',
|
||||||
|
beforeTransformPlugins: 'beforeTransformPlugins',
|
||||||
|
beforeUploadPlugins: 'beforeUploadPlugins',
|
||||||
|
uploader: 'uploader',
|
||||||
|
transformer: 'transformer'
|
||||||
|
}
|
||||||
|
|
||||||
|
export const IPasteStyle = {
|
||||||
|
MARKDOWN: 'markdown',
|
||||||
|
HTML: 'HTML',
|
||||||
|
URL: 'URL',
|
||||||
|
UBB: 'UBB',
|
||||||
|
CUSTOM: 'Custom'
|
||||||
|
}
|
||||||
|
|
||||||
|
export const IWindowList = {
|
||||||
|
SETTING_WINDOW: 'SETTING_WINDOW',
|
||||||
|
TRAY_WINDOW: 'TRAY_WINDOW',
|
||||||
|
MINI_WINDOW: 'MINI_WINDOW',
|
||||||
|
RENAME_WINDOW: 'RENAME_WINDOW',
|
||||||
|
TOOLBOX_WINDOW: 'TOOLBOX_WINDOW'
|
||||||
|
}
|
||||||
|
|
||||||
|
export const IRemoteNoticeActionType = {
|
||||||
|
OPEN_URL: 'OPEN_URL',
|
||||||
|
SHOW_NOTICE: 'SHOW_NOTICE', // notification
|
||||||
|
SHOW_DIALOG: 'SHOW_DIALOG', // dialog notice
|
||||||
|
COMMON: 'COMMON',
|
||||||
|
VOID: 'VOID', // do nothing
|
||||||
|
SHOW_MESSAGE_BOX: 'SHOW_MESSAGE_BOX'
|
||||||
|
}
|
||||||
|
|
||||||
|
export const IRemoteNoticeTriggerHook = {
|
||||||
|
APP_START: 'APP_START',
|
||||||
|
SETTING_WINDOW_OPEN: 'SETTING_WINDOW_OPEN'
|
||||||
|
}
|
||||||
|
|
||||||
|
export const IRemoteNoticeTriggerCount = {
|
||||||
|
ONCE: 'ONCE', // default
|
||||||
|
ALWAYS: 'ALWAYS'
|
||||||
|
}
|
||||||
|
|
||||||
|
export const IRPCType = {
|
||||||
|
INVOKE: 'INVOKE',
|
||||||
|
SEND: 'SEND'
|
||||||
|
}
|
||||||
|
|
||||||
|
export const IRPCActionType = {
|
||||||
|
// system rpc
|
||||||
|
RELOAD_APP: 'RELOAD_APP',
|
||||||
|
OPEN_URL: 'OPEN_URL',
|
||||||
|
OPEN_FILE: 'OPEN_FILE',
|
||||||
|
HIDE_DOCK: 'HIDE_DOCK',
|
||||||
|
SET_CURRENT_LANGUAGE: 'SET_CURRENT_LANGUAGE',
|
||||||
|
OPEN_WINDOW: 'OPEN_WINDOW',
|
||||||
|
OPEN_MINI_WINDOW: 'OPEN_MINI_WINDOW',
|
||||||
|
CLOSE_WINDOW: 'CLOSE_WINDOW',
|
||||||
|
MINIMIZE_WINDOW: 'MINIMIZE_WINDOW',
|
||||||
|
SHOW_MINI_PAGE_MENU: 'SHOW_MINI_PAGE_MENU',
|
||||||
|
SHOW_MAIN_PAGE_MENU: 'SHOW_MAIN_PAGE_MENU',
|
||||||
|
SHOW_UPLOAD_PAGE_MENU: 'SHOW_UPLOAD_PAGE_MENU',
|
||||||
|
SHOW_SECOND_UPLOADER_MENU: 'SHOW_SECOND_UPLOADER_MENU',
|
||||||
|
SHOW_PLUGIN_PAGE_MENU: 'SHOW_PLUGIN_PAGE_MENU',
|
||||||
|
SET_MINI_WINDOW_POS: 'SET_MINI_WINDOW_POS',
|
||||||
|
MINI_WINDOW_ON_TOP: 'MINI_WINDOW_ON_TOP',
|
||||||
|
MAIN_WINDOW_ON_TOP: 'MAIN_WINDOW_ON_TOP',
|
||||||
|
UPDATE_MINI_WINDOW_ICON: 'UPDATE_MINI_WINDOW_ICON',
|
||||||
|
REFRESH_SETTING_WINDOW: 'REFRESH_SETTING_WINDOW',
|
||||||
|
// picbed RPC
|
||||||
|
PICBED_GET_PICBED_CONFIG: 'PICBED_GET_PICBED_CONFIG',
|
||||||
|
PICBED_GET_CONFIG_LIST: 'PICBED_GET_CONFIG_LIST',
|
||||||
|
PICBED_DELETE_CONFIG: 'PICBED_DELETE_CONFIG',
|
||||||
|
UPLOADER_CHANGE_CURRENT: 'UPLOADER_CHANGE_CURRENT',
|
||||||
|
UPLOADER_SELECT: 'UPLOADER_SELECT',
|
||||||
|
UPLOADER_UPDATE_CONFIG: 'UPLOADER_UPDATE_CONFIG',
|
||||||
|
UPLOADER_RESET_CONFIG: 'UPLOADER_RESET_CONFIG',
|
||||||
|
DELETE_ALL_API: 'DELETE_ALL_API',
|
||||||
|
|
||||||
|
// toolbox rpc
|
||||||
|
TOOLBOX_CHECK: 'TOOLBOX_CHECK',
|
||||||
|
TOOLBOX_CHECK_RES: 'TOOLBOX_CHECK_RES',
|
||||||
|
TOOLBOX_CHECK_FIX: 'TOOLBOX_CHECK_FIX',
|
||||||
|
|
||||||
|
// main app setting rpc
|
||||||
|
PICLIST_GET_CONFIG: 'PICLIST_GET_CONFIG',
|
||||||
|
PICLIST_GET_CONFIG_SYNC: 'PICLIST_GET_CONFIG_SYNC',
|
||||||
|
PICLIST_SAVE_CONFIG: 'PICLIST_SAVE_CONFIG',
|
||||||
|
PICLIST_OPEN_FILE: 'PICLIST_OPEN_FILE',
|
||||||
|
PICLIST_OPEN_DIRECTORY: 'PICLIST_OPEN_DIRECTORY',
|
||||||
|
PICLIST_AUTO_START: 'PICLIST_AUTO_START',
|
||||||
|
|
||||||
|
// shortkey setting rpc
|
||||||
|
SHORTKEY_UPDATE: 'SHORTKEY_UPDATE',
|
||||||
|
SHORTKEY_BIND_OR_UNBIND: 'SHORTKEY_BIND_OR_UNBIND',
|
||||||
|
SHORTKEY_TOGGLE_SHORTKEY_MODIFIED_MODE: 'SHORTKEY_TOGGLE_SHORTKEY_MODIFIED_MODE',
|
||||||
|
|
||||||
|
// configuration setting rpc
|
||||||
|
CONFIGURE_MIGRATE_FROM_PICGO: 'CONFIGURE_MIGRATE_FROM_PICGO',
|
||||||
|
CONFIGURE_UPLOAD_COMMON_CONFIG: 'CONFIGURE_UPLOAD_COMMON_CONFIG',
|
||||||
|
CONFIGURE_UPLOAD_MANAGE_CONFIG: 'CONFIGURE_UPLOAD_MANAGE_CONFIG',
|
||||||
|
CONFIGURE_UPLOAD_ALL_CONFIG: 'CONFIGURE_UPLOAD_ALL_CONFIG',
|
||||||
|
CONFIGURE_DOWNLOAD_COMMON_CONFIG: 'CONFIGURE_DOWNLOAD_COMMON_CONFIG',
|
||||||
|
CONFIGURE_DOWNLOAD_MANAGE_CONFIG: 'CONFIGURE_DOWNLOAD_MANAGE_CONFIG',
|
||||||
|
CONFIGURE_DOWNLOAD_ALL_CONFIG: 'CONFIGURE_DOWNLOAD_ALL_CONFIG',
|
||||||
|
|
||||||
|
// advanced setting rpc
|
||||||
|
ADVANCED_UPDATE_SERVER: 'ADVANCED_UPDATE_SERVER',
|
||||||
|
ADVANCED_STOP_WEB_SERVER: 'ADVANCED_STOP_WEB_SERVER',
|
||||||
|
ADVANCED_RESTART_WEB_SERVER: 'ADVANCED_RESTART_WEB_SERVER',
|
||||||
|
|
||||||
|
// upload and main page rpc
|
||||||
|
MAIN_GET_PICBED: 'MAIN_GET_PICBED',
|
||||||
|
UPLOAD_CLIPBOARD_FILES_FROM_UPLOAD_PAGE: 'UPLOAD_CLIPBOARD_FILES_FROM_UPLOAD_PAGE',
|
||||||
|
UPLOAD_CHOOSED_FILES: 'UPLOAD_CHOOSED_FILES',
|
||||||
|
|
||||||
|
// gallery rpc
|
||||||
|
GALLERY_PASTE_TEXT: 'GALLERY_PASTE_TEXT',
|
||||||
|
GALLERY_REMOVE_FILES: 'GALLERY_REMOVE_FILES',
|
||||||
|
GALLERY_GET_DB: 'GALLERY_GET_DB',
|
||||||
|
GALLERY_GET_BY_ID_DB: 'GALLERY_GET_BY_ID_DB',
|
||||||
|
GALLERY_UPDATE_BY_ID_DB: 'GALLERY_UPDATE_BY_ID_DB',
|
||||||
|
GALLERY_REMOVE_BY_ID_DB: 'GALLERY_REMOVE_BY_ID_DB',
|
||||||
|
GALLERY_INSERT_DB: 'GALLERY_INSERT_DB',
|
||||||
|
GALLERY_INSERT_DB_BATCH: 'GALLERY_INSERT_DB_BATCH',
|
||||||
|
// plugin rpc
|
||||||
|
PLUGIN_GET_LIST: 'PLUGIN_GET_LIST',
|
||||||
|
PLUGIN_INSTALL: 'PLUGIN_INSTALL',
|
||||||
|
PLUGIN_IMPORT_LOCAL: 'PLUGIN_IMPORT_LOCAL',
|
||||||
|
PLUGIN_UPDATE_ALL: 'PLUGIN_UPDATE_ALL',
|
||||||
|
|
||||||
|
// tray rpc
|
||||||
|
TRAY_SET_TOOL_TIP: 'TRAY_SET_TOOL_TIP',
|
||||||
|
TRAY_GET_SHORT_URL: 'TRAY_GET_SHORT_URL',
|
||||||
|
TRAY_UPLOAD_CLIPBOARD_FILES: 'TRAY_UPLOAD_CLIPBOARD_FILES',
|
||||||
|
|
||||||
|
// manage rpc
|
||||||
|
MANAGE_GET_CONFIG: 'MANAGE_GET_CONFIG',
|
||||||
|
MANAGE_SAVE_CONFIG: 'MANAGE_SAVE_CONFIG',
|
||||||
|
MANAGE_REMOVE_CONFIG: 'MANAGE_REMOVE_CONFIG',
|
||||||
|
MANAGE_GET_BUCKET_LIST: 'MANAGE_GET_BUCKET_LIST',
|
||||||
|
MANAGE_GET_BUCKET_LIST_BACKSTAGE: 'MANAGE_GET_BUCKET_LIST_BACKSTAGE',
|
||||||
|
MANAGE_GET_BUCKET_LIST_RECURSIVELY: 'MANAGE_GET_BUCKET_LIST_RECURSIVELY',
|
||||||
|
MANAGE_CREATE_BUCKET: 'MANAGE_CREATE_BUCKET',
|
||||||
|
MANAGE_GET_BUCKET_FILE_LIST: 'MANAGE_GET_BUCKET_FILE_LIST',
|
||||||
|
MANAGE_GET_BUCKET_DOMAIN: 'MANAGE_GET_BUCKET_DOMAIN',
|
||||||
|
MANAGE_SET_BUCKET_ACL_POLICY: 'MANAGE_SET_BUCKET_ACL_POLICY',
|
||||||
|
MANAGE_RENAME_BUCKET_FILE: 'MANAGE_RENAME_BUCKET_FILE',
|
||||||
|
MANAGE_DELETE_BUCKET_FILE: 'MANAGE_DELETE_BUCKET_FILE',
|
||||||
|
MANAGE_DELETE_BUCKET_FOLDER: 'MANAGE_DELETE_BUCKET_FOLDER',
|
||||||
|
MANAGE_GET_PRE_SIGNED_URL: 'MANAGE_GET_PRE_SIGNED_URL',
|
||||||
|
MANAGE_UPLOAD_BUCKET_FILE: 'MANAGE_UPLOAD_BUCKET_FILE',
|
||||||
|
MANAGE_DOWNLOAD_BUCKET_FILE: 'MANAGE_DOWNLOAD_BUCKET_FILE',
|
||||||
|
MANAGE_CREATE_BUCKET_FOLDER: 'MANAGE_CREATE_BUCKET_FOLDER',
|
||||||
|
MANAGE_OPEN_FILE_SELECT_DIALOG: 'MANAGE_OPEN_FILE_SELECT_DIALOG',
|
||||||
|
MANAGE_GET_UPLOAD_TASK_LIST: 'MANAGE_GET_UPLOAD_TASK_LIST',
|
||||||
|
MANAGE_GET_DOWNLOAD_TASK_LIST: 'MANAGE_GET_DOWNLOAD_TASK_LIST',
|
||||||
|
MANAGE_DELETE_UPLOADED_TASK: 'MANAGE_DELETE_UPLOADED_TASK',
|
||||||
|
MANAGE_DELETE_ALL_UPLOADED_TASK: 'MANAGE_DELETE_ALL_UPLOADED_TASK',
|
||||||
|
MANAGE_DELETE_DOWNLOADED_TASK: 'MANAGE_DELETE_DOWNLOADED_TASK',
|
||||||
|
MANAGE_DELETE_ALL_DOWNLOADED_TASK: 'MANAGE_DELETE_ALL_DOWNLOADED_TASK',
|
||||||
|
MANAGE_SELECT_DOWNLOAD_FOLDER: 'MANAGE_SELECT_DOWNLOAD_FOLDER',
|
||||||
|
MANAGE_GET_DEFAULT_DOWNLOAD_FOLDER: 'MANAGE_GET_DEFAULT_DOWNLOAD_FOLDER',
|
||||||
|
MANAGE_OPEN_DOWNLOADED_FOLDER: 'MANAGE_OPEN_DOWNLOADED_FOLDER',
|
||||||
|
MANAGE_OPEN_LOCAL_FILE: 'MANAGE_OPEN_LOCAL_FILE',
|
||||||
|
MANAGE_DOWNLOAD_FILE_FROM_URL: 'MANAGE_DOWNLOAD_FILE_FROM_URL',
|
||||||
|
MANAGE_CONVERT_PATH_TO_BASE64: 'MANAGE_CONVERT_PATH_TO_BASE64'
|
||||||
|
}
|
||||||
|
|
||||||
|
export const IToolboxItemType = {
|
||||||
|
IS_CONFIG_FILE_BROKEN: 'IS_CONFIG_FILE_BROKEN',
|
||||||
|
IS_GALLERY_FILE_BROKEN: 'IS_GALLERY_FILE_BROKEN',
|
||||||
|
HAS_PROBLEM_WITH_CLIPBOARD_PIC_UPLOAD: 'HAS_PROBLEM_WITH_CLIPBOARD_PIC_UPLOAD',
|
||||||
|
HAS_PROBLEM_WITH_PROXY: 'HAS_PROBLEM_WITH_PROXY'
|
||||||
|
}
|
||||||
|
|
||||||
|
export const IToolboxItemCheckStatus = {
|
||||||
|
INIT: 'init',
|
||||||
|
LOADING: 'loading',
|
||||||
|
SUCCESS: 'success',
|
||||||
|
ERROR: 'error'
|
||||||
|
}
|
||||||
|
|
||||||
|
export const ISartMode = {
|
||||||
|
QUIET: 'quiet',
|
||||||
|
MINI: 'mini',
|
||||||
|
MAIN: 'main',
|
||||||
|
NO_TRAY: 'no-tray'
|
||||||
|
}
|
||||||
|
|
||||||
|
export const II18nLanguage = {
|
||||||
|
ZH_CN: 'zh-CN',
|
||||||
|
ZH_TW: 'zh-TW',
|
||||||
|
EN: 'en'
|
||||||
|
}
|
||||||
|
|
||||||
|
export const IShortUrlServer = {
|
||||||
|
C1N: 'c1n',
|
||||||
|
YOURLS: 'yourls',
|
||||||
|
CFWORKER: 'cf_worker',
|
||||||
|
SINK: 'sink'
|
||||||
|
}
|
||||||
|
|
||||||
|
export const commonTaskStatus = {
|
||||||
|
queuing: 'queuing',
|
||||||
|
failed: 'failed',
|
||||||
|
canceled: 'canceled',
|
||||||
|
paused: 'paused'
|
||||||
|
}
|
||||||
|
|
||||||
|
// manage task status
|
||||||
|
|
||||||
|
export const uploadTaskSpecialStatus = {
|
||||||
|
uploading: 'uploading',
|
||||||
|
uploaded: 'uploaded'
|
||||||
|
}
|
||||||
|
|
||||||
|
export const downloadTaskSpecialStatus = {
|
||||||
|
downloading: 'downloading',
|
||||||
|
downloaded: 'downloaded'
|
||||||
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import picgo from '@core/picgo'
|
import picgo from '@core/picgo'
|
||||||
|
|
||||||
import { IPicBedType } from '#/types/types'
|
import type { IPicBedType } from '#/types/types'
|
||||||
import { configPaths } from '#/utils/configPaths'
|
import { configPaths } from '~/utils/configPaths'
|
||||||
|
|
||||||
const getPicBeds = () => {
|
const getPicBeds = () => {
|
||||||
const picBedTypes = picgo.helper.uploader.getIdList()
|
const picBedTypes = picgo.helper.uploader.getIdList()
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import path from 'node:path'
|
|||||||
import fs from 'fs-extra'
|
import fs from 'fs-extra'
|
||||||
import { Logger } from 'piclist'
|
import { Logger } from 'piclist'
|
||||||
|
|
||||||
import { isUrl } from '#/utils/common'
|
import { isUrl } from '~/utils/common'
|
||||||
|
|
||||||
interface IResultFileObject {
|
interface IResultFileObject {
|
||||||
path: string
|
path: string
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import db from '@core/datastore'
|
import db from '@core/datastore'
|
||||||
|
|
||||||
import { II18nLanguage } from '#/types/enum'
|
|
||||||
import { configPaths } from '#/utils/configPaths'
|
|
||||||
import { i18nManager } from '~/i18n'
|
import { i18nManager } from '~/i18n'
|
||||||
|
import { configPaths } from '~/utils/configPaths'
|
||||||
|
import { II18nLanguage } from '~/utils/enum'
|
||||||
|
|
||||||
export const initI18n = () => {
|
export const initI18n = () => {
|
||||||
const currentLanguage = db.get(configPaths.settings.language) || II18nLanguage.ZH_CN
|
const currentLanguage = db.get(configPaths.settings.language) || II18nLanguage.ZH_CN
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
import picgo from '@core/picgo'
|
import picgo from '@core/picgo'
|
||||||
import { v4 as uuid } from 'uuid'
|
import { v4 as uuid } from 'uuid'
|
||||||
|
|
||||||
import { IPicGoPluginConfig, IPicGoPluginOriginConfig, IStringKeyMap, IUploaderConfigItem, IUploaderConfigListItem } from '#/types/types'
|
import type { IPicGoPluginConfig, IPicGoPluginOriginConfig, IStringKeyMap, IUploaderConfigItem, IUploaderConfigListItem } from '#/types/types'
|
||||||
import { trimValues } from '#/utils/common'
|
import { setTrayToolTip, trimValues } from '~/utils/common'
|
||||||
import { configPaths } from '#/utils/configPaths'
|
import { configPaths } from '~/utils/configPaths'
|
||||||
import { setTrayToolTip } from '~/utils/common'
|
|
||||||
|
|
||||||
export const handleConfigWithFunction = (config: IPicGoPluginOriginConfig[]): IPicGoPluginConfig[] => {
|
export const handleConfigWithFunction = (config: IPicGoPluginOriginConfig[]): IPicGoPluginConfig[] => {
|
||||||
for (const i in config) {
|
for (const i in config) {
|
||||||
|
|||||||
3
src/main/utils/notification.ts
Normal file
3
src/main/utils/notification.ts
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
import type { IAppNotification } from '#/types/types'
|
||||||
|
|
||||||
|
export const notificationList: IAppNotification[] = []
|
||||||
@@ -1,9 +1,8 @@
|
|||||||
import db from '@core/datastore'
|
import db from '@core/datastore'
|
||||||
|
|
||||||
import { IPasteStyle } from '#/types/enum'
|
import type { ImgInfo } from '#/types/types'
|
||||||
import { ImgInfo } from '#/types/types'
|
|
||||||
import { configPaths } from '#/utils/configPaths'
|
|
||||||
import { generateShortUrl, handleUrlEncodeWithSetting } from '~/utils/common'
|
import { generateShortUrl, handleUrlEncodeWithSetting } from '~/utils/common'
|
||||||
|
import { configPaths } from '~/utils/configPaths'
|
||||||
|
|
||||||
export const formatCustomLink = (customLink: string, item: ImgInfo) => {
|
export const formatCustomLink = (customLink: string, item: ImgInfo) => {
|
||||||
const fileName = item.fileName!.replace(new RegExp(`\\${item.extname}$`), '')
|
const fileName = item.fileName!.replace(new RegExp(`\\${item.extname}$`), '')
|
||||||
@@ -24,7 +23,7 @@ export const formatCustomLink = (customLink: string, item: ImgInfo) => {
|
|||||||
return customLink
|
return customLink
|
||||||
}
|
}
|
||||||
|
|
||||||
export default async (style: IPasteStyle, item: ImgInfo, customLink: string | undefined) => {
|
export default async (style: string, item: ImgInfo, customLink: string | undefined) => {
|
||||||
let url = item.url || item.imgUrl
|
let url = item.url || item.imgUrl
|
||||||
if (item.type === 'aws-s3' || item.type === 'aws-s3-plist') {
|
if (item.type === 'aws-s3' || item.type === 'aws-s3-plist') {
|
||||||
url = item.imgUrl || item.url || ''
|
url = item.imgUrl || item.url || ''
|
||||||
@@ -35,7 +34,7 @@ export default async (style: IPasteStyle, item: ImgInfo, customLink: string | un
|
|||||||
url = item.shortUrl && item.shortUrl !== url ? item.shortUrl : await generateShortUrl(url)
|
url = item.shortUrl && item.shortUrl !== url ? item.shortUrl : await generateShortUrl(url)
|
||||||
}
|
}
|
||||||
const _customLink = customLink || ''
|
const _customLink = customLink || ''
|
||||||
const tpl = {
|
const tpl: Record<string, string> = {
|
||||||
markdown: ``,
|
markdown: ``,
|
||||||
HTML: `<img src="${url}"/>`,
|
HTML: `<img src="${url}"/>`,
|
||||||
URL: url,
|
URL: url,
|
||||||
|
|||||||
25
src/main/utils/static.ts
Normal file
25
src/main/utils/static.ts
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
export const CLIPBOARD_IMAGE_FOLDER = 'piclist-clipboard-images'
|
||||||
|
|
||||||
|
export const cancelDownloadLoadingFileList = 'cancelDownloadLoadingFileList'
|
||||||
|
export const refreshDownloadFileTransferList = 'refreshDownloadFileTransferList'
|
||||||
|
|
||||||
|
export const picBedsCanbeDeleted = [
|
||||||
|
'aliyun',
|
||||||
|
'alist',
|
||||||
|
'alistplist',
|
||||||
|
'aws-s3',
|
||||||
|
'aws-s3-plist',
|
||||||
|
'dogecloud',
|
||||||
|
'github',
|
||||||
|
'huaweicloud-uploader',
|
||||||
|
'imgur',
|
||||||
|
'local',
|
||||||
|
'lskyplist',
|
||||||
|
'piclist',
|
||||||
|
'qiniu',
|
||||||
|
'sftpplist',
|
||||||
|
'smms',
|
||||||
|
'tcyun',
|
||||||
|
'upyun',
|
||||||
|
'webdavplist'
|
||||||
|
]
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user