Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test #1

Open
wants to merge 82 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
82 commits
Select commit Hold shift + click to select a range
def5d98
Add querybl command to query uploads by addresses in blacklist
Oct 27, 2017
7bbeb2d
Add NSFW detection
Oct 27, 2017
ebfbc6b
Add NSFW filter to address query commands
Oct 27, 2017
c3c29ab
Faster query commands, add removed query filter
Oct 27, 2017
04b46bd
Tweak NSFW threshold
Oct 27, 2017
b2d830e
store_url: only accept identity content encoding
Oct 30, 2017
5608c72
Fix indent error in querybl
Nov 8, 2017
0b288d9
Add command to delete all files uploaded by address
Nov 8, 2017
4b8c9eb
Add extension override for text/x-diff
Dec 22, 2017
b1c79e5
add extension override for audio/flac
Jan 9, 2018
cfee463
Disable NSFW detection by default
Dec 22, 2018
f66418a
Update requirements.txt
Apr 30, 2019
a4d496d
Change license to EUPL
mia-0 Nov 3, 2020
a52127f
Add text/plain exception for .log name extension
mia-0 Nov 3, 2020
a4da58f
Add mailmap
mia-0 May 23, 2021
5db62c2
Support instance config
mia-0 Dec 29, 2020
d815d68
Use template responses
mia-0 Dec 29, 2020
59a0439
Drop dump_urls endpoint
mia-0 Dec 29, 2020
493119f
Drop Flask-Manager
mia-0 Dec 29, 2020
b7c1290
Update requirements.txt
mia-0 May 23, 2021
b5ce94e
Update README
mia-0 Dec 29, 2020
cd083a7
Use pathlib
mia-0 Dec 29, 2020
73045dc
Move storage to classes, support double suffixes
mia-0 Dec 29, 2020
3bdbab9
Support client-defined names in file URL routing
mia-0 Dec 29, 2020
b65209d
Add tests
mia-0 Dec 30, 2020
47ff3a1
Support instance templates
mia-0 Jan 1, 2021
b8def71
Fix some flake8 errors in cleanup and nsfw_detect
nikolas Aug 6, 2021
9c4a0fd
remove short_url and add in-tree URLencoder (#53)
mia-0 Dec 1, 2021
0db6e4b
Fix mime splitting
asakovets Jan 1, 2022
5216e9e
Open upload blacklist in text mode
mia-0 Aug 1, 2022
c7a728c
Fix non-seekable file handles
mia-0 Aug 11, 2022
afb5811
README: Warn users about URL fetch network security implications
mia-0 Aug 19, 2022
4ba1814
README: Clarify how to change configuration
mia-0 Nov 20, 2022
b5f0cfd
README: Clarify why serving file requests from the app is bad
mia-0 Nov 20, 2022
be796b9
Add example configuration file
Nov 27, 2022
00dba0e
config.example.py: Clarify MIME ext mapping
mia-0 Nov 28, 2022
af4b3b0
Add support for expiring files
Alch-Emi Nov 22, 2022
f25619b
nsfw_detect: Tolerate score computation failure
mia-0 Nov 29, 2022
db9a20c
Add example systemd unit files for prune job
mia-0 Nov 29, 2022
aa44317
README: Also run db upgrade after git pull!
mia-0 Nov 29, 2022
14cfe3d
nsfw_detect: Use pathlib, fix deprecation warning
mia-0 Nov 29, 2022
eb0b1d2
nsfw_detect: Use PyAV instead of ffmpegthumbnailer
mia-0 Nov 29, 2022
a182b61
Allow management operations like deleting files
mia-0 Nov 30, 2022
afe2329
templates/index: Remove unnecessary escaping
mia-0 Nov 30, 2022
e168534
Allow changing expiration date
mia-0 Nov 30, 2022
9214bb4
Add X-Expires to file response headers
mia-0 Nov 30, 2022
7661216
Fix handling double file name extensions
mia-0 Dec 1, 2022
ed84d37
Fix 500 on invalid paths
mia-0 Dec 1, 2022
0b80a62
Add support for “secret” file URLs
mia-0 Dec 1, 2022
da30c8f
index.html: Document appending file names
mia-0 Dec 1, 2022
a904922
Add support for ClamAV
mia-0 Dec 12, 2022
b1ed63c
README: Add note about StreamMaxLength in clamd.conf
mia-0 Dec 12, 2022
6055a50
File: Add is_nsfw property
mia-0 Dec 13, 2022
aaf0e44
Record file sizes in db
mia-0 Dec 13, 2022
d5763a9
File: Fix 404 case with secret URLs
mia-0 Dec 13, 2022
77801ef
Fix URL test issue
mia-0 Dec 13, 2022
57c4b68
Prevent unreasonably long MIME types
mia-0 Dec 13, 2022
f76dbef
Fix NSFW detection
mia-0 Dec 17, 2022
dcea8bf
migrations: Fix file expirations on SQLite
mia-0 Dec 20, 2022
eebd5d8
Add moderation TUI
mia-0 Dec 20, 2022
455863c
Update requirements.txt
mia-0 Dec 20, 2022
8b04e08
ModUI: Add application/json to text handler
mia-0 Dec 20, 2022
556cd8a
README: Add ModUI screenshot
mia-0 Dec 20, 2022
53249df
README: Kitty support was merged in mpv
mia-0 Dec 21, 2022
0e4f020
ModUI: Fix jinja2 func call in ban action
mia-0 Dec 22, 2022
647e3a5
ModUI: Add application/xml to text handler
mia-0 Dec 22, 2022
e1e9995
ModUI: Fix crash when encountering null NSFW score
mia-0 Dec 29, 2022
3950f6e
fix 500 error when file extension could not be guessed
jonas-w Jan 15, 2023
e00866f
URL: Explicitly set upper-case table name
mia-0 Mar 29, 2023
3d1faca
Store user agent with files
mia-0 Mar 29, 2023
c189c47
ModUI: Allow LIKE matching for address filtering
mia-0 Mar 29, 2023
c2b5e95
ModUI: Handle opening filter panel with NULL user agent
mia-0 Mar 29, 2023
8a912e8
Fix remote URL content length check off-by-one
polina4096 Jun 4, 2023
322f32c
Create Dockerfile
sgcclh Jul 24, 2023
4db0978
Update Dockerfile
sgcclh Jul 24, 2023
9f25b1f
Create nginx.conf
sgcclh Jul 24, 2023
d2f692f
Rename Dockerfile to Dockerfile.dev
sgcclh Jul 24, 2023
df3d088
Create uwsgi.ini
sgcclh Jul 24, 2023
b8e80cb
Create entrypoint.sh
sgcclh Jul 24, 2023
4c407a6
Create config.py
sgcclh Jul 24, 2023
6318380
Create Dockerfile
sgcclh Jul 24, 2023
f6ed870
Create docker-image.yml
sgcclh Dec 12, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Docker Image CI

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

jobs:

build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Build the Docker image
run: docker build . --file Dockerfile --tag my-image-name:$(date +%s)
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
__pycache__/
.py[cod]
instance/
1 change: 1 addition & 0 deletions .mailmap
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Mia Herkt <[email protected]> <[email protected]>
22 changes: 22 additions & 0 deletions 0x0-prune.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[Unit]
Description=Prune 0x0 files
After=remote-fs.target

[Service]
Type=oneshot
User=nullptr
WorkingDirectory=/path/to/0x0
BindPaths=/path/to/0x0

Environment=FLASK_APP=fhost
ExecStart=/usr/bin/flask prune
ProtectProc=noaccess
ProtectSystem=strict
ProtectHome=tmpfs
PrivateTmp=true
PrivateUsers=true
ProtectKernelLogs=true
LockPersonality=true

[Install]
WantedBy=multi-user.target
9 changes: 9 additions & 0 deletions 0x0-prune.timer
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[Unit]
Description=Prune 0x0 files

[Timer]
OnCalendar=hourly
Persistent=true

[Install]
WantedBy=timers.target
22 changes: 22 additions & 0 deletions 0x0-vscan.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[Unit]
Description=Scan 0x0 files with ClamAV
After=remote-fs.target clamd.service

[Service]
Type=oneshot
User=nullptr
WorkingDirectory=/path/to/0x0
BindPaths=/path/to/0x0

Environment=FLASK_APP=fhost
ExecStart=/usr/bin/flask vscan
ProtectProc=noaccess
ProtectSystem=strict
ProtectHome=tmpfs
PrivateTmp=true
PrivateUsers=true
ProtectKernelLogs=true
LockPersonality=true

[Install]
WantedBy=multi-user.target
9 changes: 9 additions & 0 deletions 0x0-vscan.timer
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[Unit]
Description=Scan 0x0 files with ClamAV

[Timer]
OnCalendar=hourly
Persistent=true

[Install]
WantedBy=timers.target
37 changes: 37 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
FROM tiangolo/uwsgi-nginx:python3.11

LABEL maintainer="Sebastian Ramirez <[email protected]>"

# Install requirements
COPY requirements.txt /tmp/requirements.txt
RUN pip install --no-cache-dir -r /tmp/requirements.txt

# URL under which static (not modified by Python) files will be requested
# They will be served by Nginx directly, without being handled by uWSGI
ENV STATIC_URL /static
# Absolute path in where the static files wil be
ENV STATIC_PATH /app/static

# If STATIC_INDEX is 1, serve / with /static/index.html directly (or the static URL configured)
# ENV STATIC_INDEX 1
ENV STATIC_INDEX 0

# Add demo app
COPY . /app
WORKDIR /app

# Make /app/* available to be imported by Python globally to better support several use cases like Alembic migrations.
ENV PYTHONPATH=/app

# Move the base entrypoint to reuse it
RUN mv /entrypoint.sh /uwsgi-nginx-entrypoint.sh && mkdir -p mnt/up && FLASK_APP=fhost flask db upgrade
# Copy the entrypoint that will generate Nginx additional configs
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh

ENTRYPOINT ["/entrypoint.sh"]

# Run the start script provided by the parent image tiangolo/uwsgi-nginx.
# It will check for an /app/prestart.sh script (e.g. for migrations)
# And then will start Supervisor, which in turn will start Nginx and uWSGI
CMD ["/start.sh"]
8 changes: 8 additions & 0 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM python:latest
#RUN apt update -y && apt install python3 python3-pip sqlite3 libmagic-dev -y
#COPY . /data
RUN git clone https://github.com/mia-0/0x0.git app && cd app && pip3 install --no-cache-dir -r requirements.txt
WORKDIR /app
RUN cp instance/config.example.py instance/config.py && sed -i "s#/path/to#/app/mnt#;s#FHOST_USE_X_ACCEL_REDIRECT = True#FHOST_USE_X_ACCEL_REDIRECT = False#;s#USE_X_SENDFILE = False#USE_X_SENDFILE =True#" instance/config.py && touch app.db && FLASK_APP=fhost flask db upgrade
EXPOSE 5000
CMD ["flask","--app","fhost.py","run","-h","0.0.0.0"]
Loading