Updated: support custom paste link template

This commit is contained in:
Molunerfinn
2018-03-09 14:35:41 +08:00
parent df39511cdf
commit f6536b1dc2
5 changed files with 84 additions and 3 deletions

View File

@@ -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': `<img src="${url}"/>`,
'URL': url,
'UBB': `[IMG]${url}[/IMG]`
'UBB': `[IMG]${url}[/IMG]`,
'Custom': customLink.replace(/\$url/, url)
}
return tpl[style]
}

View File

@@ -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}`