diff --git a/.env.local b/.env.local
index 52c93190..fbd52c87 100644
--- a/.env.local
+++ b/.env.local
@@ -1,2 +1,2 @@
# 环境变量 @see https://www.nextjs.cn/docs/basic-features/environment-variables
-NEXT_PUBLIC_VERSION=4.0.12
\ No newline at end of file
+NEXT_PUBLIC_VERSION=4.0.13
\ No newline at end of file
diff --git a/.github/workflows/baidupush.yml b/.github/workflows/baidupush.yml
new file mode 100644
index 00000000..2541e38f
--- /dev/null
+++ b/.github/workflows/baidupush.yml
@@ -0,0 +1,39 @@
+## 利用GitHub Actions每天定时给百度推送链接,提高收录率 ##
+
+name: baidupush
+
+# 两种触发方式:一、push代码,二、每天国际标准时间23点(北京时间+8即早上7点)运行
+on:
+ # push:
+ schedule:
+ - cron: '0 23 * * *' # https://help.github.com/en/actions/automating-your-workflow-with-github-actions/events-that-trigger-workflows#scheduled-events-schedule
+ workflow_dispatch:
+ inputs:
+ unconditional-invoking:
+ description: 'baidupush unconditionally'
+ type: boolean
+ required: true
+ default: true
+
+# on:
+ # schedule:
+ # - cron: '*/5 * * * *' # 每5分钟一次,测试用
+
+jobs:
+ bot:
+ runs-on: ubuntu-latest # 运行环境为最新版的Ubuntu
+ steps:
+ - name: 'Checkout codes' # 步骤一,获取仓库代码
+ uses: actions/checkout@v2
+ # - name: 'Run baiduPush' # 步骤二,执行sh命令文件
+ # run: npm install && npm run baiduPush # 运行目录是仓库根目录
+ - name: Set up Python 3.8
+ uses: actions/setup-python@v1
+ with:
+ python-version: 3.8
+
+ - name: install requests
+ run: pip install requests
+
+ - name: baidupush
+ run: npm run baidupush
\ No newline at end of file
diff --git a/Dockerfile b/Dockerfile
index fc5c406f..a0311720 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,6 +1,6 @@
ARG NOTION_PAGE_ID
# Install dependencies only when needed
-FROM node:14-alpine AS deps
+FROM node:18-alpine3.18 AS deps
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
RUN apk add --no-cache libc6-compat
WORKDIR /app
@@ -8,7 +8,7 @@ COPY package.json ./
RUN yarn install --frozen-lockfile
# Rebuild the source code only when needed
-FROM node:14-alpine AS builder
+FROM node:18-alpine3.18 AS builder
ARG NOTION_PAGE_ID
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
diff --git a/baidupush.py b/baidupush.py
new file mode 100644
index 00000000..9d0c0130
--- /dev/null
+++ b/baidupush.py
@@ -0,0 +1,18 @@
+import re
+import ssl
+import requests
+import argparse
+
+
+if __name__ == '__main__':
+ ssl._create_default_https_context = ssl._create_unverified_context
+ parser = argparse.ArgumentParser(description='parse sitemap')
+ parser.add_argument('url', help='The url of your website')
+ args = parser.parse_args()
+ url = f'https://{args.url}/sitemap.xml'
+ result = requests.get(url)
+ big = re.findall('(.*?)', result.content.decode('utf-8'), re.S)
+ for i in big:
+ # print(i)
+ op_xml_txt = open('urls.txt', 'a')
+ op_xml_txt.write('%s\n' % i)
diff --git a/baidupush.sh b/baidupush.sh
new file mode 100644
index 00000000..7901c56a
--- /dev/null
+++ b/baidupush.sh
@@ -0,0 +1,12 @@
+#!/usr/bin/env sh
+
+# 确保脚本抛出遇到的错误
+set -e
+
+# 解析sitemap.xml, 记得换成你自己的域名,注意检查是否包含‘www’
+python baidupush.py 'www.ghlerrix.cn'
+
+# 百度链接推送,换成自己的token和域名
+curl -H 'Content-Type:text/plain' --data-binary @urls.txt "http://data.zz.baidu.com/urls?site=https://www.ghlerrix.cn&token=oUldnU4HZvSTlh0e"
+
+rm -rf urls.txt # 删除文件
\ No newline at end of file
diff --git a/blog.config.js b/blog.config.js
index ff3d3702..65683d0d 100644
--- a/blog.config.js
+++ b/blog.config.js
@@ -107,10 +107,10 @@ const BLOG = {
PRISM_JS_AUTO_LOADER: 'https://npm.elemecdn.com/prismjs@1.29.0/plugins/autoloader/prism-autoloader.min.js',
// 代码主题 @see https://github.com/PrismJS/prism-themes
- PRISM_THEME_PREFIX_PATH: 'https://cdn.jsdelivr.net/npm/prismjs@1.29.0/themes/prism-okaidia.css', // 代码块默认主题
+ PRISM_THEME_PREFIX_PATH: process.env.NEXT_PUBLIC_PRISM_THEME_PREFIX_PATH || 'https://cdn.jsdelivr.net/npm/prismjs@1.29.0/themes/prism-okaidia.css', // 代码块默认主题
PRISM_THEME_SWITCH: process.env.NEXT_PUBLIC_PRISM_THEME_SWITCH || true, // 是否开启浅色/深色模式代码主题切换; 开启后将显示以下两个主题
- PRISM_THEME_LIGHT_PATH: 'https://cdn.jsdelivr.net/npm/prismjs@1.29.0/themes/prism-solarizedlight.css', // 浅色模式主题
- PRISM_THEME_DARK_PATH: 'https://cdn.jsdelivr.net/npm/prismjs@1.29.0/themes/prism-okaidia.min.css', // 深色模式主题
+ PRISM_THEME_LIGHT_PATH: process.env.NEXT_PUBLIC_PRISM_THEME_LIGHT_PATH || 'https://cdn.jsdelivr.net/npm/prismjs@1.29.0/themes/prism-solarizedlight.css', // 浅色模式主题
+ PRISM_THEME_DARK_PATH: process.env.NEXT_PUBLIC_PRISM_THEME_DARK_PATH || 'https://cdn.jsdelivr.net/npm/prismjs@1.29.0/themes/prism-okaidia.min.css', // 深色模式主题
CODE_MAC_BAR: process.env.NEXT_PUBLIC_CODE_MAC_BAR || true, // 代码左上角显示mac的红黄绿图标
CODE_LINE_NUMBERS: process.env.NEXT_PUBLIC_CODE_LINE_NUMBERS || false, // 是否显示行号
@@ -332,6 +332,8 @@ const BLOG = {
// <---- 站点统计
+ // START---->营收相关
+
// 谷歌广告
ADSENSE_GOOGLE_ID: process.env.NEXT_PUBLIC_ADSENSE_GOOGLE_ID || '', // 谷歌广告ID e.g ca-pub-xxxxxxxxxxxxxxxx
ADSENSE_GOOGLE_TEST: process.env.NEXT_PUBLIC_ADSENSE_GOOGLE_TEST || false, // 谷歌广告ID测试模式,这种模式获取假的测试广告,用于开发 https://www.tangly1024.com/article/local-dev-google-adsense
@@ -340,6 +342,12 @@ const BLOG = {
ADSENSE_GOOGLE_SLOT_NATIVE: process.env.NEXT_PUBLIC_ADSENSE_GOOGLE_SLOT_NATIVE || '4980048999', // Google AdScene>广告>按单元广告>新建原生广告
ADSENSE_GOOGLE_SLOT_AUTO: process.env.NEXT_PUBLIC_ADSENSE_GOOGLE_SLOT_AUTO || '8807314373', // Google AdScene>广告>按单元广告>新建展示广告 (自动广告)
+ // 万维广告
+ AD_WWADS_ID: process.env.NEXT_PUBLIC_WWAD_ID || null, // https://wwads.cn/ 创建您的万维广告单元ID
+ AD_WWADS_BLOCK_DETECT: process.env.NEXT_PUBLIC_WWADS_AD_BLOCK_DETECT || false, // 是否开启WWADS广告屏蔽插件检测,开启后会在广告位上以文字提示 @see https://github.com/bytegravity/whitelist-wwads
+
+ // END<----营收相关
+
// 自定义配置notion数据库字段名
NOTION_PROPERTY_NAME: {
password: process.env.NEXT_PUBLIC_NOTION_PROPERTY_PASSWORD || 'password',
diff --git a/components/AdBlockDetect.js b/components/AdBlockDetect.js
new file mode 100644
index 00000000..00758a08
--- /dev/null
+++ b/components/AdBlockDetect.js
@@ -0,0 +1,40 @@
+import { useEffect } from 'react'
+
+/**
+ * 检测广告插件
+ * @returns
+ */
+export default function AdBlockDetect() {
+ useEffect(() => {
+ // 如果检测到广告屏蔽插件
+ function ABDetected() {
+ if (!document) {
+ return
+ }
+ const wwadsCns = document.getElementsByClassName('wwads-cn')
+ if (wwadsCns && wwadsCns.length > 0) {
+ for (const wwadsCn of wwadsCns) {
+ wwadsCn.insertAdjacentHTML('beforeend', "
")
+ }
+ }
+ };
+
+ // check document ready
+ function docReady(t) {
+ document.readyState === 'complete' ||
+ document.readyState === 'interactive'
+ ? setTimeout(t, 1)
+ : document.addEventListener('DOMContentLoaded', t)
+ }
+
+ // check if wwads' fire function was blocked after document is ready with 3s timeout (waiting the ad loading)
+ docReady(function () {
+ setTimeout(function () {
+ if (window._AdBlockInit === undefined) {
+ ABDetected()
+ }
+ }, 3000)
+ })
+ }, [])
+ return null
+}
diff --git a/components/CommonScript.js b/components/CommonScript.js
index 4ee0f12c..2d6afe14 100644
--- a/components/CommonScript.js
+++ b/components/CommonScript.js
@@ -38,6 +38,8 @@ const CommonScript = () => {
/>
>)}
+ {BLOG.AD_WWADS_ID && }
+
{BLOG.COMMENT_CUSDIS_APP_ID && }
{BLOG.COMMENT_TWIKOO_ENV_ID &&