From a28ff8a55feea0412ceca699465cd8cba572ef14 Mon Sep 17 00:00:00 2001 From: YiYi Date: Tue, 11 Aug 2026 23:43:48 +0800 Subject: [PATCH] Refactor code structure for improved readability and maintainability --- .bind-domain.cjs | 32 -------------------------------- .create-dns.cjs | 30 ------------------------------ index.html | 3 ++- logo.png => public/favicon.png | Bin public/favicon.svg | 1 - 5 files changed, 2 insertions(+), 64 deletions(-) delete mode 100644 .bind-domain.cjs delete mode 100644 .create-dns.cjs rename logo.png => public/favicon.png (100%) delete mode 100644 public/favicon.svg diff --git a/.bind-domain.cjs b/.bind-domain.cjs deleted file mode 100644 index e7b3e73..0000000 --- a/.bind-domain.cjs +++ /dev/null @@ -1,32 +0,0 @@ -const fs = require("fs"); -const path = require("path"); -const os = require("os"); - -const tomlPath = path.join(os.homedir(), "AppData", "Roaming", "xdg.config", ".wrangler", "config", "default.toml"); -const toml = fs.readFileSync(tomlPath, "utf8"); -const match = toml.match(/oauth_token\s*=\s*"([^"]+)"/); -if (!match) { - console.error("no token found"); - process.exit(1); -} -const token = match[1]; -const accountId = "6a638c3c2047a3ce064af7e4febb0ead"; -const project = "personalweb"; -const domain = "www.zhouhaoze.com"; - -fetch(`https://api.cloudflare.com/client/v4/accounts/${accountId}/pages/projects/${project}/domains`, { - method: "POST", - headers: { - Authorization: `Bearer ${token}`, - "Content-Type": "application/json", - }, - body: JSON.stringify({ name: domain }), -}) - .then((r) => r.json()) - .then((j) => { - console.log(JSON.stringify(j, null, 2)); - }) - .catch((e) => { - console.error(e); - process.exit(1); - }); diff --git a/.create-dns.cjs b/.create-dns.cjs deleted file mode 100644 index 63f56b8..0000000 --- a/.create-dns.cjs +++ /dev/null @@ -1,30 +0,0 @@ -const fs = require("fs"); -const path = require("path"); -const os = require("os"); - -const tomlPath = path.join(os.homedir(), "AppData", "Roaming", "xdg.config", ".wrangler", "config", "default.toml"); -const toml = fs.readFileSync(tomlPath, "utf8"); -const match = toml.match(/oauth_token\s*=\s*"([^"]+)"/); -const token = match[1]; -const zoneId = "5ed3652548a0e8c430910c4090b02357"; - -fetch(`https://api.cloudflare.com/client/v4/zones/${zoneId}/dns_records`, { - method: "POST", - headers: { - Authorization: `Bearer ${token}`, - "Content-Type": "application/json", - }, - body: JSON.stringify({ - type: "CNAME", - name: "www", - content: "personalweb-bkl.pages.dev", - proxied: true, - ttl: 1, - }), -}) - .then((r) => r.json()) - .then((j) => console.log(JSON.stringify(j, null, 2))) - .catch((e) => { - console.error(e); - process.exit(1); - }); diff --git a/index.html b/index.html index ccd4e9c..81f4846 100644 --- a/index.html +++ b/index.html @@ -2,7 +2,8 @@ - + + Haoze Zhou diff --git a/logo.png b/public/favicon.png similarity index 100% rename from logo.png rename to public/favicon.png diff --git a/public/favicon.svg b/public/favicon.svg deleted file mode 100644 index 6893eb1..0000000 --- a/public/favicon.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file