Skip to content

Commit 1a66971

Browse files
author
lucifer
committed
feat: 名单
1 parent 9635440 commit 1a66971

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

config/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,9 @@ nweass
292292
LambertCao
293293
YuetongYu
294294
kernelSue
295+
RMsBoy
296+
ZiyangZ
297+
baoqin87
295298
RealDuxy
296299
NealChristmas
297300
NorthSeacoder`),

routes/github.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,21 @@ const router = require("koa-router")();
22
const { success, fail } = require("../utils/request");
33
const fetch = require("node-fetch");
44

5-
router.get("/api/v1/github/content", async (ctx) => {
6-
const { url } = ctx.query;
7-
const res = await fetch(url, {
5+
router.all("/api/v1/github/content", async (ctx) => {
6+
const { url, ...params } = ctx.query;
7+
const dURL = new URL(url);
8+
Object.keys(params).forEach((key) =>
9+
dURL.searchParams.append(key, params[key])
10+
);
11+
console.log(dURL);
12+
const res = await fetch(dURL, {
813
headers: {
914
Accept: "application/json",
1015
Authorization: `token ${process.env.githubapi || ""}`,
1116
},
1217
}).then((res) => res.json());
13-
if (res.content) {
18+
19+
if (res) {
1420
ctx.body = success(res);
1521
} else {
1622
ctx.body = fail({

0 commit comments

Comments
 (0)