This commit is contained in:
1 parent
2b983e5c6d
commit
d42f7bce5b
7 files changed
+13
-11
No files matched your search
@@ -52,6 +52,7 @@ export default defineConfig({
|
||||
|
||||
DATABASE_URI: envField.string({ context: 'server', access: 'secret' }),
|
||||
|
||||
BASE_HOST: envField.string({ context: 'server', access: 'secret', default: 'http://localhost:4321' }),
|
||||
BASE_PATH: envField.string({ context: 'server', access: 'secret', default: '/' })
|
||||
}
|
||||
},
|
||||
|
||||
@@ -48,6 +48,7 @@
|
||||
PAYPAL_LINK = "http://example.com";
|
||||
SERVER_IP = "example.com";
|
||||
|
||||
BASE_HOST = "http://localhost:4321";
|
||||
BASE_PATH = "/craftattack";
|
||||
};
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import { int, mysqlTable, varchar } from 'drizzle-orm/mysql-core';
|
||||
import { user } from '@db/schema/user.ts';
|
||||
import { eq } from 'drizzle-orm';
|
||||
import { generateRandomString } from '@util/random.ts';
|
||||
import { BASE_PATH } from 'astro:env/server';
|
||||
import { BASE_HOST, BASE_PATH } from 'astro:env/server';
|
||||
|
||||
type Database = MySql2Database<{ directSignup: typeof directSignup }>;
|
||||
|
||||
@@ -36,7 +36,7 @@ export async function addDirectSignup(db: Database, _values: AddDirectSignupReq)
|
||||
hash: hash
|
||||
});
|
||||
|
||||
return { hash: hash, url: `${BASE_PATH}/signup/${hash}` };
|
||||
return { hash: hash, url: `${BASE_HOST}/${BASE_PATH}/signup/${hash}` };
|
||||
}
|
||||
|
||||
export async function setDirectSignupUser(db: Database, values: SetDirectSignupUserReq) {
|
||||
|
||||
@@ -3,7 +3,7 @@ import type { MySql2Database } from 'drizzle-orm/mysql2';
|
||||
import { and, desc, eq, isNotNull, like } from 'drizzle-orm';
|
||||
import { reportStatus } from './reportStatus.ts';
|
||||
import { generateRandomString } from '@util/random.ts';
|
||||
import { BASE_PATH } from 'astro:env/server';
|
||||
import { BASE_HOST, BASE_PATH } from 'astro:env/server';
|
||||
import { strikeReason } from '@db/schema/strikeReason.ts';
|
||||
import { strike } from '@db/schema/strike.ts';
|
||||
import { user } from '@db/schema/user.ts';
|
||||
@@ -70,7 +70,7 @@ export async function addReport(db: Database, values: AddReportReq) {
|
||||
})
|
||||
.$returningId();
|
||||
|
||||
return Object.assign(r[0], { url: `${BASE_PATH}/report/${urlHash}` });
|
||||
return Object.assign(r[0], { url: `${BASE_HOST}/${BASE_PATH}/report/${urlHash}` });
|
||||
}
|
||||
|
||||
export async function editReport(db: Database, values: EditReportReq) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { externalApi } from '../_api.ts';
|
||||
import { z } from 'astro:schema';
|
||||
import { db } from '@db/database.ts';
|
||||
import { BASE_PATH } from 'astro:env/server';
|
||||
import { BASE_HOST, BASE_PATH } from 'astro:env/server';
|
||||
|
||||
export const POST = externalApi({
|
||||
input: z.object({
|
||||
@@ -19,7 +19,7 @@ export const POST = externalApi({
|
||||
|
||||
const response = feedbacks.map((feedback) => ({
|
||||
uuid: feedback.uuid,
|
||||
url: `${BASE_PATH}/feedback/${feedback.urlHash}`
|
||||
url: `${BASE_HOST}/${BASE_PATH}/feedback/${feedback.urlHash}`
|
||||
}));
|
||||
|
||||
return new Response(JSON.stringify({ feedback: response }), { status: 200 });
|
||||
|
||||
@@ -2,7 +2,7 @@ import { externalApi } from '../_api.ts';
|
||||
import { z } from 'astro:schema';
|
||||
import { db } from '@db/database.ts';
|
||||
import { sendWebhook, WebhookAction } from '@util/webhook.ts';
|
||||
import { BASE_PATH } from 'astro:env/server';
|
||||
import { BASE_HOST, BASE_PATH } from 'astro:env/server';
|
||||
|
||||
export const GET = externalApi({
|
||||
auth: true,
|
||||
@@ -17,7 +17,7 @@ export const GET = externalApi({
|
||||
reason: report.reason,
|
||||
created: report.createdAt?.getTime() ?? null,
|
||||
status: report.status?.status ?? null,
|
||||
url: `${BASE_PATH}/report/${report.urlHash}`
|
||||
url: `${BASE_HOST}/${BASE_PATH}/report/${report.urlHash}`
|
||||
}))
|
||||
}),
|
||||
{ status: 200 }
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { externalApi } from '../../_api.ts';
|
||||
import { db } from '@db/database.ts';
|
||||
import { BASE_PATH } from 'astro:env/server';
|
||||
import { BASE_HOST, BASE_PATH } from 'astro:env/server';
|
||||
|
||||
export const GET = externalApi({
|
||||
auth: true,
|
||||
@@ -18,14 +18,14 @@ export const GET = externalApi({
|
||||
reason: report.reason,
|
||||
created: report.createdAt?.getTime() ?? null,
|
||||
status: report.status?.status ?? null,
|
||||
url: `${BASE_PATH}/report/${report.urlHash}`
|
||||
url: `${BASE_HOST}/${BASE_PATH}/report/${report.urlHash}`
|
||||
})),
|
||||
to_self: toSelf.map((report) => ({
|
||||
reporter: report.reporter?.uuid ?? null,
|
||||
reason: report.reason,
|
||||
created: report.createdAt?.getTime() ?? null,
|
||||
status: report.status?.status ?? null,
|
||||
url: `${BASE_PATH}/report/${report.urlHash}`
|
||||
url: `${BASE_HOST}/${BASE_PATH}/report/${report.urlHash}`
|
||||
}))
|
||||
}),
|
||||
{ status: 200 }
|
||||
|
||||
Reference in new issue
Block a user