nanndekowareta2

This commit is contained in:
Kagami Sascha Rosylight 2023-06-29 01:10:41 +02:00
parent ae7b59282c
commit 7f79227467
2 changed files with 8 additions and 1 deletions

View File

@ -104,19 +104,27 @@ interface ClientInformation {
async function discoverClientInformation(httpRequestService: HttpRequestService, id: string): Promise<ClientInformation> {
try {
const res = await httpRequestService.send(id);
console.log('TEST', 'marker1');
const redirectUris: string[] = [];
const linkHeader = res.headers.get('link');
if (linkHeader) {
redirectUris.push(...httpLinkHeader.parse(linkHeader).get('rel', 'redirect_uri').map(r => r.uri));
}
console.log('TEST', 'marker2');
const fragment = JSDOM.fragment(await res.text());
console.log('TEST', 'marker3');
redirectUris.push(...[...fragment.querySelectorAll<HTMLLinkElement>('link[rel=redirect_uri][href]')].map(el => el.href));
console.log('TEST', 'marker4');
const name = fragment.querySelector<HTMLElement>('.h-app .p-name')?.textContent?.trim() ?? id;
console.log('TEST', 'marker5');
return {
id,
redirectUris: redirectUris.map(uri => new URL(uri, res.url).toString()),

View File

@ -243,7 +243,6 @@ describe('OAuth', () => {
code_challenge: pkceAlice.code_challenge,
code_challenge_method: 'S256',
} as AuthorizationParamsExtended));
console.log(await responseAlice.text(), 'なんでこわれた');
assert.strictEqual(responseAlice.status, 200);
const responseBob = await fetch(client.authorizeURL({