hardset cookie

This commit is contained in:
TPN 2024-06-05 16:17:20 +05:30
parent d5194d21e8
commit f0bfccaa6f
No known key found for this signature in database
GPG key ID: 40AE091637892B91

View file

@ -10,14 +10,20 @@ export async function login(
pass: string, pass: string,
ctx: ShowScrapeContext | MovieScrapeContext, ctx: ShowScrapeContext | MovieScrapeContext,
): Promise<string | null> { ): Promise<string | null> {
const req = await ctx.proxiedFetcher.full<string>('/login', { let req;
baseUrl, if (user && pass)
method: 'POST', req = await ctx.proxiedFetcher.full<string>('/login', {
body: new URLSearchParams({ user, pass, action: 'login' }), baseUrl,
readHeaders: ['Set-Cookie'], method: 'POST',
}); body: new URLSearchParams({ user, pass, action: 'login' }),
readHeaders: ['Set-Cookie'],
});
const cookies = parseSetCookie(req.headers.get('Set-Cookie') || ''); const cookies = parseSetCookie(
req?.headers.get('Set-Cookie') ||
// we don't wan't our creds to be in the code
'PHPSESSID=phmje3cqeft42rckf8mj7illhc;',
);
return cookies.PHPSESSID.value; return cookies.PHPSESSID.value;
} }