Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Nov 22, 2023
2 parents 7b0b457 + 2debdf1 commit be1609f
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 11 deletions.
3 changes: 2 additions & 1 deletion .env.local
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# 环境变量 @see https://www.nextjs.cn/docs/basic-features/environment-variables
NEXT_PUBLIC_VERSION=4.1.0
NEXT_PUBLIC_VERSION=4.1.1


# 可在此添加环境变量,去掉最左边的(# )注释即可
# Notion页面ID,必须
Expand Down
3 changes: 3 additions & 0 deletions lib/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ export const siteConfig = (key, defaultVal = null, extendConfig = null) => {
return defaultVal
} else {
if (typeof val === 'string') {
if (val === 'true' || val === 'false') {
return JSON.parse(val);
}
return val;
} else {
try {
Expand Down
18 changes: 13 additions & 5 deletions lib/notion/mapImage.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,13 @@ const mapImgUrl = (img, block, type = 'block', from) => {
ret = BLOG.RANDOM_IMAGE_URL
}
}
// 随机图片接口优化 防止因url一致而随机结果相同
const separator = ret.includes('?') ? '&' : '?'
// 拼接唯一识别参数,防止请求的图片被缓存
ret = `${ret.trim()}${separator}t=${block.id}`

// 图片url优化,确保每一篇文章的图片url唯一
if (ret && ret.length > 4) {
// 图片接口拼接唯一识别参数,防止请求的图片被缓,而导致随机结果相同
const separator = ret.includes('?') ? '&' : '?'
ret = `${ret.trim()}${separator}t=${block.id}`
}
}

// 文章封面
Expand All @@ -101,8 +104,13 @@ const mapImgUrl = (img, block, type = 'block', from) => {
return ret
}

/**
* 是否是emoji图标
* @param {*} str
* @returns
*/
function isEmoji(str) {
const emojiRegex = /[\u{1F300}-\u{1F6FF}\u{1F1E0}-\u{1F1FF}\u{2600}-\u{26FF}\u{2700}-\u{27BF}\u{1F900}-\u{1F9FF}\u{1F018}-\u{1F270}]/u;
const emojiRegex = /[\u{1F300}-\u{1F6FF}\u{1F1E0}-\u{1F1FF}\u{2600}-\u{26FF}\u{2700}-\u{27BF}\u{1F900}-\u{1F9FF}\u{1F018}-\u{1F270}\u{238C}\u{2B06}\u{2B07}\u{2B05}\u{27A1}\u{2194}-\u{2199}\u{2194}\u{21A9}\u{21AA}\u{2934}\u{2935}\u{25AA}\u{25AB}\u{25FE}\u{25FD}\u{25FB}\u{25FC}\u{25B6}\u{25C0}\u{1F200}-\u{1F251}]/u;
return emojiRegex.test(str);
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "notion-next",
"version": "4.1.0",
"version": "4.1.1",
"homepage": "https://github.com/tangly1024/NotionNext.git",
"license": "MIT",
"repository": {
Expand Down
3 changes: 1 addition & 2 deletions themes/fukasawa/components/BlogCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ const BlogCard = ({ index, post, showSummary, siteInfo }) => {
</Link>}
<div className="md:flex-nowrap flex-wrap md:justify-start inline-block">
<div>

{post.tagItems.map((tag) => (
{post.tagItems?.map((tag) => (
<TagItemMini key={tag.name} tag={tag} />
))}
</div>
Expand Down
6 changes: 4 additions & 2 deletions themes/fukasawa/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,14 @@ const LayoutBase = (props) => {
const leftAreaSlot = <Live2D />
const { onLoading } = useGlobal()

const FUKASAWA_SIDEBAR_COLLAPSE_SATUS_DEFAULT = siteConfig('FUKASAWA_SIDEBAR_COLLAPSE_SATUS_DEFAULT', null, CONFIG)

// 侧边栏折叠从 本地存储中获取 open 状态的初始值
const [isCollapsed, setIsCollapse] = useState(() => {
if (typeof window !== 'undefined') {
return localStorage.getItem('fukasawa-sidebar-collapse') === 'true' || siteConfig('FUKASAWA_SIDEBAR_COLLAPSE_SATUS_DEFAULT', null, CONFIG)
return localStorage.getItem('fukasawa-sidebar-collapse') === 'true' || FUKASAWA_SIDEBAR_COLLAPSE_SATUS_DEFAULT
}
return siteConfig('FUKASAWA_SIDEBAR_COLLAPSE_SATUS_DEFAULT', null, CONFIG)
return FUKASAWA_SIDEBAR_COLLAPSE_SATUS_DEFAULT
})

// 在组件卸载时保存 open 状态到本地存储中
Expand Down

1 comment on commit be1609f

@vercel
Copy link

@vercel vercel bot commented on be1609f Nov 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.