前言

创建服务

Untitled

Untitled

Untitled

克隆并修改代码

name = "blog" #你cloudflare的worker名称,也就是test-blog
main = "src/index.js"
compatibility_date = "2023-01-25"
route = "blog.kali-team.cn/*" #这个是你博客子域名
usage_model = "bundled"
env = { }

[triggers]
crons = [ ]

[vars]
MY_DOMAIN = "blog.kali-team.cn"
NOTION_DOMAIN = "kali-team.notion.site" #你分享出来的notion子域名
INDEX_PAGE_ID = "edb6a939baab4424a25fd295b3c51312" # 分享出来的主页page id
LINK_PAGE_ID = "9c74faba0b14441a93c2f94a40da3f79" # 友情链接页面的page id
DONATE_PAGE_ID = "eb55bc48f7fb42bfaef8473d2b7b63aa" # 赞助页面 page id
PAGE_TITLE = "Kali-Team" # 博客标题
PAGE_DESCRIPTION = "三米前有蕉皮" # 博客meta标签描述
SITEMAP_BODY = '{"source":{"type":"collection","id":"52de4e5e-ba6e-46a2-9dc5-5581637cf339","spaceId":"d4aa424b-d5f8-4dc3-a0fb-e5270f17203e"},"collectionView":{"id":"a5b688dd-2876-4f80-a47d-d84e713ac56e","spaceId":"d4aa424b-d5f8-4dc3-a0fb-e5270f17203e"},"loader":{"type":"reducer","reducers":{"collection_group_results":{"type":"results","limit":50},"table:uncategorized:title:unique":{"type":"aggregation","aggregation":{"property":"title","aggregator":"unique"}},"table:uncategorized:|oXv:latest_date":{"type":"aggregation","aggregation":{"property":"|oXv","aggregator":"latest_date"}},"table:uncategorized:L:TS:[object Object]":{"type":"aggregation","aggregation":{"property":"L:TS","aggregator":{"operator":"percent_per_group","groupName":"Complete"}}}},"sort":[{"property":"|oXv","direction":"descending"}],"searchQuery":"","userTimeZone":"Asia/Shanghai"}}'

Untitled

部署更新

➜  blog git:(main) wrangler2 publish
 ⛅️ wrangler 2.8.0 (update available 2.9.1)
-----------------------------------------------------
Your worker has access to the following bindings:
- Vars:
  - MY_DOMAIN: "blog.kali-team.cn"
  - NOTION_DOMAIN: "kali-team.notion.site"
  - INDEX_PAGE_ID: "edb6a939baab4424a25fd295b3c51312"
  - LINK_PAGE_ID: "9c74faba0b14441a93c2f94a40da3f79"
  - DONATE_PAGE_ID: "eb55bc48f7fb42bfaef8473d2b7b63aa"
  - PAGE_TITLE: "Kali-Team"
  - PAGE_DESCRIPTION: "三米前有蕉皮"
  - SITEMAP_BODY: "{"source":{"type":"collection","id":"..."
Total Upload: 19.32 KiB / gzip: 4.83 KiB
Uploaded blog (1.67 sec)
Published blog (3.85 sec)
  blog.kali-team.cn/*
Current Deployment ID: 4269accc-d181-4c21-992e-223d29426ea0

部署方式

安装Wrangler

npm install -g wrangler

登录Wrangler

wrangler login

初始化项目

wrangler init --from-dash blog
name = "blog"
main = "src/index.js"
compatibility_date = "2023-01-25"
route = "blog.kali-team.cn/*"
usage_model = "bundled"
env = { }

[triggers]
crons = [ ]

本地测试

wrangler dev
[b] open a browser, [d] open Devtools, [l] turn on local mode, [c] clear console, [x] to exit

发布项目

wrangler publish

搜索文章

      div.notion-topbar > div > div:nth-child(3) { display: none !important; }
-     div.notion-topbar > div > div:nth-child(4) { display: none !important; }
+     // div.notion-topbar > div > div:nth-child(4) { display: none !important; }
      div.notion-topbar > div > div:nth-child(5) { display: none !important; }
      div.notion-topbar > div > div:nth-child(6) { display: none !important; }
      div.notion-topbar-mobile > div:nth-child(3) { display: none !important; }
      div.notion-topbar-mobile > div:nth-child(4) { display: none !important; }
      div.notion-topbar > div > div:nth-child(1n).toggle-mode { display: block !important; }
      div.notion-topbar-mobile > div:nth-child(1n).toggle-mode { display: block !important; }

截图 2023-02-05 23.24.10.png

夜间模式

sitemap.xml文件和订阅文件

response = await fetch(
    "https://" + NOTION_DOMAIN + "/api/v3/queryCollection?src=reset",
    {
      headers: {
        "User-Agent":
          "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/109.0",
        Accept: "application/x-ndjson",
        "Accept-Language":
          "zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2",
        "notion-client-version": "23.11.0.40",
        "notion-audit-log-platform": "web",
        "x-notion-active-user-header": "",
        "Content-Type": "application/json",
        "Sec-Fetch-Dest": "empty",
        "Sec-Fetch-Mode": "cors",
        "Sec-Fetch-Site": "same-origin",
        Pragma: "no-cache",
        "Cache-Control": "no-cache",
      },
      body: SITEMAP_BODY,
      method: "POST",
    }
  );
<https://blog.kali-team.cn/notion-533c178345454e84a818fa72907e0d72>
原来的标题 处理后的URL
notion博客优化记录 notion-533c178345454e84a818fa72907e0d72#e722dd2fe103452cad19c3dc4222f1d7
Gather xshell and xftp passwords Gather-xshell-and-xftp-passwords-13785f54441e4b4791acc0f3fad32bf4
编写Metasploit插件获取DBeaver密码 Metasploit-DBeaver-9f42e26241c94ba785dce5f1e69697aa
Metasploit之插件-钉钉上线通知 Metasploit-35b456719f3f414e8a896bfd082c7a97
let original_page_title = page_title;
page_title = page_title.replace(/^[^-\\w.]{1,}/gmu, ""); //删除前面的
page_title = page_title.replace(/[^-\\w.]{1,}$/gmu, ""); //删除后面的
page_title = page_title.replace(/[^-\\w.]{1,}/gmu, "-"); //替换中间的
page_title = page_title.replace("--", ""); //替换双重横杠

浮动目录

// Notion 浮动 TOC
function TOC() {
  waitFor('.notion-table_of_contents-block').then(([el]) => {
    const toc = document.querySelector('.notion-table_of_contents-block');
    if (toc) {
        const toc_p = toc.parentElement;
        if (!toc_p.classList.contains('notion-column-block')) {
            return;
        }
        toc_p.style.position = 'sticky';
        toc_p.style.top = '0';
        toc_p.style.overflowY = 'scroll';
        toc_p.style.maxHeight = '50vh';
    }
});
}

页面布局

Untitled

Untitled

赞助页面

B站视频

notion+cloudflare一键搭建和我同款博客_哔哩哔哩_bilibili

参考

https://developers.cloudflare.com/workers/wrangler/

Powered by Kali-Team