HERE WE G- *camera breaks against face*
git-svn-id: file:///srv/svn/repo/marisa/trunk@70 d6811dac-2434-b64a-9ddc-f563ab233461
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,2 +0,0 @@
|
|||||||
/marisa
|
|
||||||
/marisa-trash
|
|
||||||
2
COPYING
2
COPYING
@@ -1,5 +1,5 @@
|
|||||||
Copyright (c) 2021 Willy Goiffon <contact@z3bra.org>
|
Copyright (c) 2021 Willy Goiffon <contact@z3bra.org>
|
||||||
Copyright (c) 2023-present Izuru Yakumo <eternal-servant@yakumo.dev>
|
Copyright (c) 2023-present Shin'ya Minazuki <shinyoukai@laidback.moe>
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software for any
|
Permission to use, copy, modify, and/or distribute this software for any
|
||||||
purpose with or without fee is hereby granted, provided that the above
|
purpose with or without fee is hereby granted, provided that the above
|
||||||
|
|||||||
2
Makefile
2
Makefile
@@ -2,7 +2,7 @@ GO ?= go
|
|||||||
GOFLAGS ?= -v -ldflags "-w -X `${GO} list`.Version=${VERSION}"
|
GOFLAGS ?= -v -ldflags "-w -X `${GO} list`.Version=${VERSION}"
|
||||||
CGO ?= 0
|
CGO ?= 0
|
||||||
|
|
||||||
VERSION = 2024.02.10
|
VERSION = 2025.12.07
|
||||||
PREFIX ?= /usr/local
|
PREFIX ?= /usr/local
|
||||||
|
|
||||||
all: marisa marisa-trash
|
all: marisa marisa-trash
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ be sent via POST requests.
|
|||||||
|
|
||||||
Installation
|
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
|
||||||
# (b)make install
|
# (b)make install
|
||||||
|
|||||||
@@ -123,6 +123,14 @@ func main() {
|
|||||||
syscall.Setgid(gid)
|
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.HandleFunc("/", uploader)
|
||||||
http.Handle(conf.filectx, http.StripPrefix(conf.filectx, http.FileServer(http.Dir(conf.filepath))))
|
http.Handle(conf.filectx, http.StripPrefix(conf.filectx, http.FileServer(http.Dir(conf.filepath))))
|
||||||
|
|
||||||
|
|||||||
@@ -1,15 +1,47 @@
|
|||||||
|
html {
|
||||||
|
font-family: monospace;
|
||||||
|
}
|
||||||
body {
|
body {
|
||||||
background-color: #282c37;
|
background-color: white;
|
||||||
color: #f8f8f2;
|
color: black;
|
||||||
font-family: sans-serif;
|
|
||||||
text-align: center;
|
|
||||||
}
|
}
|
||||||
a {
|
a {
|
||||||
color: #272822;
|
color: red;
|
||||||
}
|
}
|
||||||
a:hover, a:link {
|
a:hover, a:visited {
|
||||||
color: #e6db74;
|
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;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,45 +1,48 @@
|
|||||||
<!DOCTYPE HTML PUBLIC "//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
<!DOCTYPE HTML>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<link rel="icon" href="/favicon.ico">
|
<link rel="icon" href="/favicon.ico">
|
||||||
<link rel="stylesheet" href="/marisa.css">
|
<link rel="stylesheet" href="/marisa.css">
|
||||||
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
|
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
|
||||||
<meta name="author" content="Izuru Yakumo">
|
<meta name="author" content="Shin'ya Minazuki">
|
||||||
<meta name="viewport" content="width=device-width">
|
<meta name="viewport" content="width=device-width">
|
||||||
<title>Marisa</title>
|
<title>Marisa (魔理沙)</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<table>
|
<div class="header">
|
||||||
<thead>
|
<a href="/">
|
||||||
<img class="logo" src="/marisa.png">
|
<img src="/marisa.png" alt="Marisa">
|
||||||
<br>
|
</a>
|
||||||
<h1>Marisa</h1>
|
<h1>Marisa (魔理沙)</h1>
|
||||||
</thead>
|
<p>Temporary file hoster</p>
|
||||||
<tbody>
|
</div>
|
||||||
<form enctype="multipart/form-data" method="POST">
|
<h2>Limits</h2>
|
||||||
<input class="file" name="file" type="file"><br>
|
<p>
|
||||||
<input name="output" type="hidden" value="html"><br>
|
Maximum file size is {{.Maxsize}}<br>
|
||||||
<input type="submit"><br>
|
Uploads last up to 24 hours at least and 1 week at most
|
||||||
<label for="expiry">Destroy after</label>
|
</p>
|
||||||
<select name="expiry">
|
<h2>Notes</h2>
|
||||||
<option value="900">15 minutes</option>
|
<p>
|
||||||
<option value="3600">1 hour</option>
|
Some endpoints may require authentication in order to be used, in order to curb abuse. <br>
|
||||||
<option value="28800">8 hours</option>
|
Ask the administrator in order to be allowed to upload
|
||||||
<option value="86400">1 day</option>
|
</p>
|
||||||
<option value="604800">1 week</option>
|
</ul>
|
||||||
</select>
|
<h2>Usage</h2>
|
||||||
</form>
|
<h3>DELETE</h3>
|
||||||
<p>
|
<pre>
|
||||||
File size limited to {{.Maxsize}}.
|
$ curl -X DELETE https://up.laidback.moe/f/file-id
|
||||||
</p>
|
</pre>
|
||||||
</tbody>
|
<h3>POST</h3>
|
||||||
<tfoot>
|
<pre>
|
||||||
{{if .Links}}
|
$ curl -F file=@file [-F expiry=time in seconds ] https://up.laidback.moe
|
||||||
<tr>
|
</pre>
|
||||||
{{range .Links}}<td><a href="{{.}}">{{.}}</a></td>{{end}}
|
<h3>PUT</h3>
|
||||||
</tr>
|
<pre>
|
||||||
{{end}}
|
$ curl -T file https://up.laidback.moe/f/file
|
||||||
</tfoot>
|
</pre>
|
||||||
</table>
|
<div class="footer">
|
||||||
|
<p>Source code available on <a href="https://svn.laidback.moe/repo/marisa">Subversion</a></p>
|
||||||
|
<p>This is a <a href="https://projects.laidback.moe">Suzunaan</a> project</p>
|
||||||
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
4
go.mod
4
go.mod
@@ -1,10 +1,10 @@
|
|||||||
module mahou-no-mori.yakumo.dev/marisa
|
module mahou-no-mori.yakumo.dev/marisa
|
||||||
|
|
||||||
go 1.17
|
go 1.24.0
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/dustin/go-humanize v1.0.0
|
github.com/dustin/go-humanize v1.0.0
|
||||||
gopkg.in/ini.v1 v1.63.2
|
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
|
||||||
|
|||||||
12
go.sum
12
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 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
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 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo=
|
||||||
github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
|
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 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
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/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
|
||||||
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
|
||||||
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=
|
|
||||||
gopkg.in/ini.v1 v1.63.2 h1:tGK/CyBg7SMzb60vP1M03vNZ3VDu3wGQJwn7Sxi9r3c=
|
gopkg.in/ini.v1 v1.63.2 h1:tGK/CyBg7SMzb60vP1M03vNZ3VDu3wGQJwn7Sxi9r3c=
|
||||||
gopkg.in/ini.v1 v1.63.2/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
|
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 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
|
|||||||
@@ -41,4 +41,4 @@ Lookup metadata files in directory
|
|||||||
.An Willy Goiffon Aq Mt dev@z3bra.org
|
.An Willy Goiffon Aq Mt dev@z3bra.org
|
||||||
.Pp
|
.Pp
|
||||||
"Borrowed" by
|
"Borrowed" by
|
||||||
.An Izuru Yakumo Aq Mt eternal-servant@yakumo.dev
|
.An Shin'ya Minazuki Aq Mt shinyoukai@laidback.moe
|
||||||
|
|||||||
4
marisa.1
4
marisa.1
@@ -33,11 +33,11 @@ Load configuration from
|
|||||||
.An Willy Goiffon Aq Mt dev@z3bra.org
|
.An Willy Goiffon Aq Mt dev@z3bra.org
|
||||||
.Pp
|
.Pp
|
||||||
"Borrowed" by
|
"Borrowed" by
|
||||||
.An Izuru Yakumo Aq Mt eternal-servant@yakumo.dev
|
.An Shin'ya Minazuki Aq Mt shinyoukai@laidback.moe
|
||||||
.Sh BUGS
|
.Sh BUGS
|
||||||
If you upload a file through the browser, and refresh the
|
If you upload a file through the browser, and refresh the
|
||||||
page, the file will get constantly reuploaded, which may
|
page, the file will get constantly reuploaded, which may
|
||||||
exhaust the server's storage at some point.
|
exhaust the server's storage at some point.
|
||||||
.Pp
|
.Pp
|
||||||
This shouldn't happen with a CLI, such as
|
This doesn't happen with a CLI, such as
|
||||||
.Xr curl 1
|
.Xr curl 1
|
||||||
|
|||||||
Reference in New Issue
Block a user