fix xml parser

This commit is contained in:
Omer Sabic 2024-06-13 14:45:06 +02:00
parent b4c44e7622
commit 8412cbc572

View File

@ -36,7 +36,7 @@ export const main = async () => {
origin: true, origin: true,
credentials: true, credentials: true,
}); });
server.register(oauth, { server.register(oauth, {
name: 'googleOAuth2', name: 'googleOAuth2',
scope: ['https://www.googleapis.com/auth/youtube.readonly', 'https://www.googleapis.com/auth/youtube.force-ssl', "https://www.googleapis.com/auth/userinfo.email", "https://www.googleapis.com/auth/userinfo.profile"], scope: ['https://www.googleapis.com/auth/youtube.readonly', 'https://www.googleapis.com/auth/youtube.force-ssl', "https://www.googleapis.com/auth/userinfo.email", "https://www.googleapis.com/auth/userinfo.profile"],
@ -58,15 +58,11 @@ export const main = async () => {
callbackUri: `${env.PUBLIC_API_URL}/auth/google/callback` callbackUri: `${env.PUBLIC_API_URL}/auth/google/callback`
}); });
server.addContentTypeParser(['text/xml', 'application/xml', 'application/atom+xml'], { parseAs: 'string' }, async (request, payload, done) => { server.addContentTypeParser(['text/xml', 'application/xml', 'application/atom+xml'], { parseAs: 'string' }, function (request, payload, done) {
try { xml2js.parseString(payload, function (err, body) {
let parsed = await xml2js.parseStringPromise(payload); done(err, body)
done(null, parsed) })
} catch(e) { })
console.log(e);
done(e, undefined)
}
})
// Routes // Routes
server.register(channelRoutes, { server.register(channelRoutes, {