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:
shinyoukai
2025-12-07 01:10:41 +00:00
parent 65ffd37fbe
commit 6cd6e9d610
11 changed files with 98 additions and 65 deletions

2
.gitignore vendored
View File

@@ -1,2 +0,0 @@
/marisa
/marisa-trash

View File

@@ -1,5 +1,5 @@
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
purpose with or without fee is hereby granted, provided that the above

View File

@@ -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

View File

@@ -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

View File

@@ -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))))

View File

@@ -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;
}

View File

@@ -1,45 +1,48 @@
<!DOCTYPE HTML PUBLIC "//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!DOCTYPE HTML>
<html>
<head>
<link rel="icon" href="/favicon.ico">
<link rel="stylesheet" href="/marisa.css">
<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">
<title>Marisa</title>
<title>Marisa (魔理沙)</title>
</head>
<body>
<table>
<thead>
<img class="logo" src="/marisa.png">
<br>
<h1>Marisa</h1>
</thead>
<tbody>
<form enctype="multipart/form-data" method="POST">
<input class="file" name="file" type="file"><br>
<input name="output" type="hidden" value="html"><br>
<input type="submit"><br>
<label for="expiry">Destroy after</label>
<select name="expiry">
<option value="900">15 minutes</option>
<option value="3600">1 hour</option>
<option value="28800">8 hours</option>
<option value="86400">1 day</option>
<option value="604800">1 week</option>
</select>
</form>
<p>
File size limited to {{.Maxsize}}.
</p>
</tbody>
<tfoot>
{{if .Links}}
<tr>
{{range .Links}}<td><a href="{{.}}">{{.}}</a></td>{{end}}
</tr>
{{end}}
</tfoot>
</table>
<div class="header">
<a href="/">
<img src="/marisa.png" alt="Marisa">
</a>
<h1>Marisa (魔理沙)</h1>
<p>Temporary file hoster</p>
</div>
<h2>Limits</h2>
<p>
Maximum file size is {{.Maxsize}}<br>
Uploads last up to 24 hours at least and 1 week at most
</p>
<h2>Notes</h2>
<p>
Some endpoints may require authentication in order to be used, in order to curb abuse. <br>
Ask the administrator in order to be allowed to upload
</p>
</ul>
<h2>Usage</h2>
<h3>DELETE</h3>
<pre>
$ curl -X DELETE https://up.laidback.moe/f/file-id
</pre>
<h3>POST</h3>
<pre>
$ curl -F file=@file [-F expiry=time in seconds ] https://up.laidback.moe
</pre>
<h3>PUT</h3>
<pre>
$ curl -T file https://up.laidback.moe/f/file
</pre>
<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>
</html>

4
go.mod
View File

@@ -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

12
go.sum
View File

@@ -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=

View File

@@ -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

View File

@@ -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