feat:add copyurl
This commit is contained in:
parent
dab0ff47a1
commit
28e24390a4
|
@ -46,6 +46,7 @@ router.post('/checkToken', async (req: Request, env: Env) => {
|
|||
|
||||
// list image
|
||||
router.post('/list', auth, async (req: Request, env: Env) => {
|
||||
const COPY_URL = await env.XK.get('COPY_URL')
|
||||
const data = await req.json() as ImgReq
|
||||
if (!data.limit) {
|
||||
data.limit = 10
|
||||
|
@ -75,6 +76,7 @@ router.post('/list', auth, async (req: Request, env: Env) => {
|
|||
const urls = objs.map(it => {
|
||||
return <ImgItem>{
|
||||
url: `/rest/${it.key}`,
|
||||
copyUrl: `${COPY_URL}/${it.key}`,
|
||||
key: it.key,
|
||||
size: it.size
|
||||
}
|
||||
|
@ -89,6 +91,7 @@ router.post('/list', auth, async (req: Request, env: Env) => {
|
|||
|
||||
// batch upload file
|
||||
router.post('/upload', auth, async (req: Request, env: Env) => {
|
||||
const COPY_URL = await env.XK.get('COPY_URL')
|
||||
const files = await req.formData()
|
||||
const images = files.getAll("files")
|
||||
const errs = []
|
||||
|
@ -111,6 +114,7 @@ router.post('/upload', auth, async (req: Request, env: Env) => {
|
|||
urls.push({
|
||||
key: object.key,
|
||||
size: object.size,
|
||||
copyUrl: `${COPY_URL}/${object.key}`,
|
||||
url: `/rest/${object.key}`,
|
||||
filename: item.name
|
||||
})
|
||||
|
|
|
@ -8,6 +8,7 @@ export interface ImgItem {
|
|||
key : string
|
||||
url : string
|
||||
size: number
|
||||
copyUrl: string
|
||||
filename ?: string
|
||||
}
|
||||
|
||||
|
|
|
@ -38,10 +38,10 @@
|
|||
<div v-if="mode === 'uploaded'">
|
||||
<el-divider class="m-0" />
|
||||
<div class="w-full flex text-white h-9 text-center text-sm">
|
||||
<el-tooltip :content="src" placement="top-start">
|
||||
<el-tooltip :content="copyUrl" placement="top-start">
|
||||
<div
|
||||
class="flex-1 flex items-center justify-center cursor-pointer"
|
||||
@click="copyLink(src)"
|
||||
@click="copyLink(copyUrl)"
|
||||
>
|
||||
<font-awesome-icon :icon="faCopy" class="mr-2" />
|
||||
链接
|
||||
|
@ -83,6 +83,7 @@ import LoadingOverlay from '../components/LoadingOverlay.vue'
|
|||
|
||||
const props = defineProps<{
|
||||
src: string
|
||||
copyUrl:string
|
||||
name: string
|
||||
size: number
|
||||
mode: 'converted' | 'uploaded'
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
>
|
||||
<image-box
|
||||
:src="item.url"
|
||||
:copyUrl="item.copyUrl"
|
||||
:name="item.key"
|
||||
:size="item.size"
|
||||
@delete="deleteImage(item.key)"
|
||||
|
|
Loading…
Reference in New Issue