chore: debug

This commit is contained in:
Cory Dransfeldt 2024-03-28 15:09:54 -07:00
parent 93f61608ef
commit d8cdb21b2e
No known key found for this signature in database
3 changed files with 27 additions and 3 deletions

View file

@ -1,8 +1,30 @@
import { getStore } from '@netlify/blobs'
export default async (request, context) => {
console.log(request)
console.log(context)
const ACCOUNT_ID_PLEX = Netlify.env.get("ACCOUNT_ID_PLEX");
const id = params.get('id')
const params = new URL(request['url']).searchParams
const data = await request.formData()
const payload = data['payload']
console.log(data)
console.log(payload)
if (!id) return new Response(JSON.stringify({
status: 'Bad request',
}),
{ headers: { "Content-Type": "application/json" } }
)
if (id !== ACCOUNT_ID_PLEX) return new Response(JSON.stringify({
status: 'Forbidden',
}),
{ headers: { "Content-Type": "application/json" } }
)
if (payload?.event === 'media.scrobble') {
console.log('scrobble')
}
return new Response(JSON.stringify({
status: 'success',
}),