Skip to content

Commit

Permalink
增加对notion.so自定义反代域名的配置支持
Browse files Browse the repository at this point in the history
  • Loading branch information
emengweb committed Apr 24, 2023
1 parent 84fe9e5 commit 5ec7862
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/notion/getPageProperties.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ function getImageUrl(imgObj, blockVal) {
return null
}
if (imgObj.startsWith('/')) {
return 'https://www.notion.so' + imgObj // notion内部图片转相对路径为绝对路径
return BLOG.NOTION_HOST + imgObj // notion内部图片转相对路径为绝对路径
}

if (imgObj.startsWith('http')) {
Expand Down
4 changes: 2 additions & 2 deletions lib/notion/mapImage.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const mapImgUrl = (img, block, type = 'block') => {
return ret
}
// 相对目录,则视为notion的自带图片
if (img.startsWith('/')) ret = 'https://www.notion.so' + img
if (img.startsWith('/')) ret = BLOG.NOTION_HOST + img

// 书签的地址本身就是永久链接,无需处理
if (!ret && block?.type === 'bookmark') {
Expand All @@ -21,7 +21,7 @@ const mapImgUrl = (img, block, type = 'block') => {

// notion永久图床地址
if (!ret && img.indexOf('secure.notion-static.com') > 0 && (BLOG.IMG_URL_TYPE === 'Notion' || type !== 'block')) {
ret = 'https://www.notion.so/image/' + encodeURIComponent(img) + '?table=' + type + '&id=' + block.id
ret = BLOG.NOTION_HOST + '/image/' + encodeURIComponent(img) + '?table=' + type + '&id=' + block.id
}

// 剩余的是第三方图片url或emoji
Expand Down
5 changes: 5 additions & 0 deletions public/css/theme-hexo.css
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,9 @@
width: 100%;
height: 100%;
background: linear-gradient(to bottom, rgba(0,0,0,0.5) 0%, rgba(0,0,0,0.2) 10%, rgba(0,0,0,0) 25%, rgba(0,0,0,0.2) 75%, rgba(0,0,0,0.5) 100%);
}

/* Custem */
.tk-footer{
opacity: 0;
}

0 comments on commit 5ec7862

Please sign in to comment.