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