From b5ac8fa83f1909b3a0db492ac56a5fa30dddf039 Mon Sep 17 00:00:00 2001 From: Xeltica Date: Mon, 23 Nov 2020 01:48:43 +0900 Subject: [PATCH] ua --- src/misskey.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/misskey.ts b/src/misskey.ts index de25757..748cdff 100644 --- a/src/misskey.ts +++ b/src/misskey.ts @@ -2,7 +2,9 @@ import axios from 'axios'; import { User } from './models/User'; import { Note } from './models/Note'; -export async function api(host: string, endpoint: string, opts: { [_: string]: string }): Promise { +axios.defaults.headers['User-Agent'] = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36'; + +export async function api(host: string, endpoint: string, opts: Record): Promise { const res = await axios.post(`https://${host}/api/${endpoint}`, opts); return res.data; }