update: lower message length limit
This commit is contained in:
@@ -28,10 +28,11 @@ export async function onRequestPost(context) {
|
|||||||
const { message } = await request.json();
|
const { message } = await request.json();
|
||||||
|
|
||||||
if (!message) {
|
if (!message) {
|
||||||
return new Response(JSON.stringify({"error": "Missing message"}), {
|
return createErrorResponse("Empty message", 400);
|
||||||
status: 400,
|
}
|
||||||
headers: { 'Content-Type': 'application/json' },
|
|
||||||
});
|
if (message.length > 200) {
|
||||||
|
return createErrorResponse("Message too long", 400);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generate a unique ID for the message
|
// Generate a unique ID for the message
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ const emit = defineEmits(['new-message']);
|
|||||||
const props = defineProps(['locked']);
|
const props = defineProps(['locked']);
|
||||||
|
|
||||||
const text = ref('');
|
const text = ref('');
|
||||||
const maxLength = 1024;
|
const maxLength = 200;
|
||||||
|
|
||||||
const remainingCharacters = computed(() => {
|
const remainingCharacters = computed(() => {
|
||||||
return maxLength - text.value.length;
|
return maxLength - text.value.length;
|
||||||
|
|||||||
Reference in New Issue
Block a user