diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 97a6b1f..0000000 --- a/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/marisa -/marisa-trash diff --git a/COPYING b/COPYING index 73958ac..100b163 100644 --- a/COPYING +++ b/COPYING @@ -1,5 +1,5 @@ Copyright (c) 2021 Willy Goiffon -Copyright (c) 2023-present Izuru Yakumo +Copyright (c) 2023-present Shin'ya Minazuki Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above diff --git a/Makefile b/Makefile index 6e58b82..216647b 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ GO ?= go GOFLAGS ?= -v -ldflags "-w -X `${GO} list`.Version=${VERSION}" CGO ?= 0 -VERSION = 2024.02.10 +VERSION = 2025.12.07 PREFIX ?= /usr/local all: marisa marisa-trash diff --git a/README.md b/README.md index e487c7d..a473dc6 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ be sent via POST requests. Installation ------------ -Edit the `config.mk` file to match your setup, then run the following: +Run the following commands, you will need the [Go](https://go.dev) compiler $ (b)make # (b)make install diff --git a/cmd/marisa/main.go b/cmd/marisa/main.go index 5d82b88..d597aac 100644 --- a/cmd/marisa/main.go +++ b/cmd/marisa/main.go @@ -123,6 +123,14 @@ func main() { syscall.Setgid(gid) } + if err := os.MkdirAll(conf.filepath, 0755); err != nil { + log.Fatal(err) + } + + if err := os.MkdirAll(conf.metapath, 0755); err != nil { + log.Fatal(err) + } + http.HandleFunc("/", uploader) http.Handle(conf.filectx, http.StripPrefix(conf.filectx, http.FileServer(http.Dir(conf.filepath)))) diff --git a/example/static/marisa.css b/example/static/marisa.css index ed5156d..ae45cf2 100644 --- a/example/static/marisa.css +++ b/example/static/marisa.css @@ -1,15 +1,47 @@ +html { + font-family: monospace; +} body { - background-color: #282c37; - color: #f8f8f2; - font-family: sans-serif; - text-align: center; + background-color: white; + color: black; } a { - color: #272822; + color: red; } -a:hover, a:link { - color: #e6db74; +a:hover, a:visited { + color: orange:; +} +pre { + border: 2px solid red; + padding-top: 7px; +} +.header { + text-align: center; + border-bottom: 2px solid red; +} +.footer { + border-top: 2px solid red; + text-align: center; +} + +@media(prefer-color-scheme: dark) { + body { + background-color: black; + color: white; + } + a { + color: white; + } + a:hover, a:visited { + color: silver; + } + pre { + border: 2px solid silver; + } + .header { + border-bottom: 2px solid silver; + } + .footer { + border-top: 2px solid silver; + } } -a:visited { - color: #66d9ef; - } diff --git a/example/templates/index.html b/example/templates/index.html index 2444493..fb7ec10 100644 --- a/example/templates/index.html +++ b/example/templates/index.html @@ -1,45 +1,48 @@ - + - + - Marisa + Marisa (魔理沙) - - - -
-

Marisa

- - - -
-
-
- - - -

- File size limited to {{.Maxsize}}. -

- - - {{if .Links}} - - {{range .Links}}{{end}} - - {{end}} - -
{{.}}
+
+ + Marisa + +

Marisa (魔理沙)

+

Temporary file hoster

+
+

Limits

+

+ Maximum file size is {{.Maxsize}}
+ Uploads last up to 24 hours at least and 1 week at most +

+

Notes

+

+ Some endpoints may require authentication in order to be used, in order to curb abuse.
+ Ask the administrator in order to be allowed to upload +

+ +

Usage

+

DELETE

+
+      $ curl -X DELETE https://up.laidback.moe/f/file-id
+    
+

POST

+
+      $ curl -F file=@file [-F expiry=time in seconds ]  https://up.laidback.moe
+    
+

PUT

+
+      $ curl -T file https://up.laidback.moe/f/file
+    
+ diff --git a/go.mod b/go.mod index e0f5ea0..dcae51e 100644 --- a/go.mod +++ b/go.mod @@ -1,10 +1,10 @@ module mahou-no-mori.yakumo.dev/marisa -go 1.17 +go 1.24.0 require ( github.com/dustin/go-humanize v1.0.0 gopkg.in/ini.v1 v1.63.2 ) -require github.com/stretchr/testify v1.8.4 // indirect +require github.com/stretchr/testify v1.11.1 // indirect diff --git a/go.sum b/go.sum index 56d5331..304c118 100644 --- a/go.sum +++ b/go.sum @@ -1,20 +1,12 @@ -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= +github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= gopkg.in/ini.v1 v1.63.2 h1:tGK/CyBg7SMzb60vP1M03vNZ3VDu3wGQJwn7Sxi9r3c= gopkg.in/ini.v1 v1.63.2/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/marisa-trash.1 b/marisa-trash.1 index 3b35c73..0030b32 100644 --- a/marisa-trash.1 +++ b/marisa-trash.1 @@ -41,4 +41,4 @@ Lookup metadata files in directory .An Willy Goiffon Aq Mt dev@z3bra.org .Pp "Borrowed" by -.An Izuru Yakumo Aq Mt eternal-servant@yakumo.dev +.An Shin'ya Minazuki Aq Mt shinyoukai@laidback.moe diff --git a/marisa.1 b/marisa.1 index f7f6efe..c5e1667 100644 --- a/marisa.1 +++ b/marisa.1 @@ -33,11 +33,11 @@ Load configuration from .An Willy Goiffon Aq Mt dev@z3bra.org .Pp "Borrowed" by -.An Izuru Yakumo Aq Mt eternal-servant@yakumo.dev +.An Shin'ya Minazuki Aq Mt shinyoukai@laidback.moe .Sh BUGS If you upload a file through the browser, and refresh the page, the file will get constantly reuploaded, which may exhaust the server's storage at some point. .Pp -This shouldn't happen with a CLI, such as +This doesn't happen with a CLI, such as .Xr curl 1