mirror of
https://github.com/Kuingsmile/PicList.git
synced 2026-07-09 22:43:09 +08:00
🔨 Refactor(custom): refactored imports
This commit is contained in:
@@ -2,7 +2,7 @@ import { AuthType, WebDAVClientOptions, createClient } from 'webdav'
|
||||
|
||||
import { deleteFailedLog, deleteLog } from '@/utils/common'
|
||||
|
||||
import { formatEndpoint } from '~/manage/utils/common'
|
||||
import { formatEndpoint } from '#/utils/common'
|
||||
|
||||
interface IConfigMap {
|
||||
fileName: string
|
||||
|
||||
@@ -26,7 +26,7 @@ import { Loading } from '@element-plus/icons-vue'
|
||||
import { getAuthHeader } from '@/manage/utils/digestAuth'
|
||||
import { getFileIconPath } from '@/manage/utils/common'
|
||||
|
||||
import { formatEndpoint } from '~/manage/utils/common'
|
||||
import { formatEndpoint } from '#/utils/common'
|
||||
|
||||
const base64Url = ref('')
|
||||
const success = ref(false)
|
||||
|
||||
@@ -5,7 +5,7 @@ import { Loading } from '@element-plus/icons-vue'
|
||||
import { getFileIconPath } from '@/manage/utils/common'
|
||||
import { getAuthHeader } from '@/manage/utils/digestAuth'
|
||||
|
||||
import { formatEndpoint } from '~/manage/utils/common'
|
||||
import { formatEndpoint } from '#/utils/common'
|
||||
|
||||
export default defineComponent({
|
||||
props: {
|
||||
|
||||
@@ -1467,9 +1467,8 @@ import { useRoute } from 'vue-router'
|
||||
|
||||
import { fileCacheDbInstance } from '@/manage/store/bucketFileDb'
|
||||
import { useFileTransferStore, useDownloadFileTransferStore, useManageStore } from '@/manage/store/manageStore'
|
||||
import { customRenameFormatTable, customStrMatch, customStrReplace, renameFile, formatLink, formatFileName, getFileIconPath, formatFileSize, getExtension, isValidUrl, svg } from '@/manage/utils/common'
|
||||
import { customRenameFormatTable, customStrMatch, customStrReplace, renameFile, formatLink, formatFileName, getFileIconPath, formatFileSize, isValidUrl, svg } from '@/manage/utils/common'
|
||||
import { getConfig, saveConfig } from '@/manage/utils/dataSender'
|
||||
import { cancelDownloadLoadingFileList, refreshDownloadFileTransferList } from '@/manage/utils/static'
|
||||
import { textFileExt } from '@/manage/utils/textfile'
|
||||
import { videoExt } from '@/manage/utils/videofile'
|
||||
|
||||
@@ -1479,8 +1478,10 @@ import ImageWebdavTsx from '@/components/ImageWebdavTsx'
|
||||
|
||||
import { T as $T } from '@/i18n'
|
||||
|
||||
import { IUploadTask, IDownloadTask } from '~/manage/datastore/upDownTaskQueue'
|
||||
import { trimPath } from '~/manage/utils/common'
|
||||
import { getExtension, trimPath } from '#/utils/common'
|
||||
import { cancelDownloadLoadingFileList, refreshDownloadFileTransferList } from '#/utils/static'
|
||||
import { IUploadTask, IDownloadTask } from '#/types/manage'
|
||||
|
||||
/*
|
||||
configMap:{
|
||||
prefix: string, -> baseDir
|
||||
|
||||
@@ -281,8 +281,7 @@ import { formObjToTableData, svg } from '@/manage/utils/common'
|
||||
import { getConfig as getPicBedsConfig } from '@/utils/dataSender'
|
||||
import { T as $T } from '@/i18n'
|
||||
|
||||
import { formatEndpoint } from '~/manage/utils/common'
|
||||
import { isNeedToShorten, safeSliceF } from '#/utils/common'
|
||||
import { formatEndpoint, isNeedToShorten, safeSliceF } from '#/utils/common'
|
||||
|
||||
const manageStore = useManageStore()
|
||||
const router = useRouter()
|
||||
|
||||
@@ -249,10 +249,11 @@ import DynamicSwitch from '@/manage/components/DynamicSwitch.vue'
|
||||
import { fileCacheDbInstance } from '@/manage/store/bucketFileDb'
|
||||
import { formatFileSize, customRenameFormatTable } from '@/manage/utils/common'
|
||||
import { getConfig, saveConfig, invokeToMain } from '@/manage/utils/dataSender'
|
||||
import { selectDownloadFolder } from '@/manage/utils/static'
|
||||
|
||||
import { T as $T } from '@/i18n'
|
||||
|
||||
import { selectDownloadFolder } from '#/utils/static'
|
||||
|
||||
const form = ref<IStringKeyMap>({
|
||||
timestampRename: false,
|
||||
randomStringRename: false,
|
||||
|
||||
@@ -118,11 +118,6 @@ export function formatFileName (fileName: string, length: number = 20) {
|
||||
return isNeedToShorten(fileName, length) ? `${safeSliceF(name, length - 3 - ext.length)}...${ext}` : fileName
|
||||
}
|
||||
|
||||
export const getExtension = (fileName: string) => path.extname(fileName).slice(1)
|
||||
|
||||
export const isImage = (fileName: string) =>
|
||||
['jpg', 'jpeg', 'png', 'gif', 'webp', 'bmp', 'ico', 'svg'].includes(getExtension(fileName))
|
||||
|
||||
export function formObjToTableData (obj: any) {
|
||||
const exclude = [undefined, null, '', 'transformedConfig']
|
||||
return Object.keys(obj).filter(key => !exclude.includes(obj[key])).map(key => ({
|
||||
@@ -139,34 +134,6 @@ export function isValidUrl (str: string) {
|
||||
}
|
||||
}
|
||||
|
||||
export interface IHTTPProxy {
|
||||
host: string
|
||||
port: number
|
||||
protocol: string
|
||||
}
|
||||
|
||||
export const formatHttpProxy = (proxy: string | undefined, type: 'object' | 'string'): IHTTPProxy | undefined | string => {
|
||||
if (!proxy) return undefined
|
||||
if (/^https?:\/\//.test(proxy)) {
|
||||
const { protocol, hostname, port } = new URL(proxy)
|
||||
return type === 'string'
|
||||
? `${protocol}//${hostname}:${port}`
|
||||
: {
|
||||
host: hostname,
|
||||
port: Number(port),
|
||||
protocol: protocol.slice(0, -1)
|
||||
}
|
||||
}
|
||||
const [host, port] = proxy.split(':')
|
||||
return type === 'string'
|
||||
? `http://${host}:${port}`
|
||||
: {
|
||||
host,
|
||||
port: port ? Number(port) : 80,
|
||||
protocol: 'http'
|
||||
}
|
||||
}
|
||||
|
||||
export const svg = `
|
||||
<path class="path" d="
|
||||
M 30 15
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
export const cancelDownloadLoadingFileList = 'cancelDownloadLoadingFileList'
|
||||
export const refreshDownloadFileTransferList = 'refreshDownloadFileTransferList'
|
||||
export const selectDownloadFolder = 'selectDownloadFolder'
|
||||
Reference in New Issue
Block a user