diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 0f5f644..49d41de 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -33,20 +33,20 @@ jobs: key: ${{ secrets.SERVER_SSH_KEY }} script: | # 解压文件 - unzip -o /tmp/deployment.zip -d /opt/1panel/apps/openresty/openresty/www/sites/random-api-file.czl.net/index2 + unzip -o /tmp/deployment.zip -d /opt/1panel/apps/openresty/openresty/www/sites/random-api.czl.net/index2 # 删除 index 目录下的所有文件 - rm -rf /opt/1panel/apps/openresty/openresty/www/sites/random-api-file.czl.net/index/* + rm -rf /opt/1panel/apps/openresty/openresty/www/sites/random-api.czl.net/index/* # 移动文件,采用覆盖模式 - mv -f /opt/1panel/apps/openresty/openresty/www/sites/random-api-file.czl.net/index2/* /opt/1panel/apps/openresty/openresty/www/sites/random-api-file.czl.net/index/ + mv -f /opt/1panel/apps/openresty/openresty/www/sites/random-api.net/index2/* /opt/1panel/apps/openresty/openresty/www/sites/random-api.czl.net/index/ # 删除 index2 文件夹 - rm -rf /opt/1panel/apps/openresty/openresty/www/sites/random-api-file.czl.net/index2 + rm -rf /opt/1panel/apps/openresty/openresty/www/sites/random-api-file.net/index2 # 设置目录及其子文件的所有权和权限 - chown -R 1000:1000 /opt/1panel/apps/openresty/openresty/www/sites/random-api-file.czl.net/index - chmod -R 0755 /opt/1panel/apps/openresty/openresty/www/sites/random-api-file.czl.net/index + chown -R 1000:1000 /opt/1panel/apps/openresty/openresty/www/sites/random-api.czl.net/index + chmod -R 0755 /opt/1panel/apps/openresty/openresty/www/sites/random-api.czl.net/index # 清理临时文件 rm /tmp/deployment.zip diff --git a/eo.js b/eo.js index a34a289..a53a5bb 100644 --- a/eo.js +++ b/eo.js @@ -1,5 +1,5 @@ // 外部 JSON 文件的 URL -const CSV_PATHS_URL = 'https://random-api-file.czl.net/url.json'; +const CSV_PATHS_URL = 'https://random-api.czl.net/url.json'; addEventListener('fetch', event => { event.respondWith(handleRequest(event.request)); @@ -58,7 +58,7 @@ async function handleRequest(request) { } } else { // 请求路径不在配置中,返回默认首页 - const indexHtmlResponse = await fetch('https://random-api-file.czl.net'); + const indexHtmlResponse = await fetch('https://random-api.czl.net'); return new Response(indexHtmlResponse.body, { headers: { 'Content-Type': 'text/html' }, }); diff --git a/nodejs/app.js b/nodejs/app.js index 83977fd..d2b07b9 100644 --- a/nodejs/app.js +++ b/nodejs/app.js @@ -6,12 +6,16 @@ const winston = require('winston'); require('winston-daily-rotate-file'); const cluster = require('cluster'); const numCPUs = require('os').cpus().length; +const path = require('path'); // 添加这行来导入 path 模块 const app = express(); const port = 5003; +// 设置静态文件目录 +app.use(express.static(path.join(__dirname, 'public'))); + // 外部 JSON 文件的 URL -const CSV_PATHS_URL = 'https://random-api-file.czl.net/url.json'; +const CSV_PATHS_URL = 'https://random-api.czl.net/url.json'; // 设置缓存 let csvPathsCache = null; @@ -151,7 +155,7 @@ async function handleRequest(req, res) { return res.status(500).send('CSV file could not be fetched.'); } } else { - const indexHtmlResponse = await fetch('https://random-api-file.czl.net'); + const indexHtmlResponse = await fetch('https://random-api.czl.net'); const indexHtml = await indexHtmlResponse.text(); return res.type('html').send(indexHtml); } diff --git a/index.html b/nodejs/public/index.html similarity index 98% rename from index.html rename to nodejs/public/index.html index f0f2225..29157de 100644 --- a/index.html +++ b/nodejs/public/index.html @@ -110,7 +110,7 @@ }); // 异步加载 index.md 文件内容 - fetch('https://random-api-file.czl.net/index.md') + fetch('./index.md') .then(response => response.text()) .then(markdownText => { // 渲染 Markdown 内容 diff --git a/index.md b/nodejs/public/index.md similarity index 100% rename from index.md rename to nodejs/public/index.md diff --git a/nodejs/public/url.json b/nodejs/public/url.json new file mode 100644 index 0000000..4bc9ab6 --- /dev/null +++ b/nodejs/public/url.json @@ -0,0 +1,15 @@ +{ + "pic": { + "all": "https://random-api.czl.net/url/pic/all.csv", + "fjht": "https://random-api.czl.net/url/pic/fjht.csv", + "czlwb": "https://random-api.czl.net/url/pic/czl-website-background.csv", + "truegirl": "https://random-api.czl.net/url/pic/truegirl.csv", + "ecy": "https://random-api.czl.net/url/pic/ecy.csv", + "ecy1": "https://random-api.czl.net/url/pic/ecy1.csv", + "ecy2": "https://random-api.czl.net/url/pic/ecy2.csv" + }, + "video": { + "all": "https://random-api.czl.net/url/video/all.csv" + } +} + \ No newline at end of file diff --git a/url/pic/all.csv b/nodejs/public/url/pic/all.csv similarity index 100% rename from url/pic/all.csv rename to nodejs/public/url/pic/all.csv diff --git a/url/pic/czl-website-background.csv b/nodejs/public/url/pic/czl-website-background.csv similarity index 100% rename from url/pic/czl-website-background.csv rename to nodejs/public/url/pic/czl-website-background.csv diff --git a/url/pic/ecy.csv b/nodejs/public/url/pic/ecy.csv similarity index 100% rename from url/pic/ecy.csv rename to nodejs/public/url/pic/ecy.csv diff --git a/url/pic/ecy1.csv b/nodejs/public/url/pic/ecy1.csv similarity index 100% rename from url/pic/ecy1.csv rename to nodejs/public/url/pic/ecy1.csv diff --git a/url/pic/ecy2.csv b/nodejs/public/url/pic/ecy2.csv similarity index 100% rename from url/pic/ecy2.csv rename to nodejs/public/url/pic/ecy2.csv diff --git a/url/pic/fjht.csv b/nodejs/public/url/pic/fjht.csv similarity index 100% rename from url/pic/fjht.csv rename to nodejs/public/url/pic/fjht.csv diff --git a/url/pic/truegirl.csv b/nodejs/public/url/pic/truegirl.csv similarity index 100% rename from url/pic/truegirl.csv rename to nodejs/public/url/pic/truegirl.csv diff --git a/url/video/all.csv b/nodejs/public/url/video/all.csv similarity index 100% rename from url/video/all.csv rename to nodejs/public/url/video/all.csv diff --git a/url.json b/url.json deleted file mode 100644 index 6fba94c..0000000 --- a/url.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "pic": { - "all": "https://random-api-file.czl.net/url/pic/all.csv", - "fjht": "https://random-api-file.czl.net/url/pic/fjht.csv", - "czlwb": "https://random-api-file.czl.net/url/pic/czl-website-background.csv", - "truegirl": "https://random-api-file.czl.net/url/pic/truegirl.csv", - "ecy": "https://random-api-file.czl.net/url/pic/ecy.csv", - "ecy1": "https://random-api-file.czl.net/url/pic/ecy1.csv", - "ecy2": "https://random-api-file.czl.net/url/pic/ecy2.csv" - }, - "video": { - "all": "https://random-api-file.czl.net/url/video/all.csv" - } -} - \ No newline at end of file diff --git a/worker 302跳转.js b/worker 302跳转.js index a34a289..a53a5bb 100644 --- a/worker 302跳转.js +++ b/worker 302跳转.js @@ -1,5 +1,5 @@ // 外部 JSON 文件的 URL -const CSV_PATHS_URL = 'https://random-api-file.czl.net/url.json'; +const CSV_PATHS_URL = 'https://random-api.czl.net/url.json'; addEventListener('fetch', event => { event.respondWith(handleRequest(event.request)); @@ -58,7 +58,7 @@ async function handleRequest(request) { } } else { // 请求路径不在配置中,返回默认首页 - const indexHtmlResponse = await fetch('https://random-api-file.czl.net'); + const indexHtmlResponse = await fetch('https://random-api.czl.net'); return new Response(indexHtmlResponse.body, { headers: { 'Content-Type': 'text/html' }, });