mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-30 13:33:08 +02:00
fix: oauth headers
This commit is contained in:
parent
ce42cc0e8d
commit
30cc0a9b18
2 changed files with 15 additions and 1 deletions
|
@ -48,7 +48,7 @@ export class MastodonApiServerService {
|
||||||
fastify.addContentTypeParser(['application/x-www-form-urlencoded'], { parseAs: 'string' }, (req, body, done) => {
|
fastify.addContentTypeParser(['application/x-www-form-urlencoded'], { parseAs: 'string' }, (req, body, done) => {
|
||||||
const dataObj: any = {};
|
const dataObj: any = {};
|
||||||
const parsedData = new URLSearchParams(body as string);
|
const parsedData = new URLSearchParams(body as string);
|
||||||
for (let pair of parsedData.entries()) {
|
for (const pair of parsedData.entries()) {
|
||||||
dataObj[pair[0]] = pair[1];
|
dataObj[pair[0]] = pair[1];
|
||||||
}
|
}
|
||||||
done(null, dataObj);
|
done(null, dataObj);
|
||||||
|
|
|
@ -37,6 +37,20 @@ export class OAuth2ProviderService {
|
||||||
});
|
});
|
||||||
}); */
|
}); */
|
||||||
|
|
||||||
|
fastify.addHook('onRequest', (request, reply, done) => {
|
||||||
|
reply.header('Access-Control-Allow-Origin', '*');
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
fastify.addContentTypeParser(['application/x-www-form-urlencoded'], { parseAs: 'string' }, (req, body, done) => {
|
||||||
|
const dataObj: any = {};
|
||||||
|
const parsedData = new URLSearchParams(body as string);
|
||||||
|
for (const pair of parsedData.entries()) {
|
||||||
|
dataObj[pair[0]] = pair[1];
|
||||||
|
}
|
||||||
|
done(null, dataObj);
|
||||||
|
});
|
||||||
|
|
||||||
fastify.get('/oauth/authorize', async (request, reply) => {
|
fastify.get('/oauth/authorize', async (request, reply) => {
|
||||||
const query: any = request.query;
|
const query: any = request.query;
|
||||||
let param = "mastodon=true";
|
let param = "mastodon=true";
|
||||||
|
|
Loading…
Reference in a new issue