🔨 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,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()

View File

@@ -34,7 +34,6 @@ import { isUrl } from '@/utils/common'
import { getConfig } from '@/utils/dataSender'
import { IRPCActionType } from '@/utils/enum'
import { osGlobal } from '@/utils/global'
import type { IFileWithPath } from '#/types/types'
const logoPath = ref('')
const dragover = ref(false)

View File

@@ -1778,7 +1778,6 @@ import {
} from 'lucide-vue-next'
import type { IConfig } from 'piclist'
import pkg from 'root/package.json'
import { ISettingForm } from 'root/src/universal/types/view'
import { computed, onBeforeMount, reactive, ref, toRaw, watch } from 'vue'
import { useI18n } from 'vue-i18n'
import { useRouter } from 'vue-router'
@@ -1794,7 +1793,6 @@ import { getConfig, saveConfig } from '@/utils/dataSender'
import { II18nLanguage, IRPCActionType, ISartMode } from '@/utils/enum'
import { getLatestVersion } from '@/utils/getLatestVersion'
import { osGlobal, picBedGlobal, updatePicBedGlobal } from '@/utils/global'
import type { ICheckBoxValueType } from '#/types/types'
const { t, locale } = useI18n()
const $router = useRouter()

View File

@@ -236,7 +236,6 @@ import {
import { getConfig, saveConfig } from '@/utils/dataSender'
import { IRPCActionType } from '@/utils/enum'
import { updatePicBedGlobal } from '@/utils/global'
import type { INPMSearchResultObject, IPicGoPlugin } from '#/types/types'
const { t } = useI18n()
const searchText = ref('')

View File

@@ -117,7 +117,6 @@ import { configPaths } from '@/utils/configPaths'
import { getConfig } from '@/utils/dataSender'
import { IRPCActionType } from '@/utils/enum'
import keyBinding from '@/utils/key-binding'
import type { IShortKeyConfig, IShortKeyConfigs } from '#/types/types'
const { t } = useI18n()
const list = ref<IShortKeyConfig[]>([])

View File

@@ -110,8 +110,6 @@ import ToolboxHandler from '@/components/ToolboxHandler.vue'
import ToolboxStatusIcon from '@/components/ToolboxStatusIcon.vue'
import useConfirm from '@/hooks/useConfirm'
import { IRPCActionType, IToolboxItemCheckStatus, IToolboxItemType } from '@/utils/enum'
import type { IToolboxCheckRes } from '#/types/rpc'
import type { IToolboxMap } from '#/types/view'
const { t } = useI18n()
const { confirm } = useConfirm()

View File

@@ -83,7 +83,6 @@ import { configPaths } from '@/utils/configPaths'
import { getConfig } from '@/utils/dataSender'
import $$db from '@/utils/db'
import { IPasteStyle, IRPCActionType, IWindowList } from '@/utils/enum'
import type { ImgInfo } from '#/types/types'
const { t } = useI18n()

View File

@@ -177,7 +177,6 @@ import { getConfig, saveConfig } from '@/utils/dataSender'
import { useDragEventListeners } from '@/utils/drag'
import { IPasteStyle, IRPCActionType } from '@/utils/enum'
import { picBedGlobal, updatePicBedGlobal } from '@/utils/global'
import type { IFileWithPath, IUploaderConfigItem } from '#/types/types'
useDragEventListeners()
const $router = useRouter()

View File

@@ -138,7 +138,6 @@ import { configPaths } from '@/utils/configPaths'
import { SHOW_INPUT_BOX, SHOW_INPUT_BOX_RESPONSE } from '@/utils/constant'
import { saveConfig } from '@/utils/dataSender'
import { IRPCActionType } from '@/utils/enum'
import type { IStringKeyMap, IUploaderConfigItem } from '#/types/types'
const { t } = useI18n()
const message = useMessage()

View File

@@ -144,7 +144,6 @@ import { configPaths } from '@/utils/configPaths'
import { getConfig } from '@/utils/dataSender'
import { II18nLanguage, IRPCActionType } from '@/utils/enum'
import { picBedManualUrlList } from '@/utils/static'
import type { IPicGoPluginConfig, IStringKeyMap, IUploaderConfigItem, IUploaderConfigListItem } from '#/types/types'
const { t } = useI18n()
const message = useMessage()

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

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

View File

@@ -1,5 +1,4 @@
import { IRPCActionType } from '@/utils/enum'
import type { IGalleryDB } from '#/types/extra-vue'
interface IFilter {
orderBy?: 'asc' | 'desc'

View File

@@ -1,5 +1,4 @@
import { RELEASE_URL, RELEASE_URL_BACKUP } from '@/utils/static'
import type { IStringKeyMap } from '#/types/types'
export const getLatestVersion = async (): Promise<string> => {
try {

View File

@@ -1,7 +1,6 @@
import { ref } from 'vue'
import { IRPCActionType } from '@/utils/enum'
import type { IPicBedType } from '#/types/types'
const osGlobal = ref<string>(window.electron.platform)

View File

@@ -1,5 +1,3 @@
import type { IStringKeyMap } from '#/types/types'
export const RELEASE_URL = 'https://api.github.com/repos/Kuingsmile/PicList/releases'
export const RELEASE_URL_BACKUP = 'https://release.piclist.cn'