M i m a s a m a ! ! !

Signed-off-by: Izuru Yakumo <yakumo.izuru@chaotic.ninja>

git-svn-id: file:///srv/svn/repo/marisa/trunk@65 d6811dac-2434-b64a-9ddc-f563ab233461
This commit is contained in:
yakumo.izuru 2023-09-18 21:19:59 +00:00
parent 7804c965c3
commit e0ddceb7b4
20 changed files with 227 additions and 207 deletions

14
COPYING Normal file
View File

@ -0,0 +1,14 @@
Copyright (c) 2021 Willy Goiffon <contact@z3bra.org>
Copyright (c) 2023-present Izuru Yakumo <postmaster@chaotic.ninja>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.

13
LICENSE
View File

@ -1,13 +0,0 @@
Copyright (c) 2021 Willy Goiffon <contact@z3bra.org>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.

1
LICENSE Symbolic link
View File

@ -0,0 +1 @@
COPYING

25
Makefile Normal file
View File

@ -0,0 +1,25 @@
GO ?= go
GOFLAGS ?= -v -ldflags "-w -X `go list`.Version=${VERSION} -X `go list`.Commit=${COMMIT} -X `go list`.Build=${BUILD}"
CGO ?= 0
VERSION = `git describe --abbrev=0 --tags 2>/dev/null || echo "$VERSION"`
COMMIT = `git rev-parse --short HEAD || echo "$COMMIT"`
BRANCH = `git rev-parse --abbrev-ref HEAD`
BUILD = `git show -s --pretty=format:%cI`
PREFIX ?= /usr/local
all: marisa marisa-trash
marisa:
CGO_ENABLED=${CGO} go build ${GOFLAGS} ./cmd/marisa
marisa-trash:
CGO_ENABLED=${CGO} go build ${GOFLAGS} ./cmd/marisa-trash
clean:
rm -f marisa marisa-trash
install:
install -Dm0755 marisa ${PREFIX}/bin/marisa
install -Dm0755 marisa-trash ${PREFIX}/bin/marisa-trash
install -Dm0644 marisa.1 ${PREFIX}/share/man/man1/marisa.1
install -Dm0644 marisa.conf.5 ${PREFIX}/share/man/man5/marisa.conf.5
.PHONY: marisa marisa-trash

View File

@ -1,9 +1,7 @@
partage
=======
marisa
======
HTTP based File upload system.
![screenshot](https://z3bra.org/partage/screenshot.png)
Features
--------
+ Link expiration
@ -17,11 +15,11 @@ Features
Usage
-----
Refer to the partage(1) manual page for details and examples.
Refer to the marisa(1) manual page for details and examples.
partage [-v] [-f partage.conf]
marisa [-v] [-f marisa.conf]
Configuration is done through its configuration file, partage.conf(5).
Configuration is done through its configuration file, marisa.conf(5).
The format is that of the INI file format.
Uploading files is done via PUT and POST requests. Multiple files can
@ -34,5 +32,5 @@ Installation
------------
Edit the `config.mk` file to match your setup, then run the following:
$ mk
# mk install
$ (b)make
# (b)make install

View File

@ -22,6 +22,7 @@ import (
"github.com/dustin/go-humanize"
"gopkg.in/ini.v1"
"marisa.chaotic.ninja/marisa"
)
type templatedata struct {
@ -329,7 +330,7 @@ func main() {
var listener net.Listener
/* default values */
conf.listen = "0.0.0.0:8080"
conf.listen = "127.0.0.1:8080"
conf.baseuri = "http://127.0.0.1:8080"
conf.rootdir = "static"
conf.tmplpath = "templates"
@ -408,6 +409,7 @@ func main() {
http.Handle(conf.filectx, http.StripPrefix(conf.filectx, http.FileServer(http.Dir(conf.filepath))))
if verbose {
log.Printf("Starting marisa %v\n", marisa.FullVersion())
log.Printf("Listening on %s", conf.listen)
}

View File

@ -1,6 +1,6 @@
# TCP or unix Socket to listen on.
# When unix sockets are used, the content will be served over FastCGI.
#listen = /var/run/partage-fcgi.sock
#listen = /var/run/marisa-fcgi.sock
listen = 127.0.0.1:9000
# Base to use when constructing URI to files uploaded.
@ -20,10 +20,10 @@ baseuri = http://127.0.0.1:9000
# Path to the different path used by the server. Must take into account
# the chroot if set.
rootdir = example/static
tmplpath = example/templates
filepath = example/files
metapath = example/meta
rootdir = static
tmplpath = templates
filepath = files
metapath = meta
# URI context that files will be served on
filectx = /f/

Binary file not shown.

Before

Width:  |  Height:  |  Size: 141 KiB

BIN
example/static/marisa.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 265 KiB

View File

@ -0,0 +1,90 @@
body {
padding: 5%;
margin: auto;
max-width: 540px;
font-family: sans-serif;
font-size: 1.5rem;
text-align: center;
background-color: #550000;
color: #ff4444;
}
header {
display: flex;
flex-direction: column;
flex-wrap: wrap-reverse;
align-items: center;
align-content: center;
}
section {
display: flex;
justify-content: flex-end;
font-size: initial;
}
section#formsettings > * {
margin-top: 20px;
margin-left: 20px;
}
img#logo {
height: 100%;
max-height: 30vh;
}
h1 {
font-size: 4.0rem;
}
#uploads {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
#uploads > ul {
list-style: none;
text-align: left;
padding: 0;
}
#uploads > button {
align-self: flex-end;
margin-right: 10%;
}
.dropzone {
padding-top: 60px;
padding-bottom: 60px;
border: 2px dashed #888888;
border-radius: 8px;
text-align: center;
margin: auto;
color: #888888;
}
.dropzone.dragover {
color: #222222;
border-color: #222222;
}
/* font attributes are not inherited by default */
input, input::file-selector-button {
text-align: inherit;
font-family: inherit;
font-size: inherit;
}
@media (min-aspect-ratio: 18/9) {
header {
flex-direction: row;
}
h1 { font-size: 3rem; margin-right: 10px; }
img#logo {
height: 50%;
max-height: 20vh;
order: 2;
}
}

View File

@ -1,106 +0,0 @@
body {
padding: 5%;
margin: auto;
max-width: 540px;
font-family: serif;
font-size: 1.5rem;
text-align: center;
background-color: #eeeeee;
color: #222222;
}
header {
display: flex;
flex-direction: column;
flex-wrap: wrap-reverse;
align-items: center;
align-content: center;
}
section {
display: flex;
justify-content: flex-end;
font-size: initial;
}
section#formsettings > * {
margin-top: 20px;
margin-left: 20px;
}
img#logo {
height: 100%;
max-height: 30vh;
}
h1 {
font-size: 4.0rem;
}
#uploads {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
#uploads > ul {
list-style: none;
text-align: left;
padding: 0;
}
#uploads > button {
align-self: flex-end;
margin-right: 10%;
}
.dropzone {
padding-top: 60px;
padding-bottom: 60px;
border: 2px dashed #888888;
border-radius: 8px;
text-align: center;
margin: auto;
color: #888888;
}
.dropzone.dragover {
color: #222222;
border-color: #222222;
}
/* font attributes are not inherited by default */
input, input::file-selector-button {
text-align: inherit;
font-family: inherit;
font-size: inherit;
}
@media (min-aspect-ratio: 18/9) {
header {
flex-direction: row;
}
h1 { font-size: 3rem; margin-right: 10px; }
img#logo {
height: 50%;
max-height: 20vh;
order: 2;
}
}
@media (prefers-color-scheme: light) {
a { color: black; }
body {
color: #222222;
background-color: #eeeeee;
}
}
@media (prefers-color-scheme: dark) {
a { color: white; }
body {
color: #eeeeee;
background-color: #222222;
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

View File

@ -1,25 +1,25 @@
<!DOCTYPE HTML>
<html>
<head>
<head>
<meta charset="utf-8">
<meta name="author" content="z3bra">
<meta name="robots" content="noindex,nofollow" />
<meta name="author" content="z3bra, Izuru Yakumo">
<meta name="robots" content="noindex,nofollow" >
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" type="text/css" href="/partage.css" />
<link rel="icon" type="image/ico" href="/favicon.ico" />
<title>Partage</title>
</head>
<body>
<link rel="stylesheet" type="text/css" href="/marisa_98.css" >
<link rel="icon" href="/marisa.png">
<title>Marisa</title>
</head>
<body>
<header>
<img id="logo" src="/partage.png" />
<h1>partage</h1>
<img id="logo" src="/marisa.png" >
<h1>marisa</h1>
</header>
<form enctype="multipart/form-data" method="post">
<div id="dropzone"></div>
<div id="fallbackform" class="dropzone">
<input id="filebox" name="file" type="file" multiple/>
<input id="output" name="output" type="hidden" value='html' />
<input type="submit" value="Upload"/>
<input id="filebox" name="file" type="file" multiple>
<input id="output" name="output" type="hidden" value='html' >
<input type="submit" value="Upload">
</div>
<section id="formsettings">
<label for="expiry"> Destroy after </label>
@ -38,5 +38,5 @@
{{range .Links}}<li><a href="{{.}}">{{.}}</a></li>{{end}}
</ul>
{{end}}</div>
</body>
</body>
</html>

9
go.mod
View File

@ -1,9 +1,10 @@
module git.z3bra.org/partage
module marisa.chaotic.ninja/marisa
go 1.17
require (
github.com/dustin/go-humanize v1.0.0 // indirect
github.com/vharitonsky/iniflags v0.0.0-20180513140207-a33cd0b5f3de // indirect
gopkg.in/ini.v1 v1.63.2 // indirect
github.com/dustin/go-humanize v1.0.0
gopkg.in/ini.v1 v1.63.2
)
require github.com/stretchr/testify v1.8.4 // indirect

20
go.sum Normal file
View File

@ -0,0 +1,20 @@
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=
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

30
mkfile
View File

@ -1,30 +0,0 @@
<config.mk
all:V: partage partage-trash/partage-trash
%: %.go
$GO build -o $stem $stem.go
clean:V:
rm -f partage partage-trash/partage-trash
install:V: partage partage-trash/partage-trash
mkdir -p ${DESTDIR}${PREFIX}/bin
cp partage ${DESTDIR}${PREFIX}/bin/partage
cp partage-trash/partage-trash ${DESTDIR}${PREFIX}/bin/partage-trash
chmod 755 ${DESTDIR}${PREFIX}/bin/partage
chmod 755 ${DESTDIR}${PREFIX}/bin/partage-trash
mkdir -p ${DESTDIR}${MANDIR}/man1
cp partage.1 ${DESTDIR}${MANDIR}/man1/partage.1
cp partage-trash/partage-trash.1 ${DESTDIR}${MANDIR}/man1/partage-trash.1
cp partage.conf.5 ${DESTDIR}${MANDIR}/man5/partage.conf.5
chmod 644 ${DESTDIR}${MANDIR}/man1/partage.1
chmod 644 ${DESTDIR}${MANDIR}/man1/partage-trash.1
chmod 644 ${DESTDIR}${MANDIR}/man5/partage.conf.5
uninstall:V:
rm ${DESTDIR}${PREFIX}/bin/partage
rm ${DESTDIR}${PREFIX}/bin/partage-trash
rm ${DESTDIR}${MANDIR}/man1/partage.1
rm ${DESTDIR}${MANDIR}/man1/partage-trash.1
rm ${DESTDIR}${MANDIR}/man5/partage.conf.5

18
version.go Normal file
View File

@ -0,0 +1,18 @@
package marisa
import (
"fmt"
)
var (
// Version release version
Version = "0.0.1"
// Commit will be overwritten automatically by the build system
Commit = "HEAD"
)
// FullVersion display the full version and build
func FullVersion() string {
return fmt.Sprintf("%s@%s", Version, Commit)
}