From c171a90ad6cce1939c3606d1cb532cf04604c556 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BC=96=E7=A0=81=E7=8C=BF?= Date: Tue, 9 Sep 2025 10:45:13 +0800 Subject: [PATCH] yyy --- index.html | 32 ++++++++++++++++++++++++++++++++ index.js | 7 +++++++ 2 files changed, 39 insertions(+) create mode 100644 index.html diff --git a/index.html b/index.html new file mode 100644 index 0000000..9307514 --- /dev/null +++ b/index.html @@ -0,0 +1,32 @@ + + + + + + + Document + + + + + + + + + \ No newline at end of file diff --git a/index.js b/index.js index bed9fb0..ae27aa5 100644 --- a/index.js +++ b/index.js @@ -5,6 +5,13 @@ const { port, command } = require('./config'); const express = require('express') const app = express() +app.use((req, res, next) => { + res.header('Access-Control-Allow-Origin', '*'); + res.header('Access-Control-Allow-Methods', 'GET, POST'); + res.header('Access-Control-Allow-Headers', 'Content-Type, Authorization, Content-Length, X-Requested-With'); + next(); +}); + app.get('/ip', async (req, res) => { let output = execSync(command, { encoding: "utf8" }); res.json(await ip.parseNetworkInfo(output))