Skip to content

Commit

Permalink
chore: debug
Browse files Browse the repository at this point in the history
Signed-off-by: 0x73746F66 <[email protected]>
  • Loading branch information
0x73746F66 committed Jun 12, 2024
1 parent e267f69 commit 11486e9
Show file tree
Hide file tree
Showing 10 changed files with 31,348 additions and 44,020 deletions.
10 changes: 5 additions & 5 deletions functions/github/install/[installation_id]/[code].js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ export async function onRequestGet(context) {
}
console.log('token', token)
const session = await
env.d1db.prepare("SELECT memberEmail, expiry FROM sessions WHERE kid = ?")
.bind(token)
.first()
env.d1db.prepare("SELECT memberEmail, expiry FROM sessions WHERE kid = ?")
.bind(token)
.first()
console.log('session', session)
if (!session) {
return Response.json({ 'err': 'Revoked' })
Expand All @@ -36,11 +36,11 @@ export async function onRequestGet(context) {
const data = Object.fromEntries(text.split('&').map(item => item.split('=').map(decodeURIComponent)))
if (data?.error) {
console.log(data)
throw Error(data.error)
throw new Error(data.error)
}
if (!data?.access_token) {
console.log(data)
throw Error('OAuth response invalid')
throw new Error('OAuth response invalid')
}
const info = await env.d1db.prepare('INSERT INTO integration_github (installation_id, memberEmail, access_key) VALUES (?1, ?2, ?3)')
.bind(token, session?.memberEmail, data.access_token)
Expand Down
2 changes: 1 addition & 1 deletion functions/github/webhook.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ async function readRequestBody(request) {
} else {
// Perhaps some other type of data was submitted in the form
// like an image, or some other binary data.
throw Error("Unhandled type")
throw new Error("Unhandled type")
}
}
async function verifySignature(secret, header, payload) {
Expand Down
Loading

0 comments on commit 11486e9

Please sign in to comment.