A simple, light and standalone pastebin, URL shortener and file-sharing service that hosts files, redirects links and stores texts.
filite init
to perform the initial setup (you can do this at any time to reset the config and password)filite
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.
```toml
port = 8080
database_url = "database.db"
pool_size = 4
files_dir = "files"
[highlight]
theme = "github"
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
json
{
"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$"
}
json
{
"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
.
json
{
"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
```nginx server { listen 80; listen [::]:80;
server_name
location / {
proxy_pass http://localhost:
location /f {
client_max_body_size 10M;
}
} } ```
```apache
ProxyPreserveHost On
ProxyPass / http://localhost:
All requests that require authentication use HTTP Basic Auth (without taking the username into account).
It's possible to get an array of all existing entries for each type with an authenticated request.
GET /f
GET /l
GET /t
There are two ways to create new entries, PUT
or POST
requests.
PUT
lets you choose the ID manually and POST
assigns a free one automatically, but that's the only difference.
Both methods require authentication.
PUT
requests will overwrite any existing entry.
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.
json
{
"$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.
json
{
"$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
The project is open to contributions! Before submitting a PR, make sure your changes work both with and without the dev
feature enabled.
sqlite
feature enabled.env.example
to .env
and set the variables to your likingdiesel database setup
dev
feature enabledfilite is licensed under the MIT License.