Skip to content

Burn pastes - #1

Merged
Akshad135 merged 4 commits into
mainfrom
burn-pastes
Jul 18, 2026
Merged

Akshad135 merged 4 commits into
mainfrom
burn-pastes

Conversation

@Akshad135

Copy link
Copy Markdown
Owner

added burn pastes and updated dockerfile for local builds

Copilot AI review requested due to automatic review settings July 18, 2026 05:38
@Akshad135
Akshad135 merged commit 5a7b9ea into main Jul 18, 2026
1 of 2 checks passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR replaces the legacy paste expiration model with configurable “Burn Rules” (time-based or unlock-count-based), updating both the React UI and the Rust API/server cleanup logic. It also tightens a few security/ops aspects (token comparison, CORS configurability) and improves local build performance via Docker cache mounts.

Changes:

  • Introduce burn-rule fields end-to-end (DB schema + migrations, Rust routes, TS API types, create/edit/view UI).
  • Replace expiration UI/timers with burn-status labeling and new BurnRulesControl (popover/drawer) UX.
  • Operational/security updates: configurable CORS origins, constant-time auth token compare, improved Docker build caching.

Reviewed changes

Copilot reviewed 28 out of 30 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/pages/ViewPaste.tsx Uses burn-status label UI; improves blob URL lifecycle; updates raw-view implementation.
src/pages/NewPaste.tsx Replaces “expires in” with burn-rule inputs and validation when creating pastes.
src/pages/EditPaste.tsx Adds burn-rule editing (including “keep existing time burn” behavior).
src/lib/utils.ts Centralizes formatFileSize utility.
src/lib/crypto.ts Removes modulo bias in access code generation (rejection sampling).
src/lib/constants.ts Adds burn-rule constants/validation and burn status label helpers; exports LANG_MAP.
src/lib/api.ts Updates Paste model and create/update payloads to burn-rule fields; changes revoke API payload.
src/hooks/use-media-query.ts Adds media-query hook used to switch popover vs drawer UI.
src/components/ui/drawer.tsx Adds Vaul-based Drawer primitives for mobile burn-rule editor.
src/components/SharePasteDialog.tsx Adds messaging about revoke-share burn behavior when sharing.
src/components/PasteCard.tsx Displays burn-status label in list cards; wires burnAction to share dialog.
src/components/Navbar.tsx Fixes theme preview application to react to activeIndex changes while modal open.
src/components/ExpirationTimer.tsx Removes legacy expiration countdown component.
src/components/CodePreview.tsx Switches to shared LANG_MAP from constants.
src/components/BurnRulesControl.tsx New unified burn-rule control UI (desktop popover + mobile drawer).
src-rust/routes/paste.rs Implements burn rules in CRUD/list/unlock paths; adds visibility filtering and unlock-count enforcement.
src-rust/routes/file.rs Aligns file access control with burn rules and pending-delete grace window.
src-rust/main.rs Adds ALLOWED_ORIGINS-driven CORS configuration; expands cleanup task for burned pastes.
src-rust/expiry.rs Replaces expiry helpers with burn-rule time computations and pending-delete scheduling.
src-rust/db.rs Adds migration path to rebuild pastes for burn rules; new indexes and idempotent handling.
src-rust/auth.rs Uses constant-time comparison for auth cookie token checking.
schema.sql Updates schema for burn-rule columns + indexes (drops expires_at index).
package.json Adds vaul dependency.
package-lock.json Locks vaul dependency.
fix_frontend.py Adds a local refactor script (currently committed into the repo).
Dockerfile Adds build cache mounts; changes backend build artifact copying to support caching.
docker-compose.yml Adds ALLOWED_ORIGINS environment variable wiring and documentation.
Cargo.toml Adds subtle and chrono dependencies.
Cargo.lock Locks new Rust dependencies.
.env.example Documents ALLOWED_ORIGINS configuration for production CORS restriction.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/pages/ViewPaste.tsx
Comment on lines +338 to +342
const win = window.open('', '_blank');
if (win) {
win.document.title = paste.title || 'Raw Paste';
win.document.write(`<pre style="word-wrap: break-word; white-space: pre-wrap;">${paste.content.replace(/</g, '&lt;').replace(/>/g, '&gt;')}</pre>`);
win.document.close();
Comment thread src/pages/NewPaste.tsx
Comment on lines +127 to +129
burn_trigger: burnTrigger === 'off' ? null : burnTrigger as 'time',
burn_after_value: burnTrigger === 'time' ? Number(burnValue) : undefined,
burn_after_unit: burnTrigger === 'time' ? burnUnit : undefined,
Comment thread src-rust/main.rs
Comment on lines +308 to +318
Err(_) => {
tracing::error!(
"ALLOWED_ORIGINS value '{}' is not a valid HTTP origin. \
Falling back to open CORS (*).",
trimmed
);
CorsLayer::new()
.allow_origin(Any)
.allow_methods(Any)
.allow_headers(Any)
}
Comment thread fix_frontend.py
Comment on lines +1 to +5
import re

# 1. Update constants.ts
with open('src/lib/constants.ts', 'r') as f:
constants = f.read()
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.

2 participants