feat(api): move to api.fmhy.net

This commit is contained in:
taskylizard 2024-08-02 03:19:53 +00:00
parent de933602eb
commit 76c776c2eb
No known key found for this signature in database
GPG key ID: 1820131ED1A24120
7 changed files with 637 additions and 35 deletions

View file

@ -7,14 +7,16 @@ export default defineEventHandler(async (event) => {
FeedbackSchema.parseAsync FeedbackSchema.parseAsync
) )
const env = useRuntimeConfig(event) const env = useRuntimeConfig(event)
const { pathname } = new URL(event.node.req.url)
const { success } = await env.MY_RATE_LIMITER.limit({ key: pathname }) // FIXME: somehow this is not working, but it worked before
if (!success) { // const path = 'feedback'
return new Response(`429 Failure rate limit exceeded for ${pathname}`, { //
status: 429 // const { success } = await env.MY_RATE_LIMITER.limit({ key: path })
}) // if (!success) {
} // return new Response('429 Failure global rate limit exceeded', {
// status: 429
// })
// }
let description = `${message}\n\n` let description = `${message}\n\n`
if (page) description += `**Page:** \`${page}\`` if (page) description += `**Page:** \`${page}\``

View file

@ -51,7 +51,7 @@ async function handleSubmit() {
} }
try { try {
const response = await fetch('https://feedback.tasky.workers.dev', { const response = await fetch('https://api.fmhy.net/feedback', {
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json'

View file

@ -21,7 +21,6 @@
"@fmhy/colors": "^0.0.11", "@fmhy/colors": "^0.0.11",
"@headlessui/vue": "^1.7.22", "@headlessui/vue": "^1.7.22",
"@resvg/resvg-js": "^2.6.0", "@resvg/resvg-js": "^2.6.0",
"vitepress": "npm:@taskylizard/vitepress@1.1.1",
"consola": "^3.2.3", "consola": "^3.2.3",
"feed": "^4.2.2", "feed": "^4.2.2",
"fs-extra": "^11.2.0", "fs-extra": "^11.2.0",
@ -31,6 +30,7 @@
"nprogress": "^0.2.0", "nprogress": "^0.2.0",
"pathe": "^1.1.2", "pathe": "^1.1.2",
"unocss": "^0.58.9", "unocss": "^0.58.9",
"vitepress": "npm:@taskylizard/vitepress@1.1.1",
"vue": "^3.4.33", "vue": "^3.4.33",
"x-satori": "^0.1.5", "x-satori": "^0.1.5",
"zod": "^3.23.8" "zod": "^3.23.8"
@ -45,6 +45,7 @@
"@types/node": "^20.14.11", "@types/node": "^20.14.11",
"@types/nprogress": "^0.2.3", "@types/nprogress": "^0.2.3",
"prettier": "^3.3.3", "prettier": "^3.3.3",
"tailwindcss": "^3.4.6" "tailwindcss": "^3.4.6",
"wrangler": "^3.68.0"
} }
} }

631
pnpm-lock.yaml generated

File diff suppressed because it is too large Load diff

View file

@ -1,3 +1 @@
Moved Moved: https://api.fmhy.net/single-page
https://feedback.tasky.workers.dev/single-page
https://fmhy.xyz/single-page

View file

@ -1,11 +1,15 @@
name = "feedback" name = "api"
main = ".output/server/index.mjs" main = ".output/server/index.mjs"
workers_dev = true workers_dev = false
account_id = "fe5d9bd14160b07939282e45f63eb5ad" account_id = "02f3b11d8d1017a20f95de4ba88fb5d6"
compatibility_date = "2022-09-10" compatibility_date = "2022-09-10"
routes = [
{ pattern = "api.fmhy.net", custom_domain = true, zone_id = "b4212298934f7c1998b4d15f6d261715" },
]
[[unsafe.bindings]] [[unsafe.bindings]]
name = "RATE_LIMITER" name = "RATE_LIMITER"
type = "ratelimit" type = "ratelimit"
namespace_id = "1001" namespace_id = "69420"
simple = { limit = 100, period = 30 } simple = { limit = 100, period = 60 }