rustypaste/config.toml

67 lines
2.1 KiB
TOML
Raw Normal View History

[config]
2023-05-13 19:50:39 +00:00
refresh_rate = "1s"
[server]
2023-05-13 19:50:39 +00:00
address = "127.0.0.1:8000"
#url = "https://rustypaste.shuttleapp.rs"
#workers=4
2023-05-13 19:50:39 +00:00
max_content_length = "10MB"
upload_path = "./upload"
timeout = "30s"
expose_version = false
feat(server): add an endpoint for retrieving a list of files (#94) * Start * Wip * Implement path based JSON index * Remove json_index_path * Return datetime stamp instead of relative time * Add file size to list item * Add auth check when retrieving JSON index * Make json index path hardcoded * Test (currently failing) * Fix test for test_json_list * Clippy fix * Revert cargo to original versions with only needed changes * Add detail about auth guard affecting list route * Change json_index_path to expose_list * Remove unneeded linebreak * Remove unnecessary import * Remove unnecessary space at end of line * Move config check after auth check * Use new auth check syntax, add docs to struct, rename test_json_list to test_list * Replace chrono usage with uts2ts * Check list result in test * Add example to README * Upgrade serde_json to 1.0.103 * Add linebreak * Remove unneeded clone * Remove extra nl * Update README.md * Update README.md Co-authored-by: Orhun Parmaksız <orhunparmaksiz@gmail.com> * Update README.md Co-authored-by: Orhun Parmaksız <orhunparmaksiz@gmail.com> * Remove serde_json * Set default config to false for expose_list * Apply suggestions from code review Co-authored-by: Orhun Parmaksız <orhunparmaksiz@gmail.com> * Check that option is value in test_list * Update Cargo.toml Co-authored-by: Helmut K. C. Tessarek <tessarek@evermeet.cx> * Update cargo.lock * Use expect() to check file name * Remove underscore from list item struct * Keep comma after last line * refactor(server): rename ListItem fields * test(fixtures): add fixture test for listing files * test push * remove file again * chop off ts from filename and minor refactor * update README * docs(readme): fix capitalization * refactor(server): clean up list implementation --------- Co-authored-by: Orhun Parmaksız <orhunparmaksiz@gmail.com> Co-authored-by: Helmut K. C. Tessarek <tessarek@evermeet.cx>
2023-08-07 10:55:13 +00:00
expose_list = false
#auth_tokens = [
# "super_secret_token1",
# "super_secret_token2",
#]
feat(server): support handling spaces in filenames (#107) * feat(server): add url encoding - Introduced an option to enable encoding for filenames in the returned URL. - Modified the encoding approach to specifically target whitespaces, replacing them with `%20`. - Included unit tests to validate this encoding approach. - Added fixture tests for broader functional verification. - Removed the `urlencoding` dependency from `Cargo.toml`. * Refactor code and fixtures for better compliance and consistency - Fixed errors in the fixture configuration to ensure tests run as expected. - Reformatted line endings for consistency across the codebase. - Made necessary adjustments to adhere to Clippy's recommendations. * Enhance whitespace handling options for filenames - Implemented a configuration choice for space handling in filenames: encode, replace with underscores or none. - Added corresponding unit and fixture tests. * Remove redundant function call Fixed misplaced line as per @tessus's review feedback, preventing duplicate handling of spaces in filenames. * Delete test file with spaces.txt * Refactor filename space handling - Introduced `SpaceHandling` enum to manage filename spaces. - Updated server.rs and paste.rs to utilize the new method. - Added unit tests for the new filename handling method. - Adjusted fixture tests to reflect these changes. * Move filename processing into `SpaceHandling` enum - Relocated filename processing logic to reside within the `SpaceHandling` enum, enhancing encapsulation. - Updated calls in `server.rs` and `paste.rs` to use the new method structure. - Adjusted unit tests to align with the refactored function location and call pattern. * Refactor based on review suggestions - Incorporated the inline suggestions made by @tessus, removing the unnecessary one-line assignments. - Ensured the code adheres to Rust guidelines by running clippy and fmt. * chore(deps): revert changes in Cargo.lock * chore(config): replace spaces as default * refactor(config): move SpaceHandling to config module --------- Co-authored-by: Orhun Parmaksız <orhunparmaksiz@gmail.com>
2023-08-26 12:35:13 +00:00
handle_spaces = "replace" # or "replace"
[landing_page]
text = """
Submit files via HTTP POST here:
curl -F 'file=@example.txt' <server>
This will return the URL of the uploaded file.
The server administrator might remove any pastes that they do not personally
want to host.
If you are the server administrator and want to change this page, just go
into your config file and change it! If you change the expiry time, it is
recommended that you do.
By default, pastes expire every hour. The server admin may or may not have
changed this.
Check out the GitHub repository at https://github.com/orhun/rustypaste
Command line tool is available at https://github.com/orhun/rustypaste-cli
"""
#file = "index.txt"
content_type = "text/plain; charset=utf-8"
[paste]
random_url = { type = "petname", words = 2, separator = "-" }
#random_url = { type = "alphanumeric", length = 8 }
#random_url = { type = "alphanumeric", length = 6, suffix_mode = true }
default_extension = "txt"
mime_override = [
{ mime = "image/jpeg", regex = "^.*\\.jpg$" },
{ mime = "image/png", regex = "^.*\\.png$" },
{ mime = "image/svg+xml", regex = "^.*\\.svg$" },
{ mime = "video/webm", regex = "^.*\\.webm$" },
{ mime = "video/x-matroska", regex = "^.*\\.mkv$" },
{ mime = "application/octet-stream", regex = "^.*\\.bin$" },
{ mime = "text/plain", regex = "^.*\\.(log|txt|diff|sh|rs|toml)$" },
]
mime_blacklist = [
"application/x-dosexec",
"application/java-archive",
"application/java-vm",
]
duplicate_files = true
# default_expiry = "1h"
delete_expired_files = { enabled = true, interval = "1h" }