Skip to content

Upgrade code to match 2026 standards#54

Merged
mkaczanowski merged 11 commits into
masterfrom
feat/upgrade_to_latest_2026
Mar 31, 2026
Merged

Upgrade code to match 2026 standards#54
mkaczanowski merged 11 commits into
masterfrom
feat/upgrade_to_latest_2026

Conversation

@mkaczanowski
Copy link
Copy Markdown
Owner

Long awaited upgrade after long time of not doing anything in that repo

…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
@mkaczanowski mkaczanowski merged commit d7b0790 into master Mar 31, 2026
1 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant