update dockerfile

fix gists script
This commit is contained in:
xfy
2024-05-22 11:32:49 +08:00
parent 76a4b6db2c
commit bd8a4aa42e
2 changed files with 16 additions and 21 deletions

View File

@ -1,5 +1,6 @@
/* @ts-check */
import { Octokit } from 'octokit';
import { Octokit } from '@octokit/core';
import { restEndpointMethods } from '@octokit/plugin-rest-endpoint-methods';
/**
* Get gists.
@ -10,7 +11,8 @@ 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({
const MyOctokit = Octokit.plugin(restEndpointMethods);
const octokit = new MyOctokit({
auth: password,
baseUrl: host,
});
@ -69,7 +71,7 @@ async function generateGists() {
const text = l.match(relMatch)?.[1];
if (!text) return;
const page = new URLSearchParams(l.match(linkMatch)?.[1].split('?')[1]).get(
'page'
'page',
);
pageSize[text] = Number(page);
});