mirror of
https://github.com/Kuingsmile/PicList.git
synced 2025-02-02 11:08:13 -05:00
🔨 Refactor: refactored the import section of the code
This commit is contained in:
parent
33b36d63c6
commit
cb131d5250
36
src/main.ts
36
src/main.ts
@ -1,25 +1,43 @@
|
||||
|
||||
// Vue 相关
|
||||
import { createApp } from 'vue'
|
||||
import App from './renderer/App.vue'
|
||||
import router from './renderer/router'
|
||||
import ElementUI from 'element-plus'
|
||||
import 'element-plus/dist/index.css'
|
||||
import { webFrame } from 'electron'
|
||||
import VueLazyLoad from 'vue3-lazyload'
|
||||
import axios from 'axios'
|
||||
import { mainMixin } from './renderer/utils/mainMixin'
|
||||
import { dragMixin } from '@/utils/mixin'
|
||||
import db from './renderer/utils/db'
|
||||
import { i18nManager, T } from './renderer/i18n/index'
|
||||
import { getConfig, saveConfig, sendToMain, triggerRPC } from '@/utils/dataSender'
|
||||
import { store } from '@/store'
|
||||
import vue3PhotoPreview from 'vue3-photo-preview'
|
||||
import 'vue3-photo-preview/dist/index.css'
|
||||
import VueVideoPlayer from '@videojs-player/vue'
|
||||
|
||||
// Electron 相关
|
||||
import { webFrame } from 'electron'
|
||||
|
||||
// Axios
|
||||
import axios from 'axios'
|
||||
|
||||
// Mixins
|
||||
import { mainMixin } from './renderer/utils/mainMixin'
|
||||
import { dragMixin } from '@/utils/mixin'
|
||||
|
||||
// 数据库
|
||||
import db from './renderer/utils/db'
|
||||
|
||||
// 国际化
|
||||
import { i18nManager, T } from './renderer/i18n/index'
|
||||
|
||||
// 工具函数
|
||||
import { getConfig, saveConfig, sendToMain, triggerRPC } from '@/utils/dataSender'
|
||||
|
||||
// 状态管理
|
||||
import { store } from '@/store'
|
||||
import { createPinia } from 'pinia'
|
||||
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'
|
||||
|
||||
// 代码高亮
|
||||
import 'highlight.js/styles/atom-one-dark.css'
|
||||
import hljsVuePlugin from '@highlightjs/vue-plugin'
|
||||
import hljsCommon from 'highlight.js/lib/common'
|
||||
import VueVideoPlayer from '@videojs-player/vue'
|
||||
import 'video.js/dist/video-js.css'
|
||||
|
||||
webFrame.setVisualZoomLevelLimits(1, 1)
|
||||
|
@ -1,15 +1,25 @@
|
||||
// get notice from remote
|
||||
// such as some notices for users; some updates for users
|
||||
// External dependencies
|
||||
import axios from 'axios'
|
||||
import fs from 'fs-extra'
|
||||
import { app, clipboard, dialog, shell } from 'electron'
|
||||
import { IRemoteNoticeActionType, IRemoteNoticeTriggerCount, IRemoteNoticeTriggerHook } from '#/types/enum'
|
||||
import { lte, gte } from 'semver'
|
||||
import path from 'path'
|
||||
|
||||
import axios from 'axios'
|
||||
// Electron modules
|
||||
import { app, clipboard, dialog, shell } from 'electron'
|
||||
|
||||
// Custom modules and utilities
|
||||
import windowManager from '../window/windowManager'
|
||||
import { showNotification } from '~/main/utils/common'
|
||||
|
||||
// Custom types/enums
|
||||
import {
|
||||
IRemoteNoticeActionType,
|
||||
IRemoteNoticeTriggerCount,
|
||||
IRemoteNoticeTriggerHook
|
||||
} from '#/types/enum'
|
||||
|
||||
// External utility functions
|
||||
import { gte, lte } from 'semver'
|
||||
|
||||
// for test
|
||||
const REMOTE_NOTICE_URL = 'https://release.piclist.cn/remote-notice.json'
|
||||
|
||||
|
@ -1,14 +1,24 @@
|
||||
import bus from '@core/bus'
|
||||
// External dependencies
|
||||
import {
|
||||
globalShortcut
|
||||
} from 'electron'
|
||||
import logger from '@core/picgo/logger'
|
||||
import GuiApi from '../../gui'
|
||||
|
||||
import bus from '@core/bus'
|
||||
import db from '~/main/apis/core/datastore'
|
||||
import { TOGGLE_SHORTKEY_MODIFIED_MODE } from '#/events/constants'
|
||||
import shortKeyService from './shortKeyService'
|
||||
import logger from '@core/picgo/logger'
|
||||
import picgo from '@core/picgo'
|
||||
|
||||
// Electron modules
|
||||
|
||||
// Custom utilities and modules
|
||||
import GuiApi from '../../gui'
|
||||
import shortKeyService from './shortKeyService'
|
||||
|
||||
// Custom types/enums
|
||||
|
||||
// External utility functions
|
||||
import { TOGGLE_SHORTKEY_MODIFIED_MODE } from '#/events/constants'
|
||||
|
||||
class ShortKeyHandler {
|
||||
private isInModifiedMode: boolean = false
|
||||
constructor () {
|
||||
|
@ -1,4 +1,5 @@
|
||||
import logger from '@core/picgo/logger'
|
||||
|
||||
class ShortKeyService {
|
||||
private commandList: Map<string, IShortKeyHandler> = new Map()
|
||||
registerCommand (command: string, handler: IShortKeyHandler) {
|
||||
|
@ -1,4 +1,8 @@
|
||||
// External dependencies
|
||||
import fs from 'fs-extra'
|
||||
import { cloneDeep } from 'lodash'
|
||||
|
||||
// Electron modules
|
||||
import {
|
||||
app,
|
||||
Menu,
|
||||
@ -9,6 +13,8 @@ import {
|
||||
screen,
|
||||
nativeTheme
|
||||
} from 'electron'
|
||||
|
||||
// Custom utilities and modules
|
||||
import uploader from 'apis/app/uploader'
|
||||
import db, { GalleryDB } from '~/main/apis/core/datastore'
|
||||
import windowManager from 'apis/app/window/windowManager'
|
||||
@ -22,7 +28,7 @@ import { buildPicBedListMenu } from '~/main/events/remotes/menu'
|
||||
import clipboardPoll from '~/main/utils/clipboardPoll'
|
||||
import picgo from '../../core/picgo'
|
||||
import { uploadClipboardFiles } from '../uploader/apis'
|
||||
import { cloneDeep } from 'lodash'
|
||||
|
||||
let contextMenu: Menu | null
|
||||
let tray: Tray | null
|
||||
|
||||
|
@ -1,10 +1,15 @@
|
||||
// External dependencies
|
||||
import fs from 'fs-extra'
|
||||
import { cloneDeep } from 'lodash'
|
||||
|
||||
// Electron modules
|
||||
import {
|
||||
Notification,
|
||||
WebContents
|
||||
} from 'electron'
|
||||
|
||||
// Custom utilities and modules
|
||||
import windowManager from 'apis/app/window/windowManager'
|
||||
import { IWindowList } from '#/types/enum'
|
||||
import uploader from '.'
|
||||
import pasteTemplate from '~/main/utils/pasteTemplate'
|
||||
import db, { GalleryDB } from '~/main/apis/core/datastore'
|
||||
import { handleCopyUrl, handleUrlEncodeWithSetting } from '~/main/utils/common'
|
||||
@ -12,8 +17,8 @@ import { T } from '~/main/i18n/index'
|
||||
import ALLApi from '@/apis/allApi'
|
||||
import picgo from '@core/picgo'
|
||||
import GuiApi from '../../gui'
|
||||
import fs from 'fs-extra'
|
||||
import { cloneDeep } from 'lodash'
|
||||
import uploader from '.'
|
||||
import { IWindowList } from '#/types/enum'
|
||||
|
||||
const handleClipboardUploading = async (): Promise<false | ImgInfo[]> => {
|
||||
const useBuiltinClipboard = db.get('settings.useBuiltinClipboard') === undefined ? true : !!db.get('settings.useBuiltinClipboard')
|
||||
|
@ -1,3 +1,11 @@
|
||||
// External dependencies
|
||||
import dayjs from 'dayjs'
|
||||
import util from 'util'
|
||||
import path from 'path'
|
||||
import writeFile from 'write-file-atomic'
|
||||
import fse from 'fs-extra'
|
||||
|
||||
// Electron modules
|
||||
import {
|
||||
Notification,
|
||||
BrowserWindow,
|
||||
@ -5,22 +13,26 @@ import {
|
||||
WebContents,
|
||||
clipboard
|
||||
} from 'electron'
|
||||
import dayjs from 'dayjs'
|
||||
|
||||
// Custom utilities and modules
|
||||
import picgo from '@core/picgo'
|
||||
import db from '~/main/apis/core/datastore'
|
||||
import windowManager from 'apis/app/window/windowManager'
|
||||
import { IWindowList } from '#/types/enum'
|
||||
import util from 'util'
|
||||
import { IPicGo } from 'piclist'
|
||||
import { showNotification, getClipboardFilePath } from '~/main/utils/common'
|
||||
import { GET_RENAME_FILE_NAME, RENAME_FILE_NAME } from '~/universal/events/constants'
|
||||
import logger from '@core/picgo/logger'
|
||||
import { T } from '~/main/i18n'
|
||||
import fse from 'fs-extra'
|
||||
import path from 'path'
|
||||
import writeFile from 'write-file-atomic'
|
||||
import { CLIPBOARD_IMAGE_FOLDER } from '~/universal/utils/static'
|
||||
|
||||
// Custom types/enums
|
||||
import { IWindowList } from '#/types/enum'
|
||||
|
||||
// External utility functions
|
||||
import { IPicGo } from 'piclist'
|
||||
import {
|
||||
GET_RENAME_FILE_NAME,
|
||||
RENAME_FILE_NAME
|
||||
} from '~/universal/events/constants'
|
||||
|
||||
const waitForRename = (window: BrowserWindow, id: number): Promise<string|null> => {
|
||||
return new Promise((resolve) => {
|
||||
const windowId = window.id
|
||||
|
@ -1,3 +1,14 @@
|
||||
// External dependencies
|
||||
import { app } from 'electron'
|
||||
|
||||
// Electron modules
|
||||
|
||||
// Custom utilities and modules
|
||||
import bus from '@core/bus'
|
||||
import db from '~/main/apis/core/datastore'
|
||||
import picgo from '~/main/apis/core/picgo'
|
||||
import { T } from '~/main/i18n'
|
||||
import { remoteNoticeHandler } from '../remoteNotice'
|
||||
import {
|
||||
SETTING_WINDOW_URL,
|
||||
TRAY_WINDOW_URL,
|
||||
@ -5,15 +16,13 @@ import {
|
||||
RENAME_WINDOW_URL,
|
||||
TOOLBOX_WINDOW_URL
|
||||
} from './constants'
|
||||
|
||||
// Custom types/enums
|
||||
import { IRemoteNoticeTriggerHook, IWindowList } from '#/types/enum'
|
||||
import bus from '@core/bus'
|
||||
|
||||
// External utility functions
|
||||
import { CREATE_APP_MENU } from '@core/bus/constants'
|
||||
import db from '~/main/apis/core/datastore'
|
||||
import { TOGGLE_SHORTKEY_MODIFIED_MODE } from '#/events/constants'
|
||||
import { app } from 'electron'
|
||||
import { remoteNoticeHandler } from '../remoteNotice'
|
||||
import picgo from '~/main/apis/core/picgo'
|
||||
import { T } from '~/main/i18n'
|
||||
|
||||
const windowList = new Map<IWindowList, IWindowListItem>()
|
||||
|
||||
|
@ -1,7 +1,12 @@
|
||||
import {
|
||||
BrowserWindow
|
||||
} from 'electron'
|
||||
// External dependencies
|
||||
import windowList from './windowList'
|
||||
|
||||
// Electron modules
|
||||
import { BrowserWindow } from 'electron'
|
||||
|
||||
// Custom utilities and modules
|
||||
|
||||
// Custom types/enums
|
||||
import { IWindowList } from '#/types/enum'
|
||||
|
||||
class WindowManager implements IWindowManager {
|
||||
|
@ -1,10 +1,24 @@
|
||||
// External dependencies
|
||||
import fs from 'fs-extra'
|
||||
import writeFile from 'write-file-atomic'
|
||||
import path from 'path'
|
||||
import { app } from 'electron'
|
||||
import { getLogger } from '../utils/localLogger'
|
||||
import dayjs from 'dayjs'
|
||||
import path from 'path'
|
||||
|
||||
// Electron modules
|
||||
import { app } from 'electron'
|
||||
|
||||
// Custom utilities and modules
|
||||
import { getLogger } from '../utils/localLogger'
|
||||
|
||||
// Custom types/enums
|
||||
|
||||
// External utility functions
|
||||
|
||||
// External utility functions
|
||||
import writeFile from 'write-file-atomic'
|
||||
|
||||
// Custom types/enums
|
||||
import { T } from '~/main/i18n'
|
||||
|
||||
const STORE_PATH = app.getPath('userData')
|
||||
const configFilePath = path.join(STORE_PATH, 'data.json')
|
||||
const configFileBackupPath = path.join(STORE_PATH, 'data.bak.json')
|
||||
|
@ -1,6 +1,17 @@
|
||||
// External dependencies
|
||||
import fs from 'fs-extra'
|
||||
|
||||
// Electron modules
|
||||
|
||||
// Custom utilities and modules
|
||||
import { dbPathChecker, dbPathDir, getGalleryDBPath } from './dbChecker'
|
||||
|
||||
// Custom types/enums
|
||||
|
||||
// External utility functions
|
||||
import { DBStore, JSONStore } from '@picgo/store'
|
||||
|
||||
// External utility functions
|
||||
import { T } from '~/main/i18n'
|
||||
|
||||
const STORE_PATH = dbPathDir()
|
||||
|
@ -1,8 +1,17 @@
|
||||
import { dbChecker, dbPathChecker } from 'apis/core/datastore/dbChecker'
|
||||
// External dependencies
|
||||
import pkg from 'root/package.json'
|
||||
import debounce from 'lodash/debounce'
|
||||
|
||||
// Electron modules
|
||||
|
||||
// Custom utilities and modules
|
||||
import { PicGo } from 'piclist'
|
||||
import db from 'apis/core/datastore'
|
||||
import debounce from 'lodash/debounce'
|
||||
import { dbChecker, dbPathChecker } from 'apis/core/datastore/dbChecker'
|
||||
|
||||
// Custom types/enums
|
||||
|
||||
// External utility functions
|
||||
|
||||
const CONFIG_PATH = dbPathChecker()
|
||||
|
||||
|
@ -1,25 +1,29 @@
|
||||
// External dependencies
|
||||
import fs from 'fs-extra'
|
||||
import { cloneDeep } from 'lodash'
|
||||
|
||||
// Electron modules
|
||||
import {
|
||||
dialog,
|
||||
BrowserWindow,
|
||||
Notification,
|
||||
ipcMain
|
||||
} from 'electron'
|
||||
|
||||
// Custom utilities and modules
|
||||
import db, { GalleryDB } from 'apis/core/datastore'
|
||||
import { dbPathChecker, defaultConfigPath, getGalleryDBPath } from 'apis/core/datastore/dbChecker'
|
||||
import uploader from 'apis/app/uploader'
|
||||
import pasteTemplate from '~/main/utils/pasteTemplate'
|
||||
import { handleCopyUrl } from '~/main/utils/common'
|
||||
import {
|
||||
getWindowId,
|
||||
getSettingWindowId
|
||||
} from '@core/bus/apis'
|
||||
import {
|
||||
SHOW_INPUT_BOX
|
||||
} from '~/universal/events/constants'
|
||||
import { getWindowId, getSettingWindowId } from '@core/bus/apis'
|
||||
import { SHOW_INPUT_BOX } from '~/universal/events/constants'
|
||||
|
||||
// Custom types/enums
|
||||
|
||||
// External utility functions
|
||||
import { DBStore } from '@picgo/store'
|
||||
import { T } from '~/main/i18n'
|
||||
import fs from 'fs-extra'
|
||||
import { cloneDeep } from 'lodash'
|
||||
|
||||
// Cross-process support may be required in the future
|
||||
class GuiApi implements IGuiApi {
|
||||
|
@ -1,4 +1,9 @@
|
||||
// External dependencies
|
||||
import bus from '@core/bus'
|
||||
|
||||
// Electron modules
|
||||
|
||||
// Custom utilities and modules
|
||||
import {
|
||||
uploadClipboardFiles,
|
||||
uploadChoosedFiles
|
||||
@ -6,8 +11,12 @@ import {
|
||||
import {
|
||||
createMenu
|
||||
} from 'apis/app/system'
|
||||
import { IWindowList } from '#/types/enum'
|
||||
import windowManager from 'apis/app/window/windowManager'
|
||||
|
||||
// Custom types/enums
|
||||
import { IWindowList } from '#/types/enum'
|
||||
|
||||
// External utility functions
|
||||
import {
|
||||
UPLOAD_WITH_FILES,
|
||||
UPLOAD_WITH_FILES_RESPONSE,
|
||||
@ -19,6 +28,7 @@ import {
|
||||
GET_SETTING_WINDOW_ID_RESPONSE,
|
||||
CREATE_APP_MENU
|
||||
} from '@core/bus/constants'
|
||||
|
||||
function initEventCenter () {
|
||||
const eventList: any = {
|
||||
'picgo:upload': uploadClipboardFiles,
|
||||
|
@ -126,7 +126,7 @@ export default {
|
||||
try {
|
||||
const client = SSHClient.instance
|
||||
await client.connect(config)
|
||||
const uploadPath = `/${(config.uploadPath || '').replace(/^\/+|\/+$/g, '')}/`.replace(/\/+/g, '/')
|
||||
const uploadPath = `/${(config.uploadPath || '')}/`.replace(/\/+/g, '/')
|
||||
const remote = path.join(uploadPath, fileName)
|
||||
const deleteResult = await client.deleteFile(remote)
|
||||
client.close()
|
||||
|
@ -1,5 +1,5 @@
|
||||
// External dependencies
|
||||
import path from 'path'
|
||||
import GuiApi from 'apis/gui'
|
||||
import {
|
||||
dialog,
|
||||
shell,
|
||||
@ -7,7 +7,11 @@ import {
|
||||
ipcMain,
|
||||
clipboard
|
||||
} from 'electron'
|
||||
import { IPasteStyle, IPicGoHelperType, IWindowList } from '#/types/enum'
|
||||
|
||||
// Electron modules
|
||||
|
||||
// Custom utilities and modules
|
||||
import GuiApi from 'apis/gui'
|
||||
import shortKeyHandler from 'apis/app/shortKey/shortKeyHandler'
|
||||
import picgo from '@core/picgo'
|
||||
import { handleStreamlinePluginName, simpleClone } from '~/universal/utils/common'
|
||||
@ -15,6 +19,16 @@ import { IGuiMenuItem, PicGo as PicGoCore } from 'piclist'
|
||||
import windowManager from 'apis/app/window/windowManager'
|
||||
import { showNotification } from '~/main/utils/common'
|
||||
import { dbPathChecker } from 'apis/core/datastore/dbChecker'
|
||||
import { GalleryDB } from 'apis/core/datastore'
|
||||
import pasteTemplate from '../utils/pasteTemplate'
|
||||
import { i18nManager, T } from '~/main/i18n'
|
||||
import { rpcServer } from './rpc'
|
||||
|
||||
// Custom types/enums
|
||||
import { IPasteStyle, IPicGoHelperType, IWindowList } from '#/types/enum'
|
||||
import { IObject, IFilter } from '@picgo/store/dist/types'
|
||||
|
||||
// External utility functions
|
||||
import {
|
||||
PICGO_SAVE_CONFIG,
|
||||
PICGO_GET_CONFIG,
|
||||
@ -32,12 +46,6 @@ import {
|
||||
GET_CURRENT_LANGUAGE
|
||||
} from '#/events/constants'
|
||||
|
||||
import { GalleryDB } from 'apis/core/datastore'
|
||||
import { IObject, IFilter } from '@picgo/store/dist/types'
|
||||
import pasteTemplate from '../utils/pasteTemplate'
|
||||
import { i18nManager, T } from '~/main/i18n'
|
||||
import { rpcServer } from './rpc'
|
||||
|
||||
// eslint-disable-next-line
|
||||
const requireFunc = typeof __webpack_require__ === 'function' ? __non_webpack_require__ : require
|
||||
// const PluginHandler = requireFunc('picgo/lib/PluginHandler').default
|
||||
|
@ -1,20 +1,37 @@
|
||||
import windowManager from 'apis/app/window/windowManager'
|
||||
import { IWindowList } from '#/types/enum'
|
||||
// External dependencies
|
||||
import pkg from 'root/package.json'
|
||||
|
||||
// Electron modules
|
||||
import { Menu, BrowserWindow, app, dialog } from 'electron'
|
||||
|
||||
// Custom utilities and modules
|
||||
import windowManager from 'apis/app/window/windowManager'
|
||||
import getPicBeds from '~/main/utils/getPicBeds'
|
||||
import picgo from '@core/picgo'
|
||||
import {
|
||||
uploadClipboardFiles
|
||||
} from '~/main/apis/app/uploader/apis'
|
||||
import pkg from 'root/package.json'
|
||||
import GuiApi from 'apis/gui'
|
||||
import { PICGO_CONFIG_PLUGIN, PICGO_HANDLE_PLUGIN_DONE, PICGO_HANDLE_PLUGIN_ING, PICGO_TOGGLE_PLUGIN, SHOW_MAIN_PAGE_DONATION, SHOW_MAIN_PAGE_QRCODE } from '~/universal/events/constants'
|
||||
import picgoCoreIPC from '~/main/events/picgoCoreIPC'
|
||||
import { PicGo as PicGoCore } from 'piclist'
|
||||
import { T } from '~/main/i18n'
|
||||
import { changeCurrentUploader } from '~/main/utils/handleUploaderConfig'
|
||||
import db from '~/main/apis/core/datastore'
|
||||
import clipboardPoll from '~/main/utils/clipboardPoll'
|
||||
|
||||
// Custom types/enums
|
||||
import { IWindowList } from '#/types/enum'
|
||||
|
||||
// External utility functions
|
||||
import {
|
||||
uploadClipboardFiles
|
||||
} from '~/main/apis/app/uploader/apis'
|
||||
import {
|
||||
PICGO_CONFIG_PLUGIN,
|
||||
PICGO_HANDLE_PLUGIN_DONE,
|
||||
PICGO_HANDLE_PLUGIN_ING,
|
||||
PICGO_TOGGLE_PLUGIN,
|
||||
SHOW_MAIN_PAGE_DONATION,
|
||||
SHOW_MAIN_PAGE_QRCODE
|
||||
} from '~/universal/events/constants'
|
||||
import { PicGo as PicGoCore } from 'piclist'
|
||||
import { T } from '~/main/i18n'
|
||||
|
||||
interface GuiMenuItem {
|
||||
label: string
|
||||
handle: (arg0: PicGoCore, arg1: GuiApi) => Promise<void>
|
||||
|
@ -1,10 +1,19 @@
|
||||
// External dependencies
|
||||
import { ipcMain, IpcMainEvent } from 'electron'
|
||||
import { IRPCActionType } from '~/universal/types/enum'
|
||||
import { RPC_ACTIONS } from '#/events/constants'
|
||||
|
||||
// Electron modules
|
||||
|
||||
// Custom utilities and modules
|
||||
import { configRouter } from './routes/config'
|
||||
import { toolboxRouter } from './routes/toolbox'
|
||||
import { systemRouter } from './routes/system'
|
||||
|
||||
// Custom types/enums
|
||||
import { IRPCActionType } from '~/universal/types/enum'
|
||||
|
||||
// External utility functions
|
||||
import { RPC_ACTIONS } from '#/events/constants'
|
||||
|
||||
class RPCServer implements IRPCServer {
|
||||
private routes: IRPCRoutes = new Map()
|
||||
|
||||
|
@ -1,6 +1,12 @@
|
||||
import { IRPCActionType } from '~/universal/types/enum'
|
||||
import { RPCRouter } from '../router'
|
||||
import { deleteUploaderConfig, getUploaderConfigList, selectUploaderConfig, updateUploaderConfig, resetUploaderConfig } from '~/main/utils/handleUploaderConfig'
|
||||
import {
|
||||
deleteUploaderConfig,
|
||||
getUploaderConfigList,
|
||||
selectUploaderConfig,
|
||||
updateUploaderConfig,
|
||||
resetUploaderConfig
|
||||
} from '~/main/utils/handleUploaderConfig'
|
||||
|
||||
const configRouter = new RPCRouter()
|
||||
|
||||
|
@ -1,6 +1,11 @@
|
||||
// External dependencies
|
||||
import { app, clipboard, shell } from 'electron'
|
||||
|
||||
// Electron modules
|
||||
|
||||
// Custom utilities and modules
|
||||
import { IRPCActionType } from '~/universal/types/enum'
|
||||
import { RPCRouter } from '../router'
|
||||
import { app, clipboard, shell } from 'electron'
|
||||
|
||||
const systemRouter = new RPCRouter()
|
||||
|
||||
|
@ -1,9 +1,18 @@
|
||||
// External dependencies
|
||||
import fs from 'fs-extra'
|
||||
import path from 'path'
|
||||
|
||||
// Electron modules
|
||||
|
||||
// Custom utilities and modules
|
||||
import { dbPathChecker, defaultConfigPath } from '~/main/apis/core/datastore/dbChecker'
|
||||
import { IToolboxItemCheckStatus, IToolboxItemType } from '~/universal/types/enum'
|
||||
import { CLIPBOARD_IMAGE_FOLDER } from '~/universal/utils/static'
|
||||
import { sendToolboxResWithType } from './utils'
|
||||
|
||||
// Custom types/enums
|
||||
import { IToolboxItemCheckStatus, IToolboxItemType } from '~/universal/types/enum'
|
||||
|
||||
// External utility functions
|
||||
import { CLIPBOARD_IMAGE_FOLDER } from '~/universal/utils/static'
|
||||
import { T } from '~/main/i18n'
|
||||
|
||||
const sendToolboxRes = sendToolboxResWithType(IToolboxItemType.HAS_PROBLEM_WITH_CLIPBOARD_PIC_UPLOAD)
|
||||
|
@ -1,10 +1,19 @@
|
||||
// External dependencies
|
||||
import fs from 'fs-extra'
|
||||
import path from 'path'
|
||||
|
||||
// Electron modules
|
||||
import { IpcMainEvent } from 'electron'
|
||||
import { IToolboxItemCheckStatus, IToolboxItemType } from '~/universal/types/enum'
|
||||
import { sendToolboxResWithType } from './utils'
|
||||
|
||||
// Custom utilities and modules
|
||||
import { dbPathChecker } from '~/main/apis/core/datastore/dbChecker'
|
||||
import { GalleryDB, DB_PATH } from '~/main/apis/core/datastore'
|
||||
import path from 'path'
|
||||
import { sendToolboxResWithType } from './utils'
|
||||
|
||||
// Custom types/enums
|
||||
import { IToolboxItemCheckStatus, IToolboxItemType } from '~/universal/types/enum'
|
||||
|
||||
// External utility functions
|
||||
import { T } from '~/main/i18n'
|
||||
|
||||
export const checkFileMap: IToolboxCheckerMap<
|
||||
|
@ -1,10 +1,21 @@
|
||||
// External dependencies
|
||||
import fs from 'fs-extra'
|
||||
import { IToolboxItemCheckStatus, IToolboxItemType } from '~/universal/types/enum'
|
||||
import { sendToolboxResWithType } from './utils'
|
||||
import tunnel from 'tunnel'
|
||||
import { dbPathChecker } from '~/main/apis/core/datastore/dbChecker'
|
||||
import { IConfig } from 'piclist'
|
||||
import axios, { AxiosRequestConfig } from 'axios'
|
||||
import tunnel from 'tunnel'
|
||||
|
||||
// Electron modules
|
||||
|
||||
// Custom utilities and modules
|
||||
import { dbPathChecker } from '~/main/apis/core/datastore/dbChecker'
|
||||
import { sendToolboxResWithType } from './utils'
|
||||
|
||||
// Custom types/enums
|
||||
import { IToolboxItemCheckStatus, IToolboxItemType } from '~/universal/types/enum'
|
||||
|
||||
// External utility functions
|
||||
|
||||
// Custom types/enums
|
||||
import { IConfig } from 'piclist'
|
||||
import { T } from '~/main/i18n'
|
||||
|
||||
const getProxy = (proxyStr: string): AxiosRequestConfig['proxy'] | false => {
|
||||
|
@ -1,6 +1,11 @@
|
||||
// External dependencies
|
||||
import http from 'http'
|
||||
import fs from 'fs-extra'
|
||||
import path from 'path'
|
||||
|
||||
// Electron modules
|
||||
|
||||
// Custom utilities and modules
|
||||
import picgo from '@core/picgo'
|
||||
import logger from '../apis/core/picgo/logger'
|
||||
|
||||
|
@ -1,7 +1,16 @@
|
||||
// External dependencies
|
||||
import yaml from 'js-yaml'
|
||||
import { ObjectAdapter, I18n } from '@picgo/i18n'
|
||||
import path from 'path'
|
||||
import fs from 'fs-extra'
|
||||
|
||||
// Electron modules
|
||||
|
||||
// Custom utilities and modules
|
||||
|
||||
// Custom types/enums
|
||||
|
||||
// External utility functions
|
||||
import { builtinI18nList } from '#/i18n'
|
||||
|
||||
class I18nManager {
|
||||
|
@ -493,7 +493,7 @@ class AliyunApi {
|
||||
const res = client.signatureUrl(key, {
|
||||
expires: expires || 3600
|
||||
})
|
||||
return customUrl ? `${customUrl.replace(/\/$/, '')}/${key}${res.slice(res.indexOf('?'))}` : res
|
||||
return customUrl ? `${customUrl.replace(/\/+$/, '')}/${key}${res.slice(res.indexOf('?'))}` : res
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,11 +1,11 @@
|
||||
import TcyunApi from './tcyun'
|
||||
import AliyunApi from './aliyun'
|
||||
import QiniuApi from './qiniu'
|
||||
import UpyunApi from './upyun'
|
||||
import SmmsApi from './smms'
|
||||
import GithubApi from './github'
|
||||
import ImgurApi from './imgur'
|
||||
import QiniuApi from './qiniu'
|
||||
import S3plistApi from './s3plist'
|
||||
import SmmsApi from './smms'
|
||||
import TcyunApi from './tcyun'
|
||||
import UpyunApi from './upyun'
|
||||
import WebdavplistApi from './webdavplist'
|
||||
|
||||
export default {
|
||||
|
@ -35,12 +35,7 @@ class GithubApi {
|
||||
}
|
||||
|
||||
formatFolder (item: any, slicedPrefix: string) {
|
||||
let key = ''
|
||||
if (slicedPrefix === '') {
|
||||
key = `${item.path}/`
|
||||
} else {
|
||||
key = `${slicedPrefix}/${item.path}/`
|
||||
}
|
||||
const key = `${slicedPrefix ? `${slicedPrefix}/` : ''}${item.path}/`
|
||||
return {
|
||||
...item,
|
||||
Key: key,
|
||||
@ -57,27 +52,18 @@ class GithubApi {
|
||||
|
||||
formatFile (item: any, slicedPrefix: string, branch: string, repo: string, cdnUrl: string | undefined) {
|
||||
let rawUrl = ''
|
||||
if (cdnUrl) {
|
||||
const placeholder = ['{username}', '{repo}', '{branch}', '{path}']
|
||||
if (placeholder.some(item => cdnUrl.includes(item))) {
|
||||
rawUrl = cdnUrl.replace('{username}', this.username)
|
||||
.replace('{repo}', repo)
|
||||
.replace('{branch}', branch)
|
||||
.replace('{path}', `${slicedPrefix}/${item.path}`)
|
||||
} else {
|
||||
rawUrl = `${cdnUrl}/${slicedPrefix}/${item.path}`
|
||||
}
|
||||
} else {
|
||||
rawUrl = `https://raw.githubusercontent.com/${this.username}/${repo}/${branch}/${slicedPrefix}/${item.path}`
|
||||
}
|
||||
const placeholders = ['{username}', '{repo}', '{branch}', '{path}']
|
||||
const key = slicedPrefix === '' ? item.path : `${slicedPrefix}/${item.path}`
|
||||
rawUrl = cdnUrl
|
||||
? placeholders.some(item => cdnUrl.includes(item))
|
||||
? placeholders.reduce((url, ph) => {
|
||||
const value = ph === '{username}' ? this.username : ph === '{repo}' ? repo : ph === '{branch}' ? branch : ph === '{path}' ? `${slicedPrefix}/${item.path}` : ''
|
||||
return url.replaceAll(ph, value)
|
||||
}, cdnUrl)
|
||||
: `${cdnUrl}/${key}`
|
||||
: `https://raw.githubusercontent.com/${this.username}/${repo}/${branch}/${key}`
|
||||
rawUrl = rawUrl.replace(/(?<!https?:)\/{2,}/g, '/')
|
||||
let key = ''
|
||||
if (slicedPrefix === '') {
|
||||
key = item.path
|
||||
} else {
|
||||
key = `${slicedPrefix}/${item.path}`
|
||||
}
|
||||
const result = {
|
||||
return {
|
||||
...item,
|
||||
Key: key,
|
||||
key,
|
||||
@ -88,12 +74,9 @@ class GithubApi {
|
||||
checked: false,
|
||||
match: false,
|
||||
isImage: isImage(item.path),
|
||||
rawUrl
|
||||
rawUrl: item.url,
|
||||
url: rawUrl
|
||||
}
|
||||
const temp = result.rawUrl
|
||||
result.rawUrl = result.url
|
||||
result.url = temp
|
||||
return result
|
||||
}
|
||||
|
||||
/**
|
||||
@ -151,7 +134,7 @@ class GithubApi {
|
||||
async getBucketListRecursively (configMap: IStringKeyMap): Promise<any> {
|
||||
const window = windowManager.get(IWindowList.SETTING_WINDOW)!
|
||||
const { bucketName: repo, customUrl: branch, prefix, cancelToken, cdnUrl } = configMap
|
||||
const slicedPrefix = prefix.replace(/^\//, '').replace(/\/$/, '')
|
||||
const slicedPrefix = prefix.replace(/(^\/+|\/+$)/g, '')
|
||||
const cancelTask = [false]
|
||||
ipcMain.on(cancelDownloadLoadingFileList, (_evt: IpcMainEvent, token: string) => {
|
||||
if (token === cancelToken) {
|
||||
@ -202,7 +185,7 @@ class GithubApi {
|
||||
async getBucketListBackstage (configMap: IStringKeyMap): Promise<any> {
|
||||
const window = windowManager.get(IWindowList.SETTING_WINDOW)!
|
||||
const { bucketName: repo, customUrl: branch, prefix, cancelToken, cdnUrl } = configMap
|
||||
const slicedPrefix = prefix.replace(/^\//, '').replace(/\/$/, '')
|
||||
const slicedPrefix = prefix.replace(/(^\/+|\/+$)/g, '')
|
||||
const cancelTask = [false]
|
||||
ipcMain.on('cancelLoadingFileList', (_evt: IpcMainEvent, token: string) => {
|
||||
if (token === cancelToken) {
|
||||
@ -288,7 +271,7 @@ class GithubApi {
|
||||
// TODO: if there are more than 10000 files in the folder, it will be truncated
|
||||
// Rare cases, not considered for now
|
||||
const treeRes = await got(
|
||||
`${this.baseUrl}/repos/${this.username}/${repo}/git/trees/${branch}:${key.replace(/^\//, '').replace(/\/$/, '')}`,
|
||||
`${this.baseUrl}/repos/${this.username}/${repo}/git/trees/${branch}:${key.replace(/(^\/+|\/+$)/g, '')}`,
|
||||
getOptions('GET', this.commonHeaders, {
|
||||
recursive: true
|
||||
}, 'json', undefined, undefined, this.proxy)
|
||||
@ -299,7 +282,7 @@ class GithubApi {
|
||||
const oldTree = treeRes.body.tree
|
||||
const newTree = oldTree.filter((item: any) => item.type === 'blob')
|
||||
.map((item:any) => ({
|
||||
path: `${key.replace(/^\//, '').replace(/\/$/, '')}/${item.path}`,
|
||||
path: `${key.replace(/(^\/+|\/+$)/g, '')}/${item.path}`,
|
||||
mode: item.mode,
|
||||
type: item.type,
|
||||
sha: null
|
||||
@ -333,10 +316,7 @@ class GithubApi {
|
||||
sha: commitSha
|
||||
}), undefined, this.proxy)
|
||||
) as any
|
||||
if (updateRefRes.statusCode !== 200) {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
return updateRefRes.statusCode === 200
|
||||
}
|
||||
|
||||
/**
|
||||
@ -352,20 +332,14 @@ class GithubApi {
|
||||
*/
|
||||
async getPreSignedUrl (configMap: IStringKeyMap): Promise<string> {
|
||||
const { bucketName: repo, customUrl: branch, key, rawUrl, githubPrivate: isPrivate } = configMap
|
||||
if (!isPrivate) {
|
||||
return rawUrl
|
||||
}
|
||||
if (!isPrivate) return rawUrl
|
||||
const res = await got(
|
||||
`${this.baseUrl}/repos/${this.username}/${repo}/contents/${key}`,
|
||||
getOptions('GET', this.commonHeaders, {
|
||||
ref: branch
|
||||
}, 'json', undefined, undefined, this.proxy)
|
||||
) as any
|
||||
if (res.statusCode === 200) {
|
||||
return res.body.download_url
|
||||
} else {
|
||||
return ''
|
||||
}
|
||||
return res.statusCode === 200 ? res.body.download_url : ''
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,17 +1,27 @@
|
||||
import got from 'got'
|
||||
import ManageLogger from '../utils/logger'
|
||||
import { getAgent, getOptions, NewDownloader, gotUpload, getFileMimeType, ConcurrencyPromisePool, formatError } from '../utils/common'
|
||||
import windowManager from 'apis/app/window/windowManager'
|
||||
import { IWindowList } from '#/types/enum'
|
||||
import { ipcMain, IpcMainEvent } from 'electron'
|
||||
import { formatHttpProxy, isImage } from '~/renderer/manage/utils/common'
|
||||
import path from 'path'
|
||||
import UpDownTaskQueue,
|
||||
{
|
||||
commonTaskStatus
|
||||
} from '../datastore/upDownTaskQueue'
|
||||
import FormData from 'form-data'
|
||||
// External dependencies
|
||||
import fs from 'fs-extra'
|
||||
import FormData from 'form-data'
|
||||
import got from 'got'
|
||||
import path from 'path'
|
||||
|
||||
// Electron modules
|
||||
import { ipcMain, IpcMainEvent } from 'electron'
|
||||
|
||||
// Custom utilities and modules
|
||||
import { IWindowList } from '#/types/enum'
|
||||
import {
|
||||
ConcurrencyPromisePool,
|
||||
formatError,
|
||||
getFileMimeType,
|
||||
getOptions,
|
||||
getAgent,
|
||||
gotUpload,
|
||||
NewDownloader
|
||||
} from '../utils/common'
|
||||
import ManageLogger from '../utils/logger'
|
||||
import windowManager from 'apis/app/window/windowManager'
|
||||
import { formatHttpProxy, isImage } from '~/renderer/manage/utils/common'
|
||||
import UpDownTaskQueue, { commonTaskStatus } from '../datastore/upDownTaskQueue'
|
||||
|
||||
class ImgurApi {
|
||||
userName: string
|
||||
@ -35,17 +45,19 @@ class ImgurApi {
|
||||
}
|
||||
|
||||
formatFile (item: any) {
|
||||
const fileName = path.basename(item.link)
|
||||
const isImg = isImage(fileName)
|
||||
return {
|
||||
...item,
|
||||
Key: path.basename(item.link),
|
||||
key: path.basename(item.link),
|
||||
Key: fileName,
|
||||
key: fileName,
|
||||
fileName: `${item.name}${path.extname(item.link)}`,
|
||||
formatedTime: new Date(item.datetime * 1000).toLocaleString(),
|
||||
fileSize: item.size,
|
||||
isDir: false,
|
||||
checked: false,
|
||||
match: false,
|
||||
isImage: isImage(path.basename(item.link)),
|
||||
isImage: isImg,
|
||||
url: item.link,
|
||||
sha: item.deletehash
|
||||
}
|
||||
|
@ -410,7 +410,7 @@ class TcyunApi {
|
||||
Sign: true
|
||||
}, () => {
|
||||
})
|
||||
return customUrl ? `${customUrl.replace(/\/$/, '')}/${key}${res.slice(res.indexOf('?'))}` : res
|
||||
return customUrl ? `${customUrl.replace(/\/+$/, '')}/${key}${res.slice(res.indexOf('?'))}` : res
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -5,10 +5,19 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
// 状态管理
|
||||
import { useStore } from '@/hooks/useStore'
|
||||
|
||||
// Vue 生命周期钩子
|
||||
import { onBeforeMount, onMounted, onUnmounted } from 'vue'
|
||||
|
||||
// 数据发送工具函数
|
||||
import { getConfig } from './utils/dataSender'
|
||||
|
||||
// 类型声明
|
||||
import type { IConfig } from 'piclist'
|
||||
|
||||
// 其他工具
|
||||
import bus from './utils/bus'
|
||||
import { FORCE_UPDATE } from '~/universal/events/constants'
|
||||
|
||||
|
@ -24,7 +24,7 @@ export default class AliyunApi {
|
||||
|
||||
private static getKey (fileName: string, path?: string): string {
|
||||
return path && path !== '/'
|
||||
? `${path.replace(/^\//, '').replace(/\/$/, '')}/${fileName}`
|
||||
? `${path.replace(/^\/+|\/+$/, '')}/${fileName}`
|
||||
: fileName
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@ export default class AwsS3Api {
|
||||
})
|
||||
const result = await client.deleteObject({
|
||||
Bucket: bucketName,
|
||||
Key: fileKey.replace(/^\//, '')
|
||||
Key: fileKey.replace(/^\/+/, '')
|
||||
}).promise()
|
||||
return result.$response.httpResponse.statusCode === 204
|
||||
} catch (error) {
|
||||
|
@ -20,7 +20,7 @@ export default class GithubApi {
|
||||
|
||||
private static createKey (path: string | undefined, fileName: string): string {
|
||||
return path && path !== '/'
|
||||
? `${path.replace(/^\//, '').replace(/\/$/, '')}/${fileName}`
|
||||
? `${path.replace(/^\/+|\/+$/, '')}/${fileName}`
|
||||
: fileName
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,7 @@ export default class QiniuApi {
|
||||
const qiniuConfig = new Qiniu.conf.Config()
|
||||
try {
|
||||
const bucketManager = new Qiniu.rs.BucketManager(mac, qiniuConfig)
|
||||
const formattedPath = path?.replace(/^\//, '').replace(/\/$/, '') || ''
|
||||
const formattedPath = path?.replace(/^\/+|\/+$/, '') || ''
|
||||
const key = path === '/' || !path ? fileName : `${formattedPath}/${fileName}`
|
||||
const res = await new Promise((resolve, reject) => {
|
||||
bucketManager.delete(bucket, key, (err, respBody, respInfo) => {
|
||||
|
@ -27,7 +27,7 @@ export default class TcyunApi {
|
||||
if (path === '/' || !path) {
|
||||
key = `/${fileName}`
|
||||
} else {
|
||||
key = `/${path.replace(/^\//, '').replace(/\/$/, '')}/${fileName}`
|
||||
key = `/${path.replace(/^\/+|\/+$/, '')}/${fileName}`
|
||||
}
|
||||
const result = await cos.deleteObject({
|
||||
Bucket: bucket,
|
||||
|
@ -11,7 +11,7 @@ export default class UpyunApi {
|
||||
if (path === '/' || !path) {
|
||||
key = fileName
|
||||
} else {
|
||||
key = `${path.replace(/^\//, '').replace(/\/$/, '')}/${fileName}`
|
||||
key = `${path.replace(/^\/+|\/+$/, '')}/${fileName}`
|
||||
}
|
||||
return await client.deleteFile(key)
|
||||
} catch (error) {
|
||||
|
@ -16,7 +16,7 @@ export default class WebdavApi {
|
||||
if (path === '/' || !path) {
|
||||
key = fileName
|
||||
} else {
|
||||
key = `${path.replace(/^\//, '').replace(/\/$/, '')}/${fileName}`
|
||||
key = `${path.replace(/^\/+|\/+$/, '')}/${fileName}`
|
||||
}
|
||||
try {
|
||||
await ctx.deleteFile(key)
|
||||
|
@ -34,6 +34,8 @@ import {
|
||||
} from '~/universal/events/constants'
|
||||
import $bus from '@/utils/bus'
|
||||
import { sendToMain } from '@/utils/dataSender'
|
||||
import { T as $T } from '@/i18n/index'
|
||||
|
||||
const inputBoxValue = ref('')
|
||||
const showInputBoxVisible = ref(false)
|
||||
const inputBoxOptions = reactive({
|
||||
|
@ -10,6 +10,7 @@
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { IToolboxItemCheckStatus } from '~/universal/types/enum'
|
||||
|
||||
interface IProps {
|
||||
status: IToolboxItemCheckStatus
|
||||
value: any
|
||||
|
@ -18,6 +18,7 @@
|
||||
import { CircleCloseFilled, Loading, SuccessFilled } from '@element-plus/icons-vue'
|
||||
import { computed } from 'vue'
|
||||
import { IToolboxItemCheckStatus } from '~/universal/types/enum'
|
||||
|
||||
interface IProps {
|
||||
status: IToolboxItemCheckStatus
|
||||
}
|
||||
|
@ -233,7 +233,7 @@
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
// import { Component, Vue, Watch } from 'vue-property-decorator'
|
||||
// Element Plus 图标
|
||||
import {
|
||||
Tools,
|
||||
UploadFilled,
|
||||
@ -248,20 +248,42 @@ import {
|
||||
Link,
|
||||
ArrowUpBold
|
||||
} from '@element-plus/icons-vue'
|
||||
|
||||
// Element Plus 消息框组件
|
||||
import { ElMessage as $message, ElMessageBox } from 'element-plus'
|
||||
|
||||
// 国际化函数
|
||||
import { T as $T } from '@/i18n/index'
|
||||
|
||||
// Vue 相关
|
||||
import { ref, onBeforeUnmount, Ref, onBeforeMount, watch, nextTick, reactive } from 'vue'
|
||||
|
||||
// Vue Router 相关
|
||||
import { onBeforeRouteUpdate, useRouter } from 'vue-router'
|
||||
|
||||
// 二维码组件
|
||||
import QrcodeVue from 'qrcode.vue'
|
||||
|
||||
// Lodash pick 函数
|
||||
import pick from 'lodash/pick'
|
||||
|
||||
// 根目录 package.json
|
||||
import pkg from 'root/package.json'
|
||||
|
||||
// 路由配置常量
|
||||
import * as config from '@/router/config'
|
||||
|
||||
// Electron 相关
|
||||
import {
|
||||
ipcRenderer,
|
||||
IpcRendererEvent,
|
||||
clipboard
|
||||
} from 'electron'
|
||||
|
||||
// 输入框对话框组件
|
||||
import InputBoxDialog from '@/components/InputBoxDialog.vue'
|
||||
|
||||
// 事件常量
|
||||
import {
|
||||
MINIMIZE_WINDOW,
|
||||
CLOSE_WINDOW,
|
||||
@ -271,8 +293,13 @@ import {
|
||||
GET_PICBEDS,
|
||||
OPEN_URL
|
||||
} from '~/universal/events/constants'
|
||||
|
||||
// 数据发送工具函数
|
||||
import { getConfig, sendToMain } from '@/utils/dataSender'
|
||||
|
||||
// Piclist 配置类型声明
|
||||
import { IConfig } from 'piclist'
|
||||
|
||||
const version = ref(process.env.NODE_ENV === 'production' ? pkg.version : 'Dev')
|
||||
const routerConfig = reactive(config)
|
||||
const defaultActive = ref(routerConfig.UPLOAD_PAGE)
|
||||
|
@ -1408,16 +1408,37 @@ https://www.baidu.com/img/bd_logo1.png"
|
||||
</template>
|
||||
|
||||
<script lang="tsx" setup>
|
||||
// Vue 相关
|
||||
import { ref, reactive, watch, onBeforeMount, computed, onBeforeUnmount } from 'vue'
|
||||
|
||||
// Vue Router 相关
|
||||
import { useRoute } from 'vue-router'
|
||||
|
||||
// Element Plus 图标
|
||||
import { InfoFilled, Grid, Fold, Close, Folder, FolderAdd, Upload, CircleClose, Loading, CopyDocument, Edit, DocumentAdd, Link, Refresh, ArrowRight, HomeFilled, Document, Coin, Download, DeleteFilled, Sort, FolderOpened } from '@element-plus/icons-vue'
|
||||
|
||||
// 状态管理相关
|
||||
import { useManageStore } from '../store/manageStore'
|
||||
|
||||
// 工具函数
|
||||
import { customRenameFormatTable, customStrMatch, customStrReplace, renameFile, formatLink, formatFileName, getFileIconPath, formatFileSize, getExtension, isValidUrl, svg } from '../utils/common'
|
||||
|
||||
// 静态工具函数
|
||||
import { cancelDownloadLoadingFileList, refreshDownloadFileTransferList } from '../utils/static'
|
||||
|
||||
// Electron 相关
|
||||
import { ipcRenderer, clipboard, IpcRendererEvent } from 'electron'
|
||||
|
||||
// 数据库操作
|
||||
import { fileCacheDbInstance } from '../store/bucketFileDb'
|
||||
|
||||
// 工具函数
|
||||
import { trimPath } from '~/main/manage/utils/common'
|
||||
|
||||
// Axios
|
||||
import axios from 'axios'
|
||||
|
||||
// Element Plus 组件
|
||||
import {
|
||||
ElMessage, ElMessageBox, ElNotification,
|
||||
ElButton,
|
||||
@ -1434,19 +1455,42 @@ import {
|
||||
ElTag,
|
||||
ElCard
|
||||
} from 'element-plus'
|
||||
|
||||
// 类型声明
|
||||
import type { Column, RowClassNameGetter } from 'element-plus'
|
||||
|
||||
// 状态管理相关
|
||||
import { useFileTransferStore, useDownloadFileTransferStore } from '@/manage/store/manageStore'
|
||||
|
||||
// UUID
|
||||
import { v4 as uuidv4 } from 'uuid'
|
||||
|
||||
// 路径处理库
|
||||
import path from 'path'
|
||||
import { IUploadTask, IDownloadTask } from '~/main/manage/datastore/upDownTaskQueue'
|
||||
|
||||
// 文件系统库
|
||||
import fs from 'fs-extra'
|
||||
|
||||
// 数据发送工具函数
|
||||
import { getConfig, saveConfig } from '../utils/dataSender'
|
||||
|
||||
// Markdown 解析库
|
||||
import { marked } from 'marked'
|
||||
|
||||
// 文本文件扩展名列表
|
||||
import { textFileExt } from '../utils/textfile'
|
||||
|
||||
// 视频文件扩展名列表
|
||||
import { videoExt } from '../utils/videofile'
|
||||
|
||||
// 组件
|
||||
import ImageWebdav from '@/components/ImageWebdav.vue'
|
||||
|
||||
// 国际化函数
|
||||
import { T as $T } from '@/i18n'
|
||||
|
||||
import { IUploadTask, IDownloadTask } from '~/main/manage/datastore/upDownTaskQueue'
|
||||
|
||||
/*
|
||||
configMap:{
|
||||
prefix: string, -> baseDir
|
||||
@ -2408,7 +2452,7 @@ async function handleFolderBatchDownload (item: any) {
|
||||
Location: configMap.bucketConfig.Location
|
||||
},
|
||||
paging: paging.value,
|
||||
prefix: `/${item.key.replace(/\/+$/, '').replace(/^\/+/, '')}/`,
|
||||
prefix: `/${item.key.replace(/^\/+|\/+$/, '')}/`,
|
||||
marker: pagingMarker.value,
|
||||
itemsPerPage: itemsPerPage.value,
|
||||
customUrl: currentCustomUrl.value,
|
||||
@ -2443,7 +2487,7 @@ async function handleFolderBatchDownload (item: any) {
|
||||
bucketName: configMap.bucketName,
|
||||
region: configMap.bucketConfig.Location,
|
||||
key: item.key,
|
||||
fileName: [undefined, true].includes(manageStore.config.settings.isDownloadFolderKeepDirStructure) ? `/${item.key.replace(/\/+$/, '').replace(/^\/+/, '')}` : item.fileName,
|
||||
fileName: [undefined, true].includes(manageStore.config.settings.isDownloadFolderKeepDirStructure) ? `/${item.key.replace(/^\/+|\/+$/, '')}` : item.fileName,
|
||||
customUrl: currentCustomUrl.value,
|
||||
downloadUrl: item.downloadUrl,
|
||||
githubUrl: item.url,
|
||||
@ -2486,7 +2530,7 @@ async function handleBatchDownload () {
|
||||
bucketName: configMap.bucketName,
|
||||
region: configMap.bucketConfig.Location,
|
||||
key: item.key,
|
||||
fileName: manageStore.config.settings.isDownloadFileKeepDirStructure ? `/${item.key.replace(/\/+$/, '').replace(/^\/+/, '')}` : item.fileName,
|
||||
fileName: manageStore.config.settings.isDownloadFileKeepDirStructure ? `/${item.key.replace(/^\/+|\/+$/, '')}` : item.fileName,
|
||||
customUrl: currentCustomUrl.value,
|
||||
downloadUrl: item.downloadUrl,
|
||||
githubUrl: item.url,
|
||||
|
@ -258,17 +258,40 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
// Vue 相关
|
||||
import { reactive, ref, onMounted, computed } from 'vue'
|
||||
|
||||
// 支持的图床列表
|
||||
import { supportedPicBedList } from '../utils/constants'
|
||||
|
||||
// Element Plus 图标
|
||||
import { Delete, Edit, Pointer, InfoFilled } from '@element-plus/icons-vue'
|
||||
|
||||
// Element Plus 消息组件
|
||||
import { ElMessage, ElNotification } from 'element-plus'
|
||||
|
||||
// 数据发送工具函数
|
||||
import { getConfig, saveConfig, removeConfig } from '../utils/dataSender'
|
||||
|
||||
// Electron 相关
|
||||
import { shell } from 'electron'
|
||||
|
||||
// Vue Router 相关
|
||||
import { useRouter } from 'vue-router'
|
||||
|
||||
// 状态管理相关
|
||||
import { useManageStore } from '../store/manageStore'
|
||||
|
||||
// 工具函数
|
||||
import { formObjToTableData, svg } from '../utils/common'
|
||||
|
||||
// 数据发送工具函数
|
||||
import { getConfig as getPicBedsConfig } from '@/utils/dataSender'
|
||||
|
||||
// 端点地址格式化
|
||||
import { formatEndpoint } from '~/main/manage/utils/common'
|
||||
|
||||
// 国际化函数
|
||||
import { T as $T } from '@/i18n'
|
||||
|
||||
const activeName = ref('login')
|
||||
|
@ -273,15 +273,34 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
// Vue 相关
|
||||
import { ref, reactive, computed, onBeforeMount, watch } from 'vue'
|
||||
|
||||
// Electron 相关
|
||||
import { shell } from 'electron'
|
||||
|
||||
// 支持的图床列表
|
||||
import { supportedPicBedList } from '../utils/constants'
|
||||
|
||||
// Element Plus 图标
|
||||
import { CirclePlus, SuccessFilled, Folder, Switch, Tools, ChromeFilled, HomeFilled, FolderOpened } from '@element-plus/icons-vue'
|
||||
|
||||
// Vue Router 相关
|
||||
import { useRouter, useRoute } from 'vue-router'
|
||||
|
||||
// Element Plus 通知组件
|
||||
import { ElNotification } from 'element-plus'
|
||||
|
||||
// 数据发送工具函数
|
||||
import { invokeToMain } from '../utils/dataSender'
|
||||
|
||||
// 新建图床配置
|
||||
import { newBucketConfig } from '../utils/newBucketConfig'
|
||||
|
||||
// 状态管理相关
|
||||
import { useManageStore } from '../store/manageStore'
|
||||
|
||||
// 国际化函数
|
||||
import { T as $T } from '@/i18n'
|
||||
|
||||
const manageStore = useManageStore() as any
|
||||
|
@ -513,14 +513,29 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
// Element Plus 图标
|
||||
import { InfoFilled, Folder } from '@element-plus/icons-vue'
|
||||
|
||||
// Vue 相关
|
||||
import { ref, reactive, onBeforeMount, watch, onBeforeUnmount } from 'vue'
|
||||
|
||||
// 数据发送工具函数
|
||||
import { getConfig, saveConfig, invokeToMain } from '../utils/dataSender'
|
||||
|
||||
// Element Plus 消息组件
|
||||
import { ElMessage } from 'element-plus'
|
||||
|
||||
// 状态管理相关
|
||||
import { useManageStore } from '../store/manageStore'
|
||||
import { fileCacheDbInstance } from '../store/bucketFileDb'
|
||||
|
||||
// 工具函数
|
||||
import { formatFileSize, customRenameFormatTable } from '../utils/common'
|
||||
|
||||
// 国际化函数
|
||||
import { T as $T } from '@/i18n'
|
||||
|
||||
// 静态路径选择
|
||||
import { selectDownloadFolder } from '../utils/static'
|
||||
|
||||
const manageStore = useManageStore()
|
||||
|
@ -1,8 +1,19 @@
|
||||
// UUID
|
||||
import { v4 as uuidv4 } from 'uuid'
|
||||
|
||||
// 路径处理库
|
||||
import path from 'path'
|
||||
|
||||
// 加密库
|
||||
import crypto from 'crypto'
|
||||
|
||||
// 可用图标列表
|
||||
import { availableIconList } from './icon'
|
||||
|
||||
// 数据发送工具函数
|
||||
import { getConfig } from './dataSender'
|
||||
|
||||
// 工具函数
|
||||
import { handleUrlEncode } from '~/universal/utils/common'
|
||||
|
||||
export function randomStringGenerator (length: number): string {
|
||||
|
@ -422,22 +422,46 @@
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
// 类型声明
|
||||
import type { IResult } from '@picgo/store/dist/types'
|
||||
|
||||
// 事件常量
|
||||
import { PASTE_TEXT, GET_PICBEDS } from '#/events/constants'
|
||||
|
||||
// Element Plus 组件
|
||||
import { CheckboxValueType, ElMessageBox, ElNotification, ElMessage } from 'element-plus'
|
||||
|
||||
// Element Plus 图标
|
||||
import { InfoFilled, Close, CaretBottom, Document, Edit, Delete, CaretTop, Sort } from '@element-plus/icons-vue'
|
||||
|
||||
// Electron 相关
|
||||
import {
|
||||
ipcRenderer,
|
||||
clipboard,
|
||||
IpcRendererEvent
|
||||
} from 'electron'
|
||||
|
||||
// Vue 相关
|
||||
import { computed, nextTick, onActivated, onBeforeUnmount, onBeforeMount, reactive, ref, watch } from 'vue'
|
||||
|
||||
// 数据发送工具函数
|
||||
import { getConfig, saveConfig, sendToMain } from '@/utils/dataSender'
|
||||
|
||||
// Vue Router 相关
|
||||
import { onBeforeRouteUpdate } from 'vue-router'
|
||||
|
||||
// 国际化函数
|
||||
import { T as $T } from '@/i18n/index'
|
||||
|
||||
// 数据库操作
|
||||
import $$db from '@/utils/db'
|
||||
|
||||
// API 接口
|
||||
import ALLApi from '@/apis/allApi'
|
||||
|
||||
// 工具函数
|
||||
import { customRenameFormatTable, customStrMatch, customStrReplace } from '../manage/utils/common'
|
||||
|
||||
const images = ref<ImgInfo[]>([])
|
||||
const dialogVisible = ref(false)
|
||||
const imgInfo = reactive({
|
||||
|
@ -30,21 +30,38 @@
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
|
||||
// 国际化函数
|
||||
import { T as $T } from '@/i18n/index'
|
||||
|
||||
// Element Plus 消息框组件
|
||||
import { ElMessage as $message } from 'element-plus'
|
||||
|
||||
// Electron 相关
|
||||
import {
|
||||
ipcRenderer,
|
||||
IpcRendererEvent
|
||||
} from 'electron'
|
||||
|
||||
// Vue 生命周期钩子
|
||||
import { onBeforeUnmount, onBeforeMount, ref, watch, reactive } from 'vue'
|
||||
|
||||
// 事件常量
|
||||
import { SHOW_MINI_PAGE_MENU, SET_MINI_WINDOW_POS } from '~/universal/events/constants'
|
||||
|
||||
// 工具函数
|
||||
import {
|
||||
isUrl
|
||||
} from '~/universal/utils/common'
|
||||
|
||||
// 数据发送工具函数
|
||||
import { getConfig, sendToMain } from '@/utils/dataSender'
|
||||
|
||||
// Piclist 配置类型声明
|
||||
import { IConfig } from 'piclist'
|
||||
|
||||
// 数据发送工具函数
|
||||
import { invokeToMain } from '@/manage/utils/dataSender'
|
||||
|
||||
const logoPath = reactive({
|
||||
value: ''
|
||||
})
|
||||
|
@ -1470,23 +1470,49 @@
|
||||
<script lang="ts" setup>
|
||||
// @ts-ignore
|
||||
import { ElForm, ElMessage as $message, ElMessage, ElMessageBox, FormRules } from 'element-plus'
|
||||
|
||||
// Element Plus 图标
|
||||
import { Reading, Close, Edit, InfoFilled } from '@element-plus/icons-vue'
|
||||
|
||||
// 根目录 package.json
|
||||
import pkg from 'root/package.json'
|
||||
|
||||
// 事件常量
|
||||
import { PICGO_OPEN_FILE, OPEN_URL, GET_PICBEDS, HIDE_DOCK } from '#/events/constants'
|
||||
|
||||
// Electron 相关
|
||||
import {
|
||||
ipcRenderer
|
||||
} from 'electron'
|
||||
|
||||
// 国际化管理器
|
||||
import { i18nManager, T as $T } from '@/i18n/index'
|
||||
|
||||
// 工具函数
|
||||
import { enforceNumber } from '~/universal/utils/common'
|
||||
import { getLatestVersion } from '#/utils/getLatestVersion'
|
||||
import { compare } from 'compare-versions'
|
||||
import { STABLE_RELEASE_URL } from '#/utils/static'
|
||||
|
||||
// Vue 相关
|
||||
import { computed, onBeforeMount, onBeforeUnmount, reactive, ref, toRaw } from 'vue'
|
||||
|
||||
// 数据发送工具函数
|
||||
import { getConfig, saveConfig, sendToMain } from '@/utils/dataSender'
|
||||
|
||||
// Vue Router 相关
|
||||
import { useRouter } from 'vue-router'
|
||||
|
||||
// 路由配置常量
|
||||
import { SHORTKEY_PAGE } from '@/router/config'
|
||||
|
||||
// Piclist 相关类型声明
|
||||
import { IConfig, IBuildInCompressOptions, IBuildInWaterMarkOptions } from 'piclist'
|
||||
|
||||
// 数据发送工具函数
|
||||
import { invokeToMain } from '@/manage/utils/dataSender'
|
||||
|
||||
// 内置重命名格式表
|
||||
import { buildInRenameFormatTable } from '../manage/utils/common'
|
||||
|
||||
const imageProcessDialogVisible = ref(false)
|
||||
|
@ -200,15 +200,28 @@
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
// Element Plus 图标
|
||||
import { Close, Download, Goods, Remove, Tools } from '@element-plus/icons-vue'
|
||||
|
||||
// 国际化函数
|
||||
import { T as $T } from '@/i18n/index'
|
||||
|
||||
// 组件
|
||||
import ConfigForm from '@/components/ConfigFormForPlugin.vue'
|
||||
|
||||
// Lodash 函数节流
|
||||
import { debounce, DebouncedFunc } from 'lodash'
|
||||
|
||||
// Electron 相关
|
||||
import {
|
||||
ipcRenderer,
|
||||
IpcRendererEvent
|
||||
} from 'electron'
|
||||
|
||||
// 工具函数
|
||||
import { handleStreamlinePluginName } from '~/universal/utils/common'
|
||||
|
||||
// 事件常量
|
||||
import {
|
||||
OPEN_URL,
|
||||
PICGO_CONFIG_PLUGIN,
|
||||
@ -218,10 +231,20 @@ import {
|
||||
GET_PICBEDS,
|
||||
PICGO_HANDLE_PLUGIN_DONE
|
||||
} from '#/events/constants'
|
||||
|
||||
// Vue 相关
|
||||
import { computed, ref, onBeforeMount, onBeforeUnmount, watch, onMounted } from 'vue'
|
||||
|
||||
// 数据发送工具函数
|
||||
import { getConfig, saveConfig, sendRPC, sendToMain } from '@/utils/dataSender'
|
||||
|
||||
// Element Plus 消息框组件
|
||||
import { ElMessageBox } from 'element-plus'
|
||||
|
||||
// Axios
|
||||
import axios from 'axios'
|
||||
|
||||
// 枚举类型声明
|
||||
import { IRPCActionType } from '~/universal/types/enum'
|
||||
|
||||
const $confirm = ElMessageBox.confirm
|
||||
|
@ -52,16 +52,28 @@
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
// Element Plus 图标
|
||||
import { Close } from '@element-plus/icons-vue'
|
||||
|
||||
// 事件常量
|
||||
import { GET_RENAME_FILE_NAME, RENAME_FILE_NAME } from '#/events/constants'
|
||||
|
||||
// 数据发送工具函数
|
||||
import { sendToMain } from '@/utils/dataSender'
|
||||
|
||||
// 国际化函数
|
||||
import { T as $T } from '@/i18n/index'
|
||||
import {
|
||||
ipcRenderer,
|
||||
IpcRendererEvent
|
||||
} from 'electron'
|
||||
|
||||
// Electron 相关
|
||||
import { ipcRenderer, IpcRendererEvent } from 'electron'
|
||||
|
||||
// Vue 生命周期钩子
|
||||
import { onBeforeUnmount, onBeforeMount, ref, reactive } from 'vue'
|
||||
|
||||
// 自定义钩子
|
||||
import { useIPCOn } from '@/hooks/useIPC'
|
||||
|
||||
// Element Plus 表单实例类型
|
||||
import { FormInstance } from 'element-plus'
|
||||
|
||||
const id = ref<string | null>(null)
|
||||
|
@ -114,11 +114,22 @@
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
// 按键绑定工具函数
|
||||
import keyBinding from '@/utils/key-binding'
|
||||
|
||||
// Electron 相关
|
||||
import { ipcRenderer, IpcRendererEvent } from 'electron'
|
||||
|
||||
// 事件常量
|
||||
import { TOGGLE_SHORTKEY_MODIFIED_MODE } from '#/events/constants'
|
||||
|
||||
// Vue 生命周期钩子
|
||||
import { onBeforeUnmount, onBeforeMount, ref, watch } from 'vue'
|
||||
|
||||
// 数据发送工具函数
|
||||
import { getConfig, sendToMain } from '@/utils/dataSender'
|
||||
|
||||
// 国际化函数
|
||||
import { T as $T } from '@/i18n'
|
||||
|
||||
const list = ref<IShortKeyConfig[]>([])
|
||||
|
@ -95,12 +95,25 @@
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
// 自定义钩子
|
||||
import { useIPC } from '@/hooks/useIPC'
|
||||
|
||||
// 数据发送工具函数
|
||||
import { sendRPC, triggerRPC } from '@/utils/dataSender'
|
||||
|
||||
// Element Plus 消息框组件
|
||||
import { ElMessageBox } from 'element-plus'
|
||||
|
||||
// Vue 相关
|
||||
import { computed, reactive, ref } from 'vue'
|
||||
|
||||
// 枚举类型声明
|
||||
import { IToolboxItemType, IToolboxItemCheckStatus, IRPCActionType } from '~/universal/types/enum'
|
||||
|
||||
// 国际化函数
|
||||
import { T as $T } from '@/i18n'
|
||||
|
||||
// 组件
|
||||
import ToolboxStatusIcon from '@/components/ToolboxStatusIcon.vue'
|
||||
import ToolboxHandler from '@/components/ToolboxHandler.vue'
|
||||
|
||||
|
@ -62,14 +62,31 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
// Vue 相关
|
||||
import { reactive, ref, onBeforeUnmount, onBeforeMount } from 'vue'
|
||||
|
||||
// Electron 相关
|
||||
import { clipboard, ipcRenderer } from 'electron'
|
||||
|
||||
// 数据库操作
|
||||
import $$db from '@/utils/db'
|
||||
|
||||
// 国际化函数
|
||||
import { T as $T } from '@/i18n/index'
|
||||
|
||||
// Picgo Store 相关类型
|
||||
import { IResult } from '@picgo/store/dist/types'
|
||||
|
||||
// 事件常量
|
||||
import { OPEN_WINDOW } from '#/events/constants'
|
||||
|
||||
// 枚举类型声明
|
||||
import { IPasteStyle, IWindowList } from '#/types/enum'
|
||||
|
||||
// 数据发送工具函数
|
||||
import { getConfig, sendToMain } from '@/utils/dataSender'
|
||||
|
||||
// 工具函数
|
||||
import { handleUrlEncode } from '#/utils/common'
|
||||
|
||||
const files = ref<IResult<ImgInfo>[]>([])
|
||||
|
@ -399,28 +399,49 @@
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
// Element Plus 图标
|
||||
import { UploadFilled, CaretBottom } from '@element-plus/icons-vue'
|
||||
import {
|
||||
ipcRenderer,
|
||||
IpcRendererEvent
|
||||
} from 'electron'
|
||||
|
||||
// Electron 相关
|
||||
import { ipcRenderer, IpcRendererEvent } from 'electron'
|
||||
|
||||
// Vue 相关
|
||||
import { ref, reactive, onBeforeMount, onBeforeUnmount, watch, toRaw } from 'vue'
|
||||
|
||||
// 国际化函数
|
||||
import { T as $T } from '@/i18n'
|
||||
|
||||
// 事件总线
|
||||
import $bus from '@/utils/bus'
|
||||
|
||||
// 事件常量
|
||||
import {
|
||||
SHOW_INPUT_BOX,
|
||||
SHOW_INPUT_BOX_RESPONSE,
|
||||
SHOW_UPLOAD_PAGE_MENU,
|
||||
GET_PICBEDS
|
||||
} from '~/universal/events/constants'
|
||||
|
||||
// 工具函数
|
||||
import {
|
||||
isUrl
|
||||
} from '~/universal/utils/common'
|
||||
|
||||
// Element Plus 消息提示
|
||||
import { ElMessage as $message } from 'element-plus'
|
||||
|
||||
// 数据发送工具函数
|
||||
import { getConfig, saveConfig, sendToMain } from '@/utils/dataSender'
|
||||
|
||||
// 类型声明
|
||||
import { IBuildInCompressOptions, IBuildInWaterMarkOptions } from 'piclist'
|
||||
|
||||
// Vue Router 相关
|
||||
import { useRouter } from 'vue-router'
|
||||
|
||||
// 路由配置常量
|
||||
import { PICBEDS_PAGE } from '@/router/config'
|
||||
|
||||
const $router = useRouter()
|
||||
|
||||
const imageProcessDialogVisible = ref(false)
|
||||
|
@ -92,15 +92,33 @@
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
// Element Plus 图标
|
||||
import { Edit, Delete, Plus } from '@element-plus/icons-vue'
|
||||
|
||||
// 数据发送工具函数
|
||||
import { saveConfig, triggerRPC } from '@/utils/dataSender'
|
||||
|
||||
// 时间处理库
|
||||
import dayjs from 'dayjs'
|
||||
|
||||
// 枚举类型声明
|
||||
import { IRPCActionType } from '~/universal/types/enum'
|
||||
|
||||
// 国际化函数
|
||||
import { T as $T } from '@/i18n/index'
|
||||
|
||||
// Vue Router 相关
|
||||
import { useRouter, useRoute, onBeforeRouteUpdate } from 'vue-router'
|
||||
|
||||
// Vue 生命周期钩子
|
||||
import { onBeforeMount, ref } from 'vue'
|
||||
|
||||
// 路由配置常量
|
||||
import { PICBEDS_PAGE, UPLOADER_CONFIG_PAGE } from '@/router/config'
|
||||
|
||||
// 状态管理
|
||||
import { useStore } from '@/hooks/useStore'
|
||||
|
||||
const $router = useRouter()
|
||||
const $route = useRoute()
|
||||
|
||||
|
@ -85,20 +85,40 @@
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
// 枚举类型声明
|
||||
import { IRPCActionType } from '~/universal/types/enum'
|
||||
|
||||
// Vue 相关
|
||||
import { ref, onBeforeUnmount, onBeforeMount } from 'vue'
|
||||
|
||||
// 国际化函数
|
||||
import { T as $T } from '@/i18n/index'
|
||||
|
||||
// 数据发送工具函数
|
||||
import { sendToMain, triggerRPC } from '@/utils/dataSender'
|
||||
|
||||
// Vue Router 相关
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
|
||||
// 组件
|
||||
import ConfigForm from '@/components/ConfigForm.vue'
|
||||
// import mixin from '@/utils/ConfirmButtonMixin'
|
||||
|
||||
// Electron 相关
|
||||
import {
|
||||
ipcRenderer,
|
||||
IpcRendererEvent
|
||||
} from 'electron'
|
||||
|
||||
// 事件常量
|
||||
import { OPEN_URL } from '~/universal/events/constants'
|
||||
|
||||
// Element Plus 图标
|
||||
import { Link } from '@element-plus/icons-vue'
|
||||
|
||||
// 时间处理库
|
||||
import dayjs from 'dayjs'
|
||||
|
||||
// Element Plus 下拉菜单组件
|
||||
import { ElDropdown } from 'element-plus'
|
||||
|
||||
const type = ref('')
|
||||
|
@ -1,17 +1,17 @@
|
||||
export const GALLERY_PAGE = 'GalleryPage'
|
||||
export const TRAY_PAGE = 'TrayPage'
|
||||
export const RENAME_PAGE = 'RenamePage'
|
||||
export const MINI_PAGE = 'MiniPage'
|
||||
export const MAIN_PAGE = 'MainPage'
|
||||
export const UPLOAD_PAGE = 'UploadPage'
|
||||
export const PICBEDS_PAGE = 'PicbedsPage'
|
||||
export const SETTING_PAGE = 'SettingPage'
|
||||
export const PLUGIN_PAGE = 'PluginPage'
|
||||
export const SHORTKEY_PAGE = 'ShortkeyPage'
|
||||
export const UPLOADER_CONFIG_PAGE = 'UploaderConfigPage'
|
||||
export const MANAGE_MAIN_PAGE = 'ManageMainPage'
|
||||
export const MANAGE_LOGIN_PAGE = 'ManageLoginPage'
|
||||
export const MANAGE_SETTING_PAGE = 'ManageSettingPage'
|
||||
export const MANAGE_EMPTY_PAGE = 'ManageEmptyPage'
|
||||
export const MANAGE_BUCKET_PAGE = 'ManageBucketPage'
|
||||
export const MANAGE_EMPTY_PAGE = 'ManageEmptyPage'
|
||||
export const MANAGE_LOGIN_PAGE = 'ManageLoginPage'
|
||||
export const MANAGE_MAIN_PAGE = 'ManageMainPage'
|
||||
export const MANAGE_SETTING_PAGE = 'ManageSettingPage'
|
||||
export const MAIN_PAGE = 'MainPage'
|
||||
export const MINI_PAGE = 'MiniPage'
|
||||
export const PICBEDS_PAGE = 'PicbedsPage'
|
||||
export const PLUGIN_PAGE = 'PluginPage'
|
||||
export const RENAME_PAGE = 'RenamePage'
|
||||
export const SETTING_PAGE = 'SettingPage'
|
||||
export const SHORTKEY_PAGE = 'ShortkeyPage'
|
||||
export const TOOLBOX_CONFIG_PAGE = 'ToolBoxPage'
|
||||
export const TRAY_PAGE = 'TrayPage'
|
||||
export const UPLOAD_PAGE = 'UploadPage'
|
||||
export const UPLOADER_CONFIG_PAGE = 'UploaderConfigPage'
|
||||
|
@ -1,7 +1,16 @@
|
||||
// Electron 相关
|
||||
import { ipcRenderer, IpcRendererEvent } from 'electron'
|
||||
|
||||
// 事件常量
|
||||
import { PICGO_SAVE_CONFIG, PICGO_GET_CONFIG, RPC_ACTIONS } from '#/events/constants'
|
||||
|
||||
// UUID
|
||||
import { v4 as uuid } from 'uuid'
|
||||
|
||||
// 枚举类型声明
|
||||
import { IRPCActionType } from '~/universal/types/enum'
|
||||
|
||||
// 公共工具函数
|
||||
import { getRawData } from './common'
|
||||
|
||||
export function saveConfig (config: IObj | string, value?: any) {
|
||||
|
@ -1,6 +1,13 @@
|
||||
// Picgo Store 相关类型
|
||||
import { IObject, IResult, IGetResult, IFilter } from '@picgo/store/dist/types'
|
||||
|
||||
// Electron 相关
|
||||
import { ipcRenderer, IpcRendererEvent } from 'electron'
|
||||
|
||||
// UUID
|
||||
import { v4 as uuid } from 'uuid'
|
||||
|
||||
// 数据库操作常量
|
||||
import {
|
||||
PICGO_GET_DB,
|
||||
PICGO_INSERT_DB,
|
||||
@ -9,8 +16,13 @@ import {
|
||||
PICGO_GET_BY_ID_DB,
|
||||
PICGO_REMOVE_BY_ID_DB
|
||||
} from '#/events/constants'
|
||||
|
||||
// 数据库类型声明
|
||||
import { IGalleryDB } from '#/types/extra-vue'
|
||||
|
||||
// 公共工具函数
|
||||
import { getRawData } from './common'
|
||||
|
||||
export class GalleryDB implements IGalleryDB {
|
||||
async get<T> (filter?: IFilter): Promise<IGetResult<T>> {
|
||||
const res = await this.msgHandler<IGetResult<T>>(PICGO_GET_DB, filter)
|
||||
|
@ -1,7 +1,15 @@
|
||||
// Vue 组件选项
|
||||
import { ComponentOptions } from 'vue'
|
||||
|
||||
// 事件常量
|
||||
import { FORCE_UPDATE, GET_PICBEDS } from '~/universal/events/constants'
|
||||
|
||||
// 事件总线
|
||||
import bus from '~/renderer/utils/bus'
|
||||
|
||||
// Electron 相关
|
||||
import { ipcRenderer } from 'electron'
|
||||
|
||||
export const mainMixin: ComponentOptions = {
|
||||
inject: ['forceUpdateTime'],
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { ComponentOptions } from 'vue'
|
||||
|
||||
export const dragMixin: ComponentOptions = {
|
||||
mounted () {
|
||||
this.disableDragEvent()
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { C1N } from '../events/constants'
|
||||
|
||||
export const CLIPBOARD_IMAGE_FOLDER = 'piclist-clipboard-images'
|
||||
export const RELEASE_URL = 'https://api.github.com/repos/Kuingsmile/PicList/releases'
|
||||
export const RELEASE_URL_BACKUP = 'https://release.piclist.cn'
|
||||
|
Loading…
Reference in New Issue
Block a user