mirror of
https://github.com/Kuingsmile/PicList.git
synced 2025-02-02 11:08:13 -05:00
✨ Feature: add url encode setting
This commit is contained in:
parent
09ad102fe8
commit
8c7c3b28dd
@ -65,7 +65,7 @@
|
|||||||
"mime-types": "^2.1.35",
|
"mime-types": "^2.1.35",
|
||||||
"mitt": "^3.0.0",
|
"mitt": "^3.0.0",
|
||||||
"nodejs-file-downloader": "^4.10.6",
|
"nodejs-file-downloader": "^4.10.6",
|
||||||
"piclist": "^0.3.3",
|
"piclist": "^0.5.0",
|
||||||
"pinia": "^2.0.32",
|
"pinia": "^2.0.32",
|
||||||
"pinia-plugin-persistedstate": "^3.1.0",
|
"pinia-plugin-persistedstate": "^3.1.0",
|
||||||
"qiniu": "^7.8.0",
|
"qiniu": "^7.8.0",
|
||||||
|
@ -191,6 +191,8 @@ SETTINGS_COMPRESS_AND_WATERMARK: Compress and Watermark
|
|||||||
SETTINGS_SYNC_DELETE_CLOUD: Sync delete from cloud storage of gallery
|
SETTINGS_SYNC_DELETE_CLOUD: Sync delete from cloud storage of gallery
|
||||||
SETTINGS_ISHIDEDOCK: Hide Dock Icon
|
SETTINGS_ISHIDEDOCK: Hide Dock Icon
|
||||||
SETTINGS_ISHIDEDOCK_TIPS: Not support hide dock and tray at the same time
|
SETTINGS_ISHIDEDOCK_TIPS: Not support hide dock and tray at the same time
|
||||||
|
SETTINGS_ENCODE_OUTPUT_URL: Encode Output(or Copyed) URL
|
||||||
|
|
||||||
# shortcut-page
|
# shortcut-page
|
||||||
|
|
||||||
BUILTIN_CLIPBOARD_TIPS: Use builtin clipboard function to upload instead of using scripts
|
BUILTIN_CLIPBOARD_TIPS: Use builtin clipboard function to upload instead of using scripts
|
||||||
|
@ -192,6 +192,7 @@ SETTINGS_COMPRESS_AND_WATERMARK: 设置图片水印和压缩-格式转换等参
|
|||||||
SETTINGS_SYNC_DELETE_CLOUD: 相册内删除时同步删除云端文件
|
SETTINGS_SYNC_DELETE_CLOUD: 相册内删除时同步删除云端文件
|
||||||
SETTINGS_ISHIDEDOCK: 是否隐藏dock图标
|
SETTINGS_ISHIDEDOCK: 是否隐藏dock图标
|
||||||
SETTINGS_ISHIDEDOCK_TIPS: 不支持同时隐藏dock和托盘
|
SETTINGS_ISHIDEDOCK_TIPS: 不支持同时隐藏dock和托盘
|
||||||
|
SETTINGS_ENCODE_OUTPUT_URL: 输出(复制) URL 时进行转义
|
||||||
|
|
||||||
# shortcut-page
|
# shortcut-page
|
||||||
|
|
||||||
|
@ -192,6 +192,8 @@ SETTINGS_COMPRESS_AND_WATERMARK: 設置圖片浮水印和壓縮-格式轉換等
|
|||||||
SETTINGS_SYNC_DELETE_CLOUD: 從相簿中刪除並同步從雲端刪除
|
SETTINGS_SYNC_DELETE_CLOUD: 從相簿中刪除並同步從雲端刪除
|
||||||
SETTINGS_ISHIDEDOCK: 是否隱藏dock圖示
|
SETTINGS_ISHIDEDOCK: 是否隱藏dock圖示
|
||||||
SETTINGS_ISHIDEDOCK_TIPS: 不支持同時隱藏dock和托盘
|
SETTINGS_ISHIDEDOCK_TIPS: 不支持同時隱藏dock和托盘
|
||||||
|
SETTINGS_ENCODE_OUTPUT_URL: 輸出(複製) URL 時進行轉義
|
||||||
|
|
||||||
# shortcut-page
|
# shortcut-page
|
||||||
|
|
||||||
SHORTCUT_NAME: 快捷鍵名稱
|
SHORTCUT_NAME: 快捷鍵名稱
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import { IPasteStyle } from '#/types/enum'
|
import { IPasteStyle } from '#/types/enum'
|
||||||
import { handleUrlEncode } from '#/utils/common'
|
import { handleUrlEncode } from '#/utils/common'
|
||||||
|
import db from 'apis/core/datastore'
|
||||||
|
|
||||||
const formatCustomLink = (customLink: string, item: ImgInfo) => {
|
const formatCustomLink = (customLink: string, item: ImgInfo) => {
|
||||||
const fileName = item.fileName!.replace(new RegExp(`\\${item.extname}$`), '')
|
const fileName = item.fileName!.replace(new RegExp(`\\${item.extname}$`), '')
|
||||||
@ -21,8 +22,11 @@ const formatCustomLink = (customLink: string, item: ImgInfo) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default (style: IPasteStyle, item: ImgInfo, customLink: string | undefined) => {
|
export default (style: IPasteStyle, item: ImgInfo, customLink: string | undefined) => {
|
||||||
const url = handleUrlEncode(item.url || item.imgUrl)
|
let url = item.url || item.imgUrl
|
||||||
const _customLink = customLink || '$url'
|
if (db.get('settings.encodeOutputURL') !== false) {
|
||||||
|
url = handleUrlEncode(url)
|
||||||
|
}
|
||||||
|
const _customLink = customLink || '![$fileName]($url)'
|
||||||
const tpl = {
|
const tpl = {
|
||||||
markdown: `![](${url})`,
|
markdown: `![](${url})`,
|
||||||
HTML: `<img src="${url}"/>`,
|
HTML: `<img src="${url}"/>`,
|
||||||
|
@ -335,6 +335,16 @@
|
|||||||
@change="useBuiltinClipboardChange"
|
@change="useBuiltinClipboardChange"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item
|
||||||
|
:label="$T('SETTINGS_ENCODE_OUTPUT_URL')"
|
||||||
|
>
|
||||||
|
<el-switch
|
||||||
|
v-model="form.encodeOutputURL"
|
||||||
|
:active-text="$T('SETTINGS_OPEN')"
|
||||||
|
:inactive-text="$T('SETTINGS_CLOSE')"
|
||||||
|
@change="handleEncodeOutputURL"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
<el-form-item
|
<el-form-item
|
||||||
:style="{ marginRight: '-64px' }"
|
:style="{ marginRight: '-64px' }"
|
||||||
:label="$T('CHOOSE_SHOWED_PICBED')"
|
:label="$T('CHOOSE_SHOWED_PICBED')"
|
||||||
@ -1040,7 +1050,8 @@ const form = reactive<ISettingForm>({
|
|||||||
deleteCloudFile: false,
|
deleteCloudFile: false,
|
||||||
isCustomMiniIcon: false,
|
isCustomMiniIcon: false,
|
||||||
customMiniIcon: '',
|
customMiniIcon: '',
|
||||||
isHideDock: false
|
isHideDock: false,
|
||||||
|
encodeOutputURL: true
|
||||||
})
|
})
|
||||||
|
|
||||||
const languageList = i18nManager.languageList.map(item => ({
|
const languageList = i18nManager.languageList.map(item => ({
|
||||||
@ -1061,7 +1072,7 @@ const proxyVisible = ref(false)
|
|||||||
const mainWindowSizeVisible = ref(false)
|
const mainWindowSizeVisible = ref(false)
|
||||||
|
|
||||||
const customLink = reactive({
|
const customLink = reactive({
|
||||||
value: '$url'
|
value: '![$fileName]($url)'
|
||||||
})
|
})
|
||||||
|
|
||||||
const shortKey = reactive<IShortKeyMap>({
|
const shortKey = reactive<IShortKeyMap>({
|
||||||
@ -1132,13 +1143,14 @@ async function initData () {
|
|||||||
form.checkBetaUpdate = settings.checkBetaUpdate === undefined ? true : settings.checkBetaUpdate
|
form.checkBetaUpdate = settings.checkBetaUpdate === undefined ? true : settings.checkBetaUpdate
|
||||||
form.useBuiltinClipboard = settings.useBuiltinClipboard === undefined ? false : settings.useBuiltinClipboard
|
form.useBuiltinClipboard = settings.useBuiltinClipboard === undefined ? false : settings.useBuiltinClipboard
|
||||||
form.language = settings.language ?? 'zh-CN'
|
form.language = settings.language ?? 'zh-CN'
|
||||||
|
form.encodeOutputURL = settings.encodeOutputURL === undefined ? true : settings.encodeOutputURL
|
||||||
form.deleteCloudFile = settings.deleteCloudFile || false
|
form.deleteCloudFile = settings.deleteCloudFile || false
|
||||||
form.isCustomMiniIcon = settings.isCustomMiniIcon || false
|
form.isCustomMiniIcon = settings.isCustomMiniIcon || false
|
||||||
form.customMiniIcon = settings.customMiniIcon || ''
|
form.customMiniIcon = settings.customMiniIcon || ''
|
||||||
form.isHideDock = settings.isHideDock || false
|
form.isHideDock = settings.isHideDock || false
|
||||||
currentLanguage.value = settings.language ?? 'zh-CN'
|
currentLanguage.value = settings.language ?? 'zh-CN'
|
||||||
currentStartMode.value = settings.startMode || 'quiet'
|
currentStartMode.value = settings.startMode || 'quiet'
|
||||||
customLink.value = settings.customLink || '$url'
|
customLink.value = settings.customLink || '![$fileName]($url)'
|
||||||
shortKey.upload = settings.shortKey.upload
|
shortKey.upload = settings.shortKey.upload
|
||||||
proxy.value = picBed.proxy || ''
|
proxy.value = picBed.proxy || ''
|
||||||
npmRegistry.value = settings.registry || ''
|
npmRegistry.value = settings.registry || ''
|
||||||
@ -1200,6 +1212,16 @@ function confirmCustomLink () {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function handleEncodeOutputURL (val: ICheckBoxValueType) {
|
||||||
|
saveConfig('settings.encodeOutputURL', val)
|
||||||
|
const successNotification = new Notification($T('SETTINGS_ENCODE_OUTPUT_URL'), {
|
||||||
|
body: $T('TIPS_SET_SUCCEED')
|
||||||
|
})
|
||||||
|
successNotification.onclick = () => {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async function cancelProxy () {
|
async function cancelProxy () {
|
||||||
proxyVisible.value = false
|
proxyVisible.value = false
|
||||||
proxy.value = await getConfig<string>('picBed.proxy') || ''
|
proxy.value = await getConfig<string>('picBed.proxy') || ''
|
||||||
|
@ -602,7 +602,7 @@ function ipcSendFiles (files: FileList) {
|
|||||||
|
|
||||||
async function getPasteStyle () {
|
async function getPasteStyle () {
|
||||||
pasteStyle.value = await getConfig('settings.pasteStyle') || 'markdown'
|
pasteStyle.value = await getConfig('settings.pasteStyle') || 'markdown'
|
||||||
customLink.value = await getConfig('settings.customLink') || '$url'
|
customLink.value = await getConfig('settings.customLink') || '![$fileName]($url)'
|
||||||
}
|
}
|
||||||
|
|
||||||
function handlePasteStyleChange (val: string | number | boolean) {
|
function handlePasteStyleChange (val: string | number | boolean) {
|
||||||
|
1
src/universal/types/i18n.d.ts
vendored
1
src/universal/types/i18n.d.ts
vendored
@ -186,6 +186,7 @@ interface ILocales {
|
|||||||
SETTINGS_SYNC_DELETE_CLOUD: string
|
SETTINGS_SYNC_DELETE_CLOUD: string
|
||||||
SETTINGS_ISHIDEDOCK: string
|
SETTINGS_ISHIDEDOCK: string
|
||||||
SETTINGS_ISHIDEDOCK_TIPS: string
|
SETTINGS_ISHIDEDOCK_TIPS: string
|
||||||
|
SETTINGS_ENCODE_OUTPUT_URL: string
|
||||||
SHORTCUT_NAME: string
|
SHORTCUT_NAME: string
|
||||||
SHORTCUT_BIND: string
|
SHORTCUT_BIND: string
|
||||||
SHORTCUT_STATUS: string
|
SHORTCUT_STATUS: string
|
||||||
|
3
src/universal/types/view.d.ts
vendored
3
src/universal/types/view.d.ts
vendored
@ -15,7 +15,8 @@ interface ISettingForm {
|
|||||||
deleteCloudFile: boolean,
|
deleteCloudFile: boolean,
|
||||||
isCustomMiniIcon: boolean,
|
isCustomMiniIcon: boolean,
|
||||||
customMiniIcon: string,
|
customMiniIcon: string,
|
||||||
isHideDock: boolean
|
isHideDock: boolean,
|
||||||
|
encodeOutputURL: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
interface IShortKeyMap {
|
interface IShortKeyMap {
|
||||||
|
@ -11022,10 +11022,10 @@ performance-now@^2.1.0:
|
|||||||
resolved "https://registry.npmmirror.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b"
|
resolved "https://registry.npmmirror.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b"
|
||||||
integrity sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow==
|
integrity sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow==
|
||||||
|
|
||||||
piclist@^0.3.3:
|
piclist@^0.5.0:
|
||||||
version "0.3.3"
|
version "0.5.0"
|
||||||
resolved "https://registry.npmjs.org/piclist/-/piclist-0.3.3.tgz#eedd346beaee732179b0ce50738f115097fe54e0"
|
resolved "https://registry.npmjs.org/piclist/-/piclist-0.5.0.tgz#0eedf84e475514724b690de826c4f24631862890"
|
||||||
integrity sha512-mN9rNZzNUoOW7yjb0HKsvyOOL2s0KEKMKicEMqhIxQx4QIKjhtMundYSSWck43Ulj65b/DethKU0io2vEBC6lw==
|
integrity sha512-bFdGsp7fLQ4uSf2y5cAct4tAUgry21vEFRCUE1ywIOf3nPTXPzrsNBt+rITANrIaVjQH/8MDirxnmgM7Cbll1Q==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@picgo/i18n" "^1.0.0"
|
"@picgo/i18n" "^1.0.0"
|
||||||
"@picgo/store" "^2.0.4"
|
"@picgo/store" "^2.0.4"
|
||||||
|
Loading…
Reference in New Issue
Block a user