{"id":419,"date":"2026-04-26T02:05:15","date_gmt":"2026-04-26T06:05:15","guid":{"rendered":"https:\/\/mliaomcx.com\/?p=419"},"modified":"2026-04-26T06:42:35","modified_gmt":"2026-04-26T10:42:35","slug":"%e3%80%8a%e6%89%93%e9%80%a0%e4%b8%aa%e4%ba%ba%e5%86%85%e5%ae%b9%e7%9f%a9%e9%98%b5%ef%bc%9a%e5%9c%a8-cloudflare-%e9%9b%b6%e6%88%90%e6%9c%ac%e9%83%a8%e7%bd%b2-rin-%e5%8d%9a%e5%ae%a2%e4%b8%8e%e4%b8%93","status":"publish","type":"post","link":"https:\/\/mliaomcx.com\/en\/%e3%80%8a%e6%89%93%e9%80%a0%e4%b8%aa%e4%ba%ba%e5%86%85%e5%ae%b9%e7%9f%a9%e9%98%b5%ef%bc%9a%e5%9c%a8-cloudflare-%e9%9b%b6%e6%88%90%e6%9c%ac%e9%83%a8%e7%bd%b2-rin-%e5%8d%9a%e5%ae%a2%e4%b8%8e%e4%b8%93\/","title":{"rendered":"\u300a\u6253\u9020\u4e2a\u4eba\u5185\u5bb9\u77e9\u9635\uff1a\u5728 Cloudflare \u96f6\u6210\u672c\u90e8\u7f72 Rin \u535a\u5ba2\u4e0e\u4e13\u5c5e\u5bfc\u822a\u7f51\u7ad9\u300b"},"content":{"rendered":"<h1 class=\"wp-block-heading\"><\/h1>\n\n\n\n<p>\u968f\u7740\u4e91\u7aef\u6298\u817e\u7ecf\u9a8c\u7684\u4e0d\u65ad\u4e30\u5bcc\u4ee5\u53ca\u957f\u7ebf\u8fd0\u8425\u8ba1\u5212\u7684\u63a8\u8fdb\uff0c\u5efa\u7acb\u4e00\u4e2a\u957f\u671f\u3001\u53ef\u6269\u5c55\u7684\u5e95\u5c42\u57fa\u7840\u8bbe\u65bd\u6765\u627f\u8f7d\u5185\u5bb9\u4e0e\u8f6f\u4ef6\u5de5\u5177\u77e9\u9635\uff0c\u53d8\u5f97\u5c24\u4e3a\u91cd\u8981\u3002\u4f20\u7edf\u7684 VPS \u5efa\u7ad9\u867d\u7136\u81ea\u7531\u5ea6\u9ad8\uff0c\u4f46\u5f80\u5f80\u4f34\u968f\u7740\u7e41\u7410\u7684\u670d\u52a1\u5668\u7ef4\u62a4\u3001\u73af\u5883\u914d\u7f6e\u4ee5\u53ca\u7eed\u8d39\u7126\u8651\u3002<\/p>\n\n\n\n<p>\u4eca\u5929\u8fd9\u7bc7\u6587\u7ae0\uff0c\u6211\u4eec\u5c06\u5f7b\u5e95\u8f6c\u6362\u601d\u8def\uff0c\u5229\u7528 Serverless \u67b6\u6784\u7684\u4f18\u52bf\uff0c\u4f9d\u6258 Cloudflare \u7684\u5f3a\u5927\u751f\u6001\uff0c\u624b\u628a\u624b\u6559\u4f60\u96f6\u6210\u672c\u3001\u9ad8\u53ef\u7528\u5730\u90e8\u7f72\u4e2a\u4eba\u5185\u5bb9\u5927\u672c\u8425\u2014\u2014<strong>Rin \u535a\u5ba2\u7cfb\u7edf<\/strong>\uff0c\u4ee5\u53ca\u4e00\u4e2a\u7528\u4e8e\u96c6\u4e2d\u7ba1\u7406\u5404\u7c7b\u4e91\u7aef\u670d\u52a1\u7684<strong>\u4e13\u5c5e\u5bfc\u822a\u7f51\u7ad9<\/strong>\u3002\u8fd9\u5957\u65b9\u6848\u514d\u53bb\u4e86\u5e95\u5c42\u8fd0\u7ef4\u7684\u70e6\u607c\uff0c\u5e76\u81ea\u5e26\u5168\u7403\u8fb9\u7f18\u8282\u70b9\u7684\u6781\u901f CDN \u52a0\u901f\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\u4e00\u3001 \u6838\u5fc3\u5e95\u5ea7\uff1a\u90e8\u7f72 Rin \u535a\u5ba2\u7cfb\u7edf<\/h2>\n\n\n\n<p>Rin \u662f\u4e00\u6b3e\u6781\u5176\u8f7b\u91cf\u4e14\u4e13\u4e3a Cloudflare \u751f\u6001\u6253\u9020\u7684\u73b0\u4ee3\u535a\u5ba2\u7cfb\u7edf\u3002\u5b83\u4f9d\u8d56 Cloudflare Workers \u63d0\u4f9b\u540e\u7aef\u8ba1\u7b97\uff0c\u5229\u7528 D1 \u627f\u62c5\u6570\u636e\u5e93\uff0c\u5e76\u4f7f\u7528 R2 \u4f5c\u4e3a\u5bf9\u8c61\u5b58\u50a8\uff08\u56fe\u5e8a\uff09\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">1. \u51c6\u5907\u6e90\u7801\u4e0e\u83b7\u53d6 CF \u6388\u6743<\/h3>\n\n\n\n<p>\u9996\u5148\uff0c\u9700\u8981\u83b7\u53d6\u6e90\u7801\u5e76\u8d4b\u4e88 GitHub Actions \u81ea\u52a8\u5316\u90e8\u7f72\u5230 Cloudflare \u7684\u6743\u9650\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Fork \u4ed3\u5e93<\/strong>\uff1a\u524d\u5f80 GitHub\uff0c\u8bbf\u95ee <a href=\"https:\/\/github.com\/openRin\/Rin\" target=\"_blank\" rel=\"noreferrer noopener\">openRin\/Rin \u4ed3\u5e93<\/a>\uff0c\u70b9\u51fb\u53f3\u4e0a\u89d2\u7684 <strong>Fork<\/strong> \u5c06\u4ee3\u7801\u590d\u5236\u5230\u4f60\u7684\u4e2a\u4eba\u8d26\u53f7\u4e0b\u3002<\/li>\n\n\n\n<li><strong>\u83b7\u53d6 Account ID<\/strong>\uff1a\u767b\u5f55 <a href=\"https:\/\/dash.cloudflare.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">Cloudflare \u63a7\u5236\u53f0<\/a>\uff0c\u5728\u4e3b\u9875\u968f\u4fbf\u70b9\u51fb\u8fdb\u5165\u4e00\u4e2a\u4f60\u6258\u7ba1\u7684\u81ea\u5b9a\u4e49\u57df\u540d\uff0c\u5728\u9875\u9762\u53f3\u4e0b\u65b9\u627e\u5230 <strong>\u8d26\u6237 ID (Account ID)<\/strong> \u5e76\u590d\u5236\u5907\u7528\u3002<\/li>\n\n\n\n<li><strong>\u521b\u5efa\u9ad8\u5b9a\u6743\u9650\u7684 API Token<\/strong>\uff1a\n<ol start=\"1\" class=\"wp-block-list\">\n<li>\u70b9\u51fb\u53f3\u4e0a\u89d2\u5934\u50cf\u8fdb\u5165 <strong>\u6211\u7684\u4e2a\u4eba\u8d44\u6599 (My Profile)<\/strong> -&gt; <strong>API \u4ee4\u724c (API Tokens)<\/strong> -&gt; <strong>\u521b\u5efa\u4ee4\u724c (Create Token)<\/strong>\u3002<\/li>\n\n\n\n<li>\u9009\u62e9 <code>\u7f16\u8f91 Cloudflare Workers<\/code> \u6a21\u677f\u3002<\/li>\n\n\n\n<li><strong>\u5212\u91cd\u70b9\uff1a\u4fee\u6539\u9ed8\u8ba4\u6743\u9650\uff01<\/strong>\n<ul class=\"wp-block-list\">\n<li><strong>\u5220\u9664<\/strong>\u4e0d\u9700\u8981\u7684\u6743\u9650\uff08\u5982 KV \u5b58\u50a8\u3001\u8def\u7531\u3001\u8d26\u6237\u8bbe\u7f6e\u7b49\uff09\u3002<\/li>\n\n\n\n<li><strong>\u4fdd\u7559<\/strong>\u4ee5\u4e0b\u4e09\u9879\u6743\u9650\uff1a<strong>Workers \u811a\u672c (Edit)<\/strong>\u3001<strong>R2 \u5b58\u50a8\u6876 (Edit)<\/strong>\u3001<strong>Cloudflare Pages \u9879\u76ee\u53ca\u5176\u914d\u7f6e (Edit)<\/strong>\u3002<\/li>\n\n\n\n<li><strong>\u624b\u52a8\u65b0\u589e\u4e00\u9879<\/strong>\uff1a\u70b9\u51fb <code>\u6dfb\u52a0\u66f4\u591a<\/code>\uff0c\u641c\u7d22\u5e76\u6dfb\u52a0 <strong>D1 (Edit)<\/strong> \u6743\u9650\u3002<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>\u5728\u5e95\u90e8\u201c\u8d26\u6237\u8d44\u6e90\u201d\u533a\u57df\uff0c\u9009\u62e9 <code>\u5305\u62ec<\/code> -&gt; <code>\u6240\u6709\u8d26\u6237<\/code>\u3002<\/li>\n\n\n\n<li>\u8bbe\u5b9a\u597d\u4ee4\u724c\u5230\u671f\u65f6\u95f4\uff08\u4f8b\u5982\u4e00\u4e2a\u6708\u6216\u66f4\u957f\uff09\uff0c\u70b9\u51fb\u521b\u5efa\u5e76<strong>\u59a5\u5584\u4fdd\u5b58\u8fd9\u4e32 API Token<\/strong>\u3002<\/li>\n<\/ol>\n<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">2. \u914d\u7f6e GitHub \u673a\u5bc6\u73af\u5883\u53d8\u91cf (Secrets)<\/h3>\n\n\n\n<p>\u4e3a\u4e86\u8ba9 GitHub Actions \u80fd\u591f\u987a\u5229\u5efa\u5e93\u548c\u90e8\u7f72\uff0c\u5fc5\u987b\u5c06\u51ed\u8bc1\u5b89\u5168\u5730\u5b58\u5165\u4ed3\u5e93\u3002<\/p>\n\n\n\n<p>\u8fdb\u5165\u4f60 Fork \u7684 Rin \u4ed3\u5e93\uff0c\u70b9\u51fb <strong>Settings<\/strong> -&gt; <strong>Secrets and variables<\/strong> -&gt; <strong>Actions<\/strong>\uff0c\u5728 <strong>Secrets<\/strong> \u6807\u7b7e\u9875\u4e0b\u70b9\u51fb <strong>New repository secret<\/strong>\uff0c\u4f9d\u6b21\u6dfb\u52a0\u4ee5\u4e0b\u53d8\u91cf\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><td><strong>Secret \u540d\u79f0<\/strong><\/td><td><strong>\u586b\u5165\u7684\u503c<\/strong><\/td><td><strong>\u8bf4\u660e<\/strong><\/td><\/tr><\/thead><tbody><tr><td><code>CLOUDFLARE_ACCOUNT_ID<\/code><\/td><td>\u4f60\u7684 Cloudflare \u8d26\u6237 ID<\/td><td>\u521a\u83b7\u53d6\u7684 CF \u8d26\u6237\u6807\u8bc6<\/td><\/tr><tr><td><code>CLOUDFLARE_API_TOKEN<\/code><\/td><td>\u4fee\u6539\u8fc7\u6743\u9650\uff08\u5305\u542b D1\uff09\u7684 API Token<\/td><td>\u8d4b\u4e88\u90e8\u7f72\u6743\u9650<\/td><\/tr><tr><td><code>JWT_SECRET<\/code><\/td><td>\u4efb\u610f\u957f\u5ea6\u7684\u968f\u673a\u82f1\u6587\u5b57\u7b26\u4e32<\/td><td>\u7528\u4e8e\u7cfb\u7edf\u9274\u6743\u7684\u5bc6\u94a5<\/td><\/tr><tr><td><code>ADMIN_USERNAME<\/code><\/td><td>\u81ea\u5b9a\u4e49\u7528\u6237\u540d<\/td><td>\u535a\u5ba2\u540e\u53f0\u7684\u9996\u4e2a\u7ba1\u7406\u5458\u8d26\u53f7<\/td><\/tr><tr><td><code>ADMIN_PASSWORD<\/code><\/td><td>\u81ea\u5b9a\u4e49\u5bc6\u7801<\/td><td>\u535a\u5ba2\u540e\u53f0\u7684\u9996\u4e2a\u7ba1\u7406\u5458\u5bc6\u7801<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">3. \u914d\u7f6e\u7ad9\u70b9\u4fe1\u606f\u4e0e\u56fe\u5e8a (Variables)<\/h3>\n\n\n\n<p>Rin \u535a\u5ba2\u7684\u7ad9\u70b9\u540d\u79f0\u3001\u63cf\u8ff0\u4ee5\u53ca\u56fe\u5e8a\u4f9d\u8d56\uff0c\u63a8\u8350\u901a\u8fc7 GitHub Variables \u8fdb\u884c\u56fa\u5316\u914d\u7f6e\uff0c\u907f\u514d\u91cd\u65b0\u90e8\u7f72\u65f6\u8bbe\u7f6e\u4e22\u5931\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u521b\u5efa R2 \u5b58\u50a8\u6876<\/strong>\uff1a\u5728 Cloudflare \u9762\u677f\u5de6\u4fa7\u627e\u5230 <strong>R2 \u5bf9\u8c61\u5b58\u50a8<\/strong>\uff0c\u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u5b58\u50a8\u6876\uff08\u4f8b\u5982\u547d\u540d\u4e3a <code>rin-images<\/code>\uff0c\u540d\u5b57\u4e0d\u4e0e\u5176\u4ed6\u7528\u6237\u51b2\u7a81\u5373\u53ef\uff09\uff0c\u590d\u5236\u8be5\u5b58\u50a8\u6876\u7684\u540d\u79f0\u3002<\/li>\n\n\n\n<li><strong>\u6dfb\u52a0 Variables<\/strong>\uff1a\u56de\u5230 GitHub \u4ed3\u5e93\u7684 <strong>Settings<\/strong> -&gt; <strong>Secrets and variables<\/strong> -&gt; <strong>Actions<\/strong>\uff0c\u5207\u6362\u5230 <strong>Variables<\/strong> \u6807\u7b7e\u9875\uff0c\u70b9\u51fb <strong>New repository variable<\/strong> \u4f9d\u6b21\u6dfb\u52a0\uff1a\n<ul class=\"wp-block-list\">\n<li><code>NAME<\/code>: \u4f60\u7684\u535a\u5ba2\u7ad9\u70b9\u540d\u79f0\uff08\u4f8b\u5982\uff1amliaomcx\uff09<\/li>\n\n\n\n<li><code>DESCRIPTION<\/code>: \u4f60\u7684\u7ad9\u70b9\u63cf\u8ff0<\/li>\n\n\n\n<li><code>R2_BUCKET_NAME<\/code>: \u521a\u521a\u5728 CF \u521b\u5efa\u7684 R2 \u5b58\u50a8\u6876\u540d\u79f0\uff08\u586b\u5165\u540e\u5373\u53ef\u5728\u540e\u53f0\u6b63\u5e38\u4e0a\u4f20\u56fe\u7247\u5230\u56fe\u5e8a\uff09<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">4. \u8fdb\u9636\u9009\u9879\uff1a\u914d\u7f6e GitHub OAuth \u5feb\u6377\u767b\u5f55\uff08\u53ef\u9009\uff09<\/h3>\n\n\n\n<p>\u5982\u679c\u4f60\u5e0c\u671b\u540e\u7eed\u80fd\u76f4\u63a5\u7528 GitHub \u8d26\u53f7\u767b\u5f55\u540e\u53f0\uff0c\u53ef\u4ee5\u914d\u7f6e OAuth App\uff08\u6ce8\u610f\uff1a\u9996\u6b21\u5fc5\u987b\u7528\u8d26\u53f7\u5bc6\u7801\u767b\u5f55\u4ee5\u83b7\u53d6\u7ba1\u7406\u5458\u6743\u9650\uff09\uff1a<\/p>\n\n\n\n<ol start=\"1\" class=\"wp-block-list\">\n<li>\u5728 GitHub \u53f3\u4e0a\u89d2\u5934\u50cf\u83dc\u5355\u8fdb\u5165 <strong>Settings<\/strong> -&gt; \u6700\u5e95\u90e8\u7684 <strong>Developer settings<\/strong> -&gt; <strong>OAuth Apps<\/strong> -&gt; <strong>New OAuth App<\/strong>\u3002<\/li>\n\n\n\n<li>\u586b\u5199\u540d\u79f0\uff0c<code>Homepage URL<\/code> \u586b\u5165\u4f60\u7684\u535a\u5ba2\u57df\u540d\uff08\u5982 <code>https:\/\/blog.yourdomain.com<\/code>\uff09\u3002<\/li>\n\n\n\n<li><code>Authorization callback URL<\/code> \u586b\u5165\uff1a<code>https:\/\/\u4f60\u7684\u57df\u540d\/api\/auth\/callback<\/code>\u3002<\/li>\n\n\n\n<li>\u6ce8\u518c\u540e\uff0c\u590d\u5236 <code>Client ID<\/code>\uff0c\u5e76\u751f\u6210\u4e00\u4e2a <code>Client Secret<\/code> \u590d\u5236\u4e0b\u6765\u3002<\/li>\n\n\n\n<li>\u56de\u5230 Rin \u4ed3\u5e93\u7684 <strong>Secrets<\/strong> \u8bbe\u7f6e\u4e2d\uff0c\u65b0\u589e\u4e24\u4e2a Secret\uff1a<code>GH_CLIENT_ID<\/code> \u548c <code>GH_CLIENT_SECRET<\/code>\uff0c\u5206\u522b\u586b\u5165\u5bf9\u5e94\u7684\u503c\u3002<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\">5. \u89e6\u53d1\u81ea\u52a8\u5316\u90e8\u7f72 (Build) &amp; \u7ed1\u5b9a\u57df\u540d<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u8fdb\u5165 Rin \u4ed3\u5e93\u7684 <strong>Actions<\/strong> \u9009\u9879\u5361\u3002<\/li>\n\n\n\n<li>\u5982\u679c\u662f\u7b2c\u4e00\u6b21\u8fdb\u5165\uff0c\u70b9\u51fb\u7eff\u8272\u6309\u94ae\u542f\u7528\u5de5\u4f5c\u6d41\u3002\u5982\u679c\u5728\u5de6\u4fa7\u627e\u4e0d\u5230 <code>build<\/code>\uff0c\u8bf7\u5148\u56de\u5230\u4ee3\u7801\u4e3b\u9875\u70b9\u51fb <code>Sync fork<\/code> \u540c\u6b65\u62c9\u53d6\u6700\u65b0\u4ee3\u7801\u3002<\/li>\n\n\n\n<li>\u5728\u5de6\u4fa7\u5de5\u4f5c\u6d41\u5217\u8868\u4e2d\u9009\u62e9 <strong>build<\/strong>\uff0c\u70b9\u51fb\u53f3\u4fa7\u7684 <strong>Run workflow<\/strong> \u624b\u52a8\u89e6\u53d1\u6784\u5efa\u3002<\/li>\n\n\n\n<li>\u7b49\u5f85 3-5 \u5206\u949f\u7eff\u706f\u4eae\u8d77\uff0c\u4ee3\u7801\u7f16\u8bd1\u5b8c\u6210\u3002\u6b64\u65f6 Cloudflare \u9700\u8981 1-2 \u5206\u949f\u540c\u6b65\u5168\u7f51\u8282\u70b9\u3002<\/li>\n\n\n\n<li>\u540c\u6b65\u5b8c\u6210\u540e\uff0c\u5728 Cloudflare \u5de6\u4fa7\u83dc\u5355\u7684 <strong>Workers \u548c Pages<\/strong> \u4e2d\uff0c\u627e\u5230\u65b0\u90e8\u7f72\u7684 Rin \u670d\u52a1\uff0c\u8fdb\u5165\u5176 <strong>\u8bbe\u7f6e -&gt; \u89e6\u53d1\u5668 -&gt; \u81ea\u5b9a\u4e49\u57df<\/strong>\uff0c\u6dfb\u52a0\u4f60\u7684\u4e13\u5c5e\u57df\u540d\uff08\u5982 <code>blog.yourdomain.com<\/code>\uff09\uff0c\u7b49\u5f85 SSL \u8bc1\u4e66\u81ea\u52a8\u7b7e\u53d1\u5373\u53ef\u8bbf\u95ee\u5e76\u5f00\u59cb\u521b\u4f5c\uff01<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\u4e8c\u3001 \u6548\u7387\u67a2\u7ebd\uff1a\u90e8\u7f72\u201c\u62fe\u5149\u96c6\u201d\u5bfc\u822a\u7ad9<\/h2>\n\n\n\n<p>\u5f53\u63a2\u9488\u3001\u8def\u7531\u9762\u677f\u3001\u5185\u7f51\u7a7f\u900f\u5165\u53e3\u8d8a\u6765\u8d8a\u591a\u65f6\uff0c\u6211\u4eec\u9700\u8981\u4e00\u4e2a\u96c6\u4e2d\u7684\u5bfc\u822a\u9875\u3002\u8fd9\u91cc\u5f3a\u70c8\u63a8\u8350\u90e8\u7f72\u201c\u62fe\u5149\u96c6\u201d (wangwangit\/nav) \u7684 V2 \u7248\u672c\u3002\u5b83\u57fa\u4e8e Workers + D1 + KV \u6784\u5efa\uff0c\u4e0d\u4ec5\u81ea\u5e26\u8fb9\u7f18\u7f13\u5b58\uff0c\u8fd8\u5927\u5e45\u5347\u7ea7\u4e86\u540e\u53f0\u5b89\u5168\u673a\u5236\uff08\u652f\u6301\u4f1a\u8bdd\u767b\u5f55\uff09\u3002<\/p>\n\n\n\n<p>\u6574\u4e2a\u90e8\u7f72\u8fc7\u7a0b\u5206\u4e3a\u56db\u6b65\uff0c<strong>\u8bf7\u4e25\u683c\u6309\u7167\u4e0b\u65b9\u7684\u987a\u5e8f\u548c\u540d\u79f0\u914d\u7f6e<\/strong>\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">1. \u51c6\u5907\u57fa\u7840\u8d44\u6e90\uff1a\u521b\u5efa\u6570\u636e\u5e93\u4e0e\u5b58\u50a8<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u521b\u5efa D1 \u6570\u636e\u5e93<\/strong>\uff1a\n<ul class=\"wp-block-list\">\n<li>\u767b\u5f55 Cloudflare\uff0c\u9009\u62e9 <strong>\u5b58\u50a8\u548c\u6570\u636e\u5e93 -> D1 SQL \u6570\u636e\u5e93<\/strong>\uff0c\u70b9\u51fb\u521b\u5efa\u3002\u540d\u79f0\u5efa\u8bae\u586b <strong><code>book<\/code><\/strong>\uff08\u4f4d\u7f6e\u9009\u4e9a\u592a\u5730\u533a\uff09\u3002<\/li>\n\n\n\n<li><strong>\u521d\u59cb\u5316\u6570\u636e\u8868<\/strong>\uff1a\u8fdb\u5165\u8be5\u6570\u636e\u5e93\u7684 <strong>\u63a7\u5236\u53f0 (Console)<\/strong>\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<p>CREATE TABLE sites (<br>id INTEGER PRIMARY KEY AUTOINCREMENT,<br>name TEXT NOT NULL,<br>url TEXT NOT NULL,<br>logo TEXT,<br>&#8220;desc&#8221; TEXT,<br>catelog TEXT NOT NULL,<br>status TEXT,<br>sort_order INTEGER NOT NULL DEFAULT 9999,<br>create_time DATETIME DEFAULT CURRENT_TIMESTAMP,<br>update_time DATETIME DEFAULT CURRENT_TIMESTAMP<br>);<\/p>\n\n\n\n<p>CREATE TABLE pending_sites (<br>id INTEGER PRIMARY KEY AUTOINCREMENT,<br>name TEXT NOT NULL,<br>url TEXT NOT NULL,<br>logo TEXT,<br>&#8220;desc&#8221; TEXT,<br>catelog TEXT NOT NULL,<br>status TEXT,<br>create_time DATETIME DEFAULT CURRENT_TIMESTAMP<br>);<\/p>\n\n\n\n<p>CREATE TABLE category_orders (<br>catelog TEXT PRIMARY KEY,<br>sort_order INTEGER NOT NULL DEFAULT 9999<br>);<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u521b\u5efa KV \u547d\u540d\u7a7a\u95f4\uff08\u914d\u7f6e\u540e\u53f0\u8d26\u5bc6\uff09<\/strong>\uff1a\n<ul class=\"wp-block-list\">\n<li>\u5728\u5de6\u4fa7\u83dc\u5355\u627e\u5230 <strong>\u5b58\u50a8\u548c\u6570\u636e\u5e93 -> KV<\/strong>\uff0c\u70b9\u51fb\u521b\u5efa\uff0c\u540d\u79f0\u5efa\u8bae\u586b <strong><code>NAV_AUTH<\/code><\/strong>\u3002<\/li>\n\n\n\n<li>\u8fdb\u5165\u8be5 KV \u7a7a\u95f4\uff0c\u5728 <strong>KV \u6761\u76ee (KV Entries)<\/strong> \u4e2d\u4f9d\u6b21\u6dfb\u52a0\u4e24\u6761\u6570\u636e\u4f5c\u4e3a\u4f60\u7684\u540e\u53f0\u51ed\u8bc1\uff1a\n<ul class=\"wp-block-list\">\n<li>\u7b2c\u4e00\u6761\uff1a\u952e\u586b\u5165 <code>admin_username<\/code>\uff0c\u503c\u586b\u5165\u4f60\u7684\u81ea\u5b9a\u4e49\u8d26\u53f7\u3002<\/li>\n\n\n\n<li>\u7b2c\u4e8c\u6761\uff1a\u952e\u586b\u5165 <code>admin_password<\/code>\uff0c\u503c\u586b\u5165\u4f60\u7684\u81ea\u5b9a\u4e49\u5bc6\u7801\u3002<em>(\u6ce8\uff1a\u952e\u540d\u5fc5\u987b\u5168\u5c0f\u5199\uff0c\u4e00\u5b57\u4e0d\u5dee)<\/em><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">2. \u90e8\u7f72\u5bfc\u822a\u7ad9\u6838\u5fc3\u4ee3\u7801<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u5728 Cloudflare \u5de6\u4fa7\u83dc\u5355\u9009\u62e9 <strong>Workers \u548c Pages<\/strong>\uff0c\u70b9\u51fb <strong>\u521b\u5efa -> \u521b\u5efa Worker<\/strong>\uff0c\u7ed9\u7a0b\u5e8f\u8d77\u4e2a\u540d\u5b57\uff08\u5982 <code>my-nav<\/code>\uff09\uff0c\u70b9\u51fb\u90e8\u7f72\u3002<\/li>\n\n\n\n<li>\u90e8\u7f72\u540e\u70b9\u51fb <strong>\u7f16\u8f91\u4ee3\u7801<\/strong>\uff0c\u6e05\u7a7a\u5de6\u4fa7\u7684\u9ed8\u8ba4\u4ee3\u7801\u3002<\/li>\n\n\n\n<li>\u56de\u5230 <a href=\"https:\/\/github.com\/wangwangit\/nav\" target=\"_blank\" rel=\"noreferrer noopener\">\u62fe\u5149\u96c6 GitHub \u6e90\u7801\u5e93<\/a>\uff0c\u627e\u5230 <code>work_v2.js<\/code> \u6587\u4ef6\u3002\u590d\u5236\u91cc\u9762\u7684\u6240\u6709\u4ee3\u7801\uff0c\u7c98\u8d34\u5230 Cloudflare \u7684\u7f16\u8f91\u5668\u4e2d\uff0c\u70b9\u51fb\u53f3\u4e0a\u89d2\u7684 <strong>\u90e8\u7f72<\/strong>\uff0c\u7136\u540e\u8fd4\u56de\u4e0a\u4e00\u7ea7 Worker \u9762\u677f\u3002<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">3. \u6838\u5fc3\u7ed1\u5b9a\uff08\u26a0\ufe0f \u6700\u5bb9\u6613\u8e29\u5751\u7684\u4e00\u6b65\uff09<\/h3>\n\n\n\n<p>\u73b0\u5728\u4ee3\u7801\u8dd1\u8d77\u6765\u4e86\uff0c\u4f46\u6211\u4eec\u9700\u8981\u628a\u6b65\u9aa4 1 \u521b\u5efa\u7684\u8d44\u6e90\u201c\u7ed1\u5b9a\u201d\u7ed9\u4ee3\u7801\u3002<\/p>\n\n\n\n<p>**\u907f\u5751\u5fc5\u8bfb\uff1a**\u5728 Cloudflare \u4f53\u7cfb\u4e2d\uff0c\u201c\u4f60\u5728\u540e\u53f0\u521b\u5efa\u7684\u8d44\u6e90\u540d\u201d\u548c\u201c\u4ee3\u7801\u8bfb\u53d6\u7684\u53d8\u91cf\u540d\u201d\u662f\u4e24\u7801\u4e8b\u3002\u4ee3\u7801\u91cc\u786c\u7f16\u7801\u4e86\u7279\u5b9a\u7684\u53d8\u91cf\u540d\uff0c<strong>\u586b\u9519\u4f1a\u5bfc\u81f4\u7ad9\u70b9\u76f4\u63a5\u5d29\u6e83\u62a5 undefined\uff01<\/strong><\/p>\n\n\n\n<p>\u5728\u5f53\u524d Worker \u9762\u677f\uff0c\u8fdb\u5165 <strong>\u8bbe\u7f6e -&gt; \u53d8\u91cf\u548c\u673a\u5bc6 -&gt; \u7ed1\u5b9a (Bindings)<\/strong>\uff0c\u4e25\u683c\u6309\u7167\u4e0b\u8868\u6dfb\u52a0\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><td><strong>\u7ed1\u5b9a\u7c7b\u578b<\/strong><\/td><td><strong>\u53d8\u91cf\u540d\u79f0 (\u4ee3\u7801\u91cc\u7684\u6697\u53f7\uff0c\u5fc5\u987b\u4e25\u683c\u5927\u5199)<\/strong><\/td><td><strong>\u53f3\u4fa7\u8d44\u6e90\u9009\u62e9<\/strong><\/td><\/tr><\/thead><tbody><tr><td><strong>D1 \u6570\u636e\u5e93<\/strong><\/td><td><code>NAV_DB<\/code><\/td><td>\u9009\u62e9\u4f60\u7684 D1 \u6570\u636e\u5e93 ( <code>book<\/code>)<\/td><\/tr><tr><td><strong>KV \u547d\u540d\u7a7a\u95f4<\/strong><\/td><td><code>NAV_AUTH<\/code><\/td><td>\u9009\u62e9\u4f60\u7684 KV \u7a7a\u95f4 ( <code>NAV_AUTH<\/code>)<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><em>(\u8fdb\u9636\u8bbe\u7f6e\uff1a\u5982\u679c\u4f60\u60f3\u5173\u95ed\u524d\u53f0\u8bbf\u5ba2\u63d0\u4ea4\u94fe\u63a5\u7684\u5165\u53e3\uff0c\u53ef\u5728\u201c\u73af\u5883\u53d8\u91cf\u201d\u4e2d\u65b0\u589e\u53d8\u91cf <code>ENABLE_PUBLIC_SUBMISSION<\/code>\uff0c\u503c\u586b <code>false<\/code>\u3002)<\/em><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">4. \u7ed1\u5b9a\u57df\u540d\u4e0e\u540e\u53f0\u7ba1\u7406<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u914d\u7f6e\u81ea\u5b9a\u4e49\u57df\u540d<\/strong>\uff1a\u5728 Worker \u9762\u677f\u8fdb\u5165 <strong>\u8bbe\u7f6e -> \u89e6\u53d1\u5668 -> \u81ea\u5b9a\u4e49\u57df<\/strong>\uff0c\u6dfb\u52a0\u4e13\u5c5e\u57df\u540d\uff08\u4f8b\u5982 <code>nav.yourdomain.com<\/code>\uff09\u3002<\/li>\n\n\n\n<li><strong>\u767b\u5f55\u540e\u53f0<\/strong>\uff1a\u6d4f\u89c8\u5668\u8bbf\u95ee <code>\u4f60\u7684\u57df\u540d\/admin<\/code>\uff0c\u8f93\u5165\u4f60\u5728 KV \u4e2d\u914d\u7f6e\u7684\u8d26\u53f7\u5bc6\u7801\u3002<\/li>\n\n\n\n<li><strong>\u5f00\u59cb\u4f7f\u7528<\/strong>\uff1a\u8fdb\u5165\u540e\u53f0\u540e\uff0c\u5c3d\u60c5\u6dfb\u52a0\u4f60\u7684 iStoreOS \u9762\u677f\u3001\u670d\u52a1\u5668\u63a2\u9488\u548c\u5176\u4ed6\u4e91\u7aef\u670d\u52a1\u5165\u53e3\u5427\uff01\u8bbe\u7f6e\u597d\u5206\u7c7b\u548c\u6392\u5e8f\u540e\uff0c\u524d\u53f0\u4e3b\u9875\u4f1a\u5b9e\u65f6\u6781\u901f\u54cd\u5e94\u3002<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\u7ed3\u8bed<\/h2>\n\n\n\n<p>\u81f3\u6b64\uff0c\u4e00\u5957\u8f7b\u91cf\u5316\u3001\u514d\u7ef4\u62a4\u4e14\u96f6\u670d\u52a1\u5668\u652f\u51fa\u7684\u4e2a\u4eba\u5185\u5bb9\u57fa\u5efa\u5c31\u5f7b\u5e95\u6253\u901a\u4e86\u3002\u8fd9\u79cd\u5c06\u5e95\u5c42\u67b6\u6784\u5168\u9762\u4ea4\u7ed9 Serverless \u4e0e\u8fb9\u7f18\u8ba1\u7b97\u7684\u65b9\u6848\uff0c\u6781\u5927\u5730\u964d\u4f4e\u4e86\u6211\u4eec\u65e5\u5e38\u8fd0\u7ef4\u7684\u5fc3\u667a\u8d1f\u62c5\uff0c\u8ba9\u6211\u4eec\u80fd\u591f\u5c06\u66f4\u591a\u65f6\u95f4\u4e13\u6ce8\u6295\u5165\u5230\u9ad8\u4ef7\u503c\u7684\u201c\u5185\u5bb9\u6c89\u6dc0\u201d\u548c\u77e9\u9635\u8fd0\u8425\u672c\u8eab\u3002<\/p>\n\n\n\n<p><\/p>","protected":false},"excerpt":{"rendered":"<p>\u968f\u7740\u4e91\u7aef\u6298\u817e\u7ecf\u9a8c\u7684\u4e0d\u65ad\u4e30\u5bcc\u4ee5\u53ca&#8230;<\/p>","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-419","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/mliaomcx.com\/en\/wp-json\/wp\/v2\/posts\/419","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mliaomcx.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mliaomcx.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mliaomcx.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mliaomcx.com\/en\/wp-json\/wp\/v2\/comments?post=419"}],"version-history":[{"count":9,"href":"https:\/\/mliaomcx.com\/en\/wp-json\/wp\/v2\/posts\/419\/revisions"}],"predecessor-version":[{"id":428,"href":"https:\/\/mliaomcx.com\/en\/wp-json\/wp\/v2\/posts\/419\/revisions\/428"}],"wp:attachment":[{"href":"https:\/\/mliaomcx.com\/en\/wp-json\/wp\/v2\/media?parent=419"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mliaomcx.com\/en\/wp-json\/wp\/v2\/categories?post=419"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mliaomcx.com\/en\/wp-json\/wp\/v2\/tags?post=419"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}