Compare commits

..

104 Commits

Author SHA1 Message Date
0ad9d4ead6
Bump v0.5.9
All checks were successful
continuous-integration/drone/push Build is passing
2023-09-09 22:05:57 +02:00
dece
faf0b2e62c
Make the layout more responsive 2023-09-09 22:05:57 +02:00
dece
5b1d9ad6c6
Add meta viewport tag for responsiveness 2023-09-09 22:05:56 +02:00
dece
c76d2d2204
Use shorter meta tag for charset
More info:
https://stackoverflow.com/questions/4696499/meta-charset-utf-8-vs-meta-http-equiv-content-type
2023-09-09 22:05:56 +02:00
dece
8f1e2c6309
Fix Alpine package for PCRE
This is the right one unless I'm mistaken.
2023-09-09 22:05:56 +02:00
c0ec14c8b8
Update README
All checks were successful
continuous-integration/drone/push Build is passing
2023-08-17 08:56:06 +02:00
464bd352a0
Dumb new version 2023-04-13 22:14:21 +02:00
5b255b7344
Update crystal version compatibility 2023-04-13 22:14:13 +02:00
d9e416f47f
Add custom title and bottom banner 2023-04-13 22:12:23 +02:00
91cd3746ad
Update doc to add systemd service sample 2023-04-13 22:11:59 +02:00
1faa3a29c3
Improve file dropzone
All checks were successful
continuous-integration/drone/push Build is passing
2022-11-23 23:56:05 +01:00
58d8b3e629
Update readm with crystal compatiblity
All checks were successful
continuous-integration/drone/push Build is passing
2022-11-23 21:29:33 +01:00
dece
b6365a5dfb
Separate Docker build stage to reduce image size
References to the default port (EXPOSE) have been removed as the
generated image can be run with an alternative port.
2022-11-23 21:29:28 +01:00
db0c047d23
Update kemalrc and fix dependency version 2022-11-23 21:29:27 +01:00
437e83d919
Update README 2022-11-23 21:29:26 +01:00
eb63247c25
Fix make install 2022-11-23 21:29:25 +01:00
d47f98a277
Fix static file serving, add favicon 2022-11-23 21:29:24 +01:00
5f889bb284
Fix drone CI 2022-11-23 21:29:23 +01:00
751e57dafc
Update drone and readme 2022-11-23 21:29:22 +01:00
Arthur POULET
febda62a5c
Fix warning for crystal 1.3.1 2022-11-23 21:29:21 +01:00
261ecbb1a1
Update drone and readme 2022-11-23 21:29:20 +01:00
da03f4015c
Update deps 2022-11-23 21:29:19 +01:00
3cf85dff17
Update to crystal v0.35.1 2022-11-23 21:29:14 +01:00
a736916f7d
Update version 2022-11-23 21:29:14 +01:00
Lampros Chaidas
ade4beb0ae
crystal v0.33 compatible 2022-11-23 21:29:13 +01:00
Arthur Poulet
5b596f05ca
Update readme 2022-11-23 21:29:12 +01:00
356ba5e3bc
Update docker file 2022-11-23 21:29:11 +01:00
fa1507e29d
Update version v0.5.1 2022-11-23 21:29:10 +01:00
9c8fbcf7b9
Fix date parsing 2022-11-23 21:29:09 +01:00
3df864e946
Update title 2022-11-23 21:29:08 +01:00
156494c74f
Update README 2022-11-23 21:29:07 +01:00
Lucie-Dispot
aa2f9d11a1
Update README.md 2022-11-23 21:29:06 +01:00
84034daa8b
Update README picture 2022-11-23 21:29:05 +01:00
6cbfa60450
Add required to file upload 2022-11-23 21:29:03 +01:00
7dfd27cd6b
Dump version v0.5.0 2022-11-23 21:29:03 +01:00
7d083f94f8
Fix image 2022-11-23 21:29:02 +01:00
9beac1ceeb
Add image 2022-11-23 21:29:01 +01:00
84bb3b52e3
Fix some upload with browsers 2022-11-23 21:29:00 +01:00
1a2822e948
Upgrade some doc and version 2022-11-23 21:28:59 +01:00
0c5ed87aaa
Update to compile with crystal v0.27.0 2022-11-23 21:28:58 +01:00
d64a8d85d2
Update README 2022-11-23 21:28:57 +01:00
c2b1cadfbb
Bump version v0.4.1 2022-11-23 21:28:55 +01:00
d2be334510
Update kemalcr and crystal 2022-11-23 21:28:54 +01:00
a2500aaa38
Update version to 0.4.0 2022-11-23 21:28:53 +01:00
dd12a9f121
Fix christmas 2022-11-23 21:28:52 +01:00
5a5c7e62d4
Update with crystal v0.24.1 2022-11-23 21:28:51 +01:00
a14801a541
Update README 2022-11-23 21:28:50 +01:00
252446126c
Improve makefile with NAME configurable 2022-11-23 21:28:49 +01:00
313af5819f
Add install/uninstall rules 2022-11-23 21:28:47 +01:00
9029c132ba
Upgrade to version 0.3.2 2022-11-23 21:28:46 +01:00
2746790cb4
Add TRANSFER_SSL_ENABLED 2022-11-23 21:28:45 +01:00
b5f254f699
Upgrade to version 0.3.2 2022-11-23 21:28:44 +01:00
fc5d6206e4
Add auto-detect host and port of the server (by request) 2022-11-23 21:28:42 +01:00
d2388c98c9
Add 500 http status 2022-11-23 21:28:41 +01:00
b4723773e9
Factorize file upload and fix error details leak 2022-11-23 21:28:39 +01:00
3202e68213
Fix image in the readme 2022-11-23 21:28:38 +01:00
dec3776072
Add image in the readme 2022-11-23 21:28:37 +01:00
8bad255d19
Improve upload form 2022-11-23 21:28:35 +01:00
a53c939540
Add web browser upload route 2022-11-23 21:28:34 +01:00
1c64edb4d8
Update dependancies 2022-11-23 21:28:33 +01:00
ad348b4cbc
Add 'txt' 'patch' and 'md' to the text mime 2022-11-23 21:28:32 +01:00
ab4283e836
Improve configuration
- add storage duration

- add secure size

- add time format
2022-11-23 21:28:30 +01:00
fd408985b4
Change LICENSE to GPL-3.0 2022-11-23 21:28:29 +01:00
f515b90176
Update to v0.2.1 2022-11-23 21:28:27 +01:00
1a995ca8be
Update kemal version 2022-11-23 21:28:26 +01:00
4353ede23f
Reduce the url size 2022-11-23 21:28:25 +01:00
539c282f10
Update deps + upload with post & put 2022-11-23 21:28:23 +01:00
1c9f2bc661
Update to crystal v0.20, big file work
It is possible to upload very big files as files are not converted to string
automatically. They are written by 2^16 bytes at a time.
2022-11-23 21:28:22 +01:00
2b1f7af389
Update Makefile (change deps install rule) 2022-11-23 21:28:21 +01:00
c07347e48f
Update specs (kemal) 2022-11-23 21:28:20 +01:00
066256a718
Udate Dockerfile and relative readme
- add docker entry in the README file
- fix `compile` with `build` in Dockerfile
2022-11-23 21:28:18 +01:00
5af34e3dc3
Clean index.ecr 2022-11-23 21:28:17 +01:00
f627d43d84
Improve global architecture
- Update README
- Add `make run`
- move web actions on web/
- move lib classes and constants on lib/
2022-11-23 21:28:16 +01:00
d8cfb5e3a7
Fix docker file deps installation 2022-11-23 21:28:09 +01:00
1320d534e1
Update crystal and use multipart 2022-11-23 21:28:04 +01:00
80175d81c3
Improve EXT_TRANSFORM 2022-11-23 21:28:02 +01:00
fb8e0857f9
update to v0.1.1 2022-11-23 21:27:57 +01:00
a8921ec26b
better directory init 2022-11-23 21:27:56 +01:00
415c2a4945
fix specs (no specs) and add travis build image 2022-11-23 21:27:55 +01:00
04b2f750c8
add Dockerfile and docker-compose config 2022-11-23 21:27:54 +01:00
f706ada8be
fix purge delay 2022-11-23 21:27:53 +01:00
3cf9f00472
Some error improvements and configuration
- 404 error instead of 500 when file not found
- add TRANSFER_BASE_STORAGE env var
- improve env var handlement
- more robust purge
2022-11-23 21:27:52 +01:00
a12a60106b
fix format (crystal tool format) 2022-11-23 21:27:51 +01:00
58166cfc93
update email 2022-11-23 21:27:50 +01:00
Arthur Poulet
6d9c94ed06
update makefile to crystal 0.18 2022-11-23 21:27:49 +01:00
Arthur Poulet
2e92c22c41
fix plain text
- add transformation txt -> plain
- add charset utf-8 by default for plain text
- fix mime render via extnam
2022-11-23 21:27:47 +01:00
Arthur Poulet
bb46ff6ff0
update readme 2022-11-23 21:27:46 +01:00
Arthur Poulet
4fbac24c29
fix mime search for unix shebang 2022-11-23 21:27:45 +01:00
Arthur Poulet
e8bc3d6b24
improve index.ecr 2022-11-23 21:27:45 +01:00
Arthur Poulet
a27834050b
move mime search to mime_search.cr
- create a class MimeSearch
- add new magic numbers
2022-11-23 21:27:44 +01:00
Arthur Poulet
ba734ca83f
fix mime search 2022-11-23 21:27:42 +01:00
Arthur Poulet
f0de0ff69d
Improve mime search
- add magic number search
- improve lisibility
2022-11-23 21:27:28 +01:00
Arthur Poulet
71ea07b095
All filenames are downcased before save or send 2022-11-23 21:27:05 +01:00
Arthur Poulet
730d1f0fce
add jpe 2022-11-23 21:26:55 +01:00
Arthur Poulet
1ca937b00f
update README 2022-11-23 21:26:54 +01:00
Arthur Poulet
caaa227e79
update README 2022-11-23 21:26:53 +01:00
Arthur Poulet
e9f679ceb8
Add purge system
- a Fiber check every minutes if the files must be removed
- purge every files older than 7 days (1 minutes more or less)
- each files is in a dir based on the upload time (1 minutes more or
  less) and a dedied spawn destroy it
2022-11-23 21:26:52 +01:00
Arthur Poulet
91f279b4a2
Improve mkdir 2022-11-23 21:26:51 +01:00
Arthur Poulet
98469689e9
Use ECR instead of HTML to serve the index 2022-11-23 21:26:50 +01:00
Arthur Poulet
17d40578b7
update README 2022-11-23 21:26:49 +01:00
Arthur Poulet
4c327987bd
add Makefile (build, doc, test, release, deps)
close #1
2022-11-23 21:26:47 +01:00
Arthur Poulet
c9b500716e
use SecureRandom.hex instead of base64 2022-11-23 21:26:47 +01:00
Arthur Poulet
b1aab3217b
add index.html, improve readme and fix some stuff 2022-11-23 21:26:45 +01:00
Arthur Poulet
fcd4987b21
update readme 2022-11-23 21:26:40 +01:00
6 changed files with 138 additions and 40 deletions

View File

@ -1,25 +1,29 @@
FROM alpine:edge AS builder FROM alpine:edge AS builder
RUN apk add --no-cache crystal shards libc-dev yaml-dev libxml2-dev zlib-dev openssl-dev
MAINTAINER Arthur Poulet <arthur.poulet@sceptique.eu>
# Install shards
WORKDIR /usr/local
# Add this directory to container as /app # Add this directory to container as /app
ADD . /transfer_more ADD . /build
WORKDIR /transfer_more WORKDIR /build
# Install dependencies # Install dependencies
RUN apk add --no-cache \
crystal shards libc-dev yaml-dev libxml2-dev zlib-dev openssl-dev curl
# Install shards
RUN shards install RUN shards install
# Build our app # Build our app
RUN crystal build --release --warnings all src/transfer_more.cr RUN crystal build --release --warnings all src/transfer_more.cr
# Run the tests # Run the tests
RUN mkdir /tmp/files RUN mkdir /tmp/files && crystal spec
#RUN crystal spec
EXPOSE 3000 FROM alpine:edge
MAINTAINER Arthur Poulet <arthur.poulet@sceptique.eu>
ENTRYPOINT ./transfer_more --port 3000 RUN apk add --no-cache libgcc libevent libgc++ pcre2
WORKDIR /app
ADD ./public /app/public
COPY --from=builder /build/transfer_more ./transfer_more
ENTRYPOINT ["./transfer_more"]

View File

@ -12,7 +12,7 @@ Fast and lite file upload server ([transfer.sh](https://transfer.sh/) clone).
## Installation [![Build Status](https://drone.sceptique.eu/api/badges/Sceptique/transfer_more/status.svg)](https://drone.sceptique.eu/Sceptique/transfer_more) ## Installation [![Build Status](https://drone.sceptique.eu/api/badges/Sceptique/transfer_more/status.svg)](https://drone.sceptique.eu/Sceptique/transfer_more)
Compatible crystal v1.4.1 Compatible crystal v1.9.2
### From source ### From source
@ -28,6 +28,64 @@ make doc # build the documentation
yay -S transfer-more yay -S transfer-more
``` ```
### As a systemd service
[Unit]
Description=Tranfer more file sharing
Documentation=https://wiki.archlinux.org/index.php/Transfer-more
[Service]
ExecStart=/usr/share/transfer-more/transfer-more --port 10003 --bind 127.0.0.1
Restart=on-failure
RestartSec=5
Environment="TRANSFER_SSL_ENABLED=true"
WorkingDirectory=/usr/share/transfer-more/
# Hardening
MemoryDenyWriteExecute=true
SystemCallArchitectures=native
CapabilityBoundingSet=
NoNewPrivileges=true
RemoveIPC=true
LockPersonality=true
ProtectControlGroups=true
ProtectKernelTunables=true
ProtectKernelModules=true
ProtectKernelLogs=true
ProtectClock=true
ProtectHostname=true
ProtectProc=noaccess
RestrictRealtime=true
RestrictSUIDSGID=true
RestrictNamespaces=true
RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6
ProtectSystem=full
ProtectHome=true
PrivateDevices=true
PrivateTmp=true
[Install]
WantedBy=default.target
### Behind a nginx proxy
You should configure your nginx with `/etc/nginx/servers-enabled/transfer-more.conf`:
server {
listen 443 ssl;
server_name your.sub.domain;
client_max_body_size 1G;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
location / {
proxy_pass http://localhost:3000;
}
}
## Usage ## Usage
### Run the Server ### Run the Server
@ -39,6 +97,8 @@ export TRANSFER_SECURE_SIZE=4 # how much characters to identify a file
export TRANSFER_STORAGE_DAYS=7 # how much time the files are kept export TRANSFER_STORAGE_DAYS=7 # how much time the files are kept
export TRANSFER_TIME_FORMAT="%y%m%d%H" export TRANSFER_TIME_FORMAT="%y%m%d%H"
export TRANSFER_HOST_PORT="localhost:3000" # in pinciple it is auto solved using the http headers, optional export TRANSFER_HOST_PORT="localhost:3000" # in pinciple it is auto solved using the http headers, optional
export TRANSFER_MORE_FOOTER="Something <strong>important</strong> on the bottom" # replace the default footer
export TRANSFER_MORE_TITLE="MyName upload" # replace the default title
./transfer_more ./transfer_more
``` ```
@ -54,20 +114,18 @@ export TRANSFER_HOST_PORT="localhost:3000" # in pinciple it is auto solved using
curl --progress-bar --upload-file file.mp4 http://domain/name.mp4 curl --progress-bar --upload-file file.mp4 http://domain/name.mp4
``` ```
### Inside a docker ### Inside a Docker container
If you are using docker-compose: ```sh
docker build -t transfer_more . && docker run -p 3000:3000 transfer_more
```
Or with docker-compose:
```sh ```sh
docker-compose build && docker-compose up docker-compose build && docker-compose up
``` ```
Else, you can do:
```sh
docker build -t transfer_more . && docker run transfer_more
```
### [ShareX](https://github.com/ShareX) template ### [ShareX](https://github.com/ShareX) template
```json ```json

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.9 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 25 KiB

View File

@ -1,5 +1,5 @@
name: transfer_more name: transfer_more
version: 0.5.3 version: 0.5.9
authors: authors:
- Arthur Poulet <arthur.poulet@sceptique.eu> - Arthur Poulet <arthur.poulet@sceptique.eu>

View File

@ -1,8 +1,9 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<title>File upload with kemal</title> <meta charset="utf-8">
<meta http-equiv="content-type" content="text/html; charset=utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1">
<title><%= ENV.fetch("TRANSFER_MORE_TITLE", "File upload") %></title>
<link rel="stylesheet" href="/css/bootstrap.min.css" /> <link rel="stylesheet" href="/css/bootstrap.min.css" />
<!-- <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous" /> --> <!-- <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous" /> -->
<!-- <link rel="stylesheet" href="//octicons.github.com/components/octicons/octicons/octicons.css"> --> <!-- <link rel="stylesheet" href="//octicons.github.com/components/octicons/octicons/octicons.css"> -->
@ -10,14 +11,54 @@
<!-- <script src="/js/dropzone.js"></script> --> <!-- <script src="/js/dropzone.js"></script> -->
<link rel="shortcut icon" href="/images/favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="/images/favicon.ico" type="image/x-icon">
<style type="text/css"> <style type="text/css">
body { text-align:center;font-family:helvetica,arial;font-size:22px;color:#888;margin:20px;} body {
a { color:#66b;text-decoration:none; } text-align: center;
#c {margin:0 auto;width:500px;text-align:left} font-family: Helvetica, Arial;
font-size: 22px;
color: #888;
margin-top: 20px;
}
a {
color: #66b;
text-decoration: none;
}
#c {
margin: 0 auto;
width: 500px;
text-align: left;
}
.dropzone {
font-weight: bold;
text-align: center;
padding: 1em 0;
margin: 1em auto;
color: #555;
border: 2px dashed #555;
border-radius: 6px;
cursor: default;
height: 400px;
max-width: 400px;
background-color: rgba(250, 166, 180, 0.5);
background-repeat: no-repeat;
background-position: bottom;
}
#dropzone.hover {
color: #eaa
border-color: #eaa;
border-style: solid;
box-shadow: inset 0 4px 4px #888;
}
footer {
width: 100%;
display: flex;
justify-content: space-between;
padding: 1em;
}
</style> </style>
</head> </head>
<body> <body>
<h2>File upload with kemal</h2> <h2><%= ENV.fetch("TRANSFER_MORE_TITLE", "File upload") %></h2>
<% if !file_url.empty? %> <% if !file_url.empty? %>
<div class="alert alert-success"> <div class="alert alert-success">
<p>Upload url: <a href="<%= file_url %>"><%= file_url %></a></p> <p>Upload url: <a href="<%= file_url %>"><%= file_url %></a></p>
@ -33,22 +74,19 @@
<form method="POST" action="/" enctype="multipart/form-data"> <form method="POST" action="/" enctype="multipart/form-data">
<div class="form-group"> <div class="form-group">
<div class="col-lg-10"> <div class="dropzone-bg">
<input name="commit" value="Upload" class="btn btn-primary" type="submit"> <input name="commit" value="Upload" class="btn btn-primary" type="submit">
<input class="btn btn-default" name="file" id="file" type="file" required> <input class="form-control dropzone" name="file" id="file" type="file" required>Drop files</input>
</div> </div>
</div> </div>
</form> </form>
<!-- <img src="/images/kemal.png"> -->
<img src="/images/kemal.svg">
<!-- <img src="https://kemalcr.com/img/kemal.png"> -->
<footer style="position:fixed;bottom:0px;padding:60px;"> <footer>
<span style="position:fixed;left:10%"> <span>
built by <a href="https://github.com/Nephos/">Nephos</a> with <a href="http://kemalcr.com/">kemal</a> <%= ENV.fetch("TRANSFER_MORE_FOOTER", "built by <a href=\"https://git.sceptique.eu/Sceptique\">Sceptique</a>, powered with <a href=\"http://kemalcr.com/\">kemal</a>") %>
</span> </span>
<span style="position:fixed;right:10%"> <span>
<a href="https://github.com/Nephos/transfer_more">Fork me</a> <a href="https://git.sceptique.eu/Sceptique/transfer_more">Fork or patch me</a>
</span> </span>
</footer> </footer>
</body> </body>