chore: debug
This commit is contained in:
parent
93f61608ef
commit
d8cdb21b2e
3 changed files with 27 additions and 3 deletions
|
@ -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',
|
||||
}),
|
||||
|
|
Reference in a new issue