mirror of
https://github.com/Kuingsmile/PicList.git
synced 2026-06-01 09:29:45 +08:00
🐛 Fix(custom): fix an issue eslint not worked as expected
This commit is contained in:
@@ -26,12 +26,12 @@ export default class AlistApi {
|
||||
url: `${url}/api/fs/remove`,
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: token
|
||||
Authorization: token,
|
||||
},
|
||||
data: {
|
||||
dir: path.join('/', uploadPath, path.dirname(fileName)),
|
||||
names: [path.basename(fileName)]
|
||||
}
|
||||
names: [path.basename(fileName)],
|
||||
},
|
||||
})
|
||||
const ok = result.data.code === 200
|
||||
deleteLog(fileName, 'Alist', ok)
|
||||
|
||||
@@ -18,7 +18,7 @@ interface IConfigMap {
|
||||
const getAListToken = async (url: string, username: string, password: string) => {
|
||||
const res = await axios.post(`${url}/api/auth/login`, {
|
||||
username,
|
||||
password
|
||||
password,
|
||||
})
|
||||
if (res.data.code === 200 && res.data.message === 'success') {
|
||||
return res.data.data.token
|
||||
@@ -43,12 +43,12 @@ export default class AListplistApi {
|
||||
url: `${url}/api/fs/remove`,
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: token
|
||||
Authorization: token,
|
||||
},
|
||||
data: {
|
||||
dir: path.join('/', uploadPath, path.dirname(fileName)),
|
||||
names: [path.basename(fileName)]
|
||||
}
|
||||
names: [path.basename(fileName)],
|
||||
},
|
||||
})
|
||||
const ok = result.data.code === 200
|
||||
deleteLog(fileName, 'Alist', ok)
|
||||
|
||||
@@ -35,7 +35,7 @@ const apiMap: IStringKeyMap = {
|
||||
smms: SmmsApi,
|
||||
tcyun: TcyunApi,
|
||||
upyun: UpyunApi,
|
||||
webdavplist: WebdavApi
|
||||
webdavplist: WebdavApi,
|
||||
}
|
||||
|
||||
export default class ALLApi {
|
||||
|
||||
@@ -12,7 +12,7 @@ interface IConfigMap {
|
||||
export default class GithubApi {
|
||||
static #createOctokit(token: string) {
|
||||
return new Octokit({
|
||||
auth: token
|
||||
auth: token,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ export default class GithubApi {
|
||||
const {
|
||||
fileName,
|
||||
hash,
|
||||
config: { repo, token, branch, path }
|
||||
config: { repo, token, branch, path },
|
||||
} = configMap
|
||||
const [owner, repoName] = repo.split('/')
|
||||
const octokit = GithubApi.#createOctokit(token)
|
||||
@@ -37,7 +37,7 @@ export default class GithubApi {
|
||||
path: key,
|
||||
message: `delete ${fileName} by PicList`,
|
||||
sha: hash,
|
||||
branch
|
||||
branch,
|
||||
})
|
||||
const ok = status === 200
|
||||
deleteLog(fileName, 'GitHub', ok)
|
||||
|
||||
@@ -28,7 +28,7 @@ export default class ImgurApi {
|
||||
try {
|
||||
const response: AxiosResponse = await axios.delete(apiUrl, {
|
||||
headers: { Authorization },
|
||||
timeout: 30000
|
||||
timeout: 30000,
|
||||
})
|
||||
const ok = response.status === 200
|
||||
deleteLog(hash, 'Imgur', ok)
|
||||
|
||||
@@ -21,17 +21,17 @@ export default class LskyplistApi {
|
||||
|
||||
const v2Headers = {
|
||||
Accept: 'application/json',
|
||||
Authorization: token || undefined
|
||||
Authorization: token || undefined,
|
||||
}
|
||||
|
||||
const requestAgent = new https.Agent({
|
||||
rejectUnauthorized: false
|
||||
rejectUnauthorized: false,
|
||||
})
|
||||
try {
|
||||
const response: AxiosResponse = await axios.delete(`${host}/api/v1/images/${hash}`, {
|
||||
headers: v2Headers,
|
||||
timeout: 30000,
|
||||
httpsAgent: requestAgent
|
||||
httpsAgent: requestAgent,
|
||||
})
|
||||
const ok = response.status === 200 && response.data.status === true
|
||||
deleteLog(hash, 'Lskyplist', ok)
|
||||
|
||||
@@ -18,7 +18,7 @@ export default class PiclistApi {
|
||||
|
||||
try {
|
||||
const response: AxiosResponse = await axios.post(url, {
|
||||
list: [fullResult]
|
||||
list: [fullResult],
|
||||
})
|
||||
const ok = response.status === 200 && response.data?.success
|
||||
deleteLog(fullResult, 'Piclist', ok)
|
||||
|
||||
@@ -11,7 +11,7 @@ export default class QiniuApi {
|
||||
static async delete(configMap: IConfigMap): Promise<boolean> {
|
||||
const {
|
||||
fileName,
|
||||
config: { accessKey, secretKey, bucket, path }
|
||||
config: { accessKey, secretKey, bucket, path },
|
||||
} = configMap
|
||||
const mac = new qiniu.auth.digest.Mac(accessKey, secretKey)
|
||||
const qiniuConfig = new qiniu.conf.Config()
|
||||
@@ -26,7 +26,7 @@ export default class QiniuApi {
|
||||
} else {
|
||||
resolve({
|
||||
respBody,
|
||||
respInfo
|
||||
respInfo,
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
@@ -23,13 +23,13 @@ export default class SmmsApi {
|
||||
try {
|
||||
const response: AxiosResponse = await axios.get(`${SmmsApi.#baseUrl}/delete/${hash}`, {
|
||||
headers: {
|
||||
Authorization: token
|
||||
Authorization: token,
|
||||
},
|
||||
params: {
|
||||
hash,
|
||||
format: 'json'
|
||||
format: 'json',
|
||||
},
|
||||
timeout: 30000
|
||||
timeout: 30000,
|
||||
})
|
||||
const ok = response.status === 200
|
||||
deleteLog(hash, 'Smms', ok)
|
||||
|
||||
@@ -10,14 +10,14 @@ export default class TcyunApi {
|
||||
static #createCOS(SecretId: string, SecretKey: string): COS {
|
||||
return new COS({
|
||||
SecretId,
|
||||
SecretKey
|
||||
SecretKey,
|
||||
})
|
||||
}
|
||||
|
||||
static async delete(configMap: IConfigMap): Promise<boolean> {
|
||||
const {
|
||||
fileName,
|
||||
config: { secretId, secretKey, bucket, area, path }
|
||||
config: { secretId, secretKey, bucket, area, path },
|
||||
} = configMap
|
||||
try {
|
||||
const cos = TcyunApi.#createCOS(secretId, secretKey)
|
||||
@@ -30,7 +30,7 @@ export default class TcyunApi {
|
||||
const result = await cos.deleteObject({
|
||||
Bucket: bucket,
|
||||
Region: area,
|
||||
Key: key
|
||||
Key: key,
|
||||
})
|
||||
const ok = result.statusCode === 204
|
||||
deleteLog(fileName, 'Tcyun', ok)
|
||||
|
||||
@@ -12,7 +12,7 @@ export default class UpyunApi {
|
||||
static async delete(configMap: IConfigMap): Promise<boolean> {
|
||||
const {
|
||||
fileName,
|
||||
config: { bucket, operator, password, path }
|
||||
config: { bucket, operator, password, path },
|
||||
} = configMap
|
||||
try {
|
||||
const service = new Upyun.Service(bucket, operator, password)
|
||||
|
||||
@@ -13,12 +13,12 @@ export default class WebdavApi {
|
||||
static async delete(configMap: IConfigMap): Promise<boolean> {
|
||||
const {
|
||||
fileName,
|
||||
config: { host, username, password, path, sslEnabled, authType }
|
||||
config: { host, username, password, path, sslEnabled, authType },
|
||||
} = configMap
|
||||
const endpoint = formatEndpoint(host, sslEnabled)
|
||||
const options: WebDAVClientOptions = {
|
||||
username,
|
||||
password
|
||||
password,
|
||||
}
|
||||
if (authType === 'digest') {
|
||||
options.authType = AuthType.Digest
|
||||
|
||||
Reference in New Issue
Block a user