webclipper / web-clipper

For Notion,OneNote,Bear,Yuque,Joplin。Clip anything to anywhere
https://clipper.website
Other
5.9k stars 540 forks source link

图床上传插件GitHub仓库 - 支持自定义改写图片URL #1247

Open yqs112358 opened 9 months ago

yqs112358 commented 9 months ago

如题。比如图片上传到github之后,需要用自定义CDN替换原图片的github网址以便于国内加速访问。 目前typora、obsidian等的图床功能已经支持自定义URL改写,希望web-clipper也可以加入

实现方式:

  1. 在GitHub图床设置页面增加一个“替换图片URL前缀为:”编辑框
  2. 在此处https://github.com/webclipper/web-clipper/blob/master/src/common/backend/imageHosting/github/service.ts 下面的uploadAsBase64函数中,读取this.config中前面编辑框输入的内容。如果有值的话替换原来的https://github.com/user-name/repo-name/blob/main/再返回