mirror of
https://github.com/versia-pub/server.git
synced 2026-03-13 05:49:16 +01:00
feat(api): ✨ Make Lysand a full OAuth2/OpenID Connect provider as well as still Mastodon compatible
This commit is contained in:
parent
f9f4a99cb9
commit
5cb48b2f3b
29 changed files with 8466 additions and 279 deletions
|
|
@ -89,6 +89,8 @@ export interface Config {
|
|||
client_secret: string;
|
||||
icon: string;
|
||||
}[];
|
||||
|
||||
jwt_key: string;
|
||||
};
|
||||
|
||||
http: {
|
||||
|
|
@ -447,6 +449,7 @@ export const defaultConfig: Config = {
|
|||
},
|
||||
oidc: {
|
||||
providers: [],
|
||||
jwt_key: "",
|
||||
},
|
||||
http: {
|
||||
base_url: "https://lysand.social",
|
||||
|
|
|
|||
|
|
@ -137,23 +137,14 @@ export class RequestParser {
|
|||
* @throws Error if body is invalid
|
||||
*/
|
||||
private async parseFormUrlencoded<T>(): Promise<Partial<T>> {
|
||||
const formData = await this.request.formData();
|
||||
const result: Partial<T> = {};
|
||||
const parsed = parse(await this.request.text(), {
|
||||
parseArrays: true,
|
||||
interpretNumericEntities: true,
|
||||
});
|
||||
|
||||
for (const [key, value] of formData.entries()) {
|
||||
if (key.endsWith("[]")) {
|
||||
const arrayKey = key.slice(0, -2) as keyof T;
|
||||
if (!result[arrayKey]) {
|
||||
result[arrayKey] = [] as T[keyof T];
|
||||
}
|
||||
|
||||
(result[arrayKey] as FormDataEntryValue[]).push(value);
|
||||
} else {
|
||||
result[key as keyof T] = value as T[keyof T];
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
return castBooleanObject(
|
||||
parsed as PossiblyRecursiveObject,
|
||||
) as Partial<T>;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue