Feature: migrate from aws-sdk v2 to v3

This commit is contained in:
萌萌哒赫萝 2023-08-08 20:34:19 -07:00
parent 76e588b2ef
commit 13852a5c1b
10 changed files with 557 additions and 573 deletions

View File

@ -40,11 +40,11 @@
"@octokit/rest": "^19.0.7", "@octokit/rest": "^19.0.7",
"@picgo/i18n": "^1.0.0", "@picgo/i18n": "^1.0.0",
"@picgo/store": "^2.0.4", "@picgo/store": "^2.0.4",
"@smithy/node-http-handler": "^2.0.2",
"@types/marked": "^4.0.8", "@types/marked": "^4.0.8",
"@types/mime-types": "^2.1.1", "@types/mime-types": "^2.1.1",
"@videojs-player/vue": "^1.0.0", "@videojs-player/vue": "^1.0.0",
"ali-oss": "^6.18.0", "ali-oss": "^6.18.0",
"aws-sdk": "^2.1373.0",
"axios": "^1.4.0", "axios": "^1.4.0",
"compare-versions": "^4.1.3", "compare-versions": "^4.1.3",
"core-js": "^3.27.1", "core-js": "^3.27.1",

View File

@ -29,8 +29,8 @@ const uploadFile = async () => {
secretAccessKey: SECRET_KEY secretAccessKey: SECRET_KEY
}, },
endpoint: `https://${ACCOUNT_ID}.r2.cloudflarestorage.com`, endpoint: `https://${ACCOUNT_ID}.r2.cloudflarestorage.com`,
sslEnabled: true, tls: true,
region: 'us-east-1' region: 'auto'
} }
const client = new S3Client.S3Client(options) const client = new S3Client.S3Client(options)
const parallelUploads3 = new Upload.Upload({ const parallelUploads3 = new Upload.Upload({

View File

@ -1,6 +1,6 @@
// upload dist bundled-app to r2 // upload dist bundled-app to r2
require('dotenv').config() require('dotenv').config()
const S3 = require('aws-sdk/clients/s3')
const S3Client = require('@aws-sdk/client-s3') const S3Client = require('@aws-sdk/client-s3')
const Upload = require('@aws-sdk/lib-storage') const Upload = require('@aws-sdk/lib-storage')
const pkg = require('../package.json') const pkg = require('../package.json')
@ -8,6 +8,7 @@ const configList = require('./config')
const fs = require('fs') const fs = require('fs')
const path = require('path') const path = require('path')
const yaml = require('js-yaml') const yaml = require('js-yaml')
const mime = require('mime-types')
const BUCKET = 'piclist-dl' const BUCKET = 'piclist-dl'
const VERSION = pkg.version const VERSION = pkg.version
@ -16,12 +17,15 @@ const ACCOUNT_ID = process.env.R2_ACCOUNT_ID
const SECRET_ID = process.env.R2_SECRET_ID const SECRET_ID = process.env.R2_SECRET_ID
const SECRET_KEY = process.env.R2_SECRET_KEY const SECRET_KEY = process.env.R2_SECRET_KEY
const s3 = new S3({ const options = {
endpoint: `https://${ACCOUNT_ID}.r2.cloudflarestorage.com`, credentials: {
accessKeyId: SECRET_ID, accessKeyId: SECRET_ID,
secretAccessKey: SECRET_KEY, secretAccessKey: SECRET_KEY
signatureVersion: 'v4' },
}) endpoint: `https://${ACCOUNT_ID}.r2.cloudflarestorage.com`,
tls: true,
region: 'auto'
}
const removeDupField = path => { const removeDupField = path => {
const file = fs.readFileSync(path, 'utf8') const file = fs.readFileSync(path, 'utf8')
@ -39,24 +43,20 @@ const removeDupField = path => {
const uploadFile = async () => { const uploadFile = async () => {
try { try {
const platform = process.platform const platform = process.platform
if (configList[platform]) { if (!configList[platform]) {
console.warn('platform not supported!', platform)
return
}
let versionFileHasUploaded = false let versionFileHasUploaded = false
for (const [index, config] of configList[platform].entries()) { for (const [index, config] of configList[platform].entries()) {
const fileName = `${config.appNameWithPrefix}${VERSION}${config.arch}${config.ext}` const fileName = `${config.appNameWithPrefix}${VERSION}${config.arch}${config.ext}`
const distPath = path.join(__dirname, '../dist_electron') const distPath = path.join(__dirname, '../dist_electron')
const versionFileName = config['version-file'] const versionFileName = config['version-file']
console.log('[PicList Dist] Uploading...', fileName, `${index + 1}/${configList[platform].length}`) console.log('[PicList Dist] Uploading...', fileName, `${index + 1}/${configList[platform].length}`)
const fileStream = fs.createReadStream(path.join(distPath, fileName)) const fileStream = fs.createReadStream(path.join(distPath, fileName))
const options = {
credentials: {
accessKeyId: SECRET_ID,
secretAccessKey: SECRET_KEY
},
endpoint: `https://${ACCOUNT_ID}.r2.cloudflarestorage.com`,
sslEnabled: true,
region: 'us-east-1'
}
const client = new S3Client.S3Client(options) const client = new S3Client.S3Client(options)
const parallelUploads3 = new Upload.Upload({ const parallelUploads3 = new Upload.Upload({
client, client,
params: { params: {
@ -76,6 +76,7 @@ const uploadFile = async () => {
console.log('\n') console.log('\n')
await parallelUploads3.done() await parallelUploads3.done()
console.log(`${fileName} uploaded!`) console.log(`${fileName} uploaded!`)
if (!versionFileHasUploaded) { if (!versionFileHasUploaded) {
console.log('[PicList Version File] Uploading...', versionFileName) console.log('[PicList Version File] Uploading...', versionFileName)
let versionFilePath let versionFilePath
@ -87,27 +88,43 @@ const uploadFile = async () => {
versionFilePath = path.join(distPath, 'latest-linux.yml') versionFilePath = path.join(distPath, 'latest-linux.yml')
} }
removeDupField(versionFilePath) removeDupField(versionFilePath)
const versionFileBuffer = fs.readFileSync(versionFilePath) const versionFileStream = fs.createReadStream(versionFilePath)
await s3 const uploadVersionFileToRoot = new Upload.Upload({
.upload({ client,
params: {
Bucket: BUCKET, Bucket: BUCKET,
Key: `${versionFileName}`, Key: `${versionFileName}`,
Body: versionFileBuffer Body: versionFileStream,
ContentType: mime.lookup(versionFileName),
Metadata: {
description: 'uploaded by PicList'
}
}
}) })
.promise() console.log('\nUploading version file to root...')
await s3 await uploadVersionFileToRoot.done()
.upload({ console.log(`${versionFileName} uploaded!`)
versionFileStream.close()
const versionFileStream2 = fs.createReadStream(versionFilePath)
const uploadVersionFileToLatest = new Upload.Upload({
client,
params: {
Bucket: BUCKET, Bucket: BUCKET,
Key: `${FILE_PATH}${versionFileName}`, Key: `${FILE_PATH}${versionFileName}`,
Body: versionFileBuffer Body: versionFileStream2,
ContentType: mime.lookup(versionFileName),
Metadata: {
description: 'uploaded by PicList'
}
}
}) })
.promise() console.log('\nUploading version file to latest...')
await uploadVersionFileToLatest.done()
console.log(`${versionFileName} uploaded!`)
versionFileStream2.close()
versionFileHasUploaded = true versionFileHasUploaded = true
} }
} }
} else {
console.warn('platform not supported!', platform)
}
} catch (err) { } catch (err) {
console.error(err) console.error(err)
} }

View File

@ -1,3 +1,4 @@
// Electron 相关
import { import {
app, app,
ipcMain, ipcMain,
@ -8,16 +9,38 @@ import {
screen, screen,
IpcMainInvokeEvent IpcMainInvokeEvent
} from 'electron' } from 'electron'
// 窗口管理器
import windowManager from 'apis/app/window/windowManager' import windowManager from 'apis/app/window/windowManager'
// 枚举类型声明
import { IWindowList } from '#/types/enum' import { IWindowList } from '#/types/enum'
// 上传器
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 db, { GalleryDB } from '~/main/apis/core/datastore' import db, { GalleryDB } from '~/main/apis/core/datastore'
// 服务器模块
import server from '~/main/server' import server from '~/main/server'
// 获取图片床模块
import getPicBeds from '~/main/utils/getPicBeds' import getPicBeds from '~/main/utils/getPicBeds'
// 快捷键处理器
import shortKeyHandler from 'apis/app/shortKey/shortKeyHandler' import shortKeyHandler from 'apis/app/shortKey/shortKeyHandler'
// 全局事件总线
import bus from '@core/bus' import bus from '@core/bus'
// 文件系统库
import fs from 'fs-extra' import fs from 'fs-extra'
// 事件常量
import { import {
TOGGLE_SHORTKEY_MODIFIED_MODE, TOGGLE_SHORTKEY_MODIFIED_MODE,
OPEN_DEVTOOLS, OPEN_DEVTOOLS,
@ -34,19 +57,46 @@ import {
GET_PICBEDS, GET_PICBEDS,
HIDE_DOCK HIDE_DOCK
} from '#/events/constants' } from '#/events/constants'
// 上传剪贴板文件和已选文件的函数
import { import {
uploadClipboardFiles, uploadClipboardFiles,
uploadChoosedFiles uploadChoosedFiles
} from '~/main/apis/app/uploader/apis' } from '~/main/apis/app/uploader/apis'
// 核心 IPC 模块
import picgoCoreIPC from './picgoCoreIPC' import picgoCoreIPC from './picgoCoreIPC'
// 处理复制的 URL 和生成短链接的函数
import { handleCopyUrl, generateShortUrl } from '~/main/utils/common' import { handleCopyUrl, generateShortUrl } from '~/main/utils/common'
// 构建主页面、迷你页面、插件页面、图片床列表的菜单函数
import { buildMainPageMenu, buildMiniPageMenu, buildPluginPageMenu, buildPicBedListMenu } from './remotes/menu' import { buildMainPageMenu, buildMiniPageMenu, buildPluginPageMenu, buildPicBedListMenu } from './remotes/menu'
// 路径处理库
import path from 'path' import path from 'path'
// i18n 模块
import { T } from '~/main/i18n' import { T } from '~/main/i18n'
// 同步设置的上传和下载文件函数
import { uploadFile, downloadFile } from '../utils/syncSettings' import { uploadFile, downloadFile } from '../utils/syncSettings'
// SSH 客户端模块
import SSHClient from '../utils/sshClient' import SSHClient from '../utils/sshClient'
// Sftp 配置类型声明
import { ISftpPlistConfig } from 'piclist' import { ISftpPlistConfig } from 'piclist'
// AWS S3 相关模块
import { S3Client, DeleteObjectCommand, S3ClientConfig } from '@aws-sdk/client-s3'
import { NodeHttpHandler } from '@smithy/node-http-handler'
import http, { AgentOptions } from 'http'
import https from 'https'
// 通用获取 Agent 函数
import { getAgent } from '../manage/utils/common'
const STORE_PATH = app.getPath('userData') const STORE_PATH = app.getPath('userData')
export default { export default {
@ -137,6 +187,66 @@ export default {
} }
}) })
ipcMain.handle('delete-aws-s3-file', async (_evt: IpcMainInvokeEvent, configMap: IStringKeyMap) => {
try {
const { imgUrl, config: { accessKeyID, secretAccessKey, bucketName, region, endpoint, pathStyleAccess, rejectUnauthorized, proxy } } = configMap
console.log(JSON.stringify(configMap, null, 2))
const url = new URL(!/^https?:\/\//.test(imgUrl) ? `http://${imgUrl}` : imgUrl)
const fileKey = url.pathname.replace(/^\/+/, '')
const endpointUrl: string | undefined = endpoint
? /^https?:\/\//.test(endpoint)
? endpoint
: `http://${endpoint}`
: undefined
const sslEnabled = endpointUrl ? endpointUrl.startsWith('https') : true
const agent = getAgent(proxy, sslEnabled)
const commonOptions: AgentOptions = {
keepAlive: true,
keepAliveMsecs: 1000,
scheduling: 'lifo' as 'lifo' | 'fifo' | undefined
}
const extraOptions = sslEnabled ? { rejectUnauthorized: !!rejectUnauthorized } : {}
const handler = sslEnabled
? new NodeHttpHandler({
httpsAgent: agent.https
? agent.https
: new https.Agent({
...commonOptions,
...extraOptions
})
})
: new NodeHttpHandler({
httpAgent: agent.http
? agent.http
: new http.Agent({
...commonOptions,
...extraOptions
})
})
const s3Options: S3ClientConfig = {
credentials: {
accessKeyId: accessKeyID,
secretAccessKey
},
endpoint: endpointUrl,
tls: sslEnabled,
forcePathStyle: pathStyleAccess,
region,
requestHandler: handler
}
const client = new S3Client(s3Options)
const command = new DeleteObjectCommand({
Bucket: bucketName,
Key: fileKey
})
const result = await client.send(command)
return result.$metadata.httpStatusCode === 204
} catch (err: any) {
console.error(err)
return false
}
})
ipcMain.handle('migrateFromPicGo', async () => { ipcMain.handle('migrateFromPicGo', async () => {
const picGoConfigPath = STORE_PATH.replace('piclist', 'picgo') const picGoConfigPath = STORE_PATH.replace('piclist', 'picgo')
const fileToMigration = [ const fileToMigration = [

View File

@ -4,7 +4,6 @@ import {
ListBucketsCommand, ListBucketsCommand,
ListObjectsV2Command, ListObjectsV2Command,
GetBucketLocationCommand, GetBucketLocationCommand,
S3ClientConfig,
_Object, _Object,
CommonPrefix, CommonPrefix,
ListObjectsV2CommandOutput, ListObjectsV2CommandOutput,
@ -12,7 +11,8 @@ import {
GetObjectCommand, GetObjectCommand,
DeleteObjectCommand, DeleteObjectCommand,
DeleteObjectsCommand, DeleteObjectsCommand,
PutObjectCommand PutObjectCommand,
S3ClientConfig
} from '@aws-sdk/client-s3' } from '@aws-sdk/client-s3'
// AWS S3 上传和进度 // AWS S3 上传和进度
@ -23,7 +23,8 @@ import { getSignedUrl } from '@aws-sdk/s3-request-presigner'
// HTTP 和 HTTPS 模块 // HTTP 和 HTTPS 模块
import https from 'https' import https from 'https'
import http from 'http' import http, { AgentOptions } from 'http'
import { NodeHttpHandler } from '@smithy/node-http-handler'
// 日志记录器 // 日志记录器
import { ManageLogger } from '../utils/logger' import { ManageLogger } from '../utils/logger'
@ -34,9 +35,6 @@ import { formatEndpoint, formatError, getAgent, getFileMimeType, NewDownloader,
// 是否为图片的判断函数、HTTP 代理格式化函数 // 是否为图片的判断函数、HTTP 代理格式化函数
import { isImage, formatHttpProxy } from '@/manage/utils/common' import { isImage, formatHttpProxy } from '@/manage/utils/common'
// HTTP 和 HTTPS 代理库
import { HttpsProxyAgent, HttpProxyAgent } from 'hpagent'
// 窗口管理器 // 窗口管理器
import windowManager from 'apis/app/window/windowManager' import windowManager from 'apis/app/window/windowManager'
@ -58,21 +56,8 @@ import path from 'path'
// 取消下载任务的加载文件列表、刷新下载文件传输列表 // 取消下载任务的加载文件列表、刷新下载文件传输列表
import { cancelDownloadLoadingFileList, refreshDownloadFileTransferList } from '@/manage/utils/static' import { cancelDownloadLoadingFileList, refreshDownloadFileTransferList } from '@/manage/utils/static'
interface S3plistApiOptions {
credentials: {
accessKeyId: string
secretAccessKey: string
}
endpoint?: string
sslEnabled: boolean
s3ForcePathStyle: boolean
httpOptions?: {
agent: https.Agent
}
}
class S3plistApi { class S3plistApi {
baseOptions: S3plistApiOptions baseOptions: S3ClientConfig
logger: ManageLogger logger: ManageLogger
agent: any agent: any
proxy: string | undefined proxy: string | undefined
@ -92,26 +77,39 @@ class S3plistApi {
secretAccessKey secretAccessKey
}, },
endpoint: endpoint ? formatEndpoint(endpoint, sslEnabled) : undefined, endpoint: endpoint ? formatEndpoint(endpoint, sslEnabled) : undefined,
sslEnabled, tls: sslEnabled,
s3ForcePathStyle, forcePathStyle: s3ForcePathStyle,
httpOptions: { requestHandler: this.setAgent(proxy, sslEnabled)
agent: this.setAgent(proxy, sslEnabled)
} }
} as S3plistApiOptions
this.logger = logger this.logger = logger
this.agent = this.setAgent(proxy, sslEnabled)
this.proxy = formatHttpProxy(proxy, 'string') as string | undefined this.proxy = formatHttpProxy(proxy, 'string') as string | undefined
} }
setAgent (proxy: string | undefined, sslEnabled: boolean) : HttpProxyAgent | HttpsProxyAgent | undefined { setAgent (proxy: string | undefined, sslEnabled: boolean) : NodeHttpHandler {
const protocol = sslEnabled ? 'https' : 'http' const agent = getAgent(proxy, sslEnabled)
const agent = getAgent(proxy, sslEnabled)[protocol] const commonOptions: AgentOptions = {
const commonOptions = { keepAlive: true } keepAlive: true,
keepAliveMsecs: 1000,
scheduling: 'lifo' as 'lifo' | 'fifo' | undefined
}
const extraOptions = sslEnabled ? { rejectUnauthorized: false } : {} const extraOptions = sslEnabled ? { rejectUnauthorized: false } : {}
return agent ?? new (sslEnabled ? https.Agent : http.Agent)({ return sslEnabled
? new NodeHttpHandler({
httpsAgent: agent.https
? agent.https
: new https.Agent({
...commonOptions, ...commonOptions,
...extraOptions ...extraOptions
}) })
})
: new NodeHttpHandler({
httpAgent: agent.http
? agent.http
: new http.Agent({
...commonOptions,
...extraOptions
})
})
} }
logParam = (error:any, method: string) => logParam = (error:any, method: string) =>

View File

@ -4,7 +4,7 @@ import mime from 'mime-types'
import axios from 'axios' import axios from 'axios'
import { app } from 'electron' import { app } from 'electron'
import crypto from 'crypto' import crypto from 'crypto'
import got, { RequestError } from 'got' import got, { OptionsOfTextResponseBody, RequestError } from 'got'
import { Stream } from 'stream' import { Stream } from 'stream'
import { promisify } from 'util' import { promisify } from 'util'
import UpDownTaskQueue, import UpDownTaskQueue,
@ -40,20 +40,13 @@ export const getFSFile = async (
} }
} }
export const isInputConfigValid = (config: any): boolean => { export function isInputConfigValid (config: any): boolean {
if ( return typeof config === 'object' &&
typeof config === 'object' &&
!Array.isArray(config) && !Array.isArray(config) &&
Object.keys(config).length > 0 Object.keys(config).length > 0
) {
return true
}
return false
} }
export const getFileMimeType = (filePath: string): string => { export const getFileMimeType = (filePath: string): string => mime.lookup(filePath) || 'application/octet-stream'
return mime.lookup(filePath) || 'application/octet-stream'
}
const checkTempFolderExist = async () => { const checkTempFolderExist = async () => {
const tempPath = path.join(app.getPath('downloads'), 'piclistTemp') const tempPath = path.join(app.getPath('downloads'), 'piclistTemp')
@ -131,7 +124,7 @@ export const NewDownloader = async (
}) })
return true return true
} catch (e: any) { } catch (e: any) {
logger && logger.error(formatError(e, { method: 'NewDownloader' })) logger?.error(formatError(e, { method: 'NewDownloader' }))
fs.remove(savedFilePath) fs.remove(savedFilePath)
instance.updateDownloadTask({ instance.updateDownloadTask({
id, id,
@ -179,13 +172,13 @@ export const gotUpload = async (
.then((res: any) => { .then((res: any) => {
instance.updateUploadTask({ instance.updateUploadTask({
id, id,
progress: res && (res.statusCode === 200 || res.statusCode === 201) ? 100 : 0, progress: res?.statusCode === 200 || res?.statusCode === 201 ? 100 : 0,
status: res && (res.statusCode === 200 || res.statusCode === 201) ? uploadTaskSpecialStatus.uploaded : commonTaskStatus.failed, status: res?.statusCode === 200 || res?.statusCode === 201 ? uploadTaskSpecialStatus.uploaded : commonTaskStatus.failed,
finishTime: new Date().toLocaleString() finishTime: new Date().toLocaleString()
}) })
}) })
.catch((err: any) => { .catch((err: any) => {
logger && logger.error(formatError(err, { method: 'gotUpload' })) logger?.error(formatError(err, { method: 'gotUpload' }))
instance.updateUploadTask({ instance.updateUploadTask({
id, id,
progress: 0, progress: 0,
@ -213,42 +206,46 @@ export const formatError = (err: any, params:IStringKeyMap) => {
message: err.message ?? '', message: err.message ?? '',
stack: err.stack ?? '' stack: err.stack ?? ''
} }
} else { }
if (typeof err === 'object') { if (typeof err === 'object') {
return JSON.stringify(err) + JSON.stringify(params) return `${JSON.stringify(err)}${JSON.stringify(params)}`
} else {
return String(err) + JSON.stringify(params)
}
} }
return `${String(err)}${JSON.stringify(params)}`
} }
export const trimPath = (path: string) => path.replace(/^\/+|\/+$/g, '').replace(/\/+/g, '/') export const trimPath = (path: string) => path.replace(/^\/+|\/+$/g, '').replace(/\/+/g, '/')
export const getAgent = (proxy:any, https: boolean = true) => { const commonOptions = {
keepAlive: true,
keepAliveMsecs: 1000,
scheduling: 'lifo' as 'lifo' | 'fifo' | undefined
} as any
export const getAgent = (proxy:any, https: boolean = true): {
https?: HttpsProxyAgent
http?: HttpProxyAgent
} => {
const formatProxy = formatHttpProxy(proxy, 'string') as any const formatProxy = formatHttpProxy(proxy, 'string') as any
const commonResult = {
https: undefined,
http: undefined
}
if (!formatProxy) return commonResult
commonOptions.proxy = formatProxy.replace('127.0.0.1', 'localhost')
if (https) { if (https) {
return formatProxy return {
? {
https: new HttpsProxyAgent({ https: new HttpsProxyAgent({
keepAlive: true, ...commonOptions,
keepAliveMsecs: 1000, rejectUnauthorized: false
rejectUnauthorized: false, }),
scheduling: 'lifo' as 'lifo' | 'fifo' | undefined, http: undefined
proxy: formatProxy.replace('127.0.0.1', 'localhost')
})
} }
: {} }
} else { return {
return formatProxy
? {
http: new HttpProxyAgent({ http: new HttpProxyAgent({
keepAlive: true, ...commonOptions
keepAliveMsecs: 1000, }),
scheduling: 'lifo' as 'lifo' | 'fifo' | undefined, https: undefined
proxy: formatProxy.replace('127.0.0.1', 'localhost')
})
}
: {}
} }
} }
@ -258,10 +255,8 @@ export const getInnerAgent = (proxy: any, sslEnabled: boolean = true) => {
return formatProxy return formatProxy
? { ? {
agent: new https.Agent({ agent: new https.Agent({
keepAlive: true, ...commonOptions,
keepAliveMsecs: 1000,
rejectUnauthorized: false, rejectUnauthorized: false,
scheduling: 'lifo' as 'lifo' | 'fifo' | undefined,
host: formatProxy.host, host: formatProxy.host,
port: formatProxy.port port: formatProxy.port
}) })
@ -272,25 +267,20 @@ export const getInnerAgent = (proxy: any, sslEnabled: boolean = true) => {
keepAlive: true keepAlive: true
}) })
} }
} else { }
return formatProxy return formatProxy
? { ? {
agent: new http.Agent({ agent: new http.Agent({
keepAlive: true, ...commonOptions,
keepAliveMsecs: 1000,
scheduling: 'lifo' as 'lifo' | 'fifo' | undefined,
host: formatProxy.host, host: formatProxy.host,
port: formatProxy.port port: formatProxy.port
}) })
} }
: { : {
agent: new http.Agent({ agent: new http.Agent({
keepAlive: true, ...commonOptions
keepAliveMsecs: 1000,
scheduling: 'lifo' as 'lifo' | 'fifo' | undefined
}) })
} }
}
} }
export function getOptions ( export function getOptions (
@ -301,23 +291,17 @@ export function getOptions (
body?: any, body?: any,
timeout?: number, timeout?: number,
proxy?: any proxy?: any
) { ): OptionsOfTextResponseBody {
const options = { return {
method: method?.toUpperCase(), ...(method && { method: method.toUpperCase() }),
headers, ...(headers && { headers }),
searchParams, ...(searchParams && { searchParams }),
agent: getAgent(proxy), ...(body && { body }),
timeout: { ...(responseType && { responseType }),
request: timeout || 30000 ...(timeout !== undefined ? { timeout: { request: timeout } } : { timeout: { request: 30000 } }),
}, ...(proxy && { agent: Object.fromEntries(Object.entries(getAgent(proxy)).filter(([, v]) => v !== undefined)) }),
body, throwHttpErrors: false
throwHttpErrors: false, }
responseType
} as IStringKeyMap
Object.keys(options).forEach(key => {
options[key] === undefined && delete options[key]
})
return options
} }
export const formatEndpoint = (endpoint: string, sslEnabled: boolean): string => export const formatEndpoint = (endpoint: string, sslEnabled: boolean): string =>

View File

@ -1,44 +1,13 @@
import { S3 } from 'aws-sdk' import { ipcRenderer } from 'electron'
import { getRawData } from '~/renderer/utils/common'
export default class AwsS3Api { export default class AwsS3Api {
static async delete (configMap: IStringKeyMap): Promise<boolean> { static async delete (configMap: IStringKeyMap): Promise<boolean> {
const { imgUrl, config: { accessKeyID, secretAccessKey, bucketName, region, endpoint, pathStyleAccess, bucketEndpoint, rejectUnauthorized } } = configMap
try { try {
const url = new URL(!/^https?:\/\//.test(imgUrl) ? `http://${imgUrl}` : imgUrl) const deleteResult = await ipcRenderer.invoke('delete-aws-s3-file',
const fileKey = url.pathname getRawData(configMap)
let endpointUrl )
if (endpoint) { return deleteResult
if (!/^https?:\/\//.test(endpoint)) {
endpointUrl = `http://${endpoint}`
} else {
endpointUrl = endpoint
}
}
let sslEnabled = true
if (endpointUrl) {
sslEnabled = endpointUrl.startsWith('https')
}
const http = sslEnabled ? require('https') : require('http')
const client = new S3({
accessKeyId: accessKeyID,
secretAccessKey,
endpoint: endpointUrl,
s3ForcePathStyle: pathStyleAccess,
sslEnabled,
region,
s3BucketEndpoint: bucketEndpoint,
httpOptions: {
agent: new http.Agent({
rejectUnauthorized,
timeout: 30000
})
}
})
const result = await client.deleteObject({
Bucket: bucketName,
Key: fileKey.replace(/^\/+/, '')
}).promise()
return result.$response.httpResponse.statusCode === 204
} catch (error) { } catch (error) {
console.log(error) console.log(error)
return false return false

View File

@ -4,7 +4,7 @@ ea/*
*/ */
<template> <template>
<div <div
v-loading="showLoadingPage" v-loading="isShowLoadingPage"
:element-loading-text="$T('MANAGE_BUCKET_PAGE_LOADING_TEXT')" :element-loading-text="$T('MANAGE_BUCKET_PAGE_LOADING_TEXT')"
:element-loading-spinner="svg" :element-loading-spinner="svg"
element-loading-svg-view-box="0, 0, 50, 50" element-loading-svg-view-box="0, 0, 50, 50"
@ -15,22 +15,22 @@ ea/*
style="flex-grow: 1;margin-left: 16px" style="flex-grow: 1;margin-left: 16px"
> >
<el-select <el-select
v-if="showCustomUrlSelectList && customUrlList.length > 1 && isAutoCustomUrl" v-if="isShowCustomDomainSelectList && customDomainList.length > 1 && isAutoCustomDomain"
v-model="currentCustomUrl" v-model="currentCustomDomain"
:placeholder="$T('MANAGE_BUCKET_PAGE_CUSTOM_URL_SELECT_PLACEHOLDER')" :placeholder="$T('MANAGE_BUCKET_PAGE_CUSTOM_URL_SELECT_PLACEHOLDER')"
style="width: 200px;" style="width: 200px;"
@change="handleChangeCustomUrl" @change="handleChangeCustomUrl"
> >
<el-option <el-option
v-for="item in customUrlList" v-for="item in customDomainList"
:key="item" :key="item"
:label="item.label" :label="item.label"
:value="item.value" :value="item.value"
/> />
</el-select> </el-select>
<el-input <el-input
v-else-if="showCustomUrlInput" v-else-if="isShowCustomDomainInput"
v-model="currentCustomUrl" v-model="currentCustomDomain"
:placeholder="$T('MANAGE_BUCKET_PAGE_CUSTOM_URL_INPUT_PLACEHOLDER')" :placeholder="$T('MANAGE_BUCKET_PAGE_CUSTOM_URL_INPUT_PLACEHOLDER')"
style="width: 200px;" style="width: 200px;"
@blur="handleChangeCustomUrl" @blur="handleChangeCustomUrl"
@ -39,9 +39,9 @@ ea/*
v-else v-else
:underline="false" :underline="false"
type="primary" type="primary"
@click="copyToClipboard(currentCustomUrl)" @click="copyToClipboard(currentCustomDomain)"
> >
{{ currentCustomUrl }} {{ currentCustomDomain }}
</el-link> </el-link>
</div> </div>
<div <div
@ -86,7 +86,7 @@ ea/*
</el-button> </el-button>
</div> </div>
<div <div
v-if="showCreateNewFolder" v-if="isShowCreateNewFolder"
> >
<el-button <el-button
type="text" type="text"
@ -167,9 +167,9 @@ ea/*
<Link /> <Link />
</el-icon> </el-icon>
<template #dropdown> <template #dropdown>
<template v-if="showPresignedUrl"> <template v-if="isShowPresignedUrl">
<el-dropdown-item <el-dropdown-item
v-for="i in [...linkArray, { key: 'preSignURL', value: 'preSignedUrl' }]" v-for="i in [...linkFormatArray, { key: 'preSignURL', value: 'preSignedUrl' }]"
:key="i.key" :key="i.key"
@click="handleBatchCopyLink(i.value)" @click="handleBatchCopyLink(i.value)"
> >
@ -177,7 +177,7 @@ ea/*
</el-dropdown-item> </el-dropdown-item>
</template> </template>
<el-dropdown-item <el-dropdown-item
v-for="i in linkArray" v-for="i in linkFormatArray"
v-else v-else
:key="i.value+i.key" :key="i.value+i.key"
@click="handleBatchCopyLink(i.value)" @click="handleBatchCopyLink(i.value)"
@ -402,18 +402,18 @@ ea/*
> >
<el-button <el-button
:icon="Grid" :icon="Grid"
:type="showFileStyle === 'grid' ? 'primary' : 'info'" :type="layoutStyle === 'grid' ? 'primary' : 'info'"
@click="handleViewChange('grid')" @click="handleViewChange('grid')"
/> />
<el-button <el-button
:icon="Fold" :icon="Fold"
:type="showFileStyle === 'list' ? 'primary' : 'info'" :type="layoutStyle === 'list' ? 'primary' : 'info'"
@click="handleViewChange('list')" @click="handleViewChange('list')"
/> />
</el-button-group> </el-button-group>
<el-input-number <el-input-number
v-if="paging" v-if="paging"
v-model="currentPage" v-model="currentPageNumber"
:min="1" :min="1"
size="small" size="small"
:disabled="!paging" :disabled="!paging"
@ -451,7 +451,7 @@ https://www.baidu.com/img/bd_logo1.png"
</template> </template>
</el-dialog> </el-dialog>
<div <div
v-show="showFileStyle === 'list'" v-show="layoutStyle === 'list'"
class="layout-table" class="layout-table"
style="margin: 0 15px 15px 15px;overflow-y: auto;overflow-x: hidden;height: 80vh;" style="margin: 0 15px 15px 15px;overflow-y: auto;overflow-x: hidden;height: 80vh;"
> >
@ -460,7 +460,7 @@ https://www.baidu.com/img/bd_logo1.png"
#default="{ height, width }" #default="{ height, width }"
> >
<el-table-v2 <el-table-v2
ref="elTable" ref="fileTable"
:columns="columns " :columns="columns "
:data="currentPageFilesInfo" :data="currentPageFilesInfo"
:row-class="rowClass" :row-class="rowClass"
@ -471,7 +471,7 @@ https://www.baidu.com/img/bd_logo1.png"
</el-auto-resizer> </el-auto-resizer>
</div> </div>
<div <div
v-show="showFileStyle === 'grid'" v-show="layoutStyle === 'grid'"
class="layout-grid" class="layout-grid"
style="margin: 0 15px 15px 15px;overflow-y: auto;overflow-x: hidden;height: 80vh;" style="margin: 0 15px 15px 15px;overflow-y: auto;overflow-x: hidden;height: 80vh;"
> >
@ -558,7 +558,7 @@ https://www.baidu.com/img/bd_logo1.png"
> >
<el-row> <el-row>
<el-icon <el-icon
v-if="!item.isDir && showRenameFileIcon" v-if="!item.isDir && isShowRenameFileIcon"
size="20" size="20"
style="cursor: pointer;" style="cursor: pointer;"
color="#409EFF" color="#409EFF"
@ -633,7 +633,7 @@ https://www.baidu.com/img/bd_logo1.png"
{{ $T('MANAGE_BUCKET_URL_FORMAT_CUSTOM') }} {{ $T('MANAGE_BUCKET_URL_FORMAT_CUSTOM') }}
</el-dropdown-item> </el-dropdown-item>
<el-dropdown-item <el-dropdown-item
v-if="showPresignedUrl" v-if="isShowPresignedUrl"
@click="async () => { @click="async () => {
copyToClipboard(await getPreSignedUrl(item)) copyToClipboard(await getPreSignedUrl(item))
}" }"
@ -672,12 +672,12 @@ https://www.baidu.com/img/bd_logo1.png"
</el-col> </el-col>
</div> </div>
<el-image-viewer <el-image-viewer
v-if="showImagePreview" v-if="isShowImagePreview"
:url-list="ImagePreviewList" :url-list="ImagePreviewList"
:initial-index="getCurrentPreviewIndex" :initial-index="getCurrentPreviewIndex"
infinite infinite
hide-on-click-modal hide-on-click-modal
@close="showImagePreview = false" @close="isShowImagePreview = false"
/> />
<el-dialog <el-dialog
v-model="isShowFileInfo" v-model="isShowFileInfo"
@ -690,7 +690,7 @@ https://www.baidu.com/img/bd_logo1.png"
<el-button <el-button
type="primary" type="primary"
plain plain
@click="copyToClipboard(JSON.stringify(showedFileInfo,null,2))" @click="copyToClipboard(JSON.stringify(currentShowedFileInfo,null,2))"
> >
<template #icon> <template #icon>
<el-icon> <el-icon>
@ -701,7 +701,7 @@ https://www.baidu.com/img/bd_logo1.png"
</el-button> </el-button>
</template> </template>
<el-row <el-row
v-for="(value, key) in showedFileInfo" v-for="(value, key) in currentShowedFileInfo"
:key="key" :key="key"
:gutter="20" :gutter="20"
:style="{ margin: '10px 0', textAlign: 'center', fontFamily: 'Arial, Helvetica, sans-serif' }" :style="{ margin: '10px 0', textAlign: 'center', fontFamily: 'Arial, Helvetica, sans-serif' }"
@ -766,11 +766,11 @@ https://www.baidu.com/img/bd_logo1.png"
</template> </template>
<div <div
id="upload-area" id="upload-area"
:class="{ 'is-dragover': dragover }" :class="{ 'is-dragover': isDragover }"
styel="position: fixed;bottom: 0;right: 0;heigth: 100%;width: 100%;" styel="position: fixed;bottom: 0;right: 0;heigth: 100%;width: 100%;"
@drop.prevent="onDrop" @drop.prevent="onDrop"
@dragover.prevent="dragover = true" @dragover.prevent="isDragover = true"
@dragleave.prevent="dragover = false" @dragleave.prevent="isDragover = false"
@click="openFileSelectDialog" @click="openFileSelectDialog"
> >
<div <div
@ -1503,7 +1503,7 @@ configMap:{
} }
*/ */
const linkArray = [ const linkFormatArray = [
{ key: 'Url', value: 'url' }, { key: 'Url', value: 'url' },
{ key: 'Markdown', value: 'markdown' }, { key: 'Markdown', value: 'markdown' },
{ key: 'Markdown-link', value: 'markdown-with-link' }, { key: 'Markdown-link', value: 'markdown-with-link' },
@ -1512,50 +1512,74 @@ const linkArray = [
{ key: 'Custom', value: 'custom' } { key: 'Custom', value: 'custom' }
] ]
//
const route = useRoute()
//
const manageStore = useManageStore() const manageStore = useManageStore()
const configMap = reactive(JSON.parse(route.query.configMap as string))
//
const isLoadingData = ref(false)
const isShowLoadingPage = ref(false)
const isShowImagePreview = ref(false)
const layoutStyle = ref<'list' | 'grid'>('grid')
//
const fileTable = ref(null as any)
const isShowFileInfo = ref(false)
const currentShowedFileInfo = ref({} as any)
//
const currentPageNumber = ref(1)
const pagingMarker = ref('') const pagingMarker = ref('')
const pagingMarkerStack = reactive([] as string[]) const pagingMarkerStack = reactive([] as string[])
const currentPrefix = ref('/')
const currentPage = ref(1)
const fileSortNameReverse = ref(false)
const fileSortTimeReverse = ref(false)
const fileSortSizeReverse = ref(false)
const fileSortExtReverse = ref(false)
const currentPageFilesInfo = reactive([] as any[]) const currentPageFilesInfo = reactive([] as any[])
const currentDownloadFileList = reactive([] as any[]) //
const route = useRoute() const currentPrefix = ref('/')
const configMap = reactive(JSON.parse(route.query.configMap as string)) //
const selectedItems = reactive([] as any[]) const fileSortExtReverse = ref(false)
const fileSortNameReverse = ref(false)
const fileSortSizeReverse = ref(false)
const fileSortTimeReverse = ref(false)
//
const searchText = ref('') const searchText = ref('')
const urlToUpload = ref('') const selectedItems = reactive([] as any[])
//
const isDragover = ref(false)
const tableData = reactive([] as any[])
const isShowUploadPanel = ref(false)
const activeUpLoadTab = ref('uploading')
const uploadTaskList = ref([] as IUploadTask[])
const refreshUploadTaskId = ref<NodeJS.Timer | null>(null)
const uploadPanelFilesList = ref([] as any[])
const cancelToken = ref('')
const isLoadingUploadPanelFiles = ref(false)
const isUploadKeepDirStructure = computed(() => manageStore.config.settings.isUploadKeepDirStructure ?? true)
const uploadingTaskList = computed(() => uploadTaskList.value.filter(item => ['uploading', 'queuing', 'paused'].includes(item.status)))
const uploadedTaskList = computed(() => uploadTaskList.value.filter(item => ['uploaded', 'failed', 'canceled'].includes(item.status)))
//
const isShowDownloadPanel = ref(false)
const isLoadingDownloadData = ref(false)
const activeDownLoadTab = ref('downloading')
const currentDownloadFileList = reactive([] as any[])
const downloadTaskList = ref([] as IDownloadTask[])
const refreshDownloadTaskId = ref<NodeJS.Timer | null>(null)
const downloadCancelToken = ref('')
const downloadingTaskList = computed(() => downloadTaskList.value.filter(item => ['downloading', 'queuing', 'paused'].includes(item.status)))
const downloadedTaskList = computed(() => downloadTaskList.value.filter(item => ['downloaded', 'failed', 'canceled'].includes(item.status)))
//
const dialogVisible = ref(false) const dialogVisible = ref(false)
const showLoadingPage = ref(false) const urlToUpload = ref('')
const showImagePreview = ref(false) //
const previewedImage = ref('') const previewedImage = ref('')
const isShowFileInfo = ref(false) const ImagePreviewList = computed(() => currentPageFilesInfo.filter(item => item.isImage).map(item => item.url))
const showedFileInfo = ref({} as any) //
const elTable = ref(null as any)
const isShiftKeyPress = ref<boolean>(false) const isShiftKeyPress = ref<boolean>(false)
const lastChoosed = ref<number>(-1) const lastChoosed = ref<number>(-1)
const isLoadingData = ref(false) //
const isLoadingDownloadData = ref(false) const customDomainList = ref([] as any[])
const cancelToken = ref('') const currentCustomDomain = ref('')
const downloadCancelToken = ref('') const isShowCustomDomainSelectList = computed(() => ['tcyun', 'aliyun', 'qiniu', 'github'].includes(currentPicBedName.value))
const isShowUploadPanel = ref(false) const isShowCustomDomainInput = computed(() => ['aliyun', 'qiniu', 'tcyun', 's3plist', 'webdavplist'].includes(currentPicBedName.value))
const isShowDownloadPanel = ref(false) const isAutoCustomDomain = computed(() => manageStore.config.picBed[configMap.alias].isAutoCustomUrl === undefined ? true : manageStore.config.picBed[configMap.alias].isAutoCustomUrl)
const dragover = ref(false) //
const activeUpLoadTab = ref('uploading')
const activeDownLoadTab = ref('downloading')
//
const uploadTaskList = ref([] as IUploadTask[])
const downloadTaskList = ref([] as IDownloadTask[])
const refreshUploadTaskId = ref<NodeJS.Timer | null>(null)
const refreshDownloadTaskId = ref<NodeJS.Timer | null>(null)
const uploadPanelFilesList = ref([] as any[])
const isLoadingUploadPanelFiles = ref(false)
const tableData = reactive([] as any[])
const customUrlList = ref([] as any[])
const currentCustomUrl = ref('')
const isShowMarkDownDialog = ref(false) const isShowMarkDownDialog = ref(false)
const markDownContent = ref('') const markDownContent = ref('')
const isShowTextFileDialog = ref(false) const isShowTextFileDialog = ref(false)
@ -1563,50 +1587,28 @@ const textfileContent = ref('')
const isShowVideoFileDialog = ref(false) const isShowVideoFileDialog = ref(false)
const videoFileUrl = ref('') const videoFileUrl = ref('')
const videoPlayerHeaders = ref({}) const videoPlayerHeaders = ref({})
const showFileStyle = ref<'list' | 'grid'>('grid') //
const isUploadKeepDirStructure = computed(() => manageStore.config.settings.isUploadKeepDirStructure ?? true) const isShowRenameFileIcon = computed(() => ['tcyun', 'aliyun', 'qiniu', 'upyun', 's3plist', 'webdavplist'].includes(currentPicBedName.value))
const isShowBatchRenameDialog = ref(false) const isShowBatchRenameDialog = ref(false)
const batchRenameMatch = ref('') const batchRenameMatch = ref('')
const batchRenameReplace = ref('') const batchRenameReplace = ref('')
const isRenameIncludeExt = ref(false) const isRenameIncludeExt = ref(false)
const isSingleRename = ref(false) const isSingleRename = ref(false)
const itemToBeRenamed = ref({} as any) const itemToBeRenamed = ref({} as any)
//
const isShowCreateNewFolder = computed(() => ['tcyun', 'aliyun', 'qiniu', 'upyun', 'github', 's3plist', 'webdavplist'].includes(currentPicBedName.value))
const showCustomUrlSelectList = computed(() => ['tcyun', 'aliyun', 'qiniu', 'github'].includes(currentPicBedName.value)) const isShowPresignedUrl = computed(() => ['tcyun', 'aliyun', 'qiniu', 'github', 's3plist', 'webdavplist'].includes(currentPicBedName.value))
const showCustomUrlInput = computed(() => ['aliyun', 'qiniu', 'tcyun', 's3plist', 'webdavplist'].includes(currentPicBedName.value)) //
const showCreateNewFolder = computed(() => ['tcyun', 'aliyun', 'qiniu', 'upyun', 'github', 's3plist', 'webdavplist'].includes(currentPicBedName.value))
const showRenameFileIcon = computed(() => ['tcyun', 'aliyun', 'qiniu', 'upyun', 's3plist', 'webdavplist'].includes(currentPicBedName.value))
const showPresignedUrl = computed(() => ['tcyun', 'aliyun', 'qiniu', 'github', 's3plist', 'webdavplist'].includes(currentPicBedName.value))
const uploadingTaskList = computed(() => uploadTaskList.value.filter(item => ['uploading', 'queuing', 'paused'].includes(item.status)))
const uploadedTaskList = computed(() => uploadTaskList.value.filter(item => ['uploaded', 'failed', 'canceled'].includes(item.status)))
const downloadingTaskList = computed(() => downloadTaskList.value.filter(item => ['downloading', 'queuing', 'paused'].includes(item.status)))
const downloadedTaskList = computed(() => downloadTaskList.value.filter(item => ['downloaded', 'failed', 'canceled'].includes(item.status)))
const isAutoCustomUrl = computed(() => manageStore.config.picBed[configMap.alias].isAutoCustomUrl === undefined ? true : manageStore.config.picBed[configMap.alias].isAutoCustomUrl)
function handleUploadKeepDirChange (val: any) { function handleUploadKeepDirChange (val: any) {
saveConfig('settings.isUploadKeepDirStructure', !!val) saveConfig('settings.isUploadKeepDirStructure', !!val)
manageStore.refreshConfig() manageStore.refreshConfig()
} }
function handleViewChange (val: 'list' | 'grid') { function showUploadDialog () {
saveConfig('settings.isShowList', val === 'list') isShowUploadPanel.value = true
showFileStyle.value = val
}
function getBase64ofWebdav () {
const headers = {
Authorization: 'Basic ' + Buffer.from(`${manageStore.config.picBed[configMap.alias].username}:${manageStore.config.picBed[configMap.alias].password}`).toString('base64')
}
return headers
} }
function startRefreshUploadTask () { function startRefreshUploadTask () {
@ -1617,6 +1619,16 @@ function startRefreshUploadTask () {
}, 300) }, 300)
} }
function stopRefreshUploadTask () {
refreshUploadTaskId.value && clearInterval(refreshUploadTaskId.value)
}
//
function showDownloadDialog () {
isShowDownloadPanel.value = true
}
function startRefreshDownloadTask () { function startRefreshDownloadTask () {
refreshDownloadTaskId.value = setInterval(() => { refreshDownloadTaskId.value = setInterval(() => {
ipcRenderer.invoke('getDownloadTaskList').then((res: any) => { ipcRenderer.invoke('getDownloadTaskList').then((res: any) => {
@ -1625,21 +1637,24 @@ function startRefreshDownloadTask () {
}, 300) }, 300)
} }
const stopRefreshUploadTask = () => refreshUploadTaskId.value && clearInterval(refreshUploadTaskId.value) function stopRefreshDownloadTask () {
refreshDownloadTaskId.value && clearInterval(refreshDownloadTaskId.value)
}
const stopRefreshDownloadTask = () => refreshDownloadTaskId.value && clearInterval(refreshDownloadTaskId.value) function handleViewChange (val: 'list' | 'grid') {
saveConfig('settings.isShowList', val === 'list')
layoutStyle.value = val
}
const ImagePreviewList = computed(() => currentPageFilesInfo.filter(item => item.isImage).map(item => item.url)) function getBase64ofWebdav () {
const headers = {
Authorization: 'Basic ' + Buffer.from(`${manageStore.config.picBed[configMap.alias].username}:${manageStore.config.picBed[configMap.alias].password}`).toString('base64')
}
return headers
}
const getCurrentPreviewIndex = computed(() => ImagePreviewList.value.indexOf(previewedImage.value)) const getCurrentPreviewIndex = computed(() => ImagePreviewList.value.indexOf(previewedImage.value))
const showUploadDialog = () => {
isShowUploadPanel.value = true
}
const showDownloadDialog = () => {
isShowDownloadPanel.value = true
}
function openFileSelectDialog () { function openFileSelectDialog () {
ipcRenderer.invoke('openFileSelectDialog').then((res: any) => { ipcRenderer.invoke('openFileSelectDialog').then((res: any) => {
if (res) { if (res) {
@ -1664,7 +1679,7 @@ function openFileSelectDialog () {
} }
function onDrop (e: DragEvent) { function onDrop (e: DragEvent) {
dragover.value = false isDragover.value = false
const items = e.dataTransfer?.items const items = e.dataTransfer?.items
if (items) { if (items) {
webkitReadDataTransfer(e.dataTransfer as DataTransfer) webkitReadDataTransfer(e.dataTransfer as DataTransfer)
@ -1837,7 +1852,7 @@ function uploadFiles () {
filePath: item.path, filePath: item.path,
fileSize: item.size, fileSize: item.size,
fileName: item.rawName, fileName: item.rawName,
githubBranch: currentCustomUrl.value, githubBranch: currentCustomDomain.value,
aclForUpload: manageStore.config.picBed[configMap.alias].aclForUpload aclForUpload: manageStore.config.picBed[configMap.alias].aclForUpload
}) })
}) })
@ -1878,7 +1893,7 @@ const handleOpenDownloadedFolder = () => ipcRenderer.send('OpenDownloadedFolder'
function handleShowFileInfo (item: any) { function handleShowFileInfo (item: any) {
isShowFileInfo.value = true isShowFileInfo.value = true
showedFileInfo.value = item currentShowedFileInfo.value = item
} }
async function handleBreadcrumbClick (index: number) { async function handleBreadcrumbClick (index: number) {
@ -1888,9 +1903,9 @@ async function handleBreadcrumbClick (index: number) {
ipcRenderer.send('cancelLoadingFileList', cancelToken.value) ipcRenderer.send('cancelLoadingFileList', cancelToken.value)
} }
configMap.prefix = targetPrefix configMap.prefix = targetPrefix
showLoadingPage.value = true isShowLoadingPage.value = true
resetParam(false) resetParam(false)
showLoadingPage.value = false isShowLoadingPage.value = false
} }
async function handleClickFile (item: any) { async function handleClickFile (item: any) {
@ -1902,16 +1917,16 @@ async function handleClickFile (item: any) {
} }
if (item.isImage) { if (item.isImage) {
previewedImage.value = item.url previewedImage.value = item.url
showImagePreview.value = true isShowImagePreview.value = true
} else if (item.isDir) { } else if (item.isDir) {
if (isLoadingData.value) { if (isLoadingData.value) {
isLoadingData.value = false isLoadingData.value = false
ipcRenderer.send('cancelLoadingFileList', cancelToken.value) ipcRenderer.send('cancelLoadingFileList', cancelToken.value)
} }
configMap.prefix = `/${item.key}` configMap.prefix = `/${item.key}`
showLoadingPage.value = true isShowLoadingPage.value = true
await resetParam(false) await resetParam(false)
showLoadingPage.value = false isShowLoadingPage.value = false
} else if (item.fileName.endsWith('.md')) { } else if (item.fileName.endsWith('.md')) {
try { try {
ElMessage({ ElMessage({
@ -1964,7 +1979,7 @@ const isIgnoreCase = computed(() => manageStore.config.settings.isIgnoreCase ??
async function handleChangeCustomUrl () { async function handleChangeCustomUrl () {
if (currentPicBedName.value === 'github') { if (currentPicBedName.value === 'github') {
showLoadingPage.value = true isShowLoadingPage.value = true
if (isLoadingData.value) { if (isLoadingData.value) {
ElNotification({ ElNotification({
title: $T('MANAGE_BUCKET_CHANGE_CUSTOM_URL_TITLE'), title: $T('MANAGE_BUCKET_CHANGE_CUSTOM_URL_TITLE'),
@ -1973,18 +1988,18 @@ async function handleChangeCustomUrl () {
duration: 2000 duration: 2000
}) })
} }
showLoadingPage.value = true isShowLoadingPage.value = true
await resetParam(true) await resetParam(true)
showLoadingPage.value = false isShowLoadingPage.value = false
} else if (['aliyun', 'tcyun', 'qiniu', 's3plist', 'webdavplist'].includes(currentPicBedName.value)) { } else if (['aliyun', 'tcyun', 'qiniu', 's3plist', 'webdavplist'].includes(currentPicBedName.value)) {
const currentConfigs = await getConfig<any>('picBed') const currentConfigs = await getConfig<any>('picBed')
const currentConfig = currentConfigs[configMap.alias] const currentConfig = currentConfigs[configMap.alias]
const currentTransformedConfig = JSON.parse(currentConfig.transformedConfig ?? '{}') const currentTransformedConfig = JSON.parse(currentConfig.transformedConfig ?? '{}')
if (currentTransformedConfig[configMap.bucketName]) { if (currentTransformedConfig[configMap.bucketName]) {
currentTransformedConfig[configMap.bucketName].customUrl = currentCustomUrl.value currentTransformedConfig[configMap.bucketName].customUrl = currentCustomDomain.value
} else { } else {
currentTransformedConfig[configMap.bucketName] = { currentTransformedConfig[configMap.bucketName] = {
customUrl: currentCustomUrl.value customUrl: currentCustomDomain.value
} }
} }
currentConfig.transformedConfig = JSON.stringify(currentTransformedConfig) currentConfig.transformedConfig = JSON.stringify(currentTransformedConfig)
@ -1993,8 +2008,8 @@ async function handleChangeCustomUrl () {
} }
} }
// when the current picBed is github, the customUrlList is used to store the github repo branches // when the current picBed is github, the customDomainList is used to store the github repo branches
async function initCustomUrlList () { async function initCustomDomainList () {
if ((['aliyun', 'tcyun', 'qiniu'].includes(currentPicBedName.value) && if ((['aliyun', 'tcyun', 'qiniu'].includes(currentPicBedName.value) &&
(manageStore.config.picBed[configMap.alias].isAutoCustomUrl === undefined || manageStore.config.picBed[configMap.alias].isAutoCustomUrl === true)) || (manageStore.config.picBed[configMap.alias].isAutoCustomUrl === undefined || manageStore.config.picBed[configMap.alias].isAutoCustomUrl === true)) ||
['github', 'smms', 'upyun', 'imgur'].includes(currentPicBedName.value)) { ['github', 'smms', 'upyun', 'imgur'].includes(currentPicBedName.value)) {
@ -2012,46 +2027,46 @@ async function initCustomUrlList () {
} }
const res = await ipcRenderer.invoke('getBucketDomain', configMap.alias, param) const res = await ipcRenderer.invoke('getBucketDomain', configMap.alias, param)
if (res.length > 0) { if (res.length > 0) {
customUrlList.value.length = 0 customDomainList.value.length = 0
res.forEach((item: any) => { res.forEach((item: any) => {
if (!/^https?:\/\//.test(item) && currentPicBedName.value !== 'github') { if (!/^https?:\/\//.test(item) && currentPicBedName.value !== 'github') {
item = manageStore.config.settings.isForceCustomUrlHttps ? `https://${item}` : `http://${item}` item = manageStore.config.settings.isForceCustomUrlHttps ? `https://${item}` : `http://${item}`
} }
customUrlList.value.push({ customDomainList.value.push({
label: item, label: item,
value: item value: item
}) })
}) })
defaultUrl !== '' && currentPicBedName.value !== 'github' && customUrlList.value.push({ defaultUrl !== '' && currentPicBedName.value !== 'github' && customDomainList.value.push({
label: defaultUrl, label: defaultUrl,
value: defaultUrl value: defaultUrl
}) })
currentCustomUrl.value = customUrlList.value[0].value currentCustomDomain.value = customDomainList.value[0].value
} else { } else {
customUrlList.value.length = 0 customDomainList.value.length = 0
customUrlList.value = [ customDomainList.value = [
{ {
label: defaultUrl, label: defaultUrl,
value: defaultUrl value: defaultUrl
} }
] ]
currentCustomUrl.value = defaultUrl currentCustomDomain.value = defaultUrl
} }
} else if (['aliyun', 'tcyun', 'qiniu'].includes(currentPicBedName.value)) { } else if (['aliyun', 'tcyun', 'qiniu'].includes(currentPicBedName.value)) {
const currentConfigs = await getConfig<any>('picBed') const currentConfigs = await getConfig<any>('picBed')
const currentConfig = currentConfigs[configMap.alias] const currentConfig = currentConfigs[configMap.alias]
const currentTransformedConfig = JSON.parse(currentConfig.transformedConfig ?? '{}') const currentTransformedConfig = JSON.parse(currentConfig.transformedConfig ?? '{}')
if (currentTransformedConfig[configMap.bucketName]) { if (currentTransformedConfig[configMap.bucketName]) {
currentCustomUrl.value = currentTransformedConfig[configMap.bucketName].customUrl ?? '' currentCustomDomain.value = currentTransformedConfig[configMap.bucketName].customUrl ?? ''
} else { } else {
currentCustomUrl.value = '' currentCustomDomain.value = ''
} }
} else if (currentPicBedName.value === 's3plist') { } else if (currentPicBedName.value === 's3plist') {
const currentConfigs = await getConfig<any>('picBed') const currentConfigs = await getConfig<any>('picBed')
const currentConfig = currentConfigs[configMap.alias] const currentConfig = currentConfigs[configMap.alias]
const currentTransformedConfig = JSON.parse(currentConfig.transformedConfig ?? '{}') const currentTransformedConfig = JSON.parse(currentConfig.transformedConfig ?? '{}')
if (currentTransformedConfig[configMap.bucketName]) { if (currentTransformedConfig[configMap.bucketName]) {
currentCustomUrl.value = currentTransformedConfig[configMap.bucketName].customUrl ?? '' currentCustomDomain.value = currentTransformedConfig[configMap.bucketName].customUrl ?? ''
} else { } else {
if (manageStore.config.picBed[configMap.alias].endpoint) { if (manageStore.config.picBed[configMap.alias].endpoint) {
const endpoint = manageStore.config.picBed[configMap.alias].endpoint const endpoint = manageStore.config.picBed[configMap.alias].endpoint
@ -2061,9 +2076,9 @@ async function initCustomUrlList () {
} else { } else {
url = new URL(manageStore.config.picBed[configMap.alias].sslEnabled ? 'https://' + endpoint : 'http://' + endpoint) url = new URL(manageStore.config.picBed[configMap.alias].sslEnabled ? 'https://' + endpoint : 'http://' + endpoint)
} }
currentCustomUrl.value = `${url.protocol}//${configMap.bucketName}.${url.hostname}` currentCustomDomain.value = `${url.protocol}//${configMap.bucketName}.${url.hostname}`
} else { } else {
currentCustomUrl.value = `https://${configMap.bucketName}.s3.amazonaws.com` currentCustomDomain.value = `https://${configMap.bucketName}.s3.amazonaws.com`
} }
} }
handleChangeCustomUrl() handleChangeCustomUrl()
@ -2072,13 +2087,13 @@ async function initCustomUrlList () {
const currentConfig = currentConfigs[configMap.alias] const currentConfig = currentConfigs[configMap.alias]
const currentTransformedConfig = JSON.parse(currentConfig.transformedConfig ?? '{}') const currentTransformedConfig = JSON.parse(currentConfig.transformedConfig ?? '{}')
if (currentTransformedConfig[configMap.bucketName] && currentTransformedConfig[configMap.bucketName]?.customUrl) { if (currentTransformedConfig[configMap.bucketName] && currentTransformedConfig[configMap.bucketName]?.customUrl) {
currentCustomUrl.value = currentTransformedConfig[configMap.bucketName].customUrl currentCustomDomain.value = currentTransformedConfig[configMap.bucketName].customUrl
} else { } else {
let endpoint = manageStore.config.picBed[configMap.alias].endpoint let endpoint = manageStore.config.picBed[configMap.alias].endpoint
if (!/^https?:\/\//.test(endpoint)) { if (!/^https?:\/\//.test(endpoint)) {
endpoint = 'http://' + endpoint endpoint = 'http://' + endpoint
} }
currentCustomUrl.value = endpoint currentCustomDomain.value = endpoint
} }
handleChangeCustomUrl() handleChangeCustomUrl()
} }
@ -2096,18 +2111,18 @@ async function resetParam (force: boolean = false) {
cancelToken.value = '' cancelToken.value = ''
pagingMarker.value = '' pagingMarker.value = ''
currentPrefix.value = configMap.prefix currentPrefix.value = configMap.prefix
currentPage.value = 1 currentPageNumber.value = 1
currentPageFilesInfo.length = 0 currentPageFilesInfo.length = 0
currentDownloadFileList.length = 0 currentDownloadFileList.length = 0
selectedItems.length = 0 selectedItems.length = 0
searchText.value = '' searchText.value = ''
urlToUpload.value = '' urlToUpload.value = ''
dialogVisible.value = false dialogVisible.value = false
showImagePreview.value = false isShowImagePreview.value = false
previewedImage.value = '' previewedImage.value = ''
isShowFileInfo.value = false isShowFileInfo.value = false
lastChoosed.value = -1 lastChoosed.value = -1
showFileStyle.value = manageStore.config.settings.isShowList ? 'list' : 'grid' layoutStyle.value = manageStore.config.settings.isShowList ? 'list' : 'grid'
if (!isAutoRefresh.value && !force && !paging.value) { if (!isAutoRefresh.value && !force && !paging.value) {
const cachedData = await searchExistFileList() const cachedData = await searchExistFileList()
if (cachedData.length > 0) { if (cachedData.length > 0) {
@ -2116,7 +2131,7 @@ async function resetParam (force: boolean = false) {
if (['name', 'time', 'size', 'ext'].includes(sortType as string)) { if (['name', 'time', 'size', 'ext'].includes(sortType as string)) {
sortFile(sortType) sortFile(sortType)
} }
showLoadingPage.value = false isShowLoadingPage.value = false
return return
} }
} }
@ -2140,7 +2155,7 @@ async function resetParam (force: boolean = false) {
if (res.isTruncated && paging.value) { if (res.isTruncated && paging.value) {
pagingMarkerStack.push(pagingMarker.value) pagingMarkerStack.push(pagingMarker.value)
pagingMarker.value = res.nextMarker pagingMarker.value = res.nextMarker
} else if (paging.value && currentPage.value > 1) { } else if (paging.value && currentPageNumber.value > 1) {
ElNotification({ ElNotification({
title: $T('MANAGE_BUCKET_LAST_PAGE_TITLE'), title: $T('MANAGE_BUCKET_LAST_PAGE_TITLE'),
message: $T('MANAGE_BUCKET_LAST_PAGE_MSG'), message: $T('MANAGE_BUCKET_LAST_PAGE_MSG'),
@ -2168,14 +2183,14 @@ async function resetParam (force: boolean = false) {
watch(route, async (newRoute) => { watch(route, async (newRoute) => {
if (newRoute.query.configMap) { if (newRoute.query.configMap) {
showLoadingPage.value = true isShowLoadingPage.value = true
const query = newRoute.query.configMap as string const query = newRoute.query.configMap as string
for (const key in JSON.parse(query)) { for (const key in JSON.parse(query)) {
configMap[key] = JSON.parse(query)[key] configMap[key] = JSON.parse(query)[key]
} }
await initCustomUrlList() await initCustomDomainList()
await resetParam(false) await resetParam(false)
showLoadingPage.value = false isShowLoadingPage.value = false
} }
}) })
@ -2189,31 +2204,31 @@ async function forceRefreshFileList () {
}) })
return return
} }
showLoadingPage.value = true isShowLoadingPage.value = true
await resetParam(true) await resetParam(true)
showLoadingPage.value = false isShowLoadingPage.value = false
} }
watch(currentPage, () => { watch(currentPageNumber, () => {
if (typeof currentPage.value !== 'number' || currentPage.value === null) { if (typeof currentPageNumber.value !== 'number' || currentPageNumber.value === null) {
currentPage.value = 1 currentPageNumber.value = 1
} }
}) })
const changePage = async (cur: number | undefined, prev: number | undefined) => { const changePage = async (cur: number | undefined, prev: number | undefined) => {
if (!cur || !prev) { if (!cur || !prev) {
currentPage.value = 1 currentPageNumber.value = 1
} else { } else {
if (cur > prev) { if (cur > prev) {
showLoadingPage.value = true isShowLoadingPage.value = true
currentPage.value = prev + 1 currentPageNumber.value = prev + 1
currentPageFilesInfo.length = 0 currentPageFilesInfo.length = 0
selectedItems.length = 0 selectedItems.length = 0
searchText.value = '' searchText.value = ''
urlToUpload.value = '' urlToUpload.value = ''
dialogVisible.value = false dialogVisible.value = false
const res = await getBucketFileList() as IStringKeyMap const res = await getBucketFileList() as IStringKeyMap
showLoadingPage.value = false isShowLoadingPage.value = false
if (res.success) { if (res.success) {
res.fullList.sort((a: any) => { res.fullList.sort((a: any) => {
return a.isDir ? -1 : 1 return a.isDir ? -1 : 1
@ -2243,8 +2258,8 @@ const changePage = async (cur: number | undefined, prev: number | undefined) =>
}) })
} }
} else if (cur < prev) { } else if (cur < prev) {
showLoadingPage.value = true isShowLoadingPage.value = true
currentPage.value = prev - 1 currentPageNumber.value = prev - 1
currentPageFilesInfo.length = 0 currentPageFilesInfo.length = 0
selectedItems.length = 0 selectedItems.length = 0
searchText.value = '' searchText.value = ''
@ -2254,7 +2269,7 @@ const changePage = async (cur: number | undefined, prev: number | undefined) =>
pagingMarkerStack.pop() pagingMarkerStack.pop()
pagingMarkerStack.pop() pagingMarkerStack.pop()
const res = await getBucketFileList() as IStringKeyMap const res = await getBucketFileList() as IStringKeyMap
showLoadingPage.value = false isShowLoadingPage.value = false
if (res.success) { if (res.success) {
res.fullList.sort((a: any) => { res.fullList.sort((a: any) => {
return a.isDir ? -1 : 1 return a.isDir ? -1 : 1
@ -2292,7 +2307,7 @@ const changePage = async (cur: number | undefined, prev: number | undefined) =>
watch(searchText, () => searchAndSort()) watch(searchText, () => searchAndSort())
function searchAndSort () { function searchAndSort () {
elTable.value.scrollToRow(0) fileTable.value.scrollToRow(0)
if (searchText.value) { if (searchText.value) {
if (isIgnoreCase.value) { if (isIgnoreCase.value) {
currentPageFilesInfo.forEach((item: any) => { currentPageFilesInfo.forEach((item: any) => {
@ -2455,8 +2470,8 @@ async function handleFolderBatchDownload (item: any) {
prefix: `/${item.key.replace(/^\/+|\/+$/, '')}/`, prefix: `/${item.key.replace(/^\/+|\/+$/, '')}/`,
marker: pagingMarker.value, marker: pagingMarker.value,
itemsPerPage: itemsPerPage.value, itemsPerPage: itemsPerPage.value,
customUrl: currentCustomUrl.value, customUrl: currentCustomDomain.value,
currentPage: currentPage.value, currentPage: currentPageNumber.value,
cancelToken: cancelToken.value, cancelToken: cancelToken.value,
cdnUrl: configMap.cdnUrl cdnUrl: configMap.cdnUrl
} }
@ -2488,7 +2503,7 @@ async function handleFolderBatchDownload (item: any) {
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(/^\/+|\/+$/, '')}` : item.fileName, fileName: [undefined, true].includes(manageStore.config.settings.isDownloadFolderKeepDirStructure) ? `/${item.key.replace(/^\/+|\/+$/, '')}` : item.fileName,
customUrl: currentCustomUrl.value, customUrl: currentCustomDomain.value,
downloadUrl: item.downloadUrl, downloadUrl: item.downloadUrl,
githubUrl: item.url, githubUrl: item.url,
githubPrivate: configMap.bucketConfig.private githubPrivate: configMap.bucketConfig.private
@ -2531,7 +2546,7 @@ async function handleBatchDownload () {
region: configMap.bucketConfig.Location, region: configMap.bucketConfig.Location,
key: item.key, key: item.key,
fileName: manageStore.config.settings.isDownloadFileKeepDirStructure ? `/${item.key.replace(/^\/+|\/+$/, '')}` : item.fileName, fileName: manageStore.config.settings.isDownloadFileKeepDirStructure ? `/${item.key.replace(/^\/+|\/+$/, '')}` : item.fileName,
customUrl: currentCustomUrl.value, customUrl: currentCustomDomain.value,
downloadUrl: item.downloadUrl, downloadUrl: item.downloadUrl,
githubUrl: item.url, githubUrl: item.url,
githubPrivate: configMap.bucketConfig.private githubPrivate: configMap.bucketConfig.private
@ -2589,7 +2604,7 @@ function handleCreateFolder () {
bucketName: configMap.bucketName, bucketName: configMap.bucketName,
region: configMap.bucketConfig.Location, region: configMap.bucketConfig.Location,
key: currentPrefix.value.slice(1) + formatedPath + '/', key: currentPrefix.value.slice(1) + formatedPath + '/',
githubBranch: currentCustomUrl.value githubBranch: currentCustomDomain.value
} }
const res = await ipcRenderer.invoke('createBucketFolder', configMap.alias, param) const res = await ipcRenderer.invoke('createBucketFolder', configMap.alias, param)
if (res) { if (res) {
@ -2690,7 +2705,7 @@ async function BatchRename () {
region: configMap.bucketConfig.Location, region: configMap.bucketConfig.Location,
oldKey: item.key, oldKey: item.key,
newKey: (item.key.slice(0, item.key.lastIndexOf('/') + 1) + item.newName).replaceAll('//', '/'), newKey: (item.key.slice(0, item.key.lastIndexOf('/') + 1) + item.newName).replaceAll('//', '/'),
customUrl: currentCustomUrl.value customUrl: currentCustomDomain.value
} }
ipcRenderer.invoke('renameBucketFile', configMap.alias, param).then((res: any) => { ipcRenderer.invoke('renameBucketFile', configMap.alias, param).then((res: any) => {
if (res) { if (res) {
@ -2710,7 +2725,7 @@ async function BatchRename () {
item.fileName = item.newName item.fileName = item.newName
} }
item.key = (item.key.slice(0, item.key.lastIndexOf('/') + 1) + item.newName).replaceAll('//', '/') item.key = (item.key.slice(0, item.key.lastIndexOf('/') + 1) + item.newName).replaceAll('//', '/')
item.url = `${currentCustomUrl.value}${currentPrefix.value}${item.newName}` item.url = `${currentCustomDomain.value}${currentPrefix.value}${item.newName}`
item.formatedTime = new Date().toLocaleString() item.formatedTime = new Date().toLocaleString()
if (!paging.value) { if (!paging.value) {
const table = fileCacheDbInstance.table(currentPicBedName.value) const table = fileCacheDbInstance.table(currentPicBedName.value)
@ -2726,7 +2741,7 @@ async function BatchRename () {
i.fileName = item.newName i.fileName = item.newName
} }
i.key = (i.key.slice(0, i.key.lastIndexOf('/') + 1) + item.newName).replaceAll('//', '/') i.key = (i.key.slice(0, i.key.lastIndexOf('/') + 1) + item.newName).replaceAll('//', '/')
i.url = `${currentCustomUrl.value}${currentPrefix.value}${item.newName}` i.url = `${currentCustomDomain.value}${currentPrefix.value}${item.newName}`
i.formatedTime = new Date().toLocaleString() i.formatedTime = new Date().toLocaleString()
} }
}) })
@ -2832,8 +2847,8 @@ async function getBucketFileListBackStage () {
prefix: currentPrefix.value, prefix: currentPrefix.value,
marker: pagingMarker.value, marker: pagingMarker.value,
itemsPerPage: itemsPerPage.value, itemsPerPage: itemsPerPage.value,
customUrl: currentCustomUrl.value, customUrl: currentCustomDomain.value,
currentPage: currentPage.value, currentPage: currentPageNumber.value,
cancelToken: cancelToken.value, cancelToken: cancelToken.value,
cdnUrl: configMap.cdnUrl cdnUrl: configMap.cdnUrl
} as IStringKeyMap } as IStringKeyMap
@ -2904,8 +2919,8 @@ async function getBucketFileList () {
prefix: currentPrefix.value, prefix: currentPrefix.value,
marker: pagingMarker.value, marker: pagingMarker.value,
itemsPerPage: itemsPerPage.value, itemsPerPage: itemsPerPage.value,
customUrl: currentCustomUrl.value, customUrl: currentCustomDomain.value,
currentPage: currentPage.value currentPage: currentPageNumber.value
} }
const res = await ipcRenderer.invoke('getBucketFileList', configMap.alias, param) const res = await ipcRenderer.invoke('getBucketFileList', configMap.alias, param)
return res return res
@ -2931,7 +2946,7 @@ function handleBatchDeleteInfo () {
region: configMap.bucketConfig.Location, region: configMap.bucketConfig.Location,
key: copyedSelectedItems[i].key, key: copyedSelectedItems[i].key,
DeleteHash: copyedSelectedItems[i].sha, DeleteHash: copyedSelectedItems[i].sha,
githubBranch: currentCustomUrl.value githubBranch: currentCustomDomain.value
} }
res = await ipcRenderer.invoke('deleteBucketFile', configMap.alias, param) res = await ipcRenderer.invoke('deleteBucketFile', configMap.alias, param)
} else { } else {
@ -2940,7 +2955,7 @@ function handleBatchDeleteInfo () {
bucketName: configMap.bucketName, bucketName: configMap.bucketName,
region: configMap.bucketConfig.Location, region: configMap.bucketConfig.Location,
key: copyedSelectedItems[i].key, key: copyedSelectedItems[i].key,
githubBranch: currentCustomUrl.value, githubBranch: currentCustomDomain.value,
DeleteHash: copyedSelectedItems[i].sha DeleteHash: copyedSelectedItems[i].sha
} }
res = await ipcRenderer.invoke('deleteBucketFolder', configMap.alias, param) res = await ipcRenderer.invoke('deleteBucketFolder', configMap.alias, param)
@ -2999,7 +3014,7 @@ function handleDeleteFile (item: any) {
region: configMap.bucketConfig.Location, region: configMap.bucketConfig.Location,
key: item.key, key: item.key,
DeleteHash: item.sha, DeleteHash: item.sha,
githubBranch: currentCustomUrl.value githubBranch: currentCustomDomain.value
} }
res = await ipcRenderer.invoke('deleteBucketFile', configMap.alias, param) res = await ipcRenderer.invoke('deleteBucketFile', configMap.alias, param)
} else { } else {
@ -3009,7 +3024,7 @@ function handleDeleteFile (item: any) {
region: configMap.bucketConfig.Location, region: configMap.bucketConfig.Location,
key: item.key, key: item.key,
DeleteHash: item.sha, DeleteHash: item.sha,
githubBranch: currentCustomUrl.value githubBranch: currentCustomDomain.value
} }
ElNotification.info({ ElNotification.info({
title: $T('MANAGE_BUCKET_DELETE_ERROR_MSG_TITLE'), title: $T('MANAGE_BUCKET_DELETE_ERROR_MSG_TITLE'),
@ -3066,7 +3081,7 @@ function singleRename () {
region: configMap.bucketConfig.Location, region: configMap.bucketConfig.Location,
oldKey: item.key, oldKey: item.key,
newKey: (item.key.slice(0, item.key.lastIndexOf('/') + 1) + itemToBeRenamed.value.newName).replaceAll('//', '/'), newKey: (item.key.slice(0, item.key.lastIndexOf('/') + 1) + itemToBeRenamed.value.newName).replaceAll('//', '/'),
customUrl: currentCustomUrl.value customUrl: currentCustomDomain.value
} }
ipcRenderer.invoke('renameBucketFile', configMap.alias, param).then((res: any) => { ipcRenderer.invoke('renameBucketFile', configMap.alias, param).then((res: any) => {
if (res) { if (res) {
@ -3084,7 +3099,7 @@ function singleRename () {
item.fileName = itemToBeRenamed.value.newName item.fileName = itemToBeRenamed.value.newName
} }
item.key = (item.key.slice(0, item.key.lastIndexOf('/') + 1) + itemToBeRenamed.value.newName).replaceAll('//', '/') item.key = (item.key.slice(0, item.key.lastIndexOf('/') + 1) + itemToBeRenamed.value.newName).replaceAll('//', '/')
item.url = `${currentCustomUrl.value}${currentPrefix.value}${itemToBeRenamed.value.newName}` item.url = `${currentCustomDomain.value}${currentPrefix.value}${itemToBeRenamed.value.newName}`
item.formatedTime = new Date().toLocaleString() item.formatedTime = new Date().toLocaleString()
if (!paging.value) { if (!paging.value) {
const table = fileCacheDbInstance.table(currentPicBedName.value) const table = fileCacheDbInstance.table(currentPicBedName.value)
@ -3100,7 +3115,7 @@ function singleRename () {
i.fileName = itemToBeRenamed.value.newName i.fileName = itemToBeRenamed.value.newName
} }
i.key = (i.key.slice(0, i.key.lastIndexOf('/') + 1) + itemToBeRenamed.value.newName).replaceAll('//', '/') i.key = (i.key.slice(0, i.key.lastIndexOf('/') + 1) + itemToBeRenamed.value.newName).replaceAll('//', '/')
i.url = `${currentCustomUrl.value}${currentPrefix.value}${itemToBeRenamed.value.newName}` i.url = `${currentCustomDomain.value}${currentPrefix.value}${itemToBeRenamed.value.newName}`
i.formatedTime = new Date().toLocaleString() i.formatedTime = new Date().toLocaleString()
} }
}) })
@ -3119,7 +3134,7 @@ async function getPreSignedUrl (item: any) {
bucketName: configMap.bucketName, bucketName: configMap.bucketName,
region: configMap.bucketConfig.Location, region: configMap.bucketConfig.Location,
key: item.key, key: item.key,
customUrl: currentCustomUrl.value, customUrl: currentCustomDomain.value,
expires: manageStore.config.settings.PreSignedExpire, expires: manageStore.config.settings.PreSignedExpire,
githubPrivate: configMap.bucketConfig.private, githubPrivate: configMap.bucketConfig.private,
rawUrl: item.url rawUrl: item.url
@ -3137,7 +3152,7 @@ function getTableKeyOfDb () {
let tableKey let tableKey
if (currentPicBedName.value === 'github') { if (currentPicBedName.value === 'github') {
// customUrl is branch // customUrl is branch
tableKey = `${configMap.alias}@${configMap.bucketConfig.githubUsername}@${configMap.bucketName}@${currentCustomUrl.value}@${currentPrefix.value}` tableKey = `${configMap.alias}@${configMap.bucketConfig.githubUsername}@${configMap.bucketName}@${currentCustomDomain.value}@${currentPrefix.value}`
} else { } else {
tableKey = `${configMap.alias}@${configMap.bucketName}@${currentPrefix.value}` tableKey = `${configMap.alias}@${configMap.bucketName}@${currentPrefix.value}`
} }
@ -3525,7 +3540,7 @@ const columns: Column<any>[] = [
width: 30, width: 30,
cellRenderer: ({ rowData: item }) => ( cellRenderer: ({ rowData: item }) => (
item.match || !searchText.value item.match || !searchText.value
? item.isDir || !showRenameFileIcon.value ? item.isDir || !isShowRenameFileIcon.value
? item.isDir ? item.isDir
? <ElIcon ? <ElIcon
size="20" size="20"
@ -3606,7 +3621,7 @@ const columns: Column<any>[] = [
> >
Custom Custom
</ElDropdownItem> </ElDropdownItem>
{ showPresignedUrl.value { isShowPresignedUrl.value
? <ElDropdownItem ? <ElDropdownItem
onClick={async () => { onClick={async () => {
const res = await getPreSignedUrl(item) const res = await getPreSignedUrl(item)
@ -3712,10 +3727,10 @@ const columns: Column<any>[] = [
onBeforeMount(async () => { onBeforeMount(async () => {
await manageStore.refreshConfig() await manageStore.refreshConfig()
showLoadingPage.value = true isShowLoadingPage.value = true
await initCustomUrlList() await initCustomDomainList()
await resetParam(false) await resetParam(false)
showLoadingPage.value = false isShowLoadingPage.value = false
document.addEventListener('keydown', handleDetectShiftKey) document.addEventListener('keydown', handleDetectShiftKey)
document.addEventListener('keyup', handleDetectShiftKey) document.addEventListener('keyup', handleDetectShiftKey)
}) })

View File

@ -134,7 +134,7 @@ export interface IHTTPProxy {
} }
export const formatHttpProxy = (proxy: string | undefined, type: 'object' | 'string'): IHTTPProxy | undefined | string => { export const formatHttpProxy = (proxy: string | undefined, type: 'object' | 'string'): IHTTPProxy | undefined | string => {
if (proxy === undefined || proxy === '') return undefined if (!proxy) return undefined
if (/^https?:\/\//.test(proxy)) { if (/^https?:\/\//.test(proxy)) {
const { protocol, hostname, port } = new URL(proxy) const { protocol, hostname, port } = new URL(proxy)
return type === 'string' return type === 'string'
@ -144,7 +144,7 @@ export const formatHttpProxy = (proxy: string | undefined, type: 'object' | 'str
port: Number(port), port: Number(port),
protocol: protocol.slice(0, -1) protocol: protocol.slice(0, -1)
} }
} else { }
const [host, port] = proxy.split(':') const [host, port] = proxy.split(':')
return type === 'string' return type === 'string'
? `http://${host}:${port}` ? `http://${host}:${port}`
@ -153,7 +153,6 @@ export const formatHttpProxy = (proxy: string | undefined, type: 'object' | 'str
port: port ? Number(port) : 80, port: port ? Number(port) : 80,
protocol: 'http' protocol: 'http'
} }
}
} }
export const svg = ` export const svg = `

220
yarn.lock
View File

@ -2775,6 +2775,56 @@
resolved "https://registry.npmjs.org/@sindresorhus/is/-/is-5.3.0.tgz#0ec9264cf54a527671d990eb874e030b55b70dcc" resolved "https://registry.npmjs.org/@sindresorhus/is/-/is-5.3.0.tgz#0ec9264cf54a527671d990eb874e030b55b70dcc"
integrity sha512-CX6t4SYQ37lzxicAqsBtxA3OseeoVrh9cSJ5PFYam0GksYlupRfy1A+Q4aYD3zvcfECLc0zO2u+ZnR2UYKvCrw== integrity sha512-CX6t4SYQ37lzxicAqsBtxA3OseeoVrh9cSJ5PFYam0GksYlupRfy1A+Q4aYD3zvcfECLc0zO2u+ZnR2UYKvCrw==
"@smithy/abort-controller@^2.0.2":
version "2.0.2"
resolved "https://registry.npmjs.org/@smithy/abort-controller/-/abort-controller-2.0.2.tgz#e2188247a1723b58d60b0803f3ba24b76a714413"
integrity sha512-ln5Cob0mksym62sLr7NiPOSqJ0jKao4qjfcNLDdgINM1lQI12hXrZBlKdPHbXJqpKhKiECDgonMoqCM8bigq4g==
dependencies:
"@smithy/types" "^2.1.0"
tslib "^2.5.0"
"@smithy/node-http-handler@^2.0.2":
version "2.0.2"
resolved "https://registry.npmjs.org/@smithy/node-http-handler/-/node-http-handler-2.0.2.tgz#3c4d43352f5412cdb23ca075327ac997f5b03df2"
integrity sha512-lpZjmtmyZqSAtMPsbrLhb7XoAQ2kAHeuLY/csW6I2k+QyFvOk7cZeQsqEngWmZ9SJaeYiDCBINxAIM61i5WGLw==
dependencies:
"@smithy/abort-controller" "^2.0.2"
"@smithy/protocol-http" "^2.0.2"
"@smithy/querystring-builder" "^2.0.2"
"@smithy/types" "^2.1.0"
tslib "^2.5.0"
"@smithy/protocol-http@^2.0.2":
version "2.0.2"
resolved "https://registry.npmjs.org/@smithy/protocol-http/-/protocol-http-2.0.2.tgz#ec3d45a650cb5554b6aba1c38768f51fc9cf79b5"
integrity sha512-qWu8g1FUy+m36KpO1sREJSF7BaLmjw9AqOuwxLVVSdYz+nUQjc9tFAZ9LB6jJXKdsZFSjfkjHJBbhD78QdE7Rw==
dependencies:
"@smithy/types" "^2.1.0"
tslib "^2.5.0"
"@smithy/querystring-builder@^2.0.2":
version "2.0.2"
resolved "https://registry.npmjs.org/@smithy/querystring-builder/-/querystring-builder-2.0.2.tgz#67a1bb503037c4666b5df56ad4b9e10bc525f568"
integrity sha512-H99LOMWEssfwqkOoTs4Y12UiZ7CTGQSX5Nrx5UkYgRbUEpC1GnnaprHiYrqclC58/xr4K76aNchdPyioxewMzA==
dependencies:
"@smithy/types" "^2.1.0"
"@smithy/util-uri-escape" "^2.0.0"
tslib "^2.5.0"
"@smithy/types@^2.1.0":
version "2.1.0"
resolved "https://registry.npmjs.org/@smithy/types/-/types-2.1.0.tgz#67fd47c25bbb0fd818951891bf7bcf19a8ee2fe6"
integrity sha512-KLsCsqxX0j2l99iP8s0f7LBlcsp7a7ceXGn0LPYPyVOsqmIKvSaPQajq0YevlL4T9Bm+DtcyXfBTbtBcLX1I7A==
dependencies:
tslib "^2.5.0"
"@smithy/util-uri-escape@^2.0.0":
version "2.0.0"
resolved "https://registry.npmjs.org/@smithy/util-uri-escape/-/util-uri-escape-2.0.0.tgz#19955b1a0f517a87ae77ac729e0e411963dfda95"
integrity sha512-ebkxsqinSdEooQduuk9CbKcI+wheijxEb3utGXkCoYQkJnwTnLbH1JXGimJtUkQwNQbsbuYwG2+aFVyZf5TLaw==
dependencies:
tslib "^2.5.0"
"@soda/friendly-errors-webpack-plugin@^1.8.0", "@soda/friendly-errors-webpack-plugin@^1.8.1": "@soda/friendly-errors-webpack-plugin@^1.8.0", "@soda/friendly-errors-webpack-plugin@^1.8.1":
version "1.8.1" version "1.8.1"
resolved "https://registry.npmjs.org/@soda/friendly-errors-webpack-plugin/-/friendly-errors-webpack-plugin-1.8.1.tgz#4d4fbb1108993aaa362116247c3d18188a2c6c85" resolved "https://registry.npmjs.org/@soda/friendly-errors-webpack-plugin/-/friendly-errors-webpack-plugin-1.8.1.tgz#4d4fbb1108993aaa362116247c3d18188a2c6c85"
@ -4499,27 +4549,6 @@ autoprefixer@^10.2.4:
picocolors "^1.0.0" picocolors "^1.0.0"
postcss-value-parser "^4.2.0" postcss-value-parser "^4.2.0"
available-typed-arrays@^1.0.5:
version "1.0.5"
resolved "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz#92f95616501069d07d10edb2fc37d3e1c65123b7"
integrity sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==
aws-sdk@^2.1373.0:
version "2.1373.0"
resolved "https://registry.npmjs.org/aws-sdk/-/aws-sdk-2.1373.0.tgz#e1e7d5b01498de48dd0cd8c7849c1766c115f13d"
integrity sha512-3/P79VU2VVeiof25bn8TSepEhWCRhwuQGYoEWX/2pApQRJAY+w/3JFVKHjbAe3NYEEBNeiAE6PQ9DqWz5Pp+Lw==
dependencies:
buffer "4.9.2"
events "1.1.1"
ieee754 "1.1.13"
jmespath "0.16.0"
querystring "0.2.0"
sax "1.2.1"
url "0.10.3"
util "^0.12.4"
uuid "8.0.0"
xml2js "0.5.0"
aws-sign2@~0.7.0: aws-sign2@~0.7.0:
version "0.7.0" version "0.7.0"
resolved "https://registry.npmmirror.com/aws-sign2/-/aws-sign2-0.7.0.tgz#b46e890934a9591f2d2f6f86d7e6a9f1b3fe76a8" resolved "https://registry.npmmirror.com/aws-sign2/-/aws-sign2-0.7.0.tgz#b46e890934a9591f2d2f6f86d7e6a9f1b3fe76a8"
@ -4832,15 +4861,6 @@ buffer-from@^1.0.0:
resolved "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz#2b146a6fd72e80b4f55d255f35ed59a3a9a41bd5" resolved "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz#2b146a6fd72e80b4f55d255f35ed59a3a9a41bd5"
integrity sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ== integrity sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==
buffer@4.9.2:
version "4.9.2"
resolved "https://registry.npmjs.org/buffer/-/buffer-4.9.2.tgz#230ead344002988644841ab0244af8c44bbe3ef8"
integrity sha512-xq+q3SRMOxGivLhBNaUdC64hDTQwejJ+H0T/NB1XMtTVEwNTrfFF3gAxiyW0Bu/xWEGhjVKgUcMhCrUy2+uCWg==
dependencies:
base64-js "^1.0.2"
ieee754 "^1.1.4"
isarray "^1.0.0"
buffer@5.6.0: buffer@5.6.0:
version "5.6.0" version "5.6.0"
resolved "https://registry.npmjs.org/buffer/-/buffer-5.6.0.tgz#a31749dc7d81d84db08abf937b6b8c4033f62786" resolved "https://registry.npmjs.org/buffer/-/buffer-5.6.0.tgz#a31749dc7d81d84db08abf937b6b8c4033f62786"
@ -7213,11 +7233,6 @@ eventemitter3@^4.0.0:
resolved "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz#2de9b68f6528d5644ef5c59526a1b4a07306169f" resolved "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz#2de9b68f6528d5644ef5c59526a1b4a07306169f"
integrity sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw== integrity sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==
events@1.1.1:
version "1.1.1"
resolved "https://registry.npmjs.org/events/-/events-1.1.1.tgz#9ebdb7635ad099c70dcc4c2a1f5004288e8bd924"
integrity sha512-kEcvvCBByWXGnZy6JUlgAp2gBIUjfCAV6P6TgT1/aaQKcmuAEC4OZTV1I4EWQLz2gxZw76atuVyvHhTxvi0Flw==
events@3.3.0, events@^3.2.0: events@3.3.0, events@^3.2.0:
version "3.3.0" version "3.3.0"
resolved "https://registry.npmjs.org/events/-/events-3.3.0.tgz#31a95ad0a924e2d2c419a813aeb2c4e878ea7400" resolved "https://registry.npmjs.org/events/-/events-3.3.0.tgz#31a95ad0a924e2d2c419a813aeb2c4e878ea7400"
@ -7663,13 +7678,6 @@ follow-redirects@^1.14.8, follow-redirects@^1.15.0, follow-redirects@^1.15.1:
resolved "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz#b460864144ba63f2681096f274c4e57026da2c13" resolved "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz#b460864144ba63f2681096f274c4e57026da2c13"
integrity sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA== integrity sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==
for-each@^0.3.3:
version "0.3.3"
resolved "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz#69b447e88a0a5d32c3e7084f3f1710034b21376e"
integrity sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==
dependencies:
is-callable "^1.1.3"
forever-agent@~0.6.1: forever-agent@~0.6.1:
version "0.6.1" version "0.6.1"
resolved "https://registry.npmmirror.com/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91" resolved "https://registry.npmmirror.com/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91"
@ -7870,15 +7878,6 @@ get-intrinsic@^1.0.2, get-intrinsic@^1.1.0, get-intrinsic@^1.1.1:
has "^1.0.3" has "^1.0.3"
has-symbols "^1.0.1" has-symbols "^1.0.1"
get-intrinsic@^1.1.3:
version "1.2.0"
resolved "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.0.tgz#7ad1dc0535f3a2904bba075772763e5051f6d05f"
integrity sha512-L049y6nFOuom5wGyRc3/gdTLO94dySVKRACj1RmJZBQXlbTMhtNIgkWkUHq+jYmZvKf14EW1EoJnnjbmoHij0Q==
dependencies:
function-bind "^1.1.1"
has "^1.0.3"
has-symbols "^1.0.3"
get-pkg-repo@^4.0.0: get-pkg-repo@^4.0.0:
version "4.2.1" version "4.2.1"
resolved "https://registry.npmjs.org/get-pkg-repo/-/get-pkg-repo-4.2.1.tgz#75973e1c8050c73f48190c52047c4cee3acbf385" resolved "https://registry.npmjs.org/get-pkg-repo/-/get-pkg-repo-4.2.1.tgz#75973e1c8050c73f48190c52047c4cee3acbf385"
@ -8165,13 +8164,6 @@ globby@^11.0.3:
merge2 "^1.3.0" merge2 "^1.3.0"
slash "^3.0.0" slash "^3.0.0"
gopd@^1.0.1:
version "1.0.1"
resolved "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz#29ff76de69dac7489b7c0918a5788e56477c332c"
integrity sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==
dependencies:
get-intrinsic "^1.1.3"
got@^11.8.5: got@^11.8.5:
version "11.8.6" version "11.8.6"
resolved "https://registry.npmmirror.com/got/-/got-11.8.6.tgz#276e827ead8772eddbcfc97170590b841823233a" resolved "https://registry.npmmirror.com/got/-/got-11.8.6.tgz#276e827ead8772eddbcfc97170590b841823233a"
@ -8343,11 +8335,6 @@ has-symbols@^1.0.1, has-symbols@^1.0.2:
resolved "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.2.tgz#165d3070c00309752a1236a479331e3ac56f1423" resolved "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.2.tgz#165d3070c00309752a1236a479331e3ac56f1423"
integrity sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw== integrity sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw==
has-symbols@^1.0.3:
version "1.0.3"
resolved "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz#bb7b2c4349251dce87b125f7bdf874aa7c8b39f8"
integrity sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==
has-to-string-tag-x@^1.2.0: has-to-string-tag-x@^1.2.0:
version "1.4.1" version "1.4.1"
resolved "https://registry.npmjs.org/has-to-string-tag-x/-/has-to-string-tag-x-1.4.1.tgz#a045ab383d7b4b2012a00148ab0aa5f290044d4d" resolved "https://registry.npmjs.org/has-to-string-tag-x/-/has-to-string-tag-x-1.4.1.tgz#a045ab383d7b4b2012a00148ab0aa5f290044d4d"
@ -8712,11 +8699,6 @@ icss-utils@^5.0.0, icss-utils@^5.1.0:
resolved "https://registry.npmjs.org/icss-utils/-/icss-utils-5.1.0.tgz#c6be6858abd013d768e98366ae47e25d5887b1ae" resolved "https://registry.npmjs.org/icss-utils/-/icss-utils-5.1.0.tgz#c6be6858abd013d768e98366ae47e25d5887b1ae"
integrity sha512-soFhflCVWLfRNOPU3iv5Z9VUdT44xFRbzjLsEzSr5AQmgqPMTHdU3PMT1Cf1ssx8fLNJDA1juftYl+PUcv3MqA== integrity sha512-soFhflCVWLfRNOPU3iv5Z9VUdT44xFRbzjLsEzSr5AQmgqPMTHdU3PMT1Cf1ssx8fLNJDA1juftYl+PUcv3MqA==
ieee754@1.1.13:
version "1.1.13"
resolved "https://registry.npmjs.org/ieee754/-/ieee754-1.1.13.tgz#ec168558e95aa181fd87d37f55c32bbcb6708b84"
integrity sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg==
ieee754@^1.1.13, ieee754@^1.1.4: ieee754@^1.1.13, ieee754@^1.1.4:
version "1.2.1" version "1.2.1"
resolved "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz#8eb7a10a63fff25d15a57b001586d177d1b0d352" resolved "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz#8eb7a10a63fff25d15a57b001586d177d1b0d352"
@ -8864,14 +8846,6 @@ ipaddr.js@^2.0.1:
resolved "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-2.0.1.tgz#eca256a7a877e917aeb368b0a7497ddf42ef81c0" resolved "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-2.0.1.tgz#eca256a7a877e917aeb368b0a7497ddf42ef81c0"
integrity sha512-1qTgH9NG+IIJ4yfKs2e6Pp1bZg8wbDbKHT21HrLIeYBTRLgMYKnMTPAuI3Lcs61nfx5h1xlXnbJtH1kX5/d/ng== integrity sha512-1qTgH9NG+IIJ4yfKs2e6Pp1bZg8wbDbKHT21HrLIeYBTRLgMYKnMTPAuI3Lcs61nfx5h1xlXnbJtH1kX5/d/ng==
is-arguments@^1.0.4:
version "1.1.1"
resolved "https://registry.npmjs.org/is-arguments/-/is-arguments-1.1.1.tgz#15b3f88fda01f2a97fec84ca761a560f123efa9b"
integrity sha512-8Q7EARjzEnKpt/PCD7e1cgUS0a6X8u5tdSiMqXhojOdoV9TsMsiO+9VLC5vAmO8N7/GmXn7yjR8qnA6bVAEzfA==
dependencies:
call-bind "^1.0.2"
has-tostringtag "^1.0.0"
is-arrayish@^0.2.1: is-arrayish@^0.2.1:
version "0.2.1" version "0.2.1"
resolved "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" resolved "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d"
@ -8909,11 +8883,6 @@ is-buffer@~1.1.6:
resolved "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be" resolved "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be"
integrity sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w== integrity sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==
is-callable@^1.1.3:
version "1.2.7"
resolved "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz#3bc2a85ea742d9e36205dcacdd72ca1fdc51b055"
integrity sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==
is-callable@^1.1.4, is-callable@^1.2.4: is-callable@^1.1.4, is-callable@^1.2.4:
version "1.2.4" version "1.2.4"
resolved "https://registry.npmjs.org/is-callable/-/is-callable-1.2.4.tgz#47301d58dd0259407865547853df6d61fe471945" resolved "https://registry.npmjs.org/is-callable/-/is-callable-1.2.4.tgz#47301d58dd0259407865547853df6d61fe471945"
@ -9015,13 +8984,6 @@ is-function@^1.0.1:
resolved "https://registry.npmjs.org/is-function/-/is-function-1.0.2.tgz#4f097f30abf6efadac9833b17ca5dc03f8144e08" resolved "https://registry.npmjs.org/is-function/-/is-function-1.0.2.tgz#4f097f30abf6efadac9833b17ca5dc03f8144e08"
integrity sha512-lw7DUp0aWXYg+CBCN+JKkcE0Q2RayZnSvnZBlwgxHBQhqt5pZNVy4Ri7H9GmmXkdu7LUthszM+Tor1u/2iBcpQ== integrity sha512-lw7DUp0aWXYg+CBCN+JKkcE0Q2RayZnSvnZBlwgxHBQhqt5pZNVy4Ri7H9GmmXkdu7LUthszM+Tor1u/2iBcpQ==
is-generator-function@^1.0.7:
version "1.0.10"
resolved "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.0.10.tgz#f1558baf1ac17e0deea7c0415c438351ff2b3c72"
integrity sha512-jsEjy9l3yiXEQ+PsXdmBwEPcOxaXWLspKdplFUVI9vq1iZgIekeC0L167qeu86czQaxed3q/Uzuw0swL0irL8A==
dependencies:
has-tostringtag "^1.0.0"
is-glob@^4.0.0, is-glob@^4.0.1, is-glob@^4.0.3, is-glob@~4.0.1: is-glob@^4.0.0, is-glob@^4.0.1, is-glob@^4.0.3, is-glob@~4.0.1:
version "4.0.3" version "4.0.3"
resolved "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz#64f61e42cbbb2eec2071a9dac0b28ba1e65d5084" resolved "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz#64f61e42cbbb2eec2071a9dac0b28ba1e65d5084"
@ -9179,17 +9141,6 @@ is-type-of@^1.4.0:
is-class-hotfix "~0.0.6" is-class-hotfix "~0.0.6"
isstream "~0.1.2" isstream "~0.1.2"
is-typed-array@^1.1.10, is-typed-array@^1.1.3:
version "1.1.10"
resolved "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.10.tgz#36a5b5cb4189b575d1a3e4b08536bfb485801e3f"
integrity sha512-PJqgEHiWZvMpaFZ3uTc8kHPM4+4ADTlDniuQL7cU/UDA0Ql7F70yGfHph3cLNe+c9toaigv+DFzTJKhc2CtO6A==
dependencies:
available-typed-arrays "^1.0.5"
call-bind "^1.0.2"
for-each "^0.3.3"
gopd "^1.0.1"
has-tostringtag "^1.0.0"
is-typedarray@^1.0.0, is-typedarray@~1.0.0: is-typedarray@^1.0.0, is-typedarray@~1.0.0:
version "1.0.0" version "1.0.0"
resolved "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a" resolved "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a"
@ -9234,7 +9185,7 @@ isarray@0.0.1:
resolved "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz#8a18acfca9a8f4177e09abfc6038939b05d1eedf" resolved "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz#8a18acfca9a8f4177e09abfc6038939b05d1eedf"
integrity sha512-D2S+3GLxWH+uhrNEcoh/fnmYeP8E8/zHl644d/jdA0g2uyXvy3sb0qxotE+ne0LtccHknQzWwZEzhak7oJ0COQ== integrity sha512-D2S+3GLxWH+uhrNEcoh/fnmYeP8E8/zHl644d/jdA0g2uyXvy3sb0qxotE+ne0LtccHknQzWwZEzhak7oJ0COQ==
isarray@^1.0.0, isarray@~1.0.0: isarray@~1.0.0:
version "1.0.0" version "1.0.0"
resolved "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" resolved "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11"
integrity sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE= integrity sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=
@ -9307,11 +9258,6 @@ jest-worker@^28.0.2:
merge-stream "^2.0.0" merge-stream "^2.0.0"
supports-color "^8.0.0" supports-color "^8.0.0"
jmespath@0.16.0:
version "0.16.0"
resolved "https://registry.npmjs.org/jmespath/-/jmespath-0.16.0.tgz#b15b0a85dfd4d930d43e69ed605943c802785076"
integrity sha512-9FzQjJ7MATs1tSpnco1K6ayiYE3figslrXA72G2HQ/n76RzvYlofyi5QM+iX4YRs/pu3yzxlVQSST23+dMDknw==
joi@^17.4.0: joi@^17.4.0:
version "17.7.0" version "17.7.0"
resolved "https://registry.npmjs.org/joi/-/joi-17.7.0.tgz#591a33b1fe1aca2bc27f290bcad9b9c1c570a6b3" resolved "https://registry.npmjs.org/joi/-/joi-17.7.0.tgz#591a33b1fe1aca2bc27f290bcad9b9c1c570a6b3"
@ -11594,11 +11540,6 @@ pump@^3.0.0:
end-of-stream "^1.1.0" end-of-stream "^1.1.0"
once "^1.3.1" once "^1.3.1"
punycode@1.3.2:
version "1.3.2"
resolved "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz#9653a036fb7c1ee42342f2325cceefea3926c48d"
integrity sha512-RofWgt/7fL5wP1Y7fxE7/EmTLzQVnB0ycyibJ0OOHIlJqTNzglYFxVwETOcIoJqJmpDXJ9xImDv+Fq34F/d4Dw==
punycode@^2.1.0: punycode@^2.1.0:
version "2.1.1" version "2.1.1"
resolved "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" resolved "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec"
@ -11681,11 +11622,6 @@ query-string@^5.0.1:
object-assign "^4.1.0" object-assign "^4.1.0"
strict-uri-encode "^1.0.0" strict-uri-encode "^1.0.0"
querystring@0.2.0:
version "0.2.0"
resolved "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz#b209849203bb25df820da756e747005878521620"
integrity sha512-X/xY82scca2tau62i9mDyU9K+I+djTMUsvwf7xnUX5GLvVzgJybOJf4Y6o9Zx3oJK/LSXg5tTZBjwzqVPaPO2g==
querystringify@^2.1.1: querystringify@^2.1.1:
version "2.2.0" version "2.2.0"
resolved "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz#3345941b4153cb9d082d8eee4cda2016a9aef7f6" resolved "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz#3345941b4153cb9d082d8eee4cda2016a9aef7f6"
@ -12272,11 +12208,6 @@ sanitize-filename@^1.6.3:
dependencies: dependencies:
truncate-utf8-bytes "^1.0.0" truncate-utf8-bytes "^1.0.0"
sax@1.2.1:
version "1.2.1"
resolved "https://registry.npmjs.org/sax/-/sax-1.2.1.tgz#7b8e656190b228e81a66aea748480d828cd2d37a"
integrity sha512-8I2a3LovHTOpm7NV5yOyO8IHqgVsfK4+UuySrXU8YXkSRX7k6hCV9b3HrkKCr3nMpgj+0bmocaJJWpvp1oc7ZA==
sax@>=0.6.0, sax@^1.2.4, sax@~1.2.4: sax@>=0.6.0, sax@^1.2.4, sax@~1.2.4:
version "1.2.4" version "1.2.4"
resolved "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz#2816234e2378bddc4e5354fab5caa895df7100d9" resolved "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz#2816234e2378bddc4e5354fab5caa895df7100d9"
@ -13463,6 +13394,11 @@ tslib@^2.1.0, tslib@^2.3.1:
resolved "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz#e8a335add5ceae51aa261d32a490158ef042ef01" resolved "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz#e8a335add5ceae51aa261d32a490158ef042ef01"
integrity sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw== integrity sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==
tslib@^2.5.0:
version "2.6.1"
resolved "https://registry.npmjs.org/tslib/-/tslib-2.6.1.tgz#fd8c9a0ff42590b25703c0acb3de3d3f4ede0410"
integrity sha512-t0hLfiEKfMUoqhG+U1oid7Pva4bbDPHYfJNiB7BiIjRkj1pyC++4N3huJfqY6aRH6VTB0rvtzQwjM4K6qpfOig==
tsutils@^3.21.0: tsutils@^3.21.0:
version "3.21.0" version "3.21.0"
resolved "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz#b48717d394cea6c1e096983eed58e9d61715b623" resolved "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz#b48717d394cea6c1e096983eed58e9d61715b623"
@ -13735,14 +13671,6 @@ url-toolkit@^2.2.1:
resolved "https://registry.npmjs.org/url-toolkit/-/url-toolkit-2.2.5.tgz#58406b18e12c58803e14624df5e374f638b0f607" resolved "https://registry.npmjs.org/url-toolkit/-/url-toolkit-2.2.5.tgz#58406b18e12c58803e14624df5e374f638b0f607"
integrity sha512-mtN6xk+Nac+oyJ/PrI7tzfmomRVNFIWKUbG8jdYFt52hxbiReFAXIjYskvu64/dvuW71IcB7lV8l0HvZMac6Jg== integrity sha512-mtN6xk+Nac+oyJ/PrI7tzfmomRVNFIWKUbG8jdYFt52hxbiReFAXIjYskvu64/dvuW71IcB7lV8l0HvZMac6Jg==
url@0.10.3:
version "0.10.3"
resolved "https://registry.npmjs.org/url/-/url-0.10.3.tgz#021e4d9c7705f21bbf37d03ceb58767402774c64"
integrity sha512-hzSUW2q06EqL1gKM/a+obYHLIO6ct2hwPuviqTTOcfFVc61UbfJ2Q32+uGL/HCPxKqrdGB5QUwIe7UqlDgwsOQ==
dependencies:
punycode "1.3.2"
querystring "0.2.0"
urllib@^2.33.1, urllib@^2.34.1: urllib@^2.33.1, urllib@^2.34.1:
version "2.40.0" version "2.40.0"
resolved "https://registry.npmjs.org/urllib/-/urllib-2.40.0.tgz#c63d4425081908560d7e1c4dc651f7d723a3cf76" resolved "https://registry.npmjs.org/urllib/-/urllib-2.40.0.tgz#c63d4425081908560d7e1c4dc651f7d723a3cf76"
@ -13781,17 +13709,6 @@ util-deprecate@^1.0.1, util-deprecate@^1.0.2, util-deprecate@~1.0.1:
resolved "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" resolved "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf"
integrity sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8= integrity sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=
util@^0.12.4:
version "0.12.5"
resolved "https://registry.npmjs.org/util/-/util-0.12.5.tgz#5f17a6059b73db61a875668781a1c2b136bd6fbc"
integrity sha512-kZf/K6hEIrWHI6XqOFUiiMa+79wE/D8Q+NCNAWclkyg3b4d2k7s0QGepNjiABc+aR3N1PAyHL7p6UcLY6LmrnA==
dependencies:
inherits "^2.0.3"
is-arguments "^1.0.4"
is-generator-function "^1.0.7"
is-typed-array "^1.1.3"
which-typed-array "^1.1.2"
utila@~0.4: utila@~0.4:
version "0.4.0" version "0.4.0"
resolved "https://registry.npmjs.org/utila/-/utila-0.4.0.tgz#8a16a05d445657a3aea5eecc5b12a4fa5379772c" resolved "https://registry.npmjs.org/utila/-/utila-0.4.0.tgz#8a16a05d445657a3aea5eecc5b12a4fa5379772c"
@ -13824,11 +13741,6 @@ utils-merge@1.0.1:
resolved "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz#9f95710f50a267947b2ccc124741c1028427e713" resolved "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz#9f95710f50a267947b2ccc124741c1028427e713"
integrity sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM= integrity sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=
uuid@8.0.0:
version "8.0.0"
resolved "https://registry.npmjs.org/uuid/-/uuid-8.0.0.tgz#bc6ccf91b5ff0ac07bbcdbf1c7c4e150db4dbb6c"
integrity sha512-jOXGuXZAWdsTH7eZLtyXMqUb9EcWMGZNbL9YcGBJl4MH4nrxHmZJhEHvyLFrkxo+28uLb/NYRcStH48fnD0Vzw==
uuid@^3.3.2: uuid@^3.3.2:
version "3.4.0" version "3.4.0"
resolved "https://registry.npmmirror.com/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee" resolved "https://registry.npmmirror.com/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee"
@ -14265,18 +14177,6 @@ which-boxed-primitive@^1.0.2:
is-string "^1.0.5" is-string "^1.0.5"
is-symbol "^1.0.3" is-symbol "^1.0.3"
which-typed-array@^1.1.2:
version "1.1.9"
resolved "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.9.tgz#307cf898025848cf995e795e8423c7f337efbde6"
integrity sha512-w9c4xkx6mPidwp7180ckYWfMmvxpjlZuIudNtDf4N/tTAUB8VJbX25qZoAsrtGuYNnGw3pa0AXgbGKRB8/EceA==
dependencies:
available-typed-arrays "^1.0.5"
call-bind "^1.0.2"
for-each "^0.3.3"
gopd "^1.0.1"
has-tostringtag "^1.0.0"
is-typed-array "^1.1.10"
which@^1.2.14, which@^1.2.9: which@^1.2.14, which@^1.2.9:
version "1.3.1" version "1.3.1"
resolved "https://registry.npmjs.org/which/-/which-1.3.1.tgz#a45043d54f5805316da8d62f9f50918d3da70b0a" resolved "https://registry.npmjs.org/which/-/which-1.3.1.tgz#a45043d54f5805316da8d62f9f50918d3da70b0a"
@ -14380,14 +14280,6 @@ xml-name-validator@^4.0.0:
resolved "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-4.0.0.tgz#79a006e2e63149a8600f15430f0a4725d1524835" resolved "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-4.0.0.tgz#79a006e2e63149a8600f15430f0a4725d1524835"
integrity sha512-ICP2e+jsHvAj2E2lIHxa5tjXRlKDJo4IdvPvCXbXQGdzSfmSpNVyIKMvoZHjDY9DP0zV17iI85o90vRFXNccRw== integrity sha512-ICP2e+jsHvAj2E2lIHxa5tjXRlKDJo4IdvPvCXbXQGdzSfmSpNVyIKMvoZHjDY9DP0zV17iI85o90vRFXNccRw==
xml2js@0.5.0:
version "0.5.0"
resolved "https://registry.npmjs.org/xml2js/-/xml2js-0.5.0.tgz#d9440631fbb2ed800203fad106f2724f62c493b7"
integrity sha512-drPFnkQJik/O+uPKpqSgr22mpuFHqKdbS835iAQrUC73L2F5WkboIRd63ai/2Yg6I1jzifPFKH2NTK+cfglkIA==
dependencies:
sax ">=0.6.0"
xmlbuilder "~11.0.0"
xml2js@^0.4.16: xml2js@^0.4.16:
version "0.4.23" version "0.4.23"
resolved "https://registry.npmmirror.com/xml2js/-/xml2js-0.4.23.tgz#a0c69516752421eb2ac758ee4d4ccf58843eac66" resolved "https://registry.npmmirror.com/xml2js/-/xml2js-0.4.23.tgz#a0c69516752421eb2ac758ee4d4ccf58843eac66"