From 8a5cee1d5ff23ac4eaa0b4fc2d3d6ad8f211d493 Mon Sep 17 00:00:00 2001 From: neko Date: Tue, 21 Jan 2025 10:03:43 +0500 Subject: [PATCH] Add all supported file extensions and Update Dockerfile to make image smaller by utilizing virtual packages in alpine --- Dockerfile | 7 +++++-- TODO.md | 9 +++++++++ main.py | 21 +++++++++++++++++++-- 3 files changed, 33 insertions(+), 4 deletions(-) create mode 100644 TODO.md diff --git a/Dockerfile b/Dockerfile index 49f3231..c4b40cf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,14 @@ FROM alpine:latest -RUN apk add --no-cache libreoffice py3-pip +RUN apk add --no-cache libreoffice +RUN apk add font-terminus font-noto font-noto-extra font-arabic-misc font-misc-cyrillic font-mutt-misc font-screen-cyrillic font-winitzki-cyrillic font-cronyx-cyrillic font-noto-arabic font-noto-armenian font-noto-cherokee font-noto-devanagari font-noto-ethiopic font-noto-georgian font-noto-hebrew font-noto-lao font-noto-malayalam font-noto-tamil font-noto-thaana font-noto-thai +RUN apk add --no-cache --virtual temporary python3-dev py3-pip gcc libc-dev && pip install --break-system-packages pyrogram TgCrypto && apk del temporary + + WORKDIR /2pdf COPY main.py /2pdf/ COPY 2pdf.session /2pdf/ -RUN pip install --break-system-packages pyrogram CMD ["python", "main.py"] diff --git a/TODO.md b/TODO.md new file mode 100644 index 0000000..98a5867 --- /dev/null +++ b/TODO.md @@ -0,0 +1,9 @@ +# TODO +## Planned +* Add /start command +* Add /replace command +* Make every filename random to prevent issues with the same filename + + +## In progress +* Use unoserver \ No newline at end of file diff --git a/main.py b/main.py index bc55bb4..722e3e2 100644 --- a/main.py +++ b/main.py @@ -20,8 +20,25 @@ def validDocument(mime_type): valid_mime_types = [ "application/msword", # .doc "application/vnd.openxmlformats-officedocument.wordprocessingml.document", # .docx - "application/vnd.ms-excel", # xls - "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" # .xlsx + "application/vnd.ms-excel", # .xls + "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", # .xlsx + "application/vnd.oasis.opendocument.text", # .odt + "application/rtf", # .rtf + "text/plain", # .txt + "application/xhtml+xml", # .html + "application/epub+zip", # .epub + "application/vnd.oasis.opendocument.spreadsheet", # .ods + "application/vnd.oasis.opendocument.presentation", # .odp + "application/vnd.oasis.opendocument.graphics", # .odg + "application/vnd.visio", # .vsd + "image/svg+xml", # .svg + "application/vnd.ms-powerpoint", # .ppt + "application/vnd.openxmlformats-officedocument.presentationml.presentation", # .pptx + "application/x-abiword", # .abw + "application/vnd.ms-works", # .wps + "application/x-tex", # .tex + "text/csv", # .csv + "text/tab-separated-values", # .tsv ] return mime_type in valid_mime_types