add gists proxy url

This commit is contained in:
DefectingCat
2022-09-05 11:32:58 +08:00
parent e06078646b
commit 195cbd3b64
3 changed files with 5 additions and 6 deletions

View File

@ -2,10 +2,10 @@ import { Octokit } from 'octokit';
import { GistsFile } from 'types';
const password = process.env.NEXT_PUBLIC_GITHUB_API;
const host = process.env.NEXT_PUBLIC_GISTS_HOST ?? 'http://api.github.com';
const octokit = new Octokit({
auth: password,
// @TODO reverse proxy
baseUrl: 'http://api.github.com',
baseUrl: host,
});
const linkMatch = /<(.*?)>/;

View File

@ -6,8 +6,7 @@
"dev": "next dev",
"build": "next build && yarn build:search",
"build:export": "cross-env NEXT_BUILD=export next build && cross-env NEXT_BUILD=export next export",
"build:search": "node scripts/build-search.mjs",
"build:search-g": "node scripts/build-search.mjs -g",
"build:search": "node scripts/build-search.mjs -g",
"start": "next start",
"lint": "next lint",
"test": "jest --watch",

View File

@ -9,10 +9,10 @@ import { Octokit } from 'octokit';
*/
async function getGists(page, perPage) {
const password = process.env.NEXT_PUBLIC_GITHUB_API;
const host = process.env.NEXT_PUBLIC_GISTS_HOST ?? 'http://api.github.com';
const octokit = new Octokit({
auth: password,
// @TODO reverse proxy
baseUrl: 'http://api.github.com',
baseUrl: host,
});
return await octokit.rest.gists.list({
page,