From 4a49bf30a3b583a095edacaf63c9dc9569d69820 Mon Sep 17 00:00:00 2001 From: "Alexander \"Arav\" Andreev" Date: Thu, 23 Feb 2023 18:16:06 +0400 Subject: [PATCH] Version up to 23.8.0. Changed arav.top to arav.su. Fixed templates. Deleted pre-compiled ones. --- LICENSE | 2 +- build/archlinux/PKGBUILD | 10 +++---- cmd/dwelling-upload-clean/main.go | 2 +- cmd/dwelling-upload/main.go | 2 +- configs/config.yaml | 2 +- configs/nginx.conf | 8 +++--- pkg/utils/dwelling.go | 2 +- web/error404.jade.mod.go | 28 -------------------- web/index.jade.mod.go | 43 ------------------------------- web/nospace.jade.mod.go | 29 --------------------- web/templates/base.jade | 2 +- web/templates/error404.jade | 2 +- web/templates/index.jade | 8 +++--- web/templates/nospace.jade | 2 +- web/templates/uploaded.jade | 2 +- web/uploaded.jade.mod.go | 33 ------------------------ 16 files changed, 22 insertions(+), 155 deletions(-) delete mode 100644 web/error404.jade.mod.go delete mode 100644 web/index.jade.mod.go delete mode 100644 web/nospace.jade.mod.go delete mode 100644 web/uploaded.jade.mod.go diff --git a/LICENSE b/LICENSE index 826701c..d59651b 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2022 Alexander "Arav" Andreev +Copyright (c) 2022,2023 Alexander "Arav" Andreev Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: diff --git a/build/archlinux/PKGBUILD b/build/archlinux/PKGBUILD index df862a8..2fec352 100644 --- a/build/archlinux/PKGBUILD +++ b/build/archlinux/PKGBUILD @@ -1,21 +1,21 @@ -# Maintainer: Alexander "Arav" Andreev +# Maintainer: Alexander "Arav" Andreev pkgname=dwelling-upload -pkgver=22.31.0 +pkgver=23.8.0 pkgrel=1 pkgdesc="Arav's Dwelling / Upload" arch=('i686' 'x86_64' 'arm' 'armv6h' 'armv7h' 'aarch64') -url="https://git.arav.top/Arav/dwelling-upload" +url="https://git.arav.su/Arav/dwelling-upload" license=('MIT') groups=() depends=() -makedepends=('git' 'go') +makedepends=('go') provides=('dwelling-upload') conflicts=('dwelling-upload') replaces=() backup=('etc/dwelling/upload.yaml') options=() install= -source=('dwelling-upload::git+https://git.arav.top/Arav/dwelling-upload.git') +source=('https://git.arav.top/Arav/dwelling-upload/archive/23.8.0.tar.gz') noextract=() md5sums=('SKIP') diff --git a/cmd/dwelling-upload-clean/main.go b/cmd/dwelling-upload-clean/main.go index 664a919..ae5bd07 100644 --- a/cmd/dwelling-upload-clean/main.go +++ b/cmd/dwelling-upload-clean/main.go @@ -21,7 +21,7 @@ func main() { flag.Parse() if *showVersion { - fmt.Println("dwelling-upload-clean Ver. 22.24.1\nCopyright (c) 2022 Alexander \"Arav\" Andreev ") + fmt.Println("dwelling-upload-clean Ver. 23.8.0\nCopyright (c) 2022,2023 Alexander \"Arav\" Andreev ") return } diff --git a/cmd/dwelling-upload/main.go b/cmd/dwelling-upload/main.go index abc0c1a..78688a6 100644 --- a/cmd/dwelling-upload/main.go +++ b/cmd/dwelling-upload/main.go @@ -23,7 +23,7 @@ func main() { flag.Parse() if *showVersion { - fmt.Println("dwelling-upload Ver. 22.26.0\nCopyright (c) 2022 Alexander \"Arav\" Andreev ") + fmt.Println("dwelling-upload Ver. 23.8.0\nCopyright (c) 2022,2023 Alexander \"Arav\" Andreev ") return } diff --git a/configs/config.yaml b/configs/config.yaml index b0ef90a..3fc6518 100644 --- a/configs/config.yaml +++ b/configs/config.yaml @@ -1,7 +1,7 @@ # Sets network type (could be tcp{,4,6}, unix) # and address:port or /path/to/unix.sock to # listen on. -listen_on: "unix /var/run/dwelling-upload/u.sock" +listen_on: "unix /var/run/dwelling-upload/sock" # Salt for hash of uploaded files. # Aim is to make links bruteforcing useless. hash_salt: "iyP3oZWHI3xO3XBF7s78Vg" diff --git a/configs/nginx.conf b/configs/nginx.conf index 4ade160..045dbf1 100644 --- a/configs/nginx.conf +++ b/configs/nginx.conf @@ -3,11 +3,11 @@ server { listen 8094; # Tor listen 127.0.0.1:8114; # I2P - server_name upload.arav.top upload.arav.i2p; + server_name upload.arav.su upload.arav.i2p; access_log /var/log/nginx/dwelling/upload.log main if=$nolog; - ssl_certificate /etc/letsencrypt/live/arav.top/fullchain.pem; - ssl_certificate_key /etc/letsencrypt/live/arav.top/privkey.pem; + ssl_certificate /etc/letsencrypt/live/arav.su/fullchain.pem; + ssl_certificate_key /etc/letsencrypt/live/arav.su/privkey.pem; add_header Content-Security-Policy "default-src 'self'; script-src 'none'; style-src 'self' 'unsafe-inline'; img-src 'self'; media-src 'self'; object-src 'none'; frame-src 'none'; frame-ancestors 'none'; font-src 'self'; form-action 'self'"; @@ -19,7 +19,7 @@ server { location / { - proxy_pass http://unix:/var/run/dwelling-upload/u.sock; + proxy_pass http://unix:/var/run/dwelling-upload/sock; proxy_buffering off; proxy_set_header Host $host; diff --git a/pkg/utils/dwelling.go b/pkg/utils/dwelling.go index 5897ee4..48fac2d 100644 --- a/pkg/utils/dwelling.go +++ b/pkg/utils/dwelling.go @@ -12,7 +12,7 @@ func MainSite(host string) string { return "http://[300:a98d:d6d0:8a08::f]" } - return "https://arav.top" + return "https://arav.su" } // NetworkType detects network based on host suffix, diff --git a/web/error404.jade.mod.go b/web/error404.jade.mod.go deleted file mode 100644 index 86cd246..0000000 --- a/web/error404.jade.mod.go +++ /dev/null @@ -1,28 +0,0 @@ -// Code generated by "jade.go"; DO NOT EDIT. - -package web - -import ( - "html" - "io" -) - -const ( - error404__0 = `Arav's dwelling / Upload
` -) - -func Error404(mainSite string, wr io.Writer) { - buffer := &WriterAsBuffer{wr} - - buffer.WriteString(error404__0) - buffer.WriteString(html.EscapeString(mainSite)) - buffer.WriteString(error404__1) -} diff --git a/web/index.jade.mod.go b/web/index.jade.mod.go deleted file mode 100644 index 867a20e..0000000 --- a/web/index.jade.mod.go +++ /dev/null @@ -1,43 +0,0 @@ -// Code generated by "jade.go"; DO NOT EDIT. - -package web - -import ( - "html" - "io" - "strconv" -) - -const ( - index__0 = `Arav's dwelling / Upload

Rules

  • Max. file size is ` - index__2 = `.
  • It will be kept for ` - index__3 = ` hours.
  • Anything you upload should comply with Russian Federation's law. Generally speaking, anything illegal, like CP, extremist literature etc., is forbidden.

Free space

` - index__4 = `` - index__7 = `
` - index__8 = `

Upload

You can use cURL to upload a file: curl -F 'file=@somefile.ext' https://upload.arav.top

Over I2P: curl --proxy 127.0.0.1:4444 -F 'file=@somefile.ext' http://upload.arav.i2p

A resulted link looks like this: /f/base64rawURL(sha256)/filename.ext.

filename.ext is mandatory. It is a name the file will be retrieved with.

Delete

You can delete a file using cURL: curl -XDELETE https://upload.arav.top/<hash>

Over I2P: curl --proxy 127.0.0.1:4444 -XDELETE http://upload.arav.i2p/<hash>

Privacy statements

I WILL cooperate with law enforcements and provide them with logs, guess I shouldn't clarify why. Abuses should be sent to admin@arav.top.

Upload logs include: access time, IP-address, name of a file it was uploaded with, a SHA-256 hash of the file, download name*, size of the file in bytes, User-Agent.

Each download and deletion are also being logged and include: access time, IP-address, name of a file it was requested with, download name*, User-Agent.

*Download name is a salted SHA-256 hash of the file encoded using base64 raw URL encoding. The hash is being salted to make useless any attempt of bruteforcing.

` -) - -func Index(mainSite string, storageCapacity, storageUsed int64, keepForHours int, fileMaxSize, storageUsedStr, storageCapacityStr, storageAvailableStr string, wr io.Writer) { - buffer := &WriterAsBuffer{wr} - - buffer.WriteString(index__0) - buffer.WriteString(html.EscapeString(mainSite)) - buffer.WriteString(index__1) - buffer.WriteString(html.EscapeString(fileMaxSize)) - buffer.WriteString(index__2) - buffer.WriteString(html.EscapeString(strconv.FormatInt(int64(keepForHours), 10))) - buffer.WriteString(index__3) - buffer.WriteString(html.EscapeString(storageUsedStr)) - buffer.WriteString(index__4) - buffer.WriteString(html.EscapeString(strconv.FormatInt(storageUsed, 10))) - buffer.WriteString(index__5) - buffer.WriteString(html.EscapeString(strconv.FormatInt(storageCapacity, 10))) - buffer.WriteString(index__6) - buffer.WriteString(html.EscapeString(storageCapacityStr)) - buffer.WriteString(index__7) - buffer.WriteString(html.EscapeString(storageAvailableStr)) - buffer.WriteString(index__8) -} diff --git a/web/nospace.jade.mod.go b/web/nospace.jade.mod.go deleted file mode 100644 index ef4ca70..0000000 --- a/web/nospace.jade.mod.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by "jade.go"; DO NOT EDIT. - -package web - -import ( - "html" - "io" -) - -const ( - nospace__0 = `Arav's dwelling / Upload
` -) - -func ErrorNoSpace(mainSite string, wr io.Writer) { - buffer := &WriterAsBuffer{wr} - - buffer.WriteString(nospace__0) - buffer.WriteString(html.EscapeString(mainSite)) - buffer.WriteString(nospace__1) - -} diff --git a/web/templates/base.jade b/web/templates/base.jade index fcd49a7..f897f28 100644 --- a/web/templates/base.jade +++ b/web/templates/base.jade @@ -20,4 +20,4 @@ html(lang="en") block header block body footer - | 2022 Arav <#[a(href="mailto:me@arav.top") me@arav.top]> \ No newline at end of file + | 2022,2023 Arav <#[a(href="mailto:me@arav.su") me@arav.su]> \ No newline at end of file diff --git a/web/templates/error404.jade b/web/templates/error404.jade index dab1c9b..d2d7272 100644 --- a/web/templates/error404.jade +++ b/web/templates/error404.jade @@ -1,6 +1,6 @@ :go:func Error404(mainSite string) -include base.jade +extends base.jade block append head style(type="text/css"). diff --git a/web/templates/index.jade b/web/templates/index.jade index d615b9f..7704da9 100644 --- a/web/templates/index.jade +++ b/web/templates/index.jade @@ -1,6 +1,6 @@ :go:func Index(mainSite string, storageCapacity, storageUsed int64, keepForHours int, fileMaxSize, storageUsedStr, storageCapacityStr, storageAvailableStr string) -include base.jade +extends base.jade block append header h1 Upload @@ -26,7 +26,7 @@ block body input(type="file" name="file" multiple=false) button(type="submit") Upload section.center - p You can use cURL to upload a file: #[code curl -F 'file=@somefile.ext' https://upload.arav.top] + p You can use cURL to upload a file: #[code curl -F 'file=@somefile.ext' https://upload.arav.su] p Over I2P: #[code curl --proxy 127.0.0.1:4444 -F 'file=@somefile.ext' http://upload.arav.i2p] p A resulted link looks like this: #[code /f/base64rawURL(sha256)/filename.ext]. p filename.ext is mandatory. It is a name the file will be retrieved with. @@ -36,11 +36,11 @@ block body input(type="text", name="hash" placeholder="File hash goes here" minlength="43" maxlength="43" size="43" required="") button(type="submit") Delete section.center - p You can delete a file using cURL: #[code curl -XDELETE https://upload.arav.top/<hash>] + p You can delete a file using cURL: #[code curl -XDELETE https://upload.arav.su/<hash>] p Over I2P: #[code curl --proxy 127.0.0.1:4444 -XDELETE http://upload.arav.i2p/<hash>] section h2 Privacy statements - p I WILL cooperate with law enforcements and provide them with logs, guess I shouldn't clarify why. Abuses should be sent to #[a(href="mailto:admin@arav.top") admin@arav.top]. + p I WILL cooperate with law enforcements and provide them with logs, guess I shouldn't clarify why. Abuses should be sent to #[a(href="mailto:admin@arav.su") admin@arav.su]. p Upload logs include: access time, IP-address, name of a file it was uploaded with, a SHA-256 hash of the file, download name*, size of the file in bytes, User-Agent. p Each download and deletion are also being logged and include: access time, IP-address, name of a file it was requested with, download name*, User-Agent. p *Download name is a salted SHA-256 hash of the file encoded using base64 raw URL encoding. The hash is being salted to make useless any attempt of bruteforcing. \ No newline at end of file diff --git a/web/templates/nospace.jade b/web/templates/nospace.jade index bb1e8b7..bf71071 100644 --- a/web/templates/nospace.jade +++ b/web/templates/nospace.jade @@ -1,6 +1,6 @@ :go:func ErrorNoSpace(mainSite string) -include base.jade +extends base.jade block append head style(type="text/css"). diff --git a/web/templates/uploaded.jade b/web/templates/uploaded.jade index 5acc8ca..f71d841 100644 --- a/web/templates/uploaded.jade +++ b/web/templates/uploaded.jade @@ -1,6 +1,6 @@ :go:func Uploaded(mainSite, site, downloadLink string, keepForHours int) -include base.jade +extends base.jade block append header h1 Upload diff --git a/web/uploaded.jade.mod.go b/web/uploaded.jade.mod.go deleted file mode 100644 index 21857cb..0000000 --- a/web/uploaded.jade.mod.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by "jade.go"; DO NOT EDIT. - -package web - -import ( - "html" - "io" - "strconv" -) - -const ( - uploaded__0 = `Arav's dwelling / Upload

Your link

` - uploaded__3 = `
It will be available for next ` - uploaded__4 = ` hours.
Back to index page
` -) - -func Uploaded(mainSite, site, downloadLink string, keepForHours int, wr io.Writer) { - buffer := &WriterAsBuffer{wr} - - buffer.WriteString(uploaded__0) - buffer.WriteString(html.EscapeString(mainSite)) - buffer.WriteString(uploaded__1) - buffer.WriteString(html.EscapeString(downloadLink)) - buffer.WriteString(uploaded__2) - buffer.WriteString(html.EscapeString(site)) - buffer.WriteString(html.EscapeString(downloadLink)) - buffer.WriteString(uploaded__3) - buffer.WriteString(html.EscapeString(strconv.FormatInt(int64(keepForHours), 10))) - buffer.WriteString(uploaded__4) - -}