diff --git a/.github/workflows/docker-ghcr.yaml b/.github/workflows/docker-ghcr.yaml index db58d8d8..c2a4b38e 100644 --- a/.github/workflows/docker-ghcr.yaml +++ b/.github/workflows/docker-ghcr.yaml @@ -28,16 +28,16 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 + uses: docker/setup-buildx-action@v3 # Login against a Docker registry except on PR # https://github.com/docker/login-action - name: Log into registry ${{ env.REGISTRY }} if: github.event_name != 'pull_request' - uses: docker/login-action@v1 + uses: docker/login-action@v3 with: registry: ${{ env.REGISTRY }} username: ${{ github.actor }} @@ -47,14 +47,14 @@ jobs: # https://github.com/docker/metadata-action - name: Extract Docker metadata id: meta - uses: docker/metadata-action@v3 + uses: docker/metadata-action@v5 with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} # Build and push Docker image with Buildx (don't push on PR) # https://github.com/docker/build-push-action - name: Build and push Docker image - uses: docker/build-push-action@v2 + uses: docker/build-push-action@v5 with: context: . platforms: linux/amd64,linux/arm64 diff --git a/.github/workflows/pushUrl.yml b/.github/workflows/pushUrl.yml index c8a3651f..e0bc3ac9 100644 --- a/.github/workflows/pushUrl.yml +++ b/.github/workflows/pushUrl.yml @@ -24,11 +24,11 @@ jobs: runs-on: ubuntu-latest # 运行环境为最新版的Ubuntu steps: - name: 'Checkout codes' # 步骤一,获取仓库代码 - uses: actions/checkout@v2 + uses: actions/checkout@v4 # - name: 'Run baiduPush' # 步骤二,执行sh命令文件 # run: npm install && npm run baiduPush # 运行目录是仓库根目录 - name: Set up Python 3.8 - uses: actions/setup-python@v1 + uses: actions/setup-python@v5 with: python-version: 3.8 diff --git a/.github/workflows/sync.yaml b/.github/workflows/sync.yaml index 038eff8d..7dcb3e16 100644 --- a/.github/workflows/sync.yaml +++ b/.github/workflows/sync.yaml @@ -17,7 +17,7 @@ jobs: steps: # Step 1: run a standard checkout action - name: Checkout target repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 # Step 2: run the sync action - name: Sync upstream changes diff --git a/blog.config.js b/blog.config.js index bd1bb579..7a2c2678 100644 --- a/blog.config.js +++ b/blog.config.js @@ -545,7 +545,7 @@ const BLOG = { process.env.ENABLE_CACHE || process.env.npm_lifecycle_event === 'build' || process.env.npm_lifecycle_event === 'export', // 在打包过程中默认开启缓存,开发或运行时开启此功能意义不大。 - isProd: process.env.VERCEL_ENV === 'production' || process.env.EXPORT, // distinguish between development and production environment (ref: https://vercel.com/docs/environment-variables#system-environment-variables) isProd: process.env.VERCEL_ENV === 'production' // distinguish between development and production environment (ref: https://vercel.com/docs/environment-variables#system-environment-variables) + isProd: process.env.VERCEL_ENV === 'production' || process.env.EXPORT, // distinguish between development and production environment (ref: https://vercel.com/docs/environment-variables#system-environment-variables) BUNDLE_ANALYZER: process.env.ANALYZE === 'true' || false, // 是否展示编译依赖内容与大小 VERSION: process.env.NEXT_PUBLIC_VERSION // 版本号 } diff --git a/components/Ackee.js b/components/Ackee.js index 2383f982..88618369 100644 --- a/components/Ackee.js +++ b/components/Ackee.js @@ -24,19 +24,19 @@ const Ackee = () => { }, { /* - * Enable or disable tracking of personal data. - * We recommend to ask the user for permission before turning this option on. - */ + * Enable or disable tracking of personal data. + * We recommend to ask the user for permission before turning this option on. + */ detailed: true, /* - * Enable or disable tracking when on localhost. - */ + * Enable or disable tracking when on localhost. + */ ignoreLocalhost: false, /* - * Enable or disable the tracking of your own visits. - * This is enabled by default, but should be turned off when using a wildcard Access-Control-Allow-Origin header. - * Some browsers strictly block third-party cookies. The option won't have an impact when this is the case. - */ + * Enable or disable the tracking of your own visits. + * This is enabled by default, but should be turned off when using a wildcard Access-Control-Allow-Origin header. + * Some browsers strictly block third-party cookies. The option won't have an impact when this is the case. + */ ignoreOwnVisits: false } ) diff --git a/components/CustomContextMenu.js b/components/CustomContextMenu.js index 8402f20e..19b65395 100644 --- a/components/CustomContextMenu.js +++ b/components/CustomContextMenu.js @@ -117,12 +117,14 @@ export default function CustomContextMenu(props) { function handleCopy() { const selectedText = document.getSelection().toString() if (selectedText) { - const tempInput = document.createElement('input') - tempInput.value = selectedText - document.body.appendChild(tempInput) - tempInput.select() - document.execCommand('copy') - document.body.removeChild(tempInput) + const tempInput = document.createElement('input'); + tempInput.value = selectedText; + document.body.appendChild(tempInput); + tempInput.select(); + document.execCommand('copy'); + if (tempInput && tempInput.parentNode && tempInput.parentNode.contains(tempInput)) { + tempInput.parentNode.removeChild(tempInput); + } // alert("Text copied: " + selectedText); } else { // alert("Please select some text first."); diff --git a/components/DifyChatbot.js b/components/DifyChatbot.js index c954a872..6190c58b 100644 --- a/components/DifyChatbot.js +++ b/components/DifyChatbot.js @@ -24,7 +24,9 @@ export default function DifyChatbot() { return () => { // 在组件卸载时清理 script 标签 const existingScript = document.getElementById(siteConfig('DIFY_CHATBOT_TOKEN')); // 注意调用 siteConfig() - if (existingScript) document.body.removeChild(existingScript); + if (existingScript && existingScript.parentNode && existingScript.parentNode.contains(existingScript)) { + existingScript.parentNode.removeChild(existingScript); + } }; }, []); // 注意依赖数组为空,意味着脚本将仅在加载页面时执行一次 diff --git a/components/ExternalPlugins.js b/components/ExternalPlugins.js index 7ee54a10..24ba5b55 100644 --- a/components/ExternalPlugins.js +++ b/components/ExternalPlugins.js @@ -186,10 +186,19 @@ const ExternalPlugin = props => { async dangerouslySetInnerHTML={{ __html: ` - (function(c,l,a,r,i,t,y){ - c[a]=c[a]||function(){(c[a].q=c[a].q||[]).push(arguments)}; - t=l.createElement(r);t.async=1;t.src="https://www.clarity.ms/tag/"+i; - y=l.getElementsByTagName(r)[0];y.parentNode.insertBefore(t,y); + (function(c, l, a, r, i, t, y) { + c[a] = c[a] || function() { + (c[a].q = c[a].q || []).push(arguments); + }; + t = l.createElement(r); + t.async = 1; + t.src = "https://www.clarity.ms/tag/" + i; + y = l.getElementsByTagName(r)[0]; + if (y && y.parentNode) { + y.parentNode.insertBefore(t, y); + } else { + l.head.appendChild(t); + } })(window, document, "clarity", "script", "${CLARITY_ID}"); ` }} @@ -204,8 +213,24 @@ const ExternalPlugin = props => { async dangerouslySetInnerHTML={{ __html: ` - (function(i,s,o,g,r,a,m){i["DaoVoiceObject"]=r;i[r]=i[r]||function(){(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;a.charset="utf-8";m.parentNode.insertBefore(a,m)})(window,document,"script",('https:' == document.location.protocol ? 'https:' : 'http:') + "//widget.daovoice.io/widget/daf1a94b.js","daovoice") - ` + (function(i, s, o, g, r, a, m) { + i["DaoVoiceObject"] = r; + i[r] = i[r] || function() { + (i[r].q = i[r].q || []).push(arguments); + }; + i[r].l = 1 * new Date(); + a = s.createElement(o); + m = s.getElementsByTagName(o)[0]; + a.async = 1; + a.src = g; + a.charset = "utf-8"; + if (m && m.parentNode) { + m.parentNode.insertBefore(a, m); + } else { + s.head.appendChild(a); + } + })(window, document, "script", ('https:' == document.location.protocol ? 'https:' : 'http:') + "//widget.daovoice.io/widget/daf1a94b.js", "daovoice") + ` }} />