🔨 Refactor(custom): change type defination in universal to global

This commit is contained in:
Kuingsmile
2026-01-01 09:10:43 +08:00
parent 8a4e4d02eb
commit 5ea2517460
125 changed files with 200 additions and 440 deletions

View File

@@ -1,6 +1,4 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:recommended"
]
"extends": ["config:recommended"]
}

View File

@@ -6,7 +6,6 @@ import { app, clipboard, dialog, shell } from 'electron'
import fs from 'fs-extra'
import { gte, lte } from 'semver'
import type { IRemoteNotice, IRemoteNoticeAction, IRemoteNoticeLocalCountStorage } from '#/types/types'
import { showNotification } from '~/utils/common'
import { IRemoteNoticeActionType, IRemoteNoticeTriggerCount } from '~/utils/enum'

View File

@@ -6,13 +6,6 @@ import shortKeyService from 'apis/app/shortKey/shortKeyService'
import GuiApi from 'apis/gui'
import { globalShortcut } from 'electron'
import type {
IKeyCommandType,
IPluginShortKeyConfig,
IShortKeyConfig,
IShortKeyConfigs,
IShortKeyHandler,
} from '#/types/types'
import { TOGGLE_SHORTKEY_MODIFIED_MODE } from '~/events/constant'
import { configPaths } from '~/utils/configPaths'

View File

@@ -1,7 +1,5 @@
import logger from '@core/picgo/logger'
import type { IShortKeyHandler } from '#/types/types'
class ShortKeyService {
private commandList = new Map<string, IShortKeyHandler>()
registerCommand(command: string, handler: IShortKeyHandler) {

View File

@@ -18,7 +18,6 @@ import fs from 'fs-extra'
import { cloneDeep } from 'lodash-es'
import pkg from 'root/package.json'
import type { IBounds, ImgInfo } from '#/types/types'
import { buildPicBedListMenu } from '~/events/remotes/menu'
import { T as $t } from '~/i18n'
import clipboardPoll from '~/utils/clipboardPoll'

View File

@@ -7,7 +7,6 @@ import fs from 'fs-extra'
import { cloneDeep } from 'lodash-es'
import type { IPicGo } from 'piclist'
import type { IFileWithPath, ImgInfo, IStringKeyMap, IUploadOption } from '#/types/types'
import { T as $t } from '~/i18n/index'
import { handleCopyUrl, handleUrlEncodeWithSetting } from '~/utils/common'
import { configPaths } from '~/utils/configPaths'

View File

@@ -11,7 +11,6 @@ import fs from 'fs-extra'
import type { IPicGo } from 'piclist'
import writeFile from 'write-file-atomic'
import type { ImgInfo, IUploadOption } from '#/types/types'
import { GET_RENAME_FILE_NAME, RENAME_FILE_NAME } from '~/events/constant'
import { T as $t } from '~/i18n'
import { getClipboardFilePath, showNotification } from '~/utils/common'

View File

@@ -6,8 +6,6 @@ import { CREATE_APP_MENU } from '@core/bus/constants'
import db from '@core/datastore'
import { app, BrowserWindow, Rectangle } from 'electron'
import type { IWindowListItem } from '#/types/electron'
import type { IBrowserWindowOptions } from '#/types/types'
import { TOGGLE_SHORTKEY_MODIFIED_MODE } from '~/events/constant'
import { T as $t } from '~/i18n'
import { configPaths } from '~/utils/configPaths'

View File

@@ -1,7 +1,6 @@
import windowList from 'apis/app/window/windowList'
import { BrowserWindow } from 'electron'
import type { IWindowListItem, IWindowManager } from '#/types/electron'
import { IWindowList } from '~/utils/enum'
class WindowManager implements IWindowManager {

View File

@@ -10,8 +10,6 @@ import {
} from '@core/bus/constants'
import bus from '@core/bus/index'
import type { IFileWithPath } from '#/types/types'
export const uploadWithClipboardFiles = (): Promise<{
success: boolean
result?: string[]

View File

@@ -4,8 +4,6 @@ import { debounce } from 'lodash-es'
import { PicGo } from 'piclist'
import pkg from 'root/package.json'
import type { IStringKeyMap } from '#/types/types'
const CONFIG_PATH = dbPathChecker()
dbChecker()

View File

@@ -3,8 +3,6 @@ import util from 'node:util'
import dayjs from 'dayjs'
import fs from 'fs-extra'
import type { ILogArgvTypeWithError } from '#/types/types'
const MB = 1024 * 1024
const DEFAULT_LOG_FILE_SIZE_LIMIT = 10 * MB

View File

@@ -1,6 +1,5 @@
import OSS from 'ali-oss'
import type { IAliYunConfig, PartialKeys } from '#/types/types'
import { deleteFailedLog, deleteLog } from '~/utils/deleteLog'
interface IConfigMap {

View File

@@ -1,4 +1,3 @@
import type { IStringKeyMap } from '#/types/types'
import AlistApi from '~/apis/delete/alist'
import AlistplistApi from '~/apis/delete/alistplist'
import AliyunApi from '~/apis/delete/aliyun'

View File

@@ -1,4 +1,3 @@
import type { IStringKeyMap } from '#/types/types'
import { getRawData } from '~/utils/common'
import { removeFileFromS3InMain } from '~/utils/deleteFunc'
import { deleteFailedLog } from '~/utils/deleteLog'

View File

@@ -1,4 +1,3 @@
import type { IStringKeyMap } from '#/types/types'
import { getRawData } from '~/utils/common'
import { removeFileFromDogeInMain } from '~/utils/deleteFunc'
import { deleteFailedLog } from '~/utils/deleteLog'

View File

@@ -1,6 +1,5 @@
import { Octokit } from '@octokit/rest'
import type { IGitHubConfig, PartialKeys } from '#/types/types'
import { deleteFailedLog, deleteLog } from '~/utils/deleteLog'
interface IConfigMap {

View File

@@ -1,4 +1,3 @@
import type { IStringKeyMap } from '#/types/types'
import { getRawData } from '~/utils/common'
import { removeFileFromHuaweiInMain } from '~/utils/deleteFunc'
import { deleteFailedLog } from '~/utils/deleteLog'

View File

@@ -1,6 +1,5 @@
import axios, { AxiosResponse } from 'axios'
import type { IImgurConfig } from '#/types/types'
import { deleteFailedLog, deleteLog } from '~/utils/deleteLog'
interface IConfigMap {

View File

@@ -2,7 +2,6 @@ import https from 'node:https'
import axios, { AxiosResponse } from 'axios'
import type { IStringKeyMap } from '#/types/types'
import { deleteFailedLog, deleteLog } from '~/utils/deleteLog'
export default class LskyplistApi {

View File

@@ -1,6 +1,5 @@
import axios, { AxiosResponse } from 'axios'
import type { IStringKeyMap } from '#/types/types'
import { deleteFailedLog, deleteLog } from '~/utils/deleteLog'
export default class PiclistApi {

View File

@@ -1,6 +1,5 @@
import qiniu from 'qiniu'
import type { IQiniuConfig, PartialKeys } from '#/types/types'
import { deleteFailedLog, deleteLog } from '~/utils/deleteLog'
interface IConfigMap {
fileName: string

View File

@@ -1,4 +1,3 @@
import type { IStringKeyMap } from '#/types/types'
import { getRawData } from '~/utils/common'
import { removeFileFromSFTPInMain } from '~/utils/deleteFunc'
import { deleteFailedLog } from '~/utils/deleteLog'

View File

@@ -1,6 +1,5 @@
import axios, { AxiosResponse } from 'axios'
import type { ISMMSConfig } from '#/types/types'
import { deleteFailedLog, deleteLog } from '~/utils/deleteLog'
interface IConfigMap {

View File

@@ -1,6 +1,5 @@
import COS from 'cos-nodejs-sdk-v5'
import type { ITcYunConfig, PartialKeys } from '#/types/types'
import { deleteFailedLog, deleteLog } from '~/utils/deleteLog'
interface IConfigMap {
fileName: string

View File

@@ -1,6 +1,5 @@
import Upyun from 'upyun'
import type { IUpYunConfig, PartialKeys } from '#/types/types'
import { deleteFailedLog, deleteLog } from '~/utils/deleteLog'
interface IConfigMap {

View File

@@ -1,6 +1,5 @@
import { AuthType, createClient, WebDAVClientOptions } from 'webdav'
import type { IWebdavPlistConfig, PartialKeys } from '#/types/types'
import { formatEndpoint } from '~/utils/common'
import { deleteFailedLog, deleteLog } from '~/utils/deleteLog'

View File

@@ -8,16 +8,6 @@ import { BrowserWindow, dialog, ipcMain, IpcMainEvent, MessageBoxOptions, Notifi
import fs from 'fs-extra'
import { cloneDeep } from 'lodash-es'
import type {
IGuiApi,
ImgInfo,
IShowFileExplorerOption,
IShowInputBoxOption,
IShowMessageBoxOption,
IShowMessageBoxResult,
IShowNotificationOption,
IUploadOption,
} from '#/types/types'
import { SHOW_INPUT_BOX } from '~/events/constant'
import { T as $t } from '~/i18n'
import { handleCopyUrl } from '~/utils/common'

View File

@@ -14,7 +14,6 @@ import { createMenu } from 'apis/app/system'
import { uploadChoosedFiles, uploadClipboardFiles } from 'apis/app/uploader/apis'
import windowManager from 'apis/app/window/windowManager'
import type { IFileWithPath } from '#/types/types'
import { IWindowList } from '~/utils/enum'
function initEventCenter() {

View File

@@ -7,7 +7,6 @@ import { app, BrowserWindow, dialog, Menu, MenuItem, MenuItemConstructorOptions,
import { PicGo as PicGoCore } from 'piclist'
import pkg from 'root/package.json'
import type { IPicGoPlugin, IUploaderConfig } from '#/types/types'
import {
PICGO_CONFIG_PLUGIN,
PICGO_HANDLE_PLUGIN_DONE,

View File

@@ -1,7 +1,6 @@
import logger from '@core/picgo/logger'
import { ipcMain, IpcMainEvent, IpcMainInvokeEvent } from 'electron'
import type { IRPCRoutes, IRPCServer } from '#/types/rpc'
import { RPC_ACTIONS, RPC_ACTIONS_INVOKE } from '~/events/constant'
import { galleryRouter } from '~/events/rpc/routes/gallery'
import { manageRouter } from '~/events/rpc/routes/manage'

View File

@@ -1,4 +1,3 @@
import type { IRPCHandler, IRPCRouter, IRPCRoutes } from '#/types/rpc'
import { IRPCType } from '~/utils/enum'
interface IBatchAddParams {

View File

@@ -3,8 +3,6 @@ import picgo from '@core/picgo'
import GuiApi from 'apis/gui'
import { clipboard } from 'electron'
import type { IIPCEvent } from '#/types/rpc'
import type { ImgInfo } from '#/types/types'
import { RPCRouter } from '~/events/rpc/router'
import { configPaths } from '~/utils/configPaths'
import { ICOREBuildInEvent, IPasteStyle, IRPCActionType, IRPCType } from '~/utils/enum'

View File

@@ -1,5 +1,3 @@
import type { IIPCEvent } from '#/types/rpc'
import type { IStringKeyMap } from '#/types/types'
import { ManageApi } from '~/manage/manageApi'
import { IRPCActionType, IRPCType } from '~/utils/enum'

View File

@@ -1,5 +1,3 @@
import type { IIPCEvent } from '#/types/rpc'
import type { IObj } from '#/types/types'
import getManageApi from '~/manage/Main'
import { IRPCActionType, IRPCType } from '~/utils/enum'

View File

@@ -3,7 +3,6 @@ import path from 'node:path'
import { app, dialog, shell } from 'electron'
import fs from 'fs-extra'
import type { IIPCEvent } from '#/types/rpc'
import UpDownTaskQueue from '~/manage/datastore/upDownTaskQueue'
import { downloadFileFromUrl } from '~/manage/utils/common'
import { IRPCActionType, IRPCType } from '~/utils/enum'

View File

@@ -1,7 +1,5 @@
import ALLApi from 'apis/delete/allApi'
import type { IIPCEvent } from '#/types/rpc'
import type { ImgInfo } from '#/types/types'
import { IRPCActionType, IRPCType } from '~/utils/enum'
export default [

View File

@@ -1,7 +1,5 @@
import picgo from '@core/picgo'
import type { IIPCEvent } from '#/types/rpc'
import type { IStringKeyMap } from '#/types/types'
import { RPCRouter } from '~/events/rpc/router'
import deleteRoutes from '~/events/rpc/routes/picbed/delete'
import { IRPCActionType, IRPCType } from '~/utils/enum'

View File

@@ -8,8 +8,6 @@ import { dialog, shell } from 'electron'
import fs from 'fs-extra'
import { IGuiMenuItem, PicGo as PicGoCore } from 'piclist'
import type { IIPCEvent } from '#/types/rpc'
import type { IDispose, IPicGoPlugin } from '#/types/types'
import { T as $t } from '~/i18n'
import { handleStreamlinePluginName, showNotification, simpleClone } from '~/utils/common'
import { ICOREBuildInEvent, IPicGoHelperType, IWindowList } from '~/utils/enum'

View File

@@ -5,8 +5,6 @@ import picgo from '@core/picgo'
import { IpcMainEvent, shell } from 'electron'
import fs from 'fs-extra'
import type { IIPCEvent } from '#/types/rpc'
import type { IObj } from '#/types/types'
import { isAutoStartEnabled, setAutoStart } from '~/utils/autoStart'
import { IRPCActionType, IRPCType } from '~/utils/enum'

View File

@@ -2,8 +2,6 @@ import bus from '@core/bus'
import shortKeyHandler from 'apis/app/shortKey/shortKeyHandler'
import { Notification } from 'electron'
import type { IIPCEvent } from '#/types/rpc'
import type { IShortKeyConfig } from '#/types/types'
import { TOGGLE_SHORTKEY_MODIFIED_MODE } from '~/events/constant'
import { T as $t } from '~/i18n'
import { IRPCActionType, IRPCType } from '~/utils/enum'

View File

@@ -1,7 +1,6 @@
import picgo from '@core/picgo'
import { app, shell } from 'electron'
import type { IIPCEvent } from '#/types/rpc'
import { i18nManager } from '~/i18n'
import { IRPCActionType } from '~/utils/enum'

View File

@@ -1,8 +1,6 @@
import windowManager from 'apis/app/window/windowManager'
import { app, BrowserWindow } from 'electron'
import type { IIPCEvent } from '#/types/rpc'
import type { IMiniWindowPos, IPicGoPlugin } from '#/types/types'
import {
buildMainPageMenu,
buildMiniPageMenu,

View File

@@ -3,7 +3,6 @@ import path from 'node:path'
import { dbPathChecker, defaultConfigPath } from '@core/datastore/dbChecker'
import fs from 'fs-extra'
import type { IToolboxCheckerMap, IToolboxFixMap } from '#/types/rpc'
import { sendToolboxResWithType } from '~/events/rpc/routes/toolbox/utils'
import { T as $t } from '~/i18n'
import { IToolboxItemCheckStatus, IToolboxItemType } from '~/utils/enum'

View File

@@ -5,7 +5,6 @@ import { dbPathChecker } from '@core/datastore/dbChecker'
import type { IpcMainEvent } from 'electron'
import fs from 'fs-extra'
import type { IToolboxCheckerMap, IToolboxFixMap } from '#/types/rpc'
import { sendToolboxResWithType } from '~/events/rpc/routes/toolbox/utils'
import { T as $t } from '~/i18n'
import { IToolboxItemCheckStatus, IToolboxItemType } from '~/utils/enum'

View File

@@ -4,7 +4,6 @@ import fs from 'fs-extra'
import { IConfig } from 'piclist'
import tunnel from 'tunnel'
import type { IToolboxCheckerMap } from '#/types/rpc'
import { sendToolboxResWithType } from '~/events/rpc/routes/toolbox/utils'
import { T as $t } from '~/i18n'
import { IToolboxItemCheckStatus, IToolboxItemType } from '~/utils/enum'

View File

@@ -1,6 +1,5 @@
import { IpcMainEvent } from 'electron'
import type { IToolboxCheckArgs, IToolboxCheckerMap, IToolboxFixMap } from '#/types/rpc'
import { RPCRouter } from '~/events/rpc/router'
import { checkClipboardUploadMap, fixClipboardUploadMap } from '~/events/rpc/routes/toolbox/checkClipboardUpload'
import { checkFileMap, fixFileMap } from '~/events/rpc/routes/toolbox/checkFile'

View File

@@ -1,6 +1,5 @@
import { IpcMainEvent } from 'electron'
import type { IToolboxCheckRes } from '#/types/rpc'
import { IRPCActionType } from '~/utils/enum'
export function sendToolboxResWithType(type: string) {

View File

@@ -3,7 +3,6 @@ import uploader from 'apis/app/uploader'
import windowManager from 'apis/app/window/windowManager'
import { Notification } from 'electron'
import type { IIPCEvent } from '#/types/rpc'
import { RPCRouter } from '~/events/rpc/router'
import { T as $t } from '~/i18n'
import { generateShortUrl, handleCopyUrl, setTrayToolTip } from '~/utils/common'

View File

@@ -1,7 +1,5 @@
import { uploadChoosedFiles, uploadClipboardFiles } from 'apis/app/uploader/apis'
import type { IIPCEvent } from '#/types/rpc'
import type { IFileWithPath } from '#/types/types'
import { RPCRouter } from '~/events/rpc/router'
import { IRPCActionType, IRPCType } from '~/utils/enum'
import getPicBeds from '~/utils/getPicBeds'

View File

@@ -5,9 +5,6 @@ import { I18n, ObjectAdapter } from '@piclist/i18n'
import fs from 'fs-extra'
import yaml from 'js-yaml'
import type { ILocales, ILocalesKey } from '#/types/i18n'
import type { II18nItem, IStringKeyMap } from '#/types/types'
const dirname = path.dirname(fileURLToPath(import.meta.url))
const builtinI18nList: II18nItem[] = [

View File

@@ -6,7 +6,6 @@ import axios from 'axios'
import { ipcMain, IpcMainEvent } from 'electron'
import * as fastxml from 'fast-xml-parser'
import type { IStringKeyMap } from '#/types/types'
import UpDownTaskQueue from '~/manage/datastore/upDownTaskQueue'
import {
ConcurrencyPromisePool,

View File

@@ -5,7 +5,6 @@ import { ipcMain, IpcMainEvent } from 'electron'
import fs from 'fs-extra'
import got from 'got'
import type { IStringKeyMap } from '#/types/types'
import UpDownTaskQueue from '~/manage/datastore/upDownTaskQueue'
import {
ConcurrencyPromisePool,

View File

@@ -6,7 +6,6 @@ import FormData from 'form-data'
import fs from 'fs-extra'
import got from 'got'
import type { IStringKeyMap } from '#/types/types'
import UpDownTaskQueue from '~/manage/datastore/upDownTaskQueue'
import {
ConcurrencyPromisePool,

View File

@@ -5,7 +5,6 @@ import windowManager from 'apis/app/window/windowManager'
import { ipcMain, IpcMainEvent } from 'electron'
import fs from 'fs-extra'
import type { IStringKeyMap } from '#/types/types'
import UpDownTaskQueue from '~/manage/datastore/upDownTaskQueue'
import { formatError } from '~/manage/utils/common'
import ManageLogger from '~/manage/utils/logger'

View File

@@ -5,7 +5,6 @@ import axios from 'axios'
import { ipcMain, IpcMainEvent } from 'electron'
import qiniu from 'qiniu'
import type { IStringKeyMap } from '#/types/types'
import UpDownTaskQueue from '~/manage/datastore/upDownTaskQueue'
import {
ConcurrencyPromisePool,

View File

@@ -27,7 +27,6 @@ import windowManager from 'apis/app/window/windowManager'
import { ipcMain, IpcMainEvent } from 'electron'
import fs from 'fs-extra'
import type { IStringKeyMap } from '#/types/types'
import UpDownTaskQueue from '~/manage/datastore/upDownTaskQueue'
import { ConcurrencyPromisePool, formatError, getAgent, getFileMimeType, NewDownloader } from '~/manage/utils/common'
import { dogecloudApi, DogecloudToken, getTempToken } from '~/manage/utils/dogeAPI'

View File

@@ -3,8 +3,6 @@ import path from 'node:path'
import windowManager from 'apis/app/window/windowManager'
import { ipcMain, IpcMainEvent } from 'electron'
import type { Undefinable } from '#/types/manage'
import type { IStringKeyMap } from '#/types/types'
import UpDownTaskQueue from '~/manage/datastore/upDownTaskQueue'
import { formatError } from '~/manage/utils/common'
import ManageLogger from '~/manage/utils/logger'

View File

@@ -7,7 +7,6 @@ import { ipcMain, IpcMainEvent } from 'electron'
import FormData from 'form-data'
import fs from 'fs-extra'
import type { IStringKeyMap } from '#/types/types'
import UpDownTaskQueue from '~/manage/datastore/upDownTaskQueue'
import { ConcurrencyPromisePool, formatError, getFileMimeType, gotUpload, NewDownloader } from '~/manage/utils/common'
import { ManageLogger } from '~/manage/utils/logger'

View File

@@ -5,7 +5,6 @@ import COS from 'cos-nodejs-sdk-v5'
import { ipcMain, IpcMainEvent } from 'electron'
import fs from 'fs-extra'
import type { IStringKeyMap } from '#/types/types'
import UpDownTaskQueue from '~/manage/datastore/upDownTaskQueue'
import { formatError, getFileMimeType } from '~/manage/utils/common'
import { ManageLogger } from '~/manage/utils/logger'

View File

@@ -7,7 +7,6 @@ import FormData from 'form-data'
import fs from 'fs-extra'
import Upyun from 'upyun'
import type { IStringKeyMap } from '#/types/types'
import UpDownTaskQueue from '~/manage/datastore/upDownTaskQueue'
import {
ConcurrencyPromisePool,

View File

@@ -7,7 +7,6 @@ import { ipcMain, IpcMainEvent } from 'electron'
import fs from 'fs-extra'
import { AuthType, createClient, FileStat, ProgressEvent, WebDAVClient, WebDAVClientOptions } from 'webdav'
import type { IStringKeyMap } from '#/types/types'
import UpDownTaskQueue from '~/manage/datastore/upDownTaskQueue'
import { ConcurrencyPromisePool, formatError, getInnerAgent, NewDownloader } from '~/manage/utils/common'
import ManageLogger from '~/manage/utils/logger'

View File

@@ -1,7 +1,5 @@
import { JSONStore } from '@piclist/store'
import type { IManageApiType, IManageConfigType } from '#/types/manage'
import type { IStringKeyMap } from '#/types/types'
interface IJSON {
[propsName: string]: string | number | IJSON
}

View File

@@ -6,7 +6,6 @@ import path from 'node:path'
import { app } from 'electron'
import fs from 'fs-extra'
import type { IDownloadTask, IUploadTask } from '#/types/manage'
import { commonTaskStatus, downloadTaskSpecialStatus, uploadTaskSpecialStatus } from '~/utils/enum'
class UpDownTaskQueue {

View File

@@ -7,8 +7,6 @@ import { ipcMain } from 'electron'
import fs from 'fs-extra'
import { get, set, unset } from 'lodash-es'
import type { IManageApiType, IManageConfigType, IManageError, IPicBedMangeConfig } from '#/types/manage'
import type { IStringKeyMap } from '#/types/types'
import API from '~/manage/apis/api'
import ManageDB from '~/manage/datastore/db'
import { managePathChecker } from '~/manage/datastore/dbChecker'

View File

@@ -13,7 +13,6 @@ import { HttpProxyAgent, HttpsProxyAgent } from 'hpagent'
import mime from 'mime'
import Downloader from 'nodejs-file-downloader'
import type { IHTTPProxy, IStringKeyMap } from '#/types/types'
import UpDownTaskQueue from '~/manage/datastore/upDownTaskQueue'
import { ManageLogger } from '~/manage/utils/logger'
import { formatHttpProxy } from '~/utils/common'

View File

@@ -4,8 +4,6 @@ import querystring from 'node:querystring'
import picgo from '@core/picgo'
import axios from 'axios'
import type { IObj } from '#/types/types'
export interface DogecloudToken {
accessKeyId: string
secretAccessKey: string

View File

@@ -6,8 +6,6 @@ import dayjs from 'dayjs'
import fs from 'fs-extra'
import { ILogColor, ILogger } from 'piclist/dist/types'
import type { IManageApiType, Undefinable } from '#/types/manage'
import type { ILogArgvType, ILogArgvTypeWithError } from '#/types/types'
import { enforceNumber } from '~/utils/common'
import { configPaths } from '~/utils/configPaths'
import { ILogType } from '~/utils/enum'

View File

@@ -8,7 +8,6 @@ import { app } from 'electron'
import fs from 'fs-extra'
import multer from 'multer'
import type { ErrnoException, IObj, IServerConfig } from '#/types/types'
import routers from '~/server/routerManager'
import { ensureHTTPLink, handleResponse } from '~/server/utils'
import { configPaths } from '~/utils/configPaths'

View File

@@ -1,5 +1,3 @@
import type { routeHandler } from '#/types/types'
type HttpMethod = 'GET' | 'POST'
class Router {

View File

@@ -10,7 +10,6 @@ import { app } from 'electron'
import fs from 'fs-extra'
import { marked } from 'marked'
import type { IHttpResponse, IStringKeyMap } from '#/types/types'
import { markdownContent } from '~/server/apiDoc'
import router from '~/server/router'
import { deleteChoosedFiles, handleResponse } from '~/server/utils'

View File

@@ -6,7 +6,6 @@ import ALLApi from 'apis/delete/allApi'
import GuiApi from 'apis/gui'
import { Notification } from 'electron'
import type { IHttpResponse, ImgInfo, IObj } from '#/types/types'
import { T as $t } from '~/i18n/index'
import { configPaths } from '~/utils/configPaths'
import { ICOREBuildInEvent, IWindowList } from '~/utils/enum'

View File

@@ -5,7 +5,6 @@ import picgo from '@core/picgo'
import logger from '@core/picgo/logger'
import fs from 'fs-extra'
import type { IStringKeyMap } from '#/types/types'
import { encodeFilePath } from '~/utils/common'
import { configPaths } from '~/utils/configPaths'
@@ -76,7 +75,7 @@ function generateDirectoryListingHtml(files: any[], requestPath: string, fullPat
padding: 0;
box-sizing: border-box;
}
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica', 'Arial', sans-serif;
font-size: 13px;
@@ -84,14 +83,14 @@ function generateDirectoryListingHtml(files: any[], requestPath: string, fullPat
color: #212121;
line-height: 1.4;
}
.window {
height: 100vh;
display: flex;
flex-direction: column;
border: 1px solid #dadce0;
}
.titlebar {
height: 32px;
background: #f8f9fa;
@@ -103,7 +102,7 @@ function generateDirectoryListingHtml(files: any[], requestPath: string, fullPat
font-size: 13px;
font-weight: 500;
}
.toolbar {
height: 40px;
background: #ffffff;
@@ -113,7 +112,7 @@ function generateDirectoryListingHtml(files: any[], requestPath: string, fullPat
padding: 0 12px;
gap: 8px;
}
.nav-button {
width: 24px;
height: 24px;
@@ -127,17 +126,17 @@ function generateDirectoryListingHtml(files: any[], requestPath: string, fullPat
font-size: 12px;
color: #5f6368;
}
.nav-button:hover {
background: #f8f9fa;
border-color: #c4c7c5;
}
.nav-button:disabled {
opacity: 0.5;
cursor: not-allowed;
}
.address-bar {
flex: 1;
height: 24px;
@@ -149,12 +148,12 @@ function generateDirectoryListingHtml(files: any[], requestPath: string, fullPat
font-size: 13px;
color: #202124;
}
.address-bar:focus {
outline: none;
border-color: #1a73e8;
}
.search-box {
width: 200px;
height: 24px;
@@ -164,24 +163,24 @@ function generateDirectoryListingHtml(files: any[], requestPath: string, fullPat
border-radius: 2px;
font-size: 13px;
}
.search-box:focus {
outline: none;
border-color: #1a73e8;
}
.main-content {
flex: 1;
display: flex;
overflow: hidden;
}
.file-list-container {
flex: 1;
overflow: auto;
background: #ffffff;
}
.list-header {
height: 24px;
background: #f8f9fa;
@@ -195,27 +194,27 @@ function generateDirectoryListingHtml(files: any[], requestPath: string, fullPat
text-transform: uppercase;
letter-spacing: 0.8px;
}
.header-name {
flex: 1;
min-width: 200px;
}
.header-modified {
width: 140px;
padding: 0 8px;
}
.header-size {
width: 80px;
text-align: right;
padding: 0 8px;
}
.file-list {
user-select: none;
}
.file-item {
height: 20px;
display: flex;
@@ -226,22 +225,22 @@ function generateDirectoryListingHtml(files: any[], requestPath: string, fullPat
border-bottom: 1px solid transparent;
cursor: pointer;
}
.file-item:hover {
background: #f8f9fa;
}
.file-item:active {
background: #e8f0fe;
}
.file-icon {
width: 16px;
height: 16px;
margin-right: 8px;
flex-shrink: 0;
}
.file-name {
flex: 1;
min-width: 0;
@@ -250,7 +249,7 @@ function generateDirectoryListingHtml(files: any[], requestPath: string, fullPat
text-overflow: ellipsis;
font-size: 13px;
}
.file-modified {
width: 140px;
padding: 0 8px;
@@ -258,7 +257,7 @@ function generateDirectoryListingHtml(files: any[], requestPath: string, fullPat
color: #5f6368;
white-space: nowrap;
}
.file-size {
width: 80px;
text-align: right;
@@ -267,20 +266,20 @@ function generateDirectoryListingHtml(files: any[], requestPath: string, fullPat
color: #5f6368;
white-space: nowrap;
}
.directory .file-name {
font-weight: 500;
}
.parent-dir {
border-bottom: 1px solid #e8eaed;
}
.parent-dir .file-name {
color: #1a73e8;
font-weight: 500;
}
.empty-state {
display: flex;
flex-direction: column;
@@ -289,14 +288,14 @@ function generateDirectoryListingHtml(files: any[], requestPath: string, fullPat
height: 200px;
color: #5f6368;
}
.empty-state-icon {
width: 48px;
height: 48px;
margin-bottom: 16px;
opacity: 0.5;
}
.status-bar {
height: 22px;
background: #f8f9fa;
@@ -307,16 +306,16 @@ function generateDirectoryListingHtml(files: any[], requestPath: string, fullPat
font-size: 12px;
color: #5f6368;
}
@media (max-width: 768px) {
.header-modified, .file-modified {
display: none;
}
.header-size, .file-size {
width: 60px;
}
.search-box {
width: 150px;
}
@@ -328,7 +327,7 @@ function generateDirectoryListingHtml(files: any[], requestPath: string, fullPat
<div class="titlebar">
File Browser - ${requestPath || 'Home'}
</div>
<div class="toolbar">
<button class="nav-button" onclick="history.back()" title="Back">←</button>
<button class="nav-button" onclick="history.forward()" title="Forward">→</button>
@@ -336,7 +335,7 @@ function generateDirectoryListingHtml(files: any[], requestPath: string, fullPat
<input type="text" class="address-bar" value="${requestPath || '/'}" readonly>
<input type="text" class="search-box" placeholder="Search..." id="searchBox">
</div>
<div class="main-content">
<div class="file-list-container">
<div class="list-header">
@@ -344,7 +343,7 @@ function generateDirectoryListingHtml(files: any[], requestPath: string, fullPat
<div class="header-modified">Date modified</div>
<div class="header-size">Size</div>
</div>
<div class="file-list" id="fileList">
`
@@ -410,18 +409,18 @@ function generateDirectoryListingHtml(files: any[], requestPath: string, fullPat
</div>
</div>
</div>
<div class="status-bar">
${itemCount} items
</div>
</div>
<script>
// Search functionality
document.getElementById('searchBox').addEventListener('input', function(e) {
const searchTerm = e.target.value.toLowerCase();
const fileItems = document.querySelectorAll('.file-item:not(.parent-dir)');
fileItems.forEach(item => {
const fileName = item.querySelector('.file-name').textContent.toLowerCase();
if (fileName.includes(searchTerm)) {
@@ -431,7 +430,7 @@ function generateDirectoryListingHtml(files: any[], requestPath: string, fullPat
}
});
});
// Handle keyboard navigation
document.addEventListener('keydown', function(e) {
if (e.key === 'F5') {
@@ -508,7 +507,7 @@ function generateErrorPage(errorCode: number, _e: string): string {
padding: 0;
box-sizing: border-box;
}
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
@@ -518,7 +517,7 @@ function generateErrorPage(errorCode: number, _e: string): string {
justify-content: center;
padding: 20px;
}
.error-container {
background: rgba(255, 255, 255, 0.95);
border-radius: 15px;
@@ -529,34 +528,34 @@ function generateErrorPage(errorCode: number, _e: string): string {
max-width: 500px;
width: 100%;
}
.error-icon {
font-size: 80px;
margin-bottom: 20px;
opacity: 0.8;
}
.error-code {
font-size: 48px;
font-weight: 700;
color: #e74c3c;
margin-bottom: 10px;
}
.error-title {
font-size: 24px;
font-weight: 600;
color: #2c3e50;
margin-bottom: 15px;
}
.error-description {
font-size: 16px;
color: #7f8c8d;
line-height: 1.6;
margin-bottom: 30px;
}
.back-button {
display: inline-block;
padding: 12px 24px;
@@ -567,25 +566,25 @@ function generateErrorPage(errorCode: number, _e: string): string {
font-weight: 500;
transition: transform 0.3s, box-shadow 0.3s;
}
.back-button:hover {
transform: translateY(-2px);
box-shadow: 0 8px 25px rgba(79, 172, 254, 0.4);
}
@media (max-width: 480px) {
.error-container {
padding: 40px 30px;
}
.error-icon {
font-size: 60px;
}
.error-code {
font-size: 36px;
}
.error-title {
font-size: 20px;
}

View File

@@ -6,7 +6,6 @@ import { dbPathChecker } from '@core/datastore/dbChecker'
import fs from 'fs-extra'
import yaml from 'js-yaml'
import type { ILocales } from '#/types/i18n'
import { i18nManager } from '~/i18n'
const configPath = dbPathChecker()

View File

@@ -9,7 +9,6 @@ import FormData from 'form-data'
import fs from 'fs-extra'
import { isReactive, isRef, toRaw, unref } from 'vue'
import type { IHTTPProxy, IPrivateShowNotificationOption, IStringKeyMap } from '#/types/types'
import { configPaths } from '~/utils/configPaths'
import { IShortUrlServer } from '~/utils/enum'

View File

@@ -1,25 +1,5 @@
import type { IBuildInCompressOptions, IBuildInWaterMarkOptions } from 'piclist'
import type {
IAliYunConfig,
IAwsS3PListUserConfig,
IGitHubConfig,
IImgurConfig,
ILocalConfig,
ILskyConfig,
IPicBedType,
IQiniuConfig,
IServerConfig,
ISftpPlistConfig,
IShortKeyConfig,
ISMMSConfig,
ISyncConfig,
ITcYunConfig,
IUploaderConfig,
IUpYunConfig,
IWebdavPlistConfig,
} from '#/types/types'
export type manualPageOpenType = 'window' | 'browser'
type IPicGoPlugins = Record<`picgo-plugin-${string}`, boolean>

View File

@@ -11,7 +11,6 @@ import { NodeHttpHandler } from '@smithy/node-http-handler'
import axios from 'axios'
import type { ISftpPlistConfig } from 'piclist'
import type { IObj, IStringKeyMap } from '#/types/types'
import { getAgent } from '~/manage/utils/common'
import SSHClient from '~/utils/sshClient'

View File

@@ -2,8 +2,6 @@ import crypto from 'node:crypto'
import axios from 'axios'
import type { IStringKeyMap } from '#/types/types'
const AUTH_KEY_VALUE_RE = /(\w+)=["']?([^'"]{1,10000})["']?/
let NC = 0
const NC_PAD = '00000000'

View File

@@ -1,6 +1,5 @@
import picgo from '@core/picgo'
import type { IPicBedType } from '#/types/types'
import { configPaths } from '~/utils/configPaths'
const getPicBeds = () => {

View File

@@ -1,13 +1,6 @@
import picgo from '@core/picgo'
import { v4 as uuid } from 'uuid'
import type {
IPicGoPluginConfig,
IPicGoPluginOriginConfig,
IStringKeyMap,
IUploaderConfigItem,
IUploaderConfigListItem,
} from '#/types/types'
import { setTrayToolTip, trimValues } from '~/utils/common'
import { configPaths } from '~/utils/configPaths'

View File

@@ -1,3 +1 @@
import type { IAppNotification } from '#/types/types'
export const notificationList: IAppNotification[] = []

View File

@@ -1,6 +1,5 @@
import db from '@core/datastore'
import type { ImgInfo } from '#/types/types'
import { generateShortUrl, handleUrlEncodeWithSetting } from '~/utils/common'
import { configPaths } from '~/utils/configPaths'

View File

@@ -11,7 +11,6 @@ import fs from 'fs-extra'
import { HttpsProxyAgent } from 'hpagent'
import { AuthType, createClient, WebDAVClientOptions } from 'webdav'
import type { IGalleryDBFile, IGalleryDBGalleryItem, ISyncConfig } from '#/types/types'
import { extractData, zipData } from '~/utils/common'
import { formatEndpoint } from '~/utils/common'
import { configPaths } from '~/utils/configPaths'

View File

@@ -1,6 +1,5 @@
import { getRawData } from '@/utils/common'
import { IRPCActionType } from '@/utils/enum'
import type { IStringKeyMap } from '#/types/types'
export default class ALLApi {
static async delete(configMap: IStringKeyMap): Promise<boolean> {

View File

@@ -60,7 +60,6 @@ import { useI18n } from 'vue-i18n'
import $bus from '@/utils/bus'
import { SHOW_INPUT_BOX, SHOW_INPUT_BOX_RESPONSE } from '@/utils/constant'
import type { IShowInputBoxOption } from '#/types/types'
const { t } = useI18n()
const inputBoxValue = ref('')

View File

@@ -130,7 +130,6 @@ import { useI18n } from 'vue-i18n'
import { useRoute } from 'vue-router'
import { getConfig } from '@/utils/dataSender'
import type { IPicGoPluginConfig, IStringKeyMap } from '#/types/types'
interface IProps {
config: any[]

View File

@@ -1,8 +1,6 @@
import { defineStore } from 'pinia'
import { ref } from 'vue'
import type { IStringKeyMap } from '#/types/types'
export const useAppStore = defineStore('app', () => {
const settings = ref<IStringKeyMap>({
app: {

View File

@@ -1294,8 +1294,6 @@ import { videoExt } from '@/manage/utils/videofile'
import { trimPath } from '@/utils/common'
import { IRPCActionType } from '@/utils/enum'
import { cancelDownloadLoadingFileList, refreshDownloadFileTransferList } from '@/utils/static'
import type { IDownloadTask, IUploadTask } from '#/types/manage'
import type { IStringKeyMap } from '#/types/types'
const { t } = useI18n()
const message = useMessage()

View File

@@ -309,7 +309,6 @@ import { getConfig, removeConfig, saveConfig } from '@/manage/utils/dataSender'
import { formatEndpoint } from '@/utils/common'
import { getConfig as getPicBedsConfig } from '@/utils/dataSender'
import { IRPCActionType } from '@/utils/enum'
import type { IStringKeyMap, IUploaderConfigListItem } from '#/types/types'
const { t } = useI18n()
const manageStore = useManageStore()

View File

@@ -276,7 +276,6 @@ import { useManageStore } from '@/manage/store/manageStore'
import { supportedPicBedList } from '@/manage/utils/constants'
import { newBucketConfig } from '@/manage/utils/newBucketConfig'
import { IRPCActionType } from '@/utils/enum'
import type { IStringKeyMap } from '#/types/types'
const { t } = useI18n()
const manageStore = useManageStore() as any

View File

@@ -226,7 +226,6 @@ import { fileCacheDbInstance } from '@/manage/store/bucketFileDb'
import { customRenameFormatTable, formatFileSize } from '@/manage/utils/common'
import { getConfig, saveConfig } from '@/manage/utils/dataSender'
import { IRPCActionType } from '@/utils/enum'
import type { IStringKeyMap } from '#/types/types'
const { t } = useI18n()
const message = useMessage()

View File

@@ -1,7 +1,5 @@
import Dexie, { Table } from 'dexie'
import type { IStringKeyMap } from '#/types/types'
/*
* create a database for bucket file cache
*database name: bucketFileDb

View File

@@ -1,7 +1,6 @@
import { defineStore } from 'pinia'
import { getConfig } from '@/manage/utils/dataSender'
import type { IStringKeyMap } from '#/types/types'
export const useManageStore = defineStore('manageConfig', {
state: () => {

View File

@@ -1,5 +1,3 @@
import type { IStringKeyMap } from '#/types/types'
const AliyunAreaCodeName: IStringKeyMap = {
'oss-cn-hangzhou': '华东1(杭州)',
'oss-cn-shanghai': '华东2(上海)',

View File

@@ -3,7 +3,6 @@ import { v4 as uuidv4 } from 'uuid'
import { getConfig } from '@/manage/utils/dataSender'
import { availableIconList } from '@/manage/utils/icon'
import { isNeedToShorten, safeSliceF } from '@/utils/common'
import type { IStringKeyMap } from '#/types/types'
export const isUrlEncode = (url: string): boolean => {
url = url || ''

View File

@@ -3,7 +3,7 @@ import { createI18n } from 'vue-i18n'
import en from '@/i18n/locales/en.json'
import zhCN from '@/i18n/locales/zh-CN.json'
import zhTW from '@/i18n/locales/zh-TW.json'
import type { IStringKeyMap } from '#/types/types'
type MessageSchema = typeof en
const i18n = createI18n<MessageSchema, 'en' | 'zh-CN' | 'zh-TW'>({

View File

@@ -1,5 +1,4 @@
import { IRPCActionType } from '@/utils/enum'
import type { IObj } from '#/types/types'
export function saveConfig(config: IObj | string, value?: any) {
const configObj = typeof config === 'string' ? { [config]: value } : config

View File

@@ -1,5 +1,3 @@
import type { IStringKeyMap } from '#/types/types'
const AUTH_KEY_VALUE_RE = /(\w+)=["']?([^'"]{1,10000})["']?/
let NC = 0
const NC_PAD = '00000000'

View File

@@ -3,7 +3,6 @@ import { createI18n } from 'vue-i18n'
import en from '@/i18n/locales/en.json'
import zhCN from '@/i18n/locales/zh-CN.json'
import zhTW from '@/i18n/locales/zh-TW.json'
import type { IStringKeyMap } from '#/types/types'
import { AliyunAreaCodeName, QiniuAreaCodeName, TencentAreaCodeName } from './bucketConfigCons'
type MessageSchema = typeof en

View File

@@ -517,7 +517,6 @@ import $$db from '@/utils/db'
import { IPasteStyle, IRPCActionType } from '@/utils/enum'
import { picBedGlobal } from '@/utils/global'
import { picBedsCanbeDeleted } from '@/utils/static'
import type { IGalleryItem, ImgInfo, IObj, IObjT } from '#/types/types'
const { t } = useI18n()
const message = useMessage()

Some files were not shown because too many files have changed in this diff Show More