mirror of
https://github.com/Kuingsmile/PicList.git
synced 2025-03-13 00:18:13 -04:00
🔨 Refactor(custom): refactored some functions
This commit is contained in:
parent
c76fbd8de3
commit
706f432fa1
@ -52,7 +52,7 @@
|
|||||||
"cos-nodejs-sdk-v5": "^2.12.5",
|
"cos-nodejs-sdk-v5": "^2.12.5",
|
||||||
"dexie": "^3.2.4",
|
"dexie": "^3.2.4",
|
||||||
"electron-updater": "^6.1.4",
|
"electron-updater": "^6.1.4",
|
||||||
"element-plus": "2.4.3",
|
"element-plus": "2.4.4",
|
||||||
"epipebomb": "^1.0.0",
|
"epipebomb": "^1.0.0",
|
||||||
"fast-xml-parser": "^4.3.2",
|
"fast-xml-parser": "^4.3.2",
|
||||||
"form-data": "^4.0.0",
|
"form-data": "^4.0.0",
|
||||||
@ -79,7 +79,7 @@
|
|||||||
"ssh2-no-cpu-features": "^1.0.0",
|
"ssh2-no-cpu-features": "^1.0.0",
|
||||||
"upyun": "^3.4.6",
|
"upyun": "^3.4.6",
|
||||||
"uuid": "^9.0.1",
|
"uuid": "^9.0.1",
|
||||||
"video.js": "^8.5.2",
|
"video.js": "^8.6.1",
|
||||||
"vue": "^3.3.11",
|
"vue": "^3.3.11",
|
||||||
"vue-router": "^4.2.5",
|
"vue-router": "^4.2.5",
|
||||||
"vue3-lazyload": "^0.3.8",
|
"vue3-lazyload": "^0.3.8",
|
||||||
@ -122,14 +122,14 @@
|
|||||||
"electron": "^22.0.2",
|
"electron": "^22.0.2",
|
||||||
"eslint": "^8.54.0",
|
"eslint": "^8.54.0",
|
||||||
"eslint-config-standard": ">=16.0.0",
|
"eslint-config-standard": ">=16.0.0",
|
||||||
"eslint-plugin-import": "^2.29.0",
|
"eslint-plugin-import": "^2.29.1",
|
||||||
"eslint-plugin-node": "^11.1.0",
|
"eslint-plugin-node": "^11.1.0",
|
||||||
"eslint-plugin-promise": "^6.1.1",
|
"eslint-plugin-promise": "^6.1.1",
|
||||||
"eslint-plugin-vue": "^9.18.1",
|
"eslint-plugin-vue": "^9.18.1",
|
||||||
"husky": "^3.1.0",
|
"husky": "^3.1.0",
|
||||||
"node-bump-version": "^1.0.2",
|
"node-bump-version": "^1.0.2",
|
||||||
"node-loader": "^2.0.0",
|
"node-loader": "^2.0.0",
|
||||||
"npm-check-updates": "^16.14.11",
|
"npm-check-updates": "^16.14.12",
|
||||||
"stylus": "^0.59.0",
|
"stylus": "^0.59.0",
|
||||||
"stylus-loader": "^7.1.3",
|
"stylus-loader": "^7.1.3",
|
||||||
"typescript": "^4.9.5",
|
"typescript": "^4.9.5",
|
||||||
|
@ -24,17 +24,9 @@ export const handleUrlEncode = (url: string): string => isUrlEncode(url) ? url :
|
|||||||
* 2. @xxx/picgo-plugin-yyy -> yyy
|
* 2. @xxx/picgo-plugin-yyy -> yyy
|
||||||
* @param name pluginFullName
|
* @param name pluginFullName
|
||||||
*/
|
*/
|
||||||
export const handleStreamlinePluginName = (name: string) => {
|
export const handleStreamlinePluginName = (name: string) => name.replace(/(@[^/]+\/)?picgo-plugin-/, '')
|
||||||
if (/^@[^/]+\/picgo-plugin-/.test(name)) {
|
|
||||||
return name.replace(/^@[^/]+\/picgo-plugin-/, '')
|
|
||||||
} else {
|
|
||||||
return name.replace(/picgo-plugin-/, '')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export const simpleClone = (obj: any) => {
|
export const simpleClone = (obj: any) => JSON.parse(JSON.stringify(obj))
|
||||||
return JSON.parse(JSON.stringify(obj))
|
|
||||||
}
|
|
||||||
|
|
||||||
export const enforceNumber = (num: number | string) => isNaN(+num) ? 0 : +num
|
export const enforceNumber = (num: number | string) => isNaN(+num) ? 0 : +num
|
||||||
|
|
||||||
@ -44,12 +36,8 @@ export const trimValues = <T extends IStringKeyMap>(obj: T): {[K in keyof T]: T[
|
|||||||
return Object.fromEntries(Object.entries(obj).map(([key, value]) => [key, typeof value === 'string' ? value.trim() : value])) as {[K in keyof T]: T[K] extends string ? string : T[K]}
|
return Object.fromEntries(Object.entries(obj).map(([key, value]) => [key, typeof value === 'string' ? value.trim() : value])) as {[K in keyof T]: T[K] extends string ? string : T[K]}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isNeedToShorten (alias: string, cutOff: number = 20) {
|
export function isNeedToShorten (alias: string, cutOff = 20) {
|
||||||
let totalLen = 0
|
return [...alias].reduce((len, char) => len + (char.charCodeAt(0) > 255 ? 2 : 1), 0) > cutOff
|
||||||
for (const s of alias) {
|
|
||||||
totalLen += s.charCodeAt(0) > 255 ? 2 : 1
|
|
||||||
}
|
|
||||||
return totalLen > cutOff
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function safeSliceF (str:string, total: number) {
|
export function safeSliceF (str:string, total: number) {
|
||||||
|
@ -6,4 +6,20 @@ export const RELEASE_URL_BACKUP = 'https://release.piclist.cn'
|
|||||||
export const STABLE_RELEASE_URL = 'https://github.com/Kuingsmile/PicList/releases/latest'
|
export const STABLE_RELEASE_URL = 'https://github.com/Kuingsmile/PicList/releases/latest'
|
||||||
export const C1 = Buffer.from(C1N, 'base64').toString()
|
export const C1 = Buffer.from(C1N, 'base64').toString()
|
||||||
|
|
||||||
export const picBedsCanbeDeleted = ['aliyun', 'aws-s3', 'github', 'imgur', 'local', 'sftpplist', 'smms', 'qiniu', 'tcyun', 'upyun', 'webdavplist', 'dogecloud', 'huaweicloud-uploader', 'alist', 'piclist']
|
export const picBedsCanbeDeleted = [
|
||||||
|
'aliyun',
|
||||||
|
'aws-s3',
|
||||||
|
'github',
|
||||||
|
'imgur',
|
||||||
|
'local',
|
||||||
|
'sftpplist',
|
||||||
|
'smms',
|
||||||
|
'qiniu',
|
||||||
|
'tcyun',
|
||||||
|
'upyun',
|
||||||
|
'webdavplist',
|
||||||
|
'dogecloud',
|
||||||
|
'huaweicloud-uploader',
|
||||||
|
'alist',
|
||||||
|
'piclist'
|
||||||
|
]
|
||||||
|
84
yarn.lock
84
yarn.lock
@ -3861,18 +3861,18 @@
|
|||||||
mux.js "6.2.0"
|
mux.js "6.2.0"
|
||||||
video.js "^7 || ^8"
|
video.js "^7 || ^8"
|
||||||
|
|
||||||
"@videojs/http-streaming@3.5.3":
|
"@videojs/http-streaming@3.7.0":
|
||||||
version "3.5.3"
|
version "3.7.0"
|
||||||
resolved "https://registry.npmjs.org/@videojs/http-streaming/-/http-streaming-3.5.3.tgz#23106e1ef2fd9b9b62aa9b3dc2083bd36d99c963"
|
resolved "https://registry.yarnpkg.com/@videojs/http-streaming/-/http-streaming-3.7.0.tgz#48ece0582602e24a3b403c2410bbcdf320bfcccd"
|
||||||
integrity sha512-dty8lsZk9QPc0i4It79tjWsmPiaC3FpgARFM0vJGko4k3yKNZIYkAk8kjiDRfkAQH/HZ3rYi5dDTriFNzwSsIg==
|
integrity sha512-5uLFKBL8CvD56dxxJyuxqB5CY0tdoa4SE9KbXakeiAy6iFBUEPvTr2YGLKEWvQ8Lojs1wl+FQndLdv+GO7t9Fw==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@babel/runtime" "^7.12.5"
|
"@babel/runtime" "^7.12.5"
|
||||||
"@videojs/vhs-utils" "4.0.0"
|
"@videojs/vhs-utils" "4.0.0"
|
||||||
aes-decrypter "4.0.1"
|
aes-decrypter "4.0.1"
|
||||||
global "^4.4.0"
|
global "^4.4.0"
|
||||||
m3u8-parser "^7.1.0"
|
m3u8-parser "^7.1.0"
|
||||||
mpd-parser "^1.1.1"
|
mpd-parser "^1.2.2"
|
||||||
mux.js "7.0.0"
|
mux.js "7.0.1"
|
||||||
video.js "^7 || ^8"
|
video.js "^7 || ^8"
|
||||||
|
|
||||||
"@videojs/vhs-utils@4.0.0", "@videojs/vhs-utils@^4.0.0":
|
"@videojs/vhs-utils@4.0.0", "@videojs/vhs-utils@^4.0.0":
|
||||||
@ -7270,10 +7270,10 @@ electron@^22.0.2:
|
|||||||
"@types/node" "^16.11.26"
|
"@types/node" "^16.11.26"
|
||||||
extract-zip "^2.0.1"
|
extract-zip "^2.0.1"
|
||||||
|
|
||||||
element-plus@2.4.3:
|
element-plus@2.4.4:
|
||||||
version "2.4.3"
|
version "2.4.4"
|
||||||
resolved "https://registry.yarnpkg.com/element-plus/-/element-plus-2.4.3.tgz#ff21d0207d71752eb6a47a46609bc667f222841f"
|
resolved "https://registry.yarnpkg.com/element-plus/-/element-plus-2.4.4.tgz#962be40b4843381af04b8f799bfc142072184b8b"
|
||||||
integrity sha512-b3q26j+lM4SBqiyzw8HybybGnP2pk4MWgrnzzzYW5qKQUgV6EG1Zg7nMCfgCVccI8tNvZoTiUHb2mFaiB9qT8w==
|
integrity sha512-TlKubXJgxwhER0dw+8ULn9hr9kZjraV4R6Q/eidwWUwCKxwXYPBGmMKsZ/85tlxlhMYbcLZd/YZh6G3QkHX4fg==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@ctrl/tinycolor" "^3.4.1"
|
"@ctrl/tinycolor" "^3.4.1"
|
||||||
"@element-plus/icons-vue" "^2.3.1"
|
"@element-plus/icons-vue" "^2.3.1"
|
||||||
@ -7612,10 +7612,10 @@ eslint-plugin-import@^2.26.0:
|
|||||||
resolve "^1.22.0"
|
resolve "^1.22.0"
|
||||||
tsconfig-paths "^3.14.1"
|
tsconfig-paths "^3.14.1"
|
||||||
|
|
||||||
eslint-plugin-import@^2.29.0:
|
eslint-plugin-import@^2.29.1:
|
||||||
version "2.29.0"
|
version "2.29.1"
|
||||||
resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.29.0.tgz#8133232e4329ee344f2f612885ac3073b0b7e155"
|
resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.29.1.tgz#d45b37b5ef5901d639c15270d74d46d161150643"
|
||||||
integrity sha512-QPOO5NO6Odv5lpoTkddtutccQjysJuFxoPS7fAHO+9m9udNHvTCPSAMW9zGAYj8lAIdr40I8yPCdUYrncXtrwg==
|
integrity sha512-BbPC0cuExzhiMo4Ff1BTVwHpjjv28C5R+btTOGaCRC7UEz801up0JadwkeSk5Ued6TG34uaczuVuH6qyy5YUxw==
|
||||||
dependencies:
|
dependencies:
|
||||||
array-includes "^3.1.7"
|
array-includes "^3.1.7"
|
||||||
array.prototype.findlastindex "^1.2.3"
|
array.prototype.findlastindex "^1.2.3"
|
||||||
@ -7633,7 +7633,7 @@ eslint-plugin-import@^2.29.0:
|
|||||||
object.groupby "^1.0.1"
|
object.groupby "^1.0.1"
|
||||||
object.values "^1.1.7"
|
object.values "^1.1.7"
|
||||||
semver "^6.3.1"
|
semver "^6.3.1"
|
||||||
tsconfig-paths "^3.14.2"
|
tsconfig-paths "^3.15.0"
|
||||||
|
|
||||||
eslint-plugin-n@^15.2.4:
|
eslint-plugin-n@^15.2.4:
|
||||||
version "15.6.0"
|
version "15.6.0"
|
||||||
@ -11306,13 +11306,13 @@ mpd-parser@^1.0.1:
|
|||||||
"@xmldom/xmldom" "^0.8.3"
|
"@xmldom/xmldom" "^0.8.3"
|
||||||
global "^4.4.0"
|
global "^4.4.0"
|
||||||
|
|
||||||
mpd-parser@^1.1.1:
|
mpd-parser@^1.2.2:
|
||||||
version "1.2.1"
|
version "1.3.0"
|
||||||
resolved "https://registry.npmjs.org/mpd-parser/-/mpd-parser-1.2.1.tgz#3306a627342dadcb5ad82de51fff7f8a9ab03d1b"
|
resolved "https://registry.yarnpkg.com/mpd-parser/-/mpd-parser-1.3.0.tgz#38c20f4d73542b4ed554158bc1f0fa571dc61388"
|
||||||
integrity sha512-f1DPoocf4ERvBi9XnS1MWFaBURdJvv9uu7EgQEjrD1+U33NL7Azw030Au/GPOpA7YWTw97T9Bt/WgcEmM/B88g==
|
integrity sha512-WgeIwxAqkmb9uTn4ClicXpEQYCEduDqRKfmUdp4X8vmghKfBNXZLYpREn9eqrDx/Tf5LhzRcJLSpi4ohfV742Q==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@babel/runtime" "^7.12.5"
|
"@babel/runtime" "^7.12.5"
|
||||||
"@videojs/vhs-utils" "^3.0.5"
|
"@videojs/vhs-utils" "^4.0.0"
|
||||||
"@xmldom/xmldom" "^0.8.3"
|
"@xmldom/xmldom" "^0.8.3"
|
||||||
global "^4.4.0"
|
global "^4.4.0"
|
||||||
|
|
||||||
@ -11375,10 +11375,18 @@ mux.js@6.2.0, mux.js@^6.2.0:
|
|||||||
"@babel/runtime" "^7.11.2"
|
"@babel/runtime" "^7.11.2"
|
||||||
global "^4.4.0"
|
global "^4.4.0"
|
||||||
|
|
||||||
mux.js@7.0.0:
|
mux.js@7.0.1:
|
||||||
version "7.0.0"
|
version "7.0.1"
|
||||||
resolved "https://registry.npmjs.org/mux.js/-/mux.js-7.0.0.tgz#f5f80cd63bc5eaf13ba2e8b3396d4dd03a8aa1f2"
|
resolved "https://registry.yarnpkg.com/mux.js/-/mux.js-7.0.1.tgz#745c77b0fb8aa81dbb47e96651428bfada49b08e"
|
||||||
integrity sha512-DeZmr+3NDrO02k4SREtl4VB5GyGPCz2fzMjDxBIlamkxffSTLge97rtNMoonnmFHTp96QggDucUtKv3fmyObrA==
|
integrity sha512-Omz79uHqYpMP1V80JlvEdCiOW1hiw4mBvDh9gaZEpxvB+7WYb2soZSzfuSRrK2Kh9Pm6eugQNrIpY/Bnyhk4hw==
|
||||||
|
dependencies:
|
||||||
|
"@babel/runtime" "^7.11.2"
|
||||||
|
global "^4.4.0"
|
||||||
|
|
||||||
|
mux.js@^7.0.1:
|
||||||
|
version "7.0.2"
|
||||||
|
resolved "https://registry.yarnpkg.com/mux.js/-/mux.js-7.0.2.tgz#410641dc922c5d173d7ce45fbdb2bb9e2a69137c"
|
||||||
|
integrity sha512-CM6+QuyDbc0qW1OfEjkd2+jVKzTXF+z5VOKH0eZxtZtnrG/ilkW/U7l7IXGtBNLASF9sKZMcK1u669cq50Qq0A==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@babel/runtime" "^7.11.2"
|
"@babel/runtime" "^7.11.2"
|
||||||
global "^4.4.0"
|
global "^4.4.0"
|
||||||
@ -11667,10 +11675,10 @@ npm-bundled@^3.0.0:
|
|||||||
dependencies:
|
dependencies:
|
||||||
npm-normalize-package-bin "^3.0.0"
|
npm-normalize-package-bin "^3.0.0"
|
||||||
|
|
||||||
npm-check-updates@^16.14.11:
|
npm-check-updates@^16.14.12:
|
||||||
version "16.14.11"
|
version "16.14.12"
|
||||||
resolved "https://registry.yarnpkg.com/npm-check-updates/-/npm-check-updates-16.14.11.tgz#aef5248d04cc5abdf6ee2e1edc4a3f7fd20e6f29"
|
resolved "https://registry.yarnpkg.com/npm-check-updates/-/npm-check-updates-16.14.12.tgz#154db2d6d575bd57cc1120ad9eb3483a1ff2c95d"
|
||||||
integrity sha512-0MMWGbGci22Pu77bR9jRsy5qgxdQSJVqNtSyyFeubDPtbcU36z4gjEDITu26PMabFWPNkAoVfKF31M3uKUvzFg==
|
integrity sha512-5FvqaDX8AqWWTDQFbBllgLwoRXTvzlqVIRSKl9Kg8bYZTfNwMnrp1Zlmb5e/ocf11UjPTc+ShBFjYQ7kg6FL0w==
|
||||||
dependencies:
|
dependencies:
|
||||||
chalk "^5.3.0"
|
chalk "^5.3.0"
|
||||||
cli-table3 "^0.6.3"
|
cli-table3 "^0.6.3"
|
||||||
@ -14972,10 +14980,10 @@ tsconfig-paths@^3.14.1:
|
|||||||
minimist "^1.2.6"
|
minimist "^1.2.6"
|
||||||
strip-bom "^3.0.0"
|
strip-bom "^3.0.0"
|
||||||
|
|
||||||
tsconfig-paths@^3.14.2:
|
tsconfig-paths@^3.15.0:
|
||||||
version "3.14.2"
|
version "3.15.0"
|
||||||
resolved "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.14.2.tgz#6e32f1f79412decd261f92d633a9dc1cfa99f088"
|
resolved "https://registry.yarnpkg.com/tsconfig-paths/-/tsconfig-paths-3.15.0.tgz#5299ec605e55b1abb23ec939ef15edaf483070d4"
|
||||||
integrity sha512-o/9iXgCYc5L/JxCHPe3Hvh8Q/2xm5Z+p18PESBU6Ff33695QnCHBEjcytY2q19ua7Mbl/DavtBOLq+oG0RCL+g==
|
integrity sha512-2Ac2RgzDe/cn48GvOe3M+o82pEFewD3UPbyoUHHdKasHwJKjds4fLXWf/Ux5kATBKN20oaFGu+jbElp1pos0mg==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@types/json5" "^0.0.29"
|
"@types/json5" "^0.0.29"
|
||||||
json5 "^1.0.2"
|
json5 "^1.0.2"
|
||||||
@ -15537,13 +15545,13 @@ verror@^1.10.0:
|
|||||||
videojs-font "3.2.0"
|
videojs-font "3.2.0"
|
||||||
videojs-vtt.js "0.15.4"
|
videojs-vtt.js "0.15.4"
|
||||||
|
|
||||||
video.js@^8.5.2:
|
video.js@^8.6.1:
|
||||||
version "8.5.2"
|
version "8.6.1"
|
||||||
resolved "https://registry.npmjs.org/video.js/-/video.js-8.5.2.tgz#11cebb3934a020e0e4ab04c4d454c8c3f35ff8b8"
|
resolved "https://registry.yarnpkg.com/video.js/-/video.js-8.6.1.tgz#d25f59fbf30fb21c0bcf04a1de6a98dfd137997c"
|
||||||
integrity sha512-6/uNXQV3xSaKLpaPf/bVvr7omd+82sKUp0RMBgIt4PxHIe28GtX+O+GcNfI2fuwBvcDRDqk5Ei5AG9bJJOpulA==
|
integrity sha512-CNYVJ5WWIZ7bOhbkkfcKqLGoc6WsE3Ft2RfS1lXdQTWk8UiSsPW2Ssk2JzPCA8qnIlUG9os/faCFsYWjyu4JcA==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@babel/runtime" "^7.12.5"
|
"@babel/runtime" "^7.12.5"
|
||||||
"@videojs/http-streaming" "3.5.3"
|
"@videojs/http-streaming" "3.7.0"
|
||||||
"@videojs/vhs-utils" "^4.0.0"
|
"@videojs/vhs-utils" "^4.0.0"
|
||||||
"@videojs/xhr" "2.6.0"
|
"@videojs/xhr" "2.6.0"
|
||||||
aes-decrypter "^4.0.1"
|
aes-decrypter "^4.0.1"
|
||||||
@ -15551,7 +15559,7 @@ video.js@^8.5.2:
|
|||||||
keycode "2.2.0"
|
keycode "2.2.0"
|
||||||
m3u8-parser "^6.0.0"
|
m3u8-parser "^6.0.0"
|
||||||
mpd-parser "^1.0.1"
|
mpd-parser "^1.0.1"
|
||||||
mux.js "^6.2.0"
|
mux.js "^7.0.1"
|
||||||
safe-json-parse "4.0.0"
|
safe-json-parse "4.0.0"
|
||||||
videojs-contrib-quality-levels "4.0.0"
|
videojs-contrib-quality-levels "4.0.0"
|
||||||
videojs-font "4.1.0"
|
videojs-font "4.1.0"
|
||||||
|
Loading…
Reference in New Issue
Block a user