mirror of
https://github.com/Kuingsmile/PicList.git
synced 2026-05-06 20:42:57 +08:00
🐛 Fix(custom): fix drag upload of upload page
This commit is contained in:
@@ -122,7 +122,7 @@ if (db.get(configPaths.settings.miniWindowOntop)) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const renameWindowOptions = {
|
const renameWindowOptions = {
|
||||||
height: 250,
|
height: 270,
|
||||||
width: 350,
|
width: 350,
|
||||||
show: true,
|
show: true,
|
||||||
fullscreenable: false,
|
fullscreenable: false,
|
||||||
|
|||||||
@@ -3,12 +3,12 @@ import path from 'node:path'
|
|||||||
import db from '@core/datastore'
|
import db from '@core/datastore'
|
||||||
import logger from '@core/picgo/logger'
|
import logger from '@core/picgo/logger'
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
import { clipboard, dialog, Notification, Tray } from 'electron'
|
import { clipboard, Notification, Tray } from 'electron'
|
||||||
import FormData from 'form-data'
|
import FormData from 'form-data'
|
||||||
import fs from 'fs-extra'
|
import fs from 'fs-extra'
|
||||||
import { isReactive, isRef, toRaw, unref } from 'vue'
|
import { isReactive, isRef, toRaw, unref } from 'vue'
|
||||||
|
|
||||||
import type { IHTTPProxy, IPrivateShowNotificationOption, IShowMessageBoxResult, IStringKeyMap } from '#/types/types'
|
import type { IHTTPProxy, IPrivateShowNotificationOption, IStringKeyMap } from '#/types/types'
|
||||||
import { configPaths } from '~/utils/configPaths'
|
import { configPaths } from '~/utils/configPaths'
|
||||||
import { IShortUrlServer } from '~/utils/enum'
|
import { IShortUrlServer } from '~/utils/enum'
|
||||||
|
|
||||||
@@ -87,17 +87,6 @@ export const showNotification = (
|
|||||||
notification.show()
|
notification.show()
|
||||||
}
|
}
|
||||||
|
|
||||||
export const showMessageBox = (options: any) => {
|
|
||||||
return new Promise<IShowMessageBoxResult>(resolve => {
|
|
||||||
dialog.showMessageBox(options).then(res => {
|
|
||||||
resolve({
|
|
||||||
result: res.response,
|
|
||||||
checkboxChecked: res.checkboxChecked
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* macOS public.file-url will get encoded file path,
|
* macOS public.file-url will get encoded file path,
|
||||||
* so we need to decode it
|
* so we need to decode it
|
||||||
@@ -142,7 +131,7 @@ export const getClipboardFilePath = (): string => {
|
|||||||
|
|
||||||
const c1nApi = 'https://c1n.cn/link/short'
|
const c1nApi = 'https://c1n.cn/link/short'
|
||||||
|
|
||||||
const generateC1NShortUrl = async (url: string) => {
|
const createC1NShortUrl = async (url: string) => {
|
||||||
const c1nToken = db.get(configPaths.settings.c1nToken) || ''
|
const c1nToken = db.get(configPaths.settings.c1nToken) || ''
|
||||||
if (!c1nToken) {
|
if (!c1nToken) {
|
||||||
logger.warn('c1n token is not set')
|
logger.warn('c1n token is not set')
|
||||||
@@ -165,7 +154,7 @@ const generateC1NShortUrl = async (url: string) => {
|
|||||||
return url
|
return url
|
||||||
}
|
}
|
||||||
|
|
||||||
const generateYOURLSShortUrl = async (url: string) => {
|
const createYOURLSShortLink = async (url: string) => {
|
||||||
let domain = db.get(configPaths.settings.yourlsDomain) || ''
|
let domain = db.get(configPaths.settings.yourlsDomain) || ''
|
||||||
const signature = db.get(configPaths.settings.yourlsSignature) || ''
|
const signature = db.get(configPaths.settings.yourlsSignature) || ''
|
||||||
|
|
||||||
@@ -197,7 +186,7 @@ const generateYOURLSShortUrl = async (url: string) => {
|
|||||||
return url
|
return url
|
||||||
}
|
}
|
||||||
|
|
||||||
const generateCFWORKERShortUrl = async (url: string) => {
|
const createShortUrlForCFWorker = async (url: string) => {
|
||||||
let cfWorkerHost = db.get(configPaths.settings.cfWorkerHost) || ''
|
let cfWorkerHost = db.get(configPaths.settings.cfWorkerHost) || ''
|
||||||
cfWorkerHost = cfWorkerHost.replace(/\/$/, '')
|
cfWorkerHost = cfWorkerHost.replace(/\/$/, '')
|
||||||
if (!cfWorkerHost) {
|
if (!cfWorkerHost) {
|
||||||
@@ -217,7 +206,7 @@ const generateCFWORKERShortUrl = async (url: string) => {
|
|||||||
return url
|
return url
|
||||||
}
|
}
|
||||||
|
|
||||||
const generateSinkShortUrl = async (url: string) => {
|
const createShortUrlFromSink = async (url: string) => {
|
||||||
let sinkDomain = db.get(configPaths.settings.sinkDomain) || ''
|
let sinkDomain = db.get(configPaths.settings.sinkDomain) || ''
|
||||||
const sinkToken = db.get(configPaths.settings.sinkToken) || ''
|
const sinkToken = db.get(configPaths.settings.sinkToken) || ''
|
||||||
if (!sinkDomain || !sinkToken) {
|
if (!sinkDomain || !sinkToken) {
|
||||||
@@ -249,13 +238,13 @@ export const generateShortUrl = async (url: string) => {
|
|||||||
const server = db.get(configPaths.settings.shortUrlServer) || IShortUrlServer.C1N
|
const server = db.get(configPaths.settings.shortUrlServer) || IShortUrlServer.C1N
|
||||||
switch (server) {
|
switch (server) {
|
||||||
case IShortUrlServer.C1N:
|
case IShortUrlServer.C1N:
|
||||||
return generateC1NShortUrl(url)
|
return createC1NShortUrl(url)
|
||||||
case IShortUrlServer.YOURLS:
|
case IShortUrlServer.YOURLS:
|
||||||
return generateYOURLSShortUrl(url)
|
return createYOURLSShortLink(url)
|
||||||
case IShortUrlServer.CFWORKER:
|
case IShortUrlServer.CFWORKER:
|
||||||
return generateCFWORKERShortUrl(url)
|
return createShortUrlForCFWorker(url)
|
||||||
case IShortUrlServer.SINK:
|
case IShortUrlServer.SINK:
|
||||||
return generateSinkShortUrl(url)
|
return createShortUrlFromSink(url)
|
||||||
default:
|
default:
|
||||||
return url
|
return url
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,10 +4,11 @@ import https from 'node:https'
|
|||||||
import path from 'node:path'
|
import path from 'node:path'
|
||||||
import querystring from 'node:querystring'
|
import querystring from 'node:querystring'
|
||||||
|
|
||||||
import { DeleteObjectCommand, S3Client, S3ClientConfig } from '@aws-sdk/client-s3'
|
import type { S3ClientConfig } from '@aws-sdk/client-s3'
|
||||||
|
import { DeleteObjectCommand, S3Client } from '@aws-sdk/client-s3'
|
||||||
import { NodeHttpHandler } from '@smithy/node-http-handler'
|
import { NodeHttpHandler } from '@smithy/node-http-handler'
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
import { ISftpPlistConfig } from 'piclist'
|
import type { ISftpPlistConfig } from 'piclist'
|
||||||
|
|
||||||
import type { IObj, IStringKeyMap } from '#/types/types'
|
import type { IObj, IStringKeyMap } from '#/types/types'
|
||||||
import { getAgent } from '~/manage/utils/common'
|
import { getAgent } from '~/manage/utils/common'
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import { getConfig } from '@/utils/dataSender'
|
|||||||
import { pageReloadCount } from '@/utils/global'
|
import { pageReloadCount } from '@/utils/global'
|
||||||
|
|
||||||
import { useAppStore } from './hooks/useAppStore'
|
import { useAppStore } from './hooks/useAppStore'
|
||||||
|
|
||||||
useATagClick()
|
useATagClick()
|
||||||
|
|
||||||
const store = useStore()
|
const store = useStore()
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ export function useATagClick () {
|
|||||||
const handleATagClick = (e: MouseEvent) => {
|
const handleATagClick = (e: MouseEvent) => {
|
||||||
if (e.target instanceof HTMLAnchorElement) {
|
if (e.target instanceof HTMLAnchorElement) {
|
||||||
if (e.target.href) {
|
if (e.target.href) {
|
||||||
// avoid opening localhost development URLs in external browser
|
|
||||||
if (!e.target.href.startsWith('http://localhost:3000')) {
|
if (!e.target.href.startsWith('http://localhost:3000')) {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
window.electron.sendRPC(IRPCActionType.OPEN_URL, e.target.href)
|
window.electron.sendRPC(IRPCActionType.OPEN_URL, e.target.href)
|
||||||
@@ -14,9 +13,11 @@ export function useATagClick () {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
document.addEventListener('click', handleATagClick)
|
document.addEventListener('click', handleATagClick)
|
||||||
})
|
})
|
||||||
|
|
||||||
onUnmounted(() => {
|
onUnmounted(() => {
|
||||||
document.removeEventListener('click', handleATagClick)
|
document.removeEventListener('click', handleATagClick)
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -389,7 +389,7 @@
|
|||||||
"picBedConfigs": {
|
"picBedConfigs": {
|
||||||
"title": "Config",
|
"title": "Config",
|
||||||
"viewDoc": "View Document",
|
"viewDoc": "View Document",
|
||||||
"copyAPI": "Copy API Address",
|
"copyAPI": "Copy Upload API",
|
||||||
"noConfigOptions": "No Config Options",
|
"noConfigOptions": "No Config Options",
|
||||||
"setSuccess": "Set Success",
|
"setSuccess": "Set Success",
|
||||||
"setFailedInfo": "Set Failed, Please Check If Config Options Are Correct",
|
"setFailedInfo": "Set Failed, Please Check If Config Options Are Correct",
|
||||||
|
|||||||
@@ -384,7 +384,7 @@
|
|||||||
"picBedConfigs": {
|
"picBedConfigs": {
|
||||||
"title": "配置",
|
"title": "配置",
|
||||||
"viewDoc": "查看文档",
|
"viewDoc": "查看文档",
|
||||||
"copyAPI": "复制API地址",
|
"copyAPI": "复制上传API",
|
||||||
"noConfigOptions": "暂无配置项",
|
"noConfigOptions": "暂无配置项",
|
||||||
"setSuccess": "设置成功",
|
"setSuccess": "设置成功",
|
||||||
"setFailedInfo": "设置失败, 请检查配置项是否正确",
|
"setFailedInfo": "设置失败, 请检查配置项是否正确",
|
||||||
|
|||||||
@@ -384,7 +384,7 @@
|
|||||||
"picBedConfigs": {
|
"picBedConfigs": {
|
||||||
"title": "配置",
|
"title": "配置",
|
||||||
"viewDoc": "查看文件",
|
"viewDoc": "查看文件",
|
||||||
"copyAPI": "複製 API 位址",
|
"copyAPI": "複製上傳API",
|
||||||
"noConfigOptions": "暫無配置項",
|
"noConfigOptions": "暫無配置項",
|
||||||
"setSuccess": "設定成功",
|
"setSuccess": "設定成功",
|
||||||
"setFailedInfo": "設定失敗,請檢查配置項是否正確",
|
"setFailedInfo": "設定失敗,請檢查配置項是否正確",
|
||||||
|
|||||||
@@ -53,7 +53,3 @@ app.use(pinia)
|
|||||||
app.use(hljsVuePlugin)
|
app.use(hljsVuePlugin)
|
||||||
app.use(VueVideoPlayer)
|
app.use(VueVideoPlayer)
|
||||||
app.mount('#app')
|
app.mount('#app')
|
||||||
|
|
||||||
export {
|
|
||||||
i18n
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -41,6 +41,7 @@
|
|||||||
<!-- Main Upload Card -->
|
<!-- Main Upload Card -->
|
||||||
<div class="upload-card main-card">
|
<div class="upload-card main-card">
|
||||||
<div
|
<div
|
||||||
|
id="upload-area"
|
||||||
class="upload-zone"
|
class="upload-zone"
|
||||||
:class="{ 'drag-active': dragover }"
|
:class="{ 'drag-active': dragover }"
|
||||||
@drop.prevent="onDrop"
|
@drop.prevent="onDrop"
|
||||||
|
|||||||
Reference in New Issue
Block a user