Commit Graph
7 Commits
Author SHA1 Message Date
eberkheev 6f6b7552fc feat(auth): add token authentication with SHA-256 hashed storage 2026-03-29 15:54:41 +04:00
eberkheevandClaude Opus 4.6 6a540eaf81 Split share.py into modules by responsibility
config.py  — share.config loading, constants, load_config(), client_cfg()
cert.py    — get_local_ip(), ensure_cert()
cleanup.py — cleanup_loop()
server.py  — ShareServer, Handler, file_type()
share.py   — main() entry point only

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 20:56:58 +04:00
eberkheevandClaude Opus 4.6 9cc4693f39 Extract all magic numbers into share.config
Unified config file with [server] (user-facing: port, dir, ttl, lang,
etc.) and [internal] (constants: timeouts, buffer sizes, cert params,
UI timings). Replaces both DEFAULTS dict and hardcoded constants.
JS constants (toast_ms, progress_hide_ms) passed through CFG injection.
Old share.conf no longer used.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 20:52:57 +04:00
eberkheevandClaude Opus 4.6 082a80a6c5 Harden server and fix client-side edge cases
Python: per-file error handling in cleanup, single stat() in download,
S_ISREG check, Content-Disposition escaping, Content-Length on all
responses, route prefix passed to handlers (no magic numbers), validate
empty upload, ensure_cert handles partial cert pair, narrower exception
catches.

JS: visibility-aware polling, concurrent upload guard, fetch r.ok checks,
missing .catch() on delete/loadFiles, REFRESH_SEC→REFRESH_MS rename,
explicit parseInt radix, transition: all→specific properties.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 20:47:47 +04:00
eberkheevandClaude Opus 4.6 ebe5c6ec90 Refactor: fix socket leak, deduplicate stat/path logic, simplify config
- get_local_ip: use context manager to prevent socket leak
- _route_files: single stat() per file instead of two
- _safe_path helper: DRY path resolution for download/delete
- load_config: loop over vars(args) instead of 6 repetitive blocks
- Remove stale comment from index.html

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 20:38:53 +04:00
eberkheevandClaude Opus 4.6 266308a2eb Detect text files via MIME + binary heuristic instead of hardcoded extension list
Server-side _file_type() now uses mimetypes for images/known text,
and falls back to null-byte check on first 8KB for everything else.
Client uses the "type" field from /files API instead of local extension sets.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 20:35:16 +04:00
eberkheevandClaude Opus 4.6 eba5ece147 Initial commit
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 20:23:55 +04:00