Files
quickdrop/.github/copilot-instructions.md
Rostislav 3aba1efced Dev (#59)
CI/CD: Jenkins pipeline updates (specify JDK/Maven tools, version-based pipeline fixes, adjust for new Jenkins setup)

Java/Spring upgrades & rollback (try Java 25 + Spring Boot 3.5.6 + GC/ObjectHeader experiments, then revert back to Java 21)

Add/refresh Copilot instructions

Controller logging + rename (add logging to FileViewController, rename PasswordController → PasswordViewController)

UI refactors + formatting pass (general reformatting and readability improvements across templates/scripts)

Tailwind migration cleanup (remove Bootstrap script references, Tailwind updates, dark theme fixes)

Template layout/styling improvements (dashboard, settings, file history, file view pages—consistent layout and styling with Tailwind)

Keep Indefinitely + Hide From List rules & option (add option to disable “Keep Indefinitely”, refine/adjust session + status checks, align UI layout)

Unified file history logging (migrate download/renewal logs into one system; refactor repository/service; update downloads section to log uploads/renewals/downloads)

Share token overhaul (better validation + uniqueness; download endpoint uses token directly; delete tokens when deleting a file; refine ShareViewController mappings)

Security/static resources (permit static resources through filter chain)

Notifications system (Discord + email settings, NotificationService, testing UI + endpoint, batching with configurable minutes, richer formatting + detailed results, improve deletion notifications)

CSRF adjustments for notification testing (CSRF token handling, add allowed header X-XSRF-TOKEN, ignore CSRF for the test endpoint where needed)

Folder upload support (SQL migration rename, directory picker + manifest improvements, better folder tree rendering with fallbacks, improved upload cleanup)

Upload/file view UX refresh (new drop zone/buttons design, theme toggler improvements, responsive/accessibility navigation improvements incl. close-on-outside-click)

File preview feature (enable/disable previews + max size settings; support images/text + PDF/JSON/CSV + more extensions; preview UI styling; normalize language extensions; add Highlight.js syntax highlighting + dark theme styles; remove integrity/crossorigin attrs)

Navigation reorg + styling (reorganize nav links; ensure light/dark contrast; consistent hover/padding/spacing)

Pagination + caching + search (pagination for dashboard/file list, caching config, search with pagination)

Settings validation + cron UX (validate settings inputs; cron validation; show next run time; layout fixes for cron section)

Service/util refactors & cleanup (dead code cleanup; DataValidator null handling; improve ScheduleService cron handling + deletion logic; improve NotificationService RestTemplate + flushing; refactor FileUtils file type/previewability; move static helpers; improve preview handling path)

Dependencies/versioning/docs (update pom.xml parent/deps, bump version to 1.5.0 in pom.xml + application.properties, update README)
2025-12-14 19:12:44 +02:00

4.8 KiB

QuickDrop AI Working Guide (concise)

  • Build/run: Java 21. Use ./mvnw clean package then java -jar target/quickdrop.jar. SQLite DB at db/quickdrop.db; Flyway auto-runs baseline-on-migrate. Docker image roastslav/quickdrop:latest exposes 8080.
  • App shape: Spring Boot MVC + Thymeleaf. Controllers in src/main/java/org/rostislav/quickdrop/controller; services in service; interceptors in interceptor; entities/repos in entity and repository; static assets + templates under src/main/resources/static and .../templates.
  • Settings source of truth: Single-row settings (id=1) via ApplicationSettingsService. Startup seeds defaults (max size 1GB, life 30d, storage files/logs, cron 0 0 2 * * *, app password off, admin password empty, file list & admin button enabled, encryption on, default home upload) and schedules cleanup. Never create extra rows.
  • Security: SecurityConfig enables whole-app password mode (/password/login), BCrypt auth, CSRF cookie, permissive CORS. Session timeout set in WebConfig. Admin and file tokens stored in-memory in SessionService.
  • Interceptors: AdminPasswordSetupInterceptor enforces /admin/setup until admin password exists. AdminPasswordInterceptor gates /admin/** and file history. FilePasswordInterceptor redirects to /file/password/{uuid} when missing a valid file session token.
  • Upload pipeline: /api/file/upload-chunk accepts chunked uploads with metadata (description, keepIndefinitely, password, hidden, fileSize, folder fields). AsyncFileMergeService buffers/merges chunks; FileEncryptionService encrypts when password + encryption enabled; final persist via FileService. Intermediate chunk calls return null—frontends must handle.
  • Storage/model: Files stored on disk under fileStoragePath (from settings) with UUID filenames; metadata in file_entity (description, keepIndefinitely, hidden, optional password hash, encrypted flag, folder fields). QuickdropApplication ensures ./db and storage path exist.
  • Downloads & history: /file/download/{uuid} decrypts on the fly; logs uploads/renewals/downloads with IP/UA into file_history_log (types UPLOAD, RENEWAL, DOWNLOAD). Share links via /api/file/share/{uuid} and /api/file/download/{uuid}/{token} decrement/delete tokens.
  • Admin UX: Dashboard lists files with download counts and actions (view, history, download, delete, keep indefinitely toggle, hidden toggle) plus analytics (total downloads, space, avg size). Public list and admin dashboard now paginated/searchable (page/size/query params) with in-memory caching of page results; cache evicted on uploads, deletions, renewals, hidden/keep toggles, downloads.
  • Cleanup/scheduling: ScheduleService schedules deletions per cron/max life, missing-file cleanup, share token cleanup. App uses @EnableScheduling.
  • Thymeleaf flags: GlobalControllerAdvice injects template booleans (file list enabled, app password set, admin button enabled, encryption enabled).
  • Conventions: Route all file mutations through FileService to ensure logging/notifications/encryption. Update interceptors when adding protected routes. Keep single settings row intact. For pagination/search, reuse Page-based service methods and propagate page/size/query to templates. Cache keys live in publicFiles, adminFiles, analytics (see CacheConfig).
  • Dev tips: SQLite dialect configured; migrations live under src/main/resources/db/migration. Few/no automated tests—manual ./mvnw clean package is typical. Logs at log/quickdrop.log (see properties). Default port 8080.