Upgrade code to match 2026 standards#54
Merged
Merged
Conversation
…proxy When running behind a reverse proxy the listening address is internal, so paste URLs returned to clients showed the wrong host. Now the Host and X-Forwarded-Host/X-Forwarded-Proto headers are preferred over the configured address, with --uri still taking highest priority. Closes #51
Error responses (404, 500) were missing the Content-Type header, causing browsers to display raw HTML source instead of rendering the page. Closes #45
- Replace structopt with clap v4 (derive), update all arg annotations
- Replace speculate with standard #[cfg(test)] module and #[test] fns
- Remove num_cpus in favour of std::thread::available_parallelism
- Update edition to 2021 and drop unused dependencies
- Fix db_opts bug: Options were configured but never passed to DB::open,
meaning the TTL compaction filter was silently never applied
- Use explicit rocket proc-macro imports; rename get handler to view_paste
to avoid name collision with the get attribute macro
- Replace unwrap_or_else(|| String::from('')) with unwrap_or_default
- Replace vec![443,80].contains() with matches!(port, 443 | 80)
- Simplify ui_expiry_times processing (remove inner split loop)
- Fix .replace('.','') on extension to trim_start_matches('.')
- Use .into_owned() instead of .to_string() on Cow<str>
- Use format!("{var}") captured-variable style throughout
- Move #[allow(clippy::too_many_arguments)] to the two functions that need it
- Auto-detects system preference via prefers-color-scheme media query - Moon/sun toggle button in footer (right side) persists choice to localStorage - CSS custom properties for all themed colors (background, text, inputs, dropdowns, footer, code blocks) - VS Code-inspired dark theme for Prism.js syntax highlighting - Theme applied before page render to avoid flash of wrong theme Closes #33
- Use &str instead of String for route handler params (lib, main) - Fix panic on GET /new?id=<nonexistent> (return 404 instead) - Fix panic on GET /static/<unknown-ext> (fall back to octet-stream) - Add tests: get_url, uri_prefix, compaction filter, format_url, get_extension, forwarded headers, bug regressions - Update ARM Dockerfiles: add libclang, clean pacman cache, fix binary path - Refactor README: drop Travis badge, add dark mode/proxy/mobile/CLI flags docs, update Nginx example
- Use String::from_utf8_lossy in get_new (consistent with view_paste)
- Add sanitize_lang() to reject CSS class injection via lang param
- Fix entry.lang().unwrap() -> unwrap_or("markup") in view_paste
- Update mermaid CDN 8.8.2 -> 11.12.0, switch to mermaid.run() API
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Long awaited upgrade after long time of not doing anything in that repo