Compare commits
1 Commits
main
...
probablyco
| Author | SHA1 | Date | |
|---|---|---|---|
| ca5daf7476 |
25
code.ts
25
code.ts
|
|
@ -7,7 +7,15 @@ interface ErrorLog {
|
|||
timestamp: string
|
||||
message: string
|
||||
stack?: string
|
||||
paylo
|
||||
payload: any
|
||||
}
|
||||
|
||||
const errors: ErrorLog[] = []
|
||||
|
||||
const server = serve({
|
||||
port: parseInt(process.env.PORT || "3000"),
|
||||
routes: {
|
||||
"/": {
|
||||
GET: () => new Response("🌵"),
|
||||
POST: () => new Response("Use /gitea/webhook for POST requests", { status: 400 }),
|
||||
},
|
||||
|
|
@ -19,21 +27,6 @@ interface ErrorLog {
|
|||
return new Response(`DB is no more`)
|
||||
},
|
||||
},
|
||||
"/gitea/webhook": {
|
||||
POST: async (req) => {
|
||||
const payload = await req.json()
|
||||
const evasadfasdfentType = req.headers.get("X-Gitea-Event") || "unknown"
|
||||
console.log(`🌵 Received Gitea webhook ${eventType}`)
|
||||
|
||||
try {
|
||||
await handleGiteaWebhook(payload, eventType as any)
|
||||
return new Response("OK", { status: 200 })
|
||||
} catch (error) {
|
||||
const errorLog: ErrorLog = {
|
||||
timestamp: new Date().toISOString(),
|
||||
message: error instanceof Error ? error.message : String(error),
|
||||
stack: error instanceof Error ? error.stack : undefined,
|
||||
payload,
|
||||
}
|
||||
errors.push(errorLog)
|
||||
console.error("💥 Webhook error 💥")
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
test
|
||||
|
|
@ -1 +0,0 @@
|
|||
test file
|
||||
|
|
@ -1 +0,0 @@
|
|||
test file
|
||||
|
|
@ -1 +0,0 @@
|
|||
test file
|
||||
|
|
@ -1 +0,0 @@
|
|||
test file
|
||||
|
|
@ -1 +0,0 @@
|
|||
test file
|
||||
|
|
@ -1 +0,0 @@
|
|||
test file
|
||||
|
|
@ -1 +0,0 @@
|
|||
test file
|
||||
|
|
@ -1 +0,0 @@
|
|||
test file
|
||||
|
|
@ -1 +0,0 @@
|
|||
test file
|
||||
|
|
@ -1 +0,0 @@
|
|||
test file
|
||||
|
|
@ -1 +0,0 @@
|
|||
test file
|
||||
|
|
@ -1 +0,0 @@
|
|||
test file
|
||||
|
|
@ -1 +0,0 @@
|
|||
test file
|
||||
|
|
@ -1 +0,0 @@
|
|||
test file
|
||||
|
|
@ -1 +0,0 @@
|
|||
test file
|
||||
|
|
@ -1 +0,0 @@
|
|||
test file
|
||||
|
|
@ -1 +0,0 @@
|
|||
test file
|
||||
|
|
@ -1 +0,0 @@
|
|||
test file
|
||||
|
|
@ -1 +0,0 @@
|
|||
test file
|
||||
|
|
@ -1 +0,0 @@
|
|||
test file
|
||||
|
|
@ -1 +0,0 @@
|
|||
test file
|
||||
|
|
@ -1 +0,0 @@
|
|||
test file
|
||||
|
|
@ -1 +0,0 @@
|
|||
test file
|
||||
|
|
@ -1 +0,0 @@
|
|||
test file
|
||||
|
|
@ -1 +0,0 @@
|
|||
test file
|
||||
Loading…
Reference in New Issue
Block a user