diff --git a/src/main/index.js b/src/main/index.js index a461ab9..0548b2d 100644 --- a/src/main/index.js +++ b/src/main/index.js @@ -395,7 +395,15 @@ ipcMain.on('updateShortKey', (evt, oldKey) => { notification.show() }) -ipcMain.on('updateDefaultPicBed', (evt) => { +ipcMain.on('updateCustomLink', (evt, oldLink) => { + const notification = new Notification({ + title: '操作成功', + body: '你的自定义链接格式已经修改成功' + }) + notification.show() +}) + +ipcMain.on('updteDefaultPicBed', (evt) => { const types = ['weibo', 'qiniu', 'tcyun', 'upyun'] let submenuItem = contextMenu.items[2].submenu.items submenuItem.forEach((item, index) => { diff --git a/src/main/utils/pasteTemplate.js b/src/main/utils/pasteTemplate.js index 9572ee2..3367954 100644 --- a/src/main/utils/pasteTemplate.js +++ b/src/main/utils/pasteTemplate.js @@ -1,9 +1,13 @@ +import db from '../../datastore' + export default (style, url) => { + const customLink = db.read().get('customLink').value() || '$url' const tpl = { 'markdown': `![](${url})`, 'HTML': ``, 'URL': url, - 'UBB': `[IMG]${url}[/IMG]` + 'UBB': `[IMG]${url}[/IMG]`, + 'Custom': customLink.replace(/\$url/, url) } return tpl[style] } diff --git a/src/main/utils/weiboUpload.js b/src/main/utils/weiboUpload.js index 6e03559..a919a77 100644 --- a/src/main/utils/weiboUpload.js +++ b/src/main/utils/weiboUpload.js @@ -66,6 +66,7 @@ const weiboUpload = async function (img, type, webContents) { body: '微博Cookie失效,请在网页版重新登录一遍' }) notification.show() + return new Error() } else { const extname = imgList[i].extname === '.gif' ? '.gif' : '.jpg' imgList[i]['imgUrl'] = `https://ws1.sinaimg.cn/${quality}/${resTextJson.data.pics.pic_1.pid}${extname}` diff --git a/src/renderer/components/SettingPage.vue b/src/renderer/components/SettingPage.vue index 6e80c1b..c66edb2 100644 --- a/src/renderer/components/SettingPage.vue +++ b/src/renderer/components/SettingPage.vue @@ -86,6 +86,54 @@ 确定 + + + + + + + + 取消 + 确定 + + + + + + + + +
+ 如[]($url) +
+ + 取消 + 确定 + +