Spaces:
Sleeping
Sleeping
Update server.js
Browse files
server.js
CHANGED
|
@@ -9,20 +9,7 @@ const app = express();
|
|
| 9 |
app.use(cors());
|
| 10 |
app.use(express.json({ limit: '10mb' }));
|
| 11 |
|
| 12 |
-
const AUTH_TOKEN = process.env.API_TOKEN;
|
| 13 |
|
| 14 |
-
// 🔐 鉴权中间件
|
| 15 |
-
app.use((req, res, next) => {
|
| 16 |
-
const auth = req.headers.authorization;
|
| 17 |
-
if (!auth || !auth.startsWith('Bearer ')) {
|
| 18 |
-
return res.status(401).send('Unauthorized');
|
| 19 |
-
}
|
| 20 |
-
const token = auth.slice(7);
|
| 21 |
-
if (token !== AUTH_TOKEN) {
|
| 22 |
-
return res.status(401).send('Unauthorized');
|
| 23 |
-
}
|
| 24 |
-
next();
|
| 25 |
-
});
|
| 26 |
|
| 27 |
/**
|
| 28 |
* 核心引擎:将所有图形转为路径并执行布尔运算
|
|
|
|
| 9 |
app.use(cors());
|
| 10 |
app.use(express.json({ limit: '10mb' }));
|
| 11 |
|
|
|
|
| 12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
|
| 14 |
/**
|
| 15 |
* 核心引擎:将所有图形转为路径并执行布尔运算
|