Disable unused actix web features
Declare time feature for tokio
Clippy lint
This project was originally forked from the legacy 0.3.0 branch of https://github.com/raftario/filite . It has been heavily customized for the author's own use cases. Those seeking an openly developed project should use the upstream project instead.
A simple, light and standalone pastebin, URL shortener and file-sharing service that hosts files, redirects links and stores texts.
filite passwd
to set the initial passwordfilite
. The program will create its state in the current working directory.That's it!
When asked for a login, use whatever username you want and the password you provided during setup. Details for programmatic usage are provided in the dedicated section.
# Port to listen on
port = 8080
# Highlight.js configuration
[highlight]
# Theme to use
theme = "github"
# Additional languages to include
languages = ["rust"]
<AUTHORIZATION>
is the result of encoding <USERNAME>:<PASSWORD>
to base64
<USERNAME>
is an arbitrary username, it doesn't matter<PASSWORD>
is the password entered during setup<ADDRESS>
is the root address where the filite is running, for instance http://localhost:8080
or https://filite.raphaeltheriault.com
{
"Version": "13.0.1",
"Name": "filite (file)",
"DestinationType": "ImageUploader, FileUploader",
"RequestMethod": "POST",
"RequestURL": "<ADDRESS>/f",
"Headers": {
"Authorization": "Basic <AUTORIZATION>"
},
"Body": "MultipartFormData",
"FileFormName": "file",
"URL": "<ADDRESS>/$response$"
}
{
"Version": "13.0.1",
"Name": "filite (link)",
"DestinationType": "URLShortener",
"RequestMethod": "POST",
"RequestURL": "<ADDRESS>/l",
"Headers": {
"Authorization": "Basic <AUTORIZATION>"
},
"Body": "JSON",
"Data": "{\"forward\":\"$input$\"}",
"URL": "<ADDRESS>/l/$response$"
}
You can remove the prompt and always enable or disable syntax highlighting by replacing
$prompt:Highlight|false$
withtrue
orfalse
.
{
"Version": "13.0.1",
"Name": "filite (text)",
"DestinationType": "TextUploader",
"RequestMethod": "POST",
"RequestURL": "<ADDRESS>/t",
"Headers": {
"Authorization": "Basic <AUTORIZATION>"
},
"Body": "JSON",
"Data": "{\"contents\":\"$input$\",\"highlight\":$prompt:Highlight|false$}",
"URL": "<ADDRESS>/t/$response$"
}
<DOMAIN>
is the domain the requests will be coming from, for instance filite.raphaeltheriault.com
<PORT>
is the port on which filite is listeningUpload limits are set to 10M as an example
server {
listen 80;
listen [::]:80;
server_name <DOMAIN>;
location / {
proxy_pass http://localhost:<PORT>;
location /f {
client_max_body_size 10M;
}
}
}
<VirtualHost *:80>
ServerName <DOMAIN>
ProxyPreserveHost On
ProxyPass / http://localhost:<PORT>/
ProxyPassReverse / http://localhost:<PORT>/
<Location "/f">
LimitRequestBody 10000000
</Location>
</VirtualHost>
All requests that require authentication use HTTP Basic Auth (without taking the username into account).
There are two ways to create new entries, PUT
or POST
requests.
For files and texts, PUT
requests must refer to an existing ID. For links, a potentially-nonexistent ID is ok.
POST
will automatically generate an ID.
Both methods require authentication.
PUT /f/{id}
POST /f
Files are sent as multipart/form-data
. The field name isn't important but the file name needs to be included. Only one file is treated.
PUT /l/{id}
POST /l
Links are sent as application/json
according to the following schema.
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Link",
"type": "object",
"properties": {
"forward": {
"description": "URL this link forwards to",
"type": "string"
}
}
}
PUT /t/{id}
POST /t
Texts are sent as application/json
according to the following schema.
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Text",
"type": "object",
"properties": {
"contents": {
"description": "Text contents",
"type": "string"
},
"highlight": {
"description": "Whether to enable code highlighting or not for that text",
"type": "boolean"
}
}
}
It's possible to delete any entry with an authenticated request.
DELETE /f
DELETE /l
DELETE /t
filite is licensed under the MIT License.