1
0
mirror of https://github.com/uetchy/namae.git synced 2025-08-20 01:48:12 +09:00

fix: tsc errors

This commit is contained in:
2021-02-25 16:48:45 +09:00
parent 42c38028f7
commit 7bd485c6d5
6 changed files with 3582 additions and 3297 deletions

View File

@@ -1,4 +1,5 @@
import { NowRequest, NowResponse } from '@vercel/node';
import assert from 'assert';
import fetch from 'cross-fetch';
import { send, sendError } from '../../../util/http';
@@ -8,6 +9,8 @@ export default async function handler(
): Promise<void> {
const { query } = req.query;
assert(process.env.DOMAINR_API_KEY);
if (!query || typeof query !== 'string') {
return sendError(res, new Error('No query given'));
}

View File

@@ -1,5 +1,6 @@
import { send, sendError, fetch } from '../../../util/http';
import { NowRequest, NowResponse } from '@vercel/node';
import 'cross-fetch';
import { fetch, send, sendError } from '../../../util/http';
export default async function handler(
req: NowRequest,
@@ -18,12 +19,14 @@ export default async function handler(
)}`,
'GET'
).then((res) => res.text());
const response = JSON.parse(
responseText.match(
/AF_initDataCallback.+?hash: '5'.+?data:([\w\W]+?), sideChannel/m
)[1]
)?.[1] ?? ''
);
const apps = response[0][1][0][0][0].map((entry) => ({
const apps = response[0][1][0][0][0].map((entry: any) => ({
id: entry[12][0],
name: entry[2],
author: entry[4][0][0][0],