Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into pr/1208nn/1626
Browse files Browse the repository at this point in the history
  • Loading branch information
tangly1024 committed Nov 20, 2023
2 parents 1d37772 + 99575c4 commit b6f5276
Show file tree
Hide file tree
Showing 26 changed files with 334 additions and 80 deletions.
171 changes: 171 additions & 0 deletions .env.local
Original file line number Diff line number Diff line change
@@ -1,2 +1,173 @@
# 环境变量 @see https://www.nextjs.cn/docs/basic-features/environment-variables
NEXT_PUBLIC_VERSION=4.1.0

# 可在此添加环境变量,去掉最左边的(# )注释即可
# Notion页面ID,必须
# NOTION_PAGE_ID=

# 非必须
# NEXT_PUBLIC_PSEUDO_STATIC=
# NEXT_PUBLIC_REVALIDATE_SECOND=
# NEXT_PUBLIC_THEME=
# NEXT_PUBLIC_THEME_SWITCH=
# NEXT_PUBLIC_LANG=
# NEXT_PUBLIC_APPEARANCE=
# NEXT_PUBLIC_APPEARANCE_DARK_TIME=
# NEXT_PUBLIC_GREETING_WORDS=
# NEXT_PUBLIC_CUSTOM_MENU=
# NEXT_PUBLIC_AUTHOR=
# NEXT_PUBLIC_BIO=
# NEXT_PUBLIC_LINK=
# NEXT_PUBLIC_KEYWORD=
# NEXT_PUBLIC_CONTACT_EMAIL=
# NEXT_PUBLIC_CONTACT_WEIBO=
# NEXT_PUBLIC_CONTACT_TWITTER=
# NEXT_PUBLIC_CONTACT_GITHUB=
# NEXT_PUBLIC_CONTACT_TELEGRAM=
# NEXT_PUBLIC_CONTACT_LINKEDIN=
# NEXT_PUBLIC_CONTACT_INSTAGRAM=
# NEXT_PUBLIC_CONTACT_BILIBILI=
# NEXT_PUBLIC_CONTACT_YOUTUBE=
# NEXT_PUBLIC_FAVICON=
# NEXT_PUBLIC_FONT_STYLE=
# NEXT_PUBLIC_FONT_URL=
# NEXT_PUBLIC_FONT_SANS=
# NEXT_PUBLIC_FONT_SERIF=
# NEXT_PUBLIC_FONT_AWESOME_PATH=
# NEXT_PUBLIC_PRISM_THEME_PREFIX_PATH=
# NEXT_PUBLIC_PRISM_THEME_SWITCH=
# NEXT_PUBLIC_PRISM_THEME_LIGHT_PATH=
# NEXT_PUBLIC_PRISM_THEME_DARK_PATH=
# NEXT_PUBLIC_CODE_MAC_BAR=
# NEXT_PUBLIC_CODE_LINE_NUMBERS=
# NEXT_PUBLIC_CODE_COLLAPSE=
# NEXT_PUBLIC_CODE_COLLAPSE_EXPAND_DEFAULT=
# NEXT_PUBLIC_MERMAID_CDN=
# NEXT_PUBLIC_QR_CODE_CDN=
# NEXT_PUBLIC_BACKGROUND_LIGHT=
# NEXT_PUBLIC_BACKGROUND_DARK=
# NEXT_PUBLIC_SUB_PATH=
# NEXT_PUBLIC_POST_SHARE_BAR=
# NEXT_PUBLIC_POST_SHARE_SERVICES=
# NEXT_PUBLIC_POST_URL_PREFIX=
# NEXT_PUBLIC_POST_LIST_STYLE=
# NEXT_PUBLIC_POST_PREVIEW=
# NEXT_PUBLIC_POST_RECOMMEND_COUNT=
# NEXT_PUBLIC_POSTS_PER_PAGE=
# NEXT_PUBLIC_POST_SORT_BY=
# NEXT_PUBLIC_ALGOLIA_APP_ID=
# ALGOLIA_ADMIN_APP_KEY=
# NEXT_PUBLIC_ALGOLIA_SEARCH_ONLY_APP_KEY=
# NEXT_PUBLIC_ALGOLIA_INDEX=
# NEXT_PUBLIC_PREVIEW_CATEGORY_COUNT=
# NEXT_PUBLIC_PREVIEW_TAG_COUNT=
# NEXT_PUBLIC_POST_DISABLE_GALLERY_CLICK=
# NEXT_PUBLIC_FIREWORKS=
# NEXT_PUBLIC_FIREWORKS_COLOR=
# NEXT_PUBLIC_SAKURA=
# NEXT_PUBLIC_NEST=
# NEXT_PUBLIC_FLUTTERINGRIBBON=
# NEXT_PUBLIC_RIBBON=
# NEXT_PUBLIC_STARRY_SKY=
# NEXT_PUBLIC_CHATBASE_ID=
# NEXT_PUBLIC_WEB_WHIZ_ENABLED=
# NEXT_PUBLIC_WEB_WHIZ_BASE_URL=
# NEXT_PUBLIC_WEB_WHIZ_CHAT_BOT_ID=
# NEXT_PUBLIC_WIDGET_PET=
# NEXT_PUBLIC_WIDGET_PET_LINK=
# NEXT_PUBLIC_WIDGET_PET_SWITCH_THEME=
# NEXT_PUBLIC_MUSIC_PLAYER=
# NEXT_PUBLIC_MUSIC_PLAYER_VISIBLE=
# NEXT_PUBLIC_MUSIC_PLAYER_AUTO_PLAY=
# NEXT_PUBLIC_MUSIC_PLAYER_LRC_TYPE=
# NEXT_PUBLIC_MUSIC_PLAYER_CDN_URL=
# NEXT_PUBLIC_MUSIC_PLAYER_ORDER=
# NEXT_PUBLIC_MUSIC_PLAYER_AUDIO_LIST=
# NEXT_PUBLIC_MUSIC_PLAYER_METING=
# NEXT_PUBLIC_MUSIC_PLAYER_METING_SERVER=
# NEXT_PUBLIC_MUSIC_PLAYER_METING_ID=
# NEXT_PUBLIC_MUSIC_PLAYER_METING_LRC_TYPE=
# NEXT_PUBLIC_COMMENT_ARTALK_SERVER=
# NEXT_PUBLIC_COMMENT_ARTALK_JS=
# NEXT_PUBLIC_COMMENT_ARTALK_CSS=
# NEXT_PUBLIC_COMMENT_ENV_ID=
# NEXT_PUBLIC_COMMENT_TWIKOO_COUNT_ENABLE=
# NEXT_PUBLIC_COMMENT_TWIKOO_CDN_URL=
# NEXT_PUBLIC_COMMENT_UTTERRANCES_REPO=
# NEXT_PUBLIC_COMMENT_GISCUS_REPO=
# NEXT_PUBLIC_COMMENT_GISCUS_REPO_ID=
# NEXT_PUBLIC_COMMENT_GISCUS_CATEGORY_ID=
# NEXT_PUBLIC_COMMENT_GISCUS_MAPPING=
# NEXT_PUBLIC_COMMENT_GISCUS_REACTIONS_ENABLED=
# NEXT_PUBLIC_COMMENT_GISCUS_EMIT_METADATA=
# NEXT_PUBLIC_COMMENT_GISCUS_INPUT_POSITION=
# NEXT_PUBLIC_COMMENT_GISCUS_LANG=
# NEXT_PUBLIC_COMMENT_GISCUS_LOADING=
# NEXT_PUBLIC_COMMENT_GISCUS_CROSSORIGIN=
# NEXT_PUBLIC_COMMENT_CUSDIS_APP_ID=
# NEXT_PUBLIC_COMMENT_CUSDIS_HOST=
# NEXT_PUBLIC_COMMENT_CUSDIS_SCRIPT_SRC=
# NEXT_PUBLIC_COMMENT_GITALK_REPO=
# NEXT_PUBLIC_COMMENT_GITALK_OWNER=
# NEXT_PUBLIC_COMMENT_GITALK_ADMIN=
# NEXT_PUBLIC_COMMENT_GITALK_CLIENT_ID=
# NEXT_PUBLIC_COMMENT_GITALK_CLIENT_SECRET=
# NEXT_PUBLIC_COMMENT_GITALK_JS_CDN_URL=
# NEXT_PUBLIC_COMMENT_GITALK_CSS_CDN_URL=
# NEXT_PUBLIC_COMMENT_GITTER_ROOM=
# NEXT_PUBLIC_COMMENT_DAO_VOICE_ID=
# NEXT_PUBLIC_COMMENT_TIDIO_ID=
# NEXT_PUBLIC_VALINE_CDN=
# NEXT_PUBLIC_VALINE_ID=
# NEXT_PUBLIC_VALINE_KEY=
# NEXT_PUBLIC_VALINE_SERVER_URLS=
# NEXT_PUBLIC_VALINE_PLACEHOLDER=
# NEXT_PUBLIC_WALINE_SERVER_URL=
# NEXT_PUBLIC_WALINE_RECENT=
# NEXT_PUBLIC_WEBMENTION_ENABLE=
# NEXT_PUBLIC_WEBMENTION_AUTH=
# NEXT_PUBLIC_WEBMENTION_HOSTNAME=
# NEXT_PUBLIC_TWITTER_USERNAME=
# NEXT_PUBLIC_WEBMENTION_TOKEN=
# NEXT_PUBLIC_ANALYTICS_VERCEL=
# NEXT_PUBLIC_ANALYTICS_BUSUANZI_ENABLE=
# NEXT_PUBLIC_ANALYTICS_BAIDU_ID=
# NEXT_PUBLIC_ANALYTICS_CNZZ_ID=
# NEXT_PUBLIC_ANALYTICS_GOOGLE_ID=
# NEXT_PUBLIC_ANALYTICS_ACKEE_TRACKER=
# NEXT_PUBLIC_ANALYTICS_ACKEE_DATA_SERVER=
# NEXT_PUBLIC_ANALYTICS_ACKEE_DOMAIN_ID=
# NEXT_PUBLIC_SEO_GOOGLE_SITE_VERIFICATION=
# NEXT_PUBLIC_SEO_BAIDU_SITE_VERIFICATION=
# NEXT_PUBLIC_ADSENSE_GOOGLE_ID=
# NEXT_PUBLIC_ADSENSE_GOOGLE_TEST=
# NEXT_PUBLIC_ADSENSE_GOOGLE_SLOT_IN_ARTICLE=
# NEXT_PUBLIC_ADSENSE_GOOGLE_SLOT_FLOW=
# NEXT_PUBLIC_ADSENSE_GOOGLE_SLOT_NATIVE=
# NEXT_PUBLIC_ADSENSE_GOOGLE_SLOT_AUTO=
# NEXT_PUBLIC_WWAD_ID=
# NEXT_PUBLIC_WWADS_AD_BLOCK_DETECT=
# NEXT_PUBLIC_NOTION_PROPERTY_PASSWORD=
# NEXT_PUBLIC_NOTION_PROPERTY_TYPE=
# NEXT_PUBLIC_NOTION_PROPERTY_TYPE_POST=
# NEXT_PUBLIC_NOTION_PROPERTY_TYPE_PAGE=
# NEXT_PUBLIC_NOTION_PROPERTY_TYPE_NOTICE=
# NEXT_PUBLIC_NOTION_PROPERTY_TYPE_MENU=
# NEXT_PUBLIC_NOTION_PROPERTY_TYPE_SUB_MENU=
# NEXT_PUBLIC_NOTION_PROPERTY_TITLE=
# NEXT_PUBLIC_NOTION_PROPERTY_STATUS=
# NEXT_PUBLIC_NOTION_PROPERTY_STATUS_PUBLISH=
# NEXT_PUBLIC_NOTION_PROPERTY_STATUS_INVISIBLE=
# NEXT_PUBLIC_NOTION_PROPERTY_SUMMARY=
# NEXT_PUBLIC_NOTION_PROPERTY_SLUG=
# NEXT_PUBLIC_NOTION_PROPERTY_CATEGORY=
# NEXT_PUBLIC_NOTION_PROPERTY_DATE=
# NEXT_PUBLIC_NOTION_PROPERTY_TAGS=
# NEXT_PUBLIC_NOTION_PROPERTY_ICON=
# NEXT_PUBLIC_ENABLE_RSS=
# MAILCHIMP_LIST_ID=
# MAILCHIMP_API_KEY=
# NEXT_PUBLIC_DEBUG=
# ENABLE_CACHE=
# VERCEL_ENV=
# NEXT_PUBLIC_VERSION=
18 changes: 9 additions & 9 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,23 @@ assignees: tangly1024
-->

**描述bug**
简单说明bug的现象、相关的错误提示、日志等
【此项必填】简单说明bug的现象、相关的错误提示、日志等

**复现步骤**
出现这个bug的操作步骤
【此项必填】出现这个bug的操作步骤

**期望的正常结果**
希望按这个步骤,正常操作结果是什么
【此项必填】希望按这个步骤,正常操作结果是什么

**截图**
相关的页面,应该的结果
【可选】相关的页面,应该的结果

**环境**

- 操作系统: [例如. iOS, Android, macOS, windows]
- 浏览器 [例如. chrome, safari, firefox]
- NotionNext版本 [e.g. 3.13.6]
- 主题 [例如. hexo]
- 【必填】NotionNext版本 [例如. 4.0.18]
- 【必填】主题 [例如. hexo]
- 【可选】操作系统: [例如. iOS, Android, macOS, windows]
- 【可选】浏览器 [例如. chrome, safari, firefox]

**补充说明**
与问题相关的其它说明
【可选】与问题相关的其它说明
8 changes: 8 additions & 0 deletions blog.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ const BLOG = {

BLOG_FAVICON: process.env.NEXT_PUBLIC_FAVICON || '/favicon.ico', // blog favicon 配置, 默认使用 /public/favicon.ico,支持在线图片,如 https://img.imesong.com/favicon.png

RANDOM_IMAGE_URL: process.env.NEXT_PUBLIC_RANDOM_IMAGE_URL || '', // 随机图片API,如果未配置下面的关键字,主页封面,头像,文章封面图都会被替换为随机图片
RANDOM_IMAGE_REPLACE_TEXT: process.env.NEXT_PUBLIC_RANDOM_IMAGE_NOT_REPLACE_TEXT || 'images.unsplash.com', // 触发替换图片的 url 关键字(多个支持用英文逗号分开),只有图片地址中包含此关键字才会替换为上方随机图片url
// eg: images.unsplash.com(notion图床的所有图片都会替换),如果你在 notion 里已经添加了一个随机图片 url,恰巧那个服务跑路或者挂掉,想一键切换所有配图可以将该 url 配置在这里
// 默认下会将你上传到 notion的主页封面图和头像也给替换,建议将主页封面图和头像放在其他图床,在 notion 里配置 link 即可。

// START ************网站字体*****************

FONT_STYLE: process.env.NEXT_PUBLIC_FONT_STYLE || 'font-sans', // ['font-serif','font-sans'] 两种可选,分别是衬线和无衬线: 参考 https://www.jianshu.com/p/55e410bd2115
Expand Down Expand Up @@ -319,6 +324,9 @@ const BLOG = {
ANALYTICS_CNZZ_ID: process.env.NEXT_PUBLIC_ANALYTICS_CNZZ_ID || '', // 只需要填写站长统计的id, [cnzz_id] -> https://s9.cnzz.com/z_stat.php?id=[cnzz_id]&web_id=[cnzz_id]
ANALYTICS_GOOGLE_ID: process.env.NEXT_PUBLIC_ANALYTICS_GOOGLE_ID || '', // 谷歌Analytics的id e.g: G-XXXXXXXXXX

// Matomo 网站统计
MATOMO_HOST_URL: process.env.NEXT_PUBLIC_MATOMO_HOST_URL || '', // Matomo服务器地址,不带斜杠
MATOMO_SITE_ID: process.env.NEXT_PUBLIC_MATOMO_SITE_ID || '', // Matomo网站ID
// ACKEE网站访客统计工具
ANALYTICS_ACKEE_TRACKER: process.env.NEXT_PUBLIC_ANALYTICS_ACKEE_TRACKER || '', // e.g 'https://ackee.tangly1024.com/tracker.js'
ANALYTICS_ACKEE_DATA_SERVER: process.env.NEXT_PUBLIC_ANALYTICS_ACKEE_DATA_SERVER || '', // e.g https://ackee.tangly1024.com , don't end with a slash
Expand Down
99 changes: 65 additions & 34 deletions components/AlgoliaSearchModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,43 +102,74 @@ export default function AlgoliaSearchModal({ cRef }) {
}

return (
<div id='search-wrapper' className={`${isModalOpen ? 'opacity-100' : 'invisible opacity-0 pointer-events-none'} z-30 fixed h-screen w-screen left-0 top-0 mt-12 flex items-start justify-center`}>

{/* 模态框 */}
<div className={`${isModalOpen ? 'opacity-100' : 'invisible opacity-0 translate-y-10'} flex flex-col justify-between w-full min-h-[10rem] max-w-xl dark:bg-hexo-black-gray dark:border-gray-800 bg-white dark:bg- p-5 rounded-lg z-50 shadow border hover:border-blue-600 duration-300 transition-all `}>

<div className='flex justify-between items-center'>
<div className='text-2xl text-blue-600 font-bold'>搜索</div>
<div><i className="text-gray-600 fa-solid fa-xmark p-1 cursor-pointer hover:text-blue-600" onClick={closeModal} ></i></div>
</div>

<input type="text" placeholder="在这里输入搜索关键词..." onChange={(e) => handleInputChange(e)}
className="text-black dark:text-gray-200 bg-gray-50 dark:bg-gray-600 outline-blue-500 w-full px-4 my-2 py-1 mb-4 border rounded-md" />

{/* 标签组 */}
<div className='mb-4'>
<TagGroups/>
</div>

<ul>
{searchResults.map((result) => (
<li key={result.objectID} className="replace my-2">
<a href={`${siteConfig('SUB_PATH')}/${result.slug}`} className="font-bold hover:text-blue-600 text-black dark:text-gray-200">
{result.title}
</a>
</li>
))}
</ul>

<Pagination totalPage={totalPage} page={page} switchPage={switchPage}/>
<div>{totalHit > 0 && <div>共搜索到 {totalHit} 条结果,用时 {useTime} 毫秒</div> }</div>
<div className='text-gray-600 mt-2'><span><i className="fa-brands fa-algolia"></i> Algolia 提供搜索服务</span> </div>
</div>
<div
id="search-wrapper"
className={`${
isModalOpen ? 'opacity-100' : 'invisible opacity-0 pointer-events-none'
} z-30 fixed h-screen w-screen left-0 top-0 mt-12 flex items-start justify-center`}
>
{/* 模态框 */}
<div
className={`${
isModalOpen ? 'opacity-100' : 'invisible opacity-0 translate-y-10'
} flex flex-col justify-between w-full min-h-[10rem] max-w-xl dark:bg-hexo-black-gray dark:border-gray-800 bg-white dark:bg- p-5 rounded-lg z-50 shadow border hover:border-blue-600 duration-300 transition-all `}
>
<div className="flex justify-between items-center">
<div className="text-2xl text-blue-600 font-bold">搜索</div>
<div>
<i
className="text-gray-600 fa-solid fa-xmark p-1 cursor-pointer hover:text-blue-600"
onClick={closeModal}
></i>
</div>
</div>

<input
type="text"
placeholder="在这里输入搜索关键词..."
onChange={e => handleInputChange(e)}
className="text-black dark:text-gray-200 bg-gray-50 dark:bg-gray-600 outline-blue-500 w-full px-4 my-2 py-1 mb-4 border rounded-md"
/>

{/* 遮罩 */}
<div onClick={closeModal} className="z-30 fixed top-0 left-0 w-full h-full flex items-center justify-center glassmorphism" />
{/* 标签组 */}
<div className="mb-4">
<TagGroups />
</div>

<ul>
{searchResults.map(result => (
<li key={result.objectID} className="replace my-2">
<a
href={`${siteConfig('SUB_PATH', '')}/${result.slug}`}
className="font-bold hover:text-blue-600 text-black dark:text-gray-200"
>
{result.title}
</a>
</li>
))}
</ul>

<Pagination totalPage={totalPage} page={page} switchPage={switchPage} />
<div>
{totalHit > 0 && (
<div>
共搜索到 {totalHit} 条结果,用时 {useTime} 毫秒
</div>
)}
</div>
<div className="text-gray-600 mt-2">
<span>
<i className="fa-brands fa-algolia"></i> Algolia 提供搜索服务
</span>{' '}
</div>
</div>

{/* 遮罩 */}
<div
onClick={closeModal}
className="z-30 fixed top-0 left-0 w-full h-full flex items-center justify-center glassmorphism"
/>
</div>
)
}

Expand Down
18 changes: 18 additions & 0 deletions components/ExternalPlugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,24 @@ const ExternalPlugin = (props) => {
/>
</>)}

{/* Matomo 统计 */}
{siteConfig('MATOMO_HOST_URL') && siteConfig('MATOMO_SITE_ID') && (
<script async dangerouslySetInnerHTML={{
__html: `
var _paq = window._paq = window._paq || [];
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u="//${siteConfig('MATOMO_HOST_URL')}/";
_paq.push(['setTrackerUrl', u+'matomo.php']);
_paq.push(['setSiteId', '${siteConfig('MATOMO_SITE_ID')}']);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
})();
`
}}/>
)}

</>
}

Expand Down
22 changes: 12 additions & 10 deletions components/QrCode.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,18 @@ export default function QrCode({ value }) {
return
}
loadExternalResource(qrCodeCDN, 'js').then(url => {
const QRCode = window.QRCode
qrcode = new QRCode(document.getElementById('qrcode'), {
text: value,
width: 256,
height: 256,
colorDark: '#000000',
colorLight: '#ffffff',
correctLevel: QRCode.CorrectLevel.H
})
// console.log('二维码', qrcode, value)
const QRCode = window?.QRCode
if (typeof QRCode !== 'undefined') {
qrcode = new QRCode(document.getElementById('qrcode'), {
text: value,
width: 256,
height: 256,
colorDark: '#000000',
colorLight: '#ffffff',
correctLevel: QRCode.CorrectLevel.H
})
// console.log('二维码', qrcode, value)
}
})
return () => {
if (qrcode) {
Expand Down
Loading

0 comments on commit b6f5276

Please sign in to comment.