partially fix Mastodon API
This commit is contained in:
parent
9050bda353
commit
92758a29f1
3 changed files with 8 additions and 3 deletions
|
@ -24,7 +24,11 @@ export function getClient(
|
|||
const accessTokenArr = authorization?.split(" ") ?? [null];
|
||||
const accessToken = accessTokenArr[accessTokenArr.length - 1];
|
||||
const generator = (megalodon as any).default;
|
||||
const client = generator(BASE_URL, accessToken) as MegalodonInterface;
|
||||
const client = generator(
|
||||
"firefish",
|
||||
BASE_URL,
|
||||
accessToken,
|
||||
) as MegalodonInterface;
|
||||
return client;
|
||||
}
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ export function apiAuthMastodon(router: Router): void {
|
|||
website: body.website,
|
||||
redirect_uri: red,
|
||||
client_id: Buffer.from(appData.url || "").toString("base64"),
|
||||
client_secret: appData.clientSecret,
|
||||
client_secret: appData.client_secret,
|
||||
};
|
||||
console.log(returns);
|
||||
ctx.body = returns;
|
||||
|
|
|
@ -165,7 +165,8 @@ mastoRouter.post("/oauth/token", async (ctx) => {
|
|||
}
|
||||
let client_id: Array<string> | string | null = body.client_id;
|
||||
const BASE_URL = `${ctx.request.protocol}://${ctx.request.hostname}`;
|
||||
const client = megalodon("firefish", BASE_URL) as MegalodonInterface;
|
||||
const generator = (megalodon as any).default;
|
||||
const client = generator("firefish", BASE_URL, null) as MegalodonInterface;
|
||||
let token = null;
|
||||
if (body.code) {
|
||||
//m = body.code.match(/^([a-zA-Z0-9]{8})([a-zA-Z0-9]{4})([a-zA-Z0-9]{4})([a-zA-Z0-9]{4})([a-zA-Z0-9]{12})/);
|
||||
|
|
Loading…
Reference in a new issue