From a9c95145e8b3d9a46a4597e4c4c5d4ac77ad18db Mon Sep 17 00:00:00 2001 From: Emil Williams Date: Sun, 6 Jul 2025 18:36:26 +0000 Subject: nginx, in deployment --- Makefile | 9 ------ README.md | 64 +++++------------------------------------ TODO.md | 4 --- crontab | 1 + example_frontend.html | 12 -------- example_frontend.lighttpd.conf | 6 ---- index.html | 43 +++++++++++++++++++++++++++ lighttpd.conf | 28 ------------------ out/.gitkeep | 0 test/evil.tcl | 6 ---- test/test.png | Bin 310382 -> 0 bytes test/test.txt | 1 - test/upload-test.sh | 2 -- up.chud.cyou | 45 +++++++++++++++++++++++++++++ upchud.tcl | 8 ++++-- 15 files changed, 102 insertions(+), 127 deletions(-) delete mode 100644 Makefile delete mode 100644 TODO.md create mode 100644 crontab delete mode 100644 example_frontend.html delete mode 100644 example_frontend.lighttpd.conf create mode 100644 index.html delete mode 100644 lighttpd.conf create mode 100644 out/.gitkeep delete mode 100755 test/evil.tcl delete mode 100644 test/test.png delete mode 100644 test/test.txt delete mode 100755 test/upload-test.sh create mode 100644 up.chud.cyou diff --git a/Makefile b/Makefile deleted file mode 100644 index b91412e..0000000 --- a/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -serve: - lighttpd -D -f lighttpd.conf - -front: - lighttpd -D -f example_frontend.lighttpd.conf - -clean: - -${RM} -frfr out/ - -${RM} errors.log diff --git a/README.md b/README.md index 073732e..f30fac6 100644 --- a/README.md +++ b/README.md @@ -1,61 +1,11 @@ -# Upchud -> File upload service; without stage 4 retardation. +Sane deployment of [anon's upchud](https://git.xolatile.top/anon/upchud) for nginx. -### Shilling points 🚀: -* Minimal dependencies -* CLI friendly -* Web friendly -* Optional random upload name mangling -* Easy to configure -* Small codebase -* Traubisoda +Things that need to change for deployment are the up.chud.cyou nginx file and crontab. -### Depedencies -* Lighttpd -* Tcl (base installation) - -### Files -| File | Description | -| :------------ | :---------- | -| lighttpd.conf | Master lighttpd configuration. Tip: set max upload size here. | -| upchud.tcl | Master CGI Tcl script. Tip: simply forked by lighttpd; set finer configurations here. | -| Makefile | Short-hands for common operations. | -| test/* | Scripts and files used during development. | -| example\_frontend.html | Simple web front-end for the service. | -| example\_frontend.lighttpd.conf | Serves the example front-end. Tip: you could merge this with the master configuration if you wanted one service. | - -### Usage -Lets get hello-world out-of the way: -```sh -$ make serve & -[1] 15225 -lighttpd -D -f lighttpd.conf -$ curl http://localhost:8080 --upload-file test/test.txt -http://localhost:8080/out//n6cru4.txt -$ curl http://localhost:8080/out//n6cru4.txt -Hello World -``` - -Alternatively I could run. -```sh -$ make serve & -[1] 23895 -lighttpd -D -f lighttpd.conf -$ make front & -[2] 24105 -lighttpd -D -f example_frontend.lighttpd.conf +The nginx & crontab files expect: +```tcl +set outdir "out/" +set keep_outdir 0 ``` -And I could use the web page (localhost:8081 by default) to perform the same task. - -The example frontend is perfectly functional, but is meant to be modified. -Alternatively, you could copy and embed it anywhere else on your site at large. - -To learn more about configuration, read the top of `upchud.tcl` and checkout `lighttpd.conf` -### Why? -Because every implementation of this extremely simple thing is flawed. -Common faults I witnessed are: -* CLI is second class with sloppy wrapper scripts and or HTML responses -* No web support, preventing phoneposting -* Horrifically convoluted configuration due to poor isolation of responsibilities -* 6 gorillion dependencies +keep_outdir is a patched in feature. diff --git a/TODO.md b/TODO.md deleted file mode 100644 index 9ae4aff..0000000 --- a/TODO.md +++ /dev/null @@ -1,4 +0,0 @@ -* include some tmp file cleaner scripts or atleast leave recommendations -* by spoofing the request, it might be currently possible to upload files -to a parent dictionary; this should be tested and fixed, but should be fine -as long as the person running the service doesnt run it as root diff --git a/crontab b/crontab new file mode 100644 index 0000000..7666084 --- /dev/null +++ b/crontab @@ -0,0 +1 @@ +@monthly find /var/www/up.chud.cyou/out/ -type f -mtime +28 -exec rm {} \; diff --git a/example_frontend.html b/example_frontend.html deleted file mode 100644 index 137594e..0000000 --- a/example_frontend.html +++ /dev/null @@ -1,12 +0,0 @@ -
You may upload files using the above form or the following command:
++ curl --upload-file 'file' https://up.chud.cyou/ ++
+ Files are wiped monthly and may not be larger than 100 mebibytes. +
++ Upchud is a FOSS file uploader service, originally developed for + up.chud.cyou +
+
+ Original source:
+ git.xolatile.top/anon/upchud
+
+ This deployment's source:
+ git.xolatile.top/emil/up.chud.cyou
+