{"id":25220414,"url":"https://github.com/adridevelopsthings/upload","last_synced_at":"2025-04-05T11:21:14.437Z","repository":{"id":222333208,"uuid":"756623960","full_name":"AdriDevelopsThings/upload","owner":"AdriDevelopsThings","description":"A simple upload/download webserver","archived":false,"fork":false,"pushed_at":"2024-04-08T12:35:03.000Z","size":36,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-10T21:53:12.672Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AdriDevelopsThings.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2024-02-13T01:08:23.000Z","updated_at":"2024-02-13T15:10:43.000Z","dependencies_parsed_at":"2024-04-08T00:44:17.958Z","dependency_job_id":null,"html_url":"https://github.com/AdriDevelopsThings/upload","commit_stats":null,"previous_names":["adridevelopsthings/upload"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AdriDevelopsThings%2Fupload","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AdriDevelopsThings%2Fupload/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AdriDevelopsThings%2Fupload/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AdriDevelopsThings%2Fupload/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AdriDevelopsThings","download_url":"https://codeload.github.com/AdriDevelopsThings/upload/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247326583,"owners_count":20920872,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-02-10T21:53:15.550Z","updated_at":"2025-04-05T11:21:14.412Z","avatar_url":"https://github.com/AdriDevelopsThings.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# upload\nA simple webserver to upload and download files.\n\n## Running\nRun upload with docker:\n```\ndocker run --name upload -v ./upload:/upload -v ./data:/data -v ./config:/config -p 80:80 ghcr.io/adridevelopsthings/upload:main\n```\n(put the `auth.toml` file in the `./config` directory)\n\nor\n\nbuild it yourself:\n\n```\ncargo build --release \u0026\u0026 ./target/release/upload\n```\n\n### Environment variables\n- `UPLOAD_DIRECTORY`: The directory where the uploaded files should be put in (default `upload`, docker default `/upload`)\n- `AUTH_CONFIG_PATH`: The path to your `auth.toml` file (default `auth.toml`, docker default `/config/auth.toml`)\n- `LISTEN_ADDRESS`: The address where the webserver should listen (default `127.0.0.1:3000`, docker default `0.0.0.0:80`)\n\n# auth.toml\n```toml\ndefault_auth_scheme = \"Basic\" # not required, this is the default value\ndefault_max_filesize = 10737418240 # 10 GB, not required, this is the default value\nallow_downloading_for_everyone = false # not required, this is the default value\nallow_uploading_for_everyone = false # not required, this is the default value\n\n[[basic]] # a basic authorization method\nusername = \"username\" # required\npassword = \"bcrypt hashed password\" # required\nmax_filesize = 1024 # not required, uses `default_max_filesize` as default\nallow_download = true # not required, this is the default value\nallow_upload = true # not required, this is the default value\n\n[[bearer]]\nsecret = \"PLEASE USE A SAFE ONE\" # required, jsonwebtoken HS256 secret, create with `openssl rand -hex 64`\ndefault_max_filesize = 1024 # not required, uses `default_max_filesize` as defualt\ndefault_permissions = [\"download\", \"upload\"] # not required, this is the default value\nmax_filesize_field_name = \"max_filesize\" # the name of the field inside the json containing the max_filesize, not required, this is the default value\npermissions_field_name = \"permissions\" # the name of the field inside the json containing the permissions, not required, this is the default value\n```\n\n## Bearer authorization\nYou can send the server an authorization header that looks like this: `Authoriztion: Bearer \u003cBearer token\u003e`. The bearer token must be a jsonwebtoken. It's body must include the `exp` key containing the expiry date.\nYou can extend the body by adding the `max_filesize` key and set it to the maximum filesize the user should can upload and by adding the `permissions` key and set it to an array of permissions (`download` and `upload` are possible).\nIf these attributes aren't set the server will use the values from the bearer auth configuration (`default_permissions` and `default_max_filesize` (and if not set, the global max filesize)).\nIt's also possible to change the names of the keys by changing the `max_filesize_field_name` and `permissions_field_name` config attribute.\nAn example jsonwebtoken body looks like this:\n```json\n{\n    \"exp\": 1710342210,\n    \"max_filesize\": 1024,\n    \"permissions\": [\n        \"download\",\n        \"upload\"\n    ],\n    \"additional_keys_are\": \"okay\"\n}\n```\n\n# HTTP\n## Uploading\nRequest:\n```\nPOST /upload/filename.txt HTTP/1.1\nAuthorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=\nContent-Length: 81\n\nThis is the body of the http message and contains the content you want to upload.\n```\nResponse:\n```\nHTTP/1.1 201 Created\nLocation: /d/md5hash_filename.txt\nContent-Length: 23\n\n/d/md5hash_filename.txt\n```\n\n## Downloading\nRequest:\n```\nGET /d/md5hash_filename.txt HTTP/1.1\nAuthorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=\n```\nResponse:\n```\nHTTP/1.1 200 OK\nContent-Length: 74\nContent-Type: application/octet-stream\nContent-Disposition: attachment; filename=\"md5hash_filename.txt\"\n\nThis is the body of the http message and contains the content of the file.\n```\n\n# File data\nIt's possible to set additional data while uploading a file with a `File-Data-$PARAMETER_NAME$` header. The data associated to a file will be saved in the data directory as json.\n\n## Download permission\nChange the download permissions of the file with the `File-Data-Download-Permission` header. Possible values are:\n1. `none`: This makes it impossible to download the file even if the user is authenticated\n2. `unlimited`: Every user even unauthenticated can download the file independent of the auth.toml configuration\n\n\n## Delete after\nDelete the file automatically after `n` seconds. The header `File-Data-Delete-After` contains the seconds after which the file is deleted.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadridevelopsthings%2Fupload","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadridevelopsthings%2Fupload","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadridevelopsthings%2Fupload/lists"}