From 41ba825e7ada24f95c9e6b4f524838cdc9066710 Mon Sep 17 00:00:00 2001 From: boy86001 <103086198+boy86001@users.noreply.github.com> Date: Sun, 30 Nov 2025 11:48:52 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20robots.txt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/robots.txt | 59 ++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 56 insertions(+), 3 deletions(-) diff --git a/public/robots.txt b/public/robots.txt index e9e57dc..3dad881 100644 --- a/public/robots.txt +++ b/public/robots.txt @@ -1,3 +1,56 @@ -# https://www.robotstxt.org/robotstxt.html -User-agent: * -Disallow: +# As a condition of accessing this website, you agree to abide by the following +# content signals: + +# (a) If a content-signal = yes, you may collect content for the corresponding +# use. +# (b) If a content-signal = no, you may not collect content for the +# corresponding use. +# (c) If the website operator does not include a content signal for a +# corresponding use, the website operator neither grants nor restricts +# permission via content signal with respect to the corresponding use. + +# The content signals and their meanings are: + +# search: building a search index and providing search results (e.g., returning +# hyperlinks and short excerpts from your website's contents). Search does not +# include providing AI-generated search summaries. +# ai-input: inputting content into one or more AI models (e.g., retrieval +# augmented generation, grounding, or other real-time taking of content for +# generative AI search answers). +# ai-train: training or fine-tuning AI models. + +# ANY RESTRICTIONS EXPRESSED VIA CONTENT SIGNALS ARE EXPRESS RESERVATIONS OF +# RIGHTS UNDER ARTICLE 4 OF THE EUROPEAN UNION DIRECTIVE 2019/790 ON COPYRIGHT +# AND RELATED RIGHTS IN THE DIGITAL SINGLE MARKET. + +# BEGIN Cloudflare Managed content + +User-Agent: * +Content-signal: search=yes,ai-train=no +Allow: / + +User-agent: Amazonbot +Disallow: / + +User-agent: Applebot-Extended +Disallow: / + +User-agent: Bytespider +Disallow: / + +User-agent: CCBot +Disallow: / + +User-agent: ClaudeBot +Disallow: / + +User-agent: Google-Extended +Disallow: / + +User-agent: GPTBot +Disallow: / + +User-agent: meta-externalagent +Disallow: / + +# END Cloudflare Managed Content From ef07983ac4849d75efb6c749b0363f0d6cb5ebfb Mon Sep 17 00:00:00 2001 From: boy86001 <103086198+boy86001@users.noreply.github.com> Date: Sun, 30 Nov 2025 11:49:46 +0800 Subject: [PATCH 2/5] Add files via upload --- public/sitemap.xml | 165 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 165 insertions(+) create mode 100644 public/sitemap.xml diff --git a/public/sitemap.xml b/public/sitemap.xml new file mode 100644 index 0000000..b473888 --- /dev/null +++ b/public/sitemap.xml @@ -0,0 +1,165 @@ + + + + + https://zero001.icu/webdav/index.html + 2025-11-26 + weekly + 1.0 + + + + + https://zero001.icu/webdav/index.html?post=2024-06-25 + 2024-06-25 + monthly + 0.8 + + + + https://zero001.icu/webdav/index.html?post=2024-09-19 + 2024-09-19 + monthly + 0.8 + + + + https://zero001.icu/webdav/index.html?post=2024-09-25 + 2024-09-25 + monthly + 0.8 + + + + https://zero001.icu/webdav/index.html?post=2024-10-19 + 2024-10-19 + monthly + 0.8 + + + + https://zero001.icu/webdav/index.html?post=2024-10-21 + 2024-10-21 + monthly + 0.8 + + + + https://zero001.icu/webdav/index.html?post=2024-10-24 + 2024-10-24 + monthly + 0.8 + + + + https://zero001.icu/webdav/index.html?post=2024-10-31 + 2024-10-31 + monthly + 0.8 + + + + https://zero001.icu/webdav/index.html?post=2024-11-07 + 2024-11-07 + monthly + 0.8 + + + + https://zero001.icu/webdav/index.html?post=2024-11-19 + 2024-11-19 + monthly + 0.8 + + + + https://zero001.icu/webdav/index.html?post=2025-01-05 + 2025-01-05 + monthly + 0.8 + + + + https://zero001.icu/webdav/index.html?post=2025-01-22 + 2025-01-22 + monthly + 0.8 + + + + https://zero001.icu/webdav/index.html?post=2025-03-19 + 2025-03-19 + monthly + 0.8 + + + + https://zero001.icu/webdav/index.html?post=2025-04-10 + 2025-04-10 + monthly + 0.8 + + + + https://zero001.icu/webdav/index.html?post=2025-04-17 + 2025-04-17 + monthly + 0.8 + + + + https://zero001.icu/webdav/index.html?post=2025-05-30 + 2025-05-30 + monthly + 0.8 + + + + https://zero001.icu/webdav/index.html?post=2025-05-31 + 2025-05-31 + monthly + 0.8 + + + + https://zero001.icu/webdav/index.html?post=2025-07-14 + 2025-07-14 + monthly + 0.8 + + + + https://zero001.icu/webdav/index.html?post=2025-08-18 + 2025-08-18 + monthly + 0.8 + + + + https://zero001.icu/webdav/index.html?post=2025-08-23 + 2025-08-23 + monthly + 0.8 + + + + https://zero001.icu/webdav/index.html?post=2025-08-26 + 2025-08-26 + monthly + 0.8 + + + + https://zero001.icu/webdav/index.html?post=2025-11-26 + 2025-11-26 + monthly + 0.8 + + + + https://zero001.icu/webdav/index.html?post=2025-11-29 + 2025-11-29 + monthly + 0.8 + + \ No newline at end of file From 403187eb0aa26d45819d5147ec416f4458799e49 Mon Sep 17 00:00:00 2001 From: boy86001 <103086198+boy86001@users.noreply.github.com> Date: Sun, 30 Nov 2025 12:40:10 +0800 Subject: [PATCH 3/5] Create [[path]].ts --- functions/[[path]].ts | 107 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100644 functions/[[path]].ts diff --git a/functions/[[path]].ts b/functions/[[path]].ts new file mode 100644 index 0000000..b00251e --- /dev/null +++ b/functions/[[path]].ts @@ -0,0 +1,107 @@ +// functions/[[path]].ts +// 这个文件处理根目录的文件访问,同时保持 WebDAV 和管理界面正常工作 + +export const onRequest: PagesFunction<{ + BUCKET: R2Bucket; +}> = async function (context) { + const request = context.request; + const url = new URL(request.url); + const pathname = url.pathname; + + console.log(`[Root Handler] 请求路径: ${pathname}`); + + // ======================================== + // 跳过这些路径,让 TWO 系统处理 + // ======================================== + + const skipPaths = [ + '/', // 首页 - TWO 管理界面 + '/favicon.ico', // 网站图标 + '/robots.txt', // robots + ]; + + const skipPrefixes = [ + '/webdav/', // WebDAV 接口(重要!) + '/api/', // API + '/assets/', // 静态资源 + '/static/', // 静态文件 + '/_next/', // Next.js + '/build/', // Docusaurus 构建文件 + '/img/', // 图片资源 + '/css/', // CSS + '/js/', // JS + '/fonts/', // 字体 + ]; + + // 检查是否需要跳过 + if (skipPaths.includes(pathname)) { + console.log(`[Root Handler] 跳过: ${pathname}`); + return context.next(); + } + + for (const prefix of skipPrefixes) { + if (pathname.startsWith(prefix)) { + console.log(`[Root Handler] 跳过: ${pathname} (匹配 ${prefix})`); + return context.next(); + } + } + + // 如果路径没有文件扩展名且不以 / 结尾,可能是页面路由 + const hasExtension = pathname.includes('.') && !pathname.endsWith('/'); + if (!hasExtension) { + console.log(`[Root Handler] 跳过: ${pathname} (可能是页面路由)`); + return context.next(); + } + + // ======================================== + // 尝试从 R2 获取文件 + // ======================================== + + const bucket = context.env.BUCKET; + + if (!bucket) { + console.error('[Root Handler] R2 bucket 未绑定'); + return new Response('配置错误: R2 bucket 未绑定', { + status: 500, + headers: { 'Content-Type': 'text/plain; charset=utf-8' } + }); + } + + try { + // 移除开头的 / + const objectKey = pathname.substring(1); + + console.log(`[Root Handler] 尝试从 R2 获取: ${objectKey}`); + + // 从 R2 获取文件 + const object = await bucket.get(objectKey); + + if (!object) { + console.log(`[Root Handler] 文件不存在: ${objectKey}`); + + // 文件不存在,交给 TWO 的 404 处理 + return context.next(); + } + + console.log(`[Root Handler] 成功获取文件: ${objectKey}, 大小: ${object.size} 字节`); + + // 构建响应头 + const headers = new Headers(); + object.writeHttpMetadata(headers); + headers.set('ETag', object.httpEtag); + headers.set('Cache-Control', 'public, max-age=3600'); + headers.set('Access-Control-Allow-Origin', '*'); + + // 返回文件内容 + return new Response(object.body, { + status: 200, + headers: headers, + }); + + } catch (error: any) { + console.error(`[Root Handler] 错误: ${error.message}`); + + // 出错了,交给 TWO 处理 + return context.next(); + } +}; From 209a95cd61922ddbfceec9d5973b8f82dd7b1c16 Mon Sep 17 00:00:00 2001 From: boy86001 <103086198+boy86001@users.noreply.github.com> Date: Sun, 30 Nov 2025 15:03:04 +0800 Subject: [PATCH 4/5] Delete functions/[[path]].ts --- functions/[[path]].ts | 107 ------------------------------------------ 1 file changed, 107 deletions(-) delete mode 100644 functions/[[path]].ts diff --git a/functions/[[path]].ts b/functions/[[path]].ts deleted file mode 100644 index b00251e..0000000 --- a/functions/[[path]].ts +++ /dev/null @@ -1,107 +0,0 @@ -// functions/[[path]].ts -// 这个文件处理根目录的文件访问,同时保持 WebDAV 和管理界面正常工作 - -export const onRequest: PagesFunction<{ - BUCKET: R2Bucket; -}> = async function (context) { - const request = context.request; - const url = new URL(request.url); - const pathname = url.pathname; - - console.log(`[Root Handler] 请求路径: ${pathname}`); - - // ======================================== - // 跳过这些路径,让 TWO 系统处理 - // ======================================== - - const skipPaths = [ - '/', // 首页 - TWO 管理界面 - '/favicon.ico', // 网站图标 - '/robots.txt', // robots - ]; - - const skipPrefixes = [ - '/webdav/', // WebDAV 接口(重要!) - '/api/', // API - '/assets/', // 静态资源 - '/static/', // 静态文件 - '/_next/', // Next.js - '/build/', // Docusaurus 构建文件 - '/img/', // 图片资源 - '/css/', // CSS - '/js/', // JS - '/fonts/', // 字体 - ]; - - // 检查是否需要跳过 - if (skipPaths.includes(pathname)) { - console.log(`[Root Handler] 跳过: ${pathname}`); - return context.next(); - } - - for (const prefix of skipPrefixes) { - if (pathname.startsWith(prefix)) { - console.log(`[Root Handler] 跳过: ${pathname} (匹配 ${prefix})`); - return context.next(); - } - } - - // 如果路径没有文件扩展名且不以 / 结尾,可能是页面路由 - const hasExtension = pathname.includes('.') && !pathname.endsWith('/'); - if (!hasExtension) { - console.log(`[Root Handler] 跳过: ${pathname} (可能是页面路由)`); - return context.next(); - } - - // ======================================== - // 尝试从 R2 获取文件 - // ======================================== - - const bucket = context.env.BUCKET; - - if (!bucket) { - console.error('[Root Handler] R2 bucket 未绑定'); - return new Response('配置错误: R2 bucket 未绑定', { - status: 500, - headers: { 'Content-Type': 'text/plain; charset=utf-8' } - }); - } - - try { - // 移除开头的 / - const objectKey = pathname.substring(1); - - console.log(`[Root Handler] 尝试从 R2 获取: ${objectKey}`); - - // 从 R2 获取文件 - const object = await bucket.get(objectKey); - - if (!object) { - console.log(`[Root Handler] 文件不存在: ${objectKey}`); - - // 文件不存在,交给 TWO 的 404 处理 - return context.next(); - } - - console.log(`[Root Handler] 成功获取文件: ${objectKey}, 大小: ${object.size} 字节`); - - // 构建响应头 - const headers = new Headers(); - object.writeHttpMetadata(headers); - headers.set('ETag', object.httpEtag); - headers.set('Cache-Control', 'public, max-age=3600'); - headers.set('Access-Control-Allow-Origin', '*'); - - // 返回文件内容 - return new Response(object.body, { - status: 200, - headers: headers, - }); - - } catch (error: any) { - console.error(`[Root Handler] 错误: ${error.message}`); - - // 出错了,交给 TWO 处理 - return context.next(); - } -}; From 5bd5c04b6856b84f32de4eec776312c1764df154 Mon Sep 17 00:00:00 2001 From: boy86001 <103086198+boy86001@users.noreply.github.com> Date: Sun, 30 Nov 2025 15:03:43 +0800 Subject: [PATCH 5/5] Delete public/sitemap.xml --- public/sitemap.xml | 165 --------------------------------------------- 1 file changed, 165 deletions(-) delete mode 100644 public/sitemap.xml diff --git a/public/sitemap.xml b/public/sitemap.xml deleted file mode 100644 index b473888..0000000 --- a/public/sitemap.xml +++ /dev/null @@ -1,165 +0,0 @@ - - - - - https://zero001.icu/webdav/index.html - 2025-11-26 - weekly - 1.0 - - - - - https://zero001.icu/webdav/index.html?post=2024-06-25 - 2024-06-25 - monthly - 0.8 - - - - https://zero001.icu/webdav/index.html?post=2024-09-19 - 2024-09-19 - monthly - 0.8 - - - - https://zero001.icu/webdav/index.html?post=2024-09-25 - 2024-09-25 - monthly - 0.8 - - - - https://zero001.icu/webdav/index.html?post=2024-10-19 - 2024-10-19 - monthly - 0.8 - - - - https://zero001.icu/webdav/index.html?post=2024-10-21 - 2024-10-21 - monthly - 0.8 - - - - https://zero001.icu/webdav/index.html?post=2024-10-24 - 2024-10-24 - monthly - 0.8 - - - - https://zero001.icu/webdav/index.html?post=2024-10-31 - 2024-10-31 - monthly - 0.8 - - - - https://zero001.icu/webdav/index.html?post=2024-11-07 - 2024-11-07 - monthly - 0.8 - - - - https://zero001.icu/webdav/index.html?post=2024-11-19 - 2024-11-19 - monthly - 0.8 - - - - https://zero001.icu/webdav/index.html?post=2025-01-05 - 2025-01-05 - monthly - 0.8 - - - - https://zero001.icu/webdav/index.html?post=2025-01-22 - 2025-01-22 - monthly - 0.8 - - - - https://zero001.icu/webdav/index.html?post=2025-03-19 - 2025-03-19 - monthly - 0.8 - - - - https://zero001.icu/webdav/index.html?post=2025-04-10 - 2025-04-10 - monthly - 0.8 - - - - https://zero001.icu/webdav/index.html?post=2025-04-17 - 2025-04-17 - monthly - 0.8 - - - - https://zero001.icu/webdav/index.html?post=2025-05-30 - 2025-05-30 - monthly - 0.8 - - - - https://zero001.icu/webdav/index.html?post=2025-05-31 - 2025-05-31 - monthly - 0.8 - - - - https://zero001.icu/webdav/index.html?post=2025-07-14 - 2025-07-14 - monthly - 0.8 - - - - https://zero001.icu/webdav/index.html?post=2025-08-18 - 2025-08-18 - monthly - 0.8 - - - - https://zero001.icu/webdav/index.html?post=2025-08-23 - 2025-08-23 - monthly - 0.8 - - - - https://zero001.icu/webdav/index.html?post=2025-08-26 - 2025-08-26 - monthly - 0.8 - - - - https://zero001.icu/webdav/index.html?post=2025-11-26 - 2025-11-26 - monthly - 0.8 - - - - https://zero001.icu/webdav/index.html?post=2025-11-29 - 2025-11-29 - monthly - 0.8 - - \ No newline at end of file