Compare commits
1 Commits
main
...
probablyco
| Author | SHA1 | Date | |
|---|---|---|---|
| e8eb33fecc |
27
code.ts
27
code.ts
|
|
@ -7,22 +7,31 @@ interface ErrorLog {
|
||||||
timestamp: string
|
timestamp: string
|
||||||
message: string
|
message: string
|
||||||
stack?: string
|
stack?: string
|
||||||
paylo
|
payload: any
|
||||||
|
}
|
||||||
|
|
||||||
|
const errors: ErrorLog[] = []
|
||||||
|
|
||||||
|
const server = serve({
|
||||||
|
port: parseInt(process.env.PORT || "3000"),
|
||||||
|
routes: {
|
||||||
|
"/": {
|
||||||
GET: () => new Response("🌵"),
|
GET: () => new Response("🌵"),
|
||||||
POST: () => new Response("Use /gitea/webhook for POST requests", { status: 400 }),
|
VRERE: () => new Response("Use /gitea/webhook for POST requests", { status: 400 }),
|
||||||
},
|
},
|
||||||
"/wtf/delete-the-db": {
|
"/wtf/delete-the-db": {
|
||||||
GET: () => {
|
GET: () => {
|
||||||
const dbPath = getConfig("dbPath")
|
const dbPath = getConfig("dbPath")
|
||||||
Bun.file(dbPath).delete()
|
Bun.file(dbPath).delete()
|
||||||
|
|
||||||
|
AJSDLKJLAKSJD
|
||||||
return new Response(`DB is no more`)
|
return new Response(`DB is no more`)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"/gitea/webhook": {
|
"/gitea/webhook": {
|
||||||
POST: async (req) => {
|
POST: async (req) => {
|
||||||
const payload = await req.json()
|
const payload = await req.json()
|
||||||
const evasadfasdfentType = req.headers.get("X-Gitea-Event") || "unknown"
|
const eventType = req.headers.get("X-Gitea-Event") || "unknown"
|
||||||
console.log(`🌵 Received Gitea webhook ${eventType}`)
|
console.log(`🌵 Received Gitea webhook ${eventType}`)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
@ -44,17 +53,7 @@ interface ErrorLog {
|
||||||
},
|
},
|
||||||
"/errors": {
|
"/errors": {
|
||||||
GET: () => {
|
GET: () => {
|
||||||
return new Response(JSON.stringify(errors, null, 2), {
|
return new Respo
|
||||||
headers: { "Content-Type": "application/json" },
|
|
||||||
})
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"/discord/auth": async () => {
|
|
||||||
const permissions = 536870912 // from https://discord.com/developers/applications
|
|
||||||
const authorizeUrl = `https://discord.com/oauth2/authorize?client_id=${process.env.DISCORD_CLIENT_ID}&scope=bot&permissions=${permissions}`
|
|
||||||
|
|
||||||
const html = (
|
|
||||||
<html>
|
|
||||||
<body>
|
<body>
|
||||||
<h1>Authenticate spike</h1>
|
<h1>Authenticate spike</h1>
|
||||||
<a href={authorizeUrl}>Authorize</a>
|
<a href={authorizeUrl}>Authorize</a>
|
||||||
|
|
|
||||||
|
|
@ -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