chore: update Dockerfile and docker-compose for improved deployment process; add deploy script
This commit is contained in:
+1
-2
@@ -43,8 +43,7 @@ const cleanupTempFile = async (tempPath: string): Promise<void> => {
|
||||
const sanitizeFilenameHeader = (fileName: string): string =>
|
||||
fileName.replace(/[\\"]/g, '').replace(/[\n\r]/g, '');
|
||||
|
||||
const fail = (status: number, error: string): Response =>
|
||||
Response.json({ error }, { status });
|
||||
const fail = (status: number, error: string): Response => Response.json({ error }, { status });
|
||||
|
||||
export const handleFileRedirect = async (req: RequestWithParams): Promise<Response> => {
|
||||
const public_id = req.params?.public_id;
|
||||
|
||||
@@ -90,7 +90,8 @@ export const handleSwaggerJson = async (): Promise<Response> => {
|
||||
'/api/upload': {
|
||||
post: {
|
||||
summary: 'Upload File',
|
||||
description: 'Uploads a file to Telegram storage via multipart/form-data or JSON base64. Rate-limited by IP.',
|
||||
description:
|
||||
'Uploads a file to Telegram storage via multipart/form-data or JSON base64. Rate-limited by IP.',
|
||||
requestBody: {
|
||||
required: true,
|
||||
content: {
|
||||
|
||||
@@ -231,7 +231,10 @@ const handleJSONUpload = async (req: Request): Promise<Response> => {
|
||||
|
||||
const { base64Data, mimeType: rawMimeType } = parseBase64File(file);
|
||||
const estimatedSizeBytes = Math.floor((base64Data.length * 3) / 4);
|
||||
if (estimatedSizeBytes > JSON_UPLOAD_LIMIT_BYTES || estimatedSizeBytes > config.maxRequestBodyBytes) {
|
||||
if (
|
||||
estimatedSizeBytes > JSON_UPLOAD_LIMIT_BYTES ||
|
||||
estimatedSizeBytes > config.maxRequestBodyBytes
|
||||
) {
|
||||
return Response.json(
|
||||
{
|
||||
error:
|
||||
|
||||
Reference in New Issue
Block a user