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
)
const env = useRuntimeConfig(event)
const { pathname } = new URL(event.node.req.url)
const { success } = await env.MY_RATE_LIMITER.limit({ key: pathname })
if (!success) {
return new Response(`429 Failure rate limit exceeded for ${pathname}`, {
status: 429
})
}
// FIXME: somehow this is not working, but it worked before
// const path = 'feedback'
//
// 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`
if (page) description += `**Page:** \`${page}\``

View file

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