dev #4
@@ -296,7 +296,7 @@ export default function ReqForm() {
|
||||
/>
|
||||
{selectedItem && selectedTypeLabel && (
|
||||
<div className="text-xs font-medium uppercase text-neutral-500 dark:text-neutral-400 tracking-wide">
|
||||
Selected type: <span className="font-bold text-neutral-700 dark:text-neutral-200">{selectedTypeLabel}</span>
|
||||
Type: <span className="font-bold text-neutral-700 dark:text-neutral-200">{selectedTypeLabel}</span>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
@@ -334,18 +334,19 @@ export default function ReqForm() {
|
||||
|
||||
<div className="space-y-2">
|
||||
<label htmlFor="year" className="block text-sm font-medium text-neutral-700 dark:text-neutral-300">
|
||||
Year <span className="text-neutral-400">(optional)</span>
|
||||
Year
|
||||
</label>
|
||||
<InputText
|
||||
id="year"
|
||||
value={year}
|
||||
onChange={(e) => setYear(e.target.value)}
|
||||
placeholder="e.g. 2023"
|
||||
className="w-full border border-neutral-200 dark:border-neutral-700 rounded-xl px-4 py-3 bg-white dark:bg-neutral-900/50 focus:border-blue-500 dark:focus:border-blue-400 focus:ring-2 focus:ring-blue-500/20 transition-all outline-none"
|
||||
placeholder=""
|
||||
readOnly
|
||||
disabled
|
||||
className="w-full border border-neutral-200 dark:border-neutral-700 rounded-xl px-4 py-3 bg-neutral-100 dark:bg-neutral-800 text-neutral-500 dark:text-neutral-400 cursor-not-allowed transition-all outline-none"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
{/* <div className="space-y-2">
|
||||
<label htmlFor="requester" className="block text-sm font-medium text-neutral-700 dark:text-neutral-300">
|
||||
Your Name <span className="text-neutral-400">(optional)</span>
|
||||
</label>
|
||||
@@ -356,7 +357,7 @@ export default function ReqForm() {
|
||||
placeholder="Who is requesting this?"
|
||||
className="w-full border border-neutral-200 dark:border-neutral-700 rounded-xl px-4 py-3 bg-white dark:bg-neutral-900/50 focus:border-blue-500 dark:focus:border-blue-400 focus:ring-2 focus:ring-blue-500/20 transition-all outline-none"
|
||||
/>
|
||||
</div>
|
||||
</div> */}
|
||||
|
||||
<div className="pt-4">
|
||||
<Button
|
||||
|
||||
@@ -15,7 +15,7 @@ interface SubmitRequestBody {
|
||||
title?: string;
|
||||
year?: string;
|
||||
type?: string;
|
||||
requester?: string;
|
||||
// requester?: string;
|
||||
[key: string]: unknown;
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@ export async function POST({ request }: APIContext): Promise<Response> {
|
||||
try {
|
||||
// Use pre-parsed body data
|
||||
const extendedRequest = request as ExtendedRequest;
|
||||
const { title, year, type, requester } = extendedRequest.bodyData || {};
|
||||
const { title, year, type } = extendedRequest.bodyData || {};
|
||||
|
||||
// Input validation
|
||||
if (!title || typeof title !== 'string' || !title.trim()) {
|
||||
@@ -174,16 +174,16 @@ export async function POST({ request }: APIContext): Promise<Response> {
|
||||
return response;
|
||||
}
|
||||
|
||||
if (requester && (typeof requester !== 'string' || requester.length > 500)) {
|
||||
const response = new Response(JSON.stringify({ error: 'Requester name must be 500 characters or less if provided' }), {
|
||||
status: 400,
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
});
|
||||
if (!hadCookie) {
|
||||
response.headers.set('Set-Cookie', createNonceCookie(cookieId));
|
||||
}
|
||||
return response;
|
||||
}
|
||||
// if (requester && (typeof requester !== 'string' || requester.length > 500)) {
|
||||
// const response = new Response(JSON.stringify({ error: 'Requester name must be 500 characters or less if provided' }), {
|
||||
// status: 400,
|
||||
// headers: { 'Content-Type': 'application/json' },
|
||||
// });
|
||||
// if (!hadCookie) {
|
||||
// response.headers.set('Set-Cookie', createNonceCookie(cookieId));
|
||||
// }
|
||||
// return response;
|
||||
// }
|
||||
|
||||
// Fetch synopsis and IMDb ID from TMDB
|
||||
let synopsis = '';
|
||||
@@ -258,13 +258,13 @@ export async function POST({ request }: APIContext): Promise<Response> {
|
||||
});
|
||||
}
|
||||
|
||||
if (requester && requester.trim()) {
|
||||
fields.push({
|
||||
name: "Requested by",
|
||||
value: requester.trim(),
|
||||
inline: false
|
||||
});
|
||||
}
|
||||
// if (requester && requester.trim()) {
|
||||
// fields.push({
|
||||
// name: "Requested by",
|
||||
// value: requester.trim(),
|
||||
// inline: false
|
||||
// });
|
||||
// }
|
||||
|
||||
interface DiscordEmbed {
|
||||
title: string;
|
||||
|
||||
Reference in New Issue
Block a user