mirror of
https://github.com/Kuingsmile/PicList.git
synced 2026-05-28 11:42:04 +08:00
✨ Feature: support short url now
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { IPasteStyle } from '#/types/enum'
|
||||
import { handleUrlEncode } from '#/utils/common'
|
||||
import { handleUrlEncode, generateShortUrl } from '#/utils/common'
|
||||
import db from '~/main/apis/core/datastore'
|
||||
|
||||
export const formatCustomLink = (customLink: string, item: ImgInfo) => {
|
||||
@@ -21,11 +21,15 @@ export const formatCustomLink = (customLink: string, item: ImgInfo) => {
|
||||
return customLink
|
||||
}
|
||||
|
||||
export default (style: IPasteStyle, item: ImgInfo, customLink: string | undefined) => {
|
||||
export default async (style: IPasteStyle, item: ImgInfo, customLink: string | undefined) => {
|
||||
let url = item.url || item.imgUrl
|
||||
if (db.get('settings.encodeOutputURL') !== false) {
|
||||
url = handleUrlEncode(url)
|
||||
}
|
||||
const useShortUrl = db.get('settings.useShortUrl') || false
|
||||
if (useShortUrl) {
|
||||
url = await generateShortUrl(url)
|
||||
}
|
||||
const _customLink = customLink || ''
|
||||
const tpl = {
|
||||
markdown: ``,
|
||||
|
||||
@@ -11,7 +11,6 @@ class PrivacyManager {
|
||||
return false
|
||||
} else {
|
||||
db.set('settings.privacyEnsure', true)
|
||||
return true
|
||||
}
|
||||
}
|
||||
return true
|
||||
|
||||
Reference in New Issue
Block a user