Commit Graph
102 Commits
Author SHA1 Message Date
MarSeventh fa965d0fb9 refactor: move storage api utils into subdirectory 2026-04-28 17:54:43 +08:00
MarSeventh e5b6c7f2f3 fix: migrate session storage to manage@ prefix and fix D1 adapter routing
- Change SESSION_PREFIX from 'session@' to 'manage@session@' to prevent
  sessions from appearing in file index and backups
- Add KV expirationTtl for automatic session cleanup on expiry
- Fix D1 adapter: route all manage@ keys to settings table instead of
  files table (fixes blockipList and session storage in wrong table)
- Fix D1 list({ prefix: 'manage@' }) not matching settings table
  (fixes backup not containing settings data)
- Exclude manage@session@ keys from settings backup export
2026-04-28 17:04:41 +08:00
htazq d33209bc54 Keep WebDAV secrets out of file metadata
WebDAV upload records now store only the channel identity and object/public paths. Read, delete, move, and rename operations resolve credentials and headers from the current WebDAV channel config by ChannelName, with a legacy metadata fallback so already-created records remain usable.

Constraint: Preserve existing WebDAV object lifecycle behavior while reducing metadata exposure

Rejected: Keep credentials on every file record | expands exposure through metadata reads, backups, and logs

Confidence: high

Scope-risk: moderate

Directive: Keep WebDAV credentials in upload config/env; do not reintroduce per-file credential metadata

Tested: npm test; node deploy/worker/generate-routes.js; npx wrangler deploy --dry-run --config deploy/worker/wrangler.toml; git diff --check

Not-tested: Live WebDAV provider move/delete/read workflow
2026-04-28 09:42:03 +08:00
htazq b41e048670 Enable third-party WebDAV storage without new runtime dependencies
Cloudflare Workers and Pages already provide the Fetch/Web APIs needed for WebDAV verbs, so the storage integration uses a small local helper instead of adding a Node-oriented WebDAV client. The channel now participates in upload, read, delete, move, rename, channel listing, and runtime config, with chunked uploads explicitly guarded because WebDAV has no portable server-side compose primitive.

Constraint: Preserve Pages Functions and generated Worker deployment paths
Constraint: No new npm dependency for WebDAV client behavior
Rejected: Add a WebDAV npm client | likely Node API/compatibility and package-lock churn
Rejected: Treat WebDAV as External URL only | not a complete storage channel lifecycle
Confidence: high
Scope-risk: moderate
Directive: WebDAV here is third-party storage; keep it distinct from the built-in /dav server settings
Tested: npm test; node worker/generate-routes.js; npx wrangler deploy --dry-run --config worker/wrangler.toml; git diff --cached --check
Not-tested: Live third-party WebDAV provider credentials; Digest-only WebDAV authentication
2026-04-28 00:05:12 +08:00
MarSeventh 143bda1ce2 feat: 会话安全策略 - 后端支持动态 Secure/MaxAge 配置
- 扩展 getSecurityConfig 和 fetchSecurityConfig 默认值,新增 sessionSecure、userSessionMaxAge、adminSessionMaxAge 字段
- 改造 buildSessionCookie 支持 secure 参数
- createSession 根据 authType 动态读取配置计算 maxAge
- destroySession 读取 sessionSecure 确保清除 Cookie 属性一致
2026-04-21 10:58:54 +08:00
MarSeventh c25bbfe4a7 fix: remove Secure flag from session cookie for HTTP Docker compatibility 2026-04-19 20:16:36 +08:00
MarSeventh 888dba1a80 refactor: extract rehashIfNeeded to passwordHash.js, deduplicate login rehash logic 2026-04-18 15:35:13 +08:00
MarSeventh 23a7f69dc4 fix: return explicit authType instead of null when auth is unconfigured
- checkAdmin: return 'admin' when admin auth not configured
- checkUser: return 'user' when authCode not configured
- directoryTree: use authType !== 'admin' to gate user-only checks
2026-04-18 15:28:01 +08:00
MarSeventh 6cf23fec70 refactor: split authCore into checkAdmin/checkUser, extract API Token to public layer 2026-04-18 15:05:49 +08:00
MarSeventh 7ad7bf364b refactor: remove Basic Auth, add /api/auth/adminLogin endpoint
- Remove Basic Auth (verifyBasicAuth, parseBasicAuth) from authCore.js
- Add /api/auth/adminLogin POST endpoint for admin login via JSON body
- Delete legacy /api/manage/check, login, logout (no longer referenced)
- Fix adminConfigured to consider password-only config
2026-04-18 14:49:01 +08:00
MarSeventh 1e96f2e27b refactor: unify auth logic into authCore with authScope parameter
- Extract shared authentication logic into utils/auth/authCore.js
- Replace enableBasicAuth/enableAuthCode flags with clear authScope enum (ADMIN/USER/EITHER)
- Move all auth-related files into utils/auth/ subdirectory
- Eliminate duplicated admin auth logic between _middleware.js and dualAuth.js
- Fix: user session no longer grants access to admin-only endpoints
- Fix: dualAuth no longer bypasses authCode when admin is not configured
- Update all 17 import references across the codebase
- Preserve original function signatures (userAuthCheck, dualAuthCheck) for zero caller changes
2026-04-18 13:24:53 +08:00
MarSeventh baca53a631 security: upgrade password hashing to PBKDF2 and fix API token generation
- Replace single-round SHA-256 with PBKDF2 (100k iterations) via Web Crypto API
- Auto-rehash old SHA-256/plaintext passwords to PBKDF2 on successful login
- Add timing-safe comparison to prevent timing attacks
- Replace Math.random() with crypto.getRandomValues() for API token and token ID generation
- Maintain full backward compatibility with existing SHA-256 hashes and plaintext passwords
2026-04-18 00:45:04 +08:00
MarSeventh 5e48fde2ca feat: session-based auth with password hashing
- Add passwordHash.js: SHA-256 + salt hashing with plaintext backward compatibility
- Add sessionManager.js: HttpOnly cookie sessions with separate admin_session/user_session
- Add sessionCheck.js: session validation endpoint for frontend route guards
- Add logout.js: session destruction endpoint with authType support
- Update login.js: return user_session cookie on successful login
- Update check.js: return admin_session cookie on successful admin auth
- Update _middleware.js: check admin_session before Basic Auth, remove WWW-Authenticate header
- Update security.js: hash passwords on save, mask in GET, clear sessions on password change
- Update dualAuth.js/userAuth.js: use verifyPassword and session validation
2026-04-17 23:11:45 +08:00
MarSeventh 9441468a5b feat: 添加 API Token 过期时间后端支持
- 新增 tokenExpiration.js 工具模块(过期判定、自动删除过滤)
- apiTokens.js 支持 expiresAt/autoDelete 字段的创建、更新、自动清理
- 新增 getTokenData 导出函数
- tokenValidator.js 增加过期检查逻辑
2026-03-10 10:52:01 +08:00
MarSeventh 3c31520faa Bug:修复HF渠道上传较大文本文件栈溢出的错误 2026-03-08 21:58:32 +08:00
copilot-swe-agent[bot]andMarSeventh 3d33b0f662 Fix Docker deployment issues: add request.cf mock, boolean binding in SQLite, caches API mock, graceful purgeCFCache error handling
Co-authored-by: MarSeventh <[email protected]>
2026-03-03 16:46:40 +00:00
MarSeventh 26226c2e10 目录树设置和体验优化 2026-03-01 11:25:39 +08:00
MarSeventh cfb6e638e2 目录树设置和体验优化 2026-03-01 11:13:43 +08:00
MarSeventh 4955ed1b8d v2.6.1:增加文件夹候选项;部分安全和体验优化 2026-02-28 16:58:42 +08:00
MarSeventh 50ff6d98b1 v2.6.1:增加文件夹候选项;部分安全和体验优化 2026-02-28 16:50:46 +08:00
MarSeventh a03766a9f9 update v2.5.7 2026-01-30 16:14:19 +08:00
MarSeventh 5d34052a1f update v2.5.5 2026-01-25 15:29:35 +08:00
MarSeventh 9d4d9fb7bf update v2.5.4 2026-01-23 21:58:25 +08:00
MarSeventh 18ebe4876c Feat:支持自定义上传页面logo跳转链接;管理端支持跳转到指定页码;一些使用细节优化 2026-01-08 12:03:57 +08:00
MarSeventh bdc94f80a2 Feat:telegram渠道支持设置代理;优化上传设置页面使用体验 2026-01-07 17:44:33 +08:00
axibayuit 0426591d4d feat: 公开浏览功能增强 & Discord API 429重试 2026-01-03 00:35:27 +08:00
axibayuit 364e7c8643 fix: pass oid to uploadMultipart for multipart complete request 2025-12-30 21:17:28 +08:00
axibayuit e973c65e9c feat(huggingface): implement direct upload for large files (>20MB)
- Add frontend direct upload to HuggingFace S3, bypassing CF Workers limits
- Add /api/huggingface/getUploadUrl endpoint to get LFS upload URLs
- Add /api/huggingface/commitUpload endpoint to commit file references
- Support multipart upload for very large files
- SHA256 computed in frontend to avoid CF Workers CPU timeout
- Small files (<20MB) still use proxy upload through CF Workers
2025-12-30 20:42:38 +08:00
axibayuit fd92a024fd feat: optimize HuggingFace upload - compute SHA256 on frontend to avoid CF Workers CPU timeout 2025-12-30 20:31:33 +08:00
axibayuit 6840484c2f feat: implement native LFS upload protocol for HuggingFace (no external SDK) 2025-12-30 20:08:28 +08:00
axibayuit fc01dfe53f fix: update HuggingFace SDK to v0.23.0 and disable Xet/WebWorkers for CF Workers compatibility 2025-12-30 20:04:25 +08:00
axibayuit cfbfb3eb8c fix: use NDJSON format for HuggingFace commit API 2025-12-30 19:57:50 +08:00
axibayuit 2f1e9df5a0 fix: use string fields instead of JSON blob for HuggingFace commit API 2025-12-30 19:52:36 +08:00
axibayuit f768f1cb3b fix: correct HuggingFace commit API format - header as JSON blob 2025-12-30 19:46:36 +08:00
axibayuit 2943f99e54 fix: use POST commit API with multipart form data for HuggingFace upload 2025-12-30 19:42:10 +08:00
axibayuit 78256d1816 fix: simplify HuggingFace upload - direct PUT without encoding 2025-12-30 18:58:06 +08:00
axibayuit e7d504cff1 fix: use multipart form upload for HuggingFace to avoid CPU timeout 2025-12-30 18:48:25 +08:00
axibayuit 72c24547c0 fix: use direct binary upload instead of base64 to avoid CPU timeout 2025-12-30 18:44:42 +08:00
axibayuit 9d88863671 fix: use correct HuggingFace commit API format with base64 encoding 2025-12-30 18:22:17 +08:00
axibayuit 7596424135 fix: use simple upload API for HuggingFace 2025-12-30 18:06:09 +08:00
axibayuit 13877de84c fix: update HuggingFace API to use LFS upload method 2025-12-30 18:05:05 +08:00
axibayuit 7ef6fd48ac feat: add HuggingFace storage channel support
- Add HuggingFace API wrapper class (huggingfaceAPI.js)
- Support upload, download, delete operations via HuggingFace Hub API
- Support public repos (unlimited storage) and private repos (100GB limit)
- Private repos: server proxies requests with Authorization header
- Auto-create repo if not exists (with write token)
- Add HuggingFace to auto-retry channel list
- Environment variables: HF_TOKEN, HF_REPO, HF_PRIVATE
- Support load balancing for multiple HuggingFace channels
2025-12-30 17:46:11 +08:00
axibayuit 5393e04631 feat(discord): add delete message support for Discord channel 2025-12-30 15:57:17 +08:00
axibayuit 24d88fd9a1 feat: 添加 Discord 渠道支持
- 新增 Discord API 封装类 (discordAPI.js)
- 支持 Discord 文件上传(10MB 限制,超过自动切换其他渠道)
- 支持 Discord 文件读取和代理 URL(国内访问)
- 前端添加 Discord 渠道配置 UI(负载均衡、表单验证)
- 支持环境变量配置:DISCORD_BOT_TOKEN, DISCORD_CHANNEL_ID, DISCORD_PROXY_URL
- 修复 sysConfig.js 中 Discord 渠道过滤
2025-12-30 15:08:19 +08:00
axibayuit a899e4925e perf: 优化容量检查,未启用时跳过KV读取 2025-12-30 00:14:56 +08:00
axibayuit 155aacab63 perf: 优化容量统计,从索引元数据读取,减少 KV 写入操作 2025-12-29 23:20:04 +08:00
axibayuit 3d77585ec5 feat: add storage quota limit for S3/R2 channels
- Add quota counter tracking (usedMB, fileCount) per channel
- Filter channels by quota threshold in fetchUploadConfig()
- Update quota on upload (endUpload) and delete
- Add /api/manage/quota API for stats and recalculation
- Fix null check in delete when file record not found
- Fix R2 channel name from hardcoded to actual channel.name
2025-12-29 19:55:20 +08:00
jenken827 6a159dcbfb feat: 支持svg和ico文件的上传 2025-12-06 15:15:13 +08:00
MarSeventh 8f89140b7e Feat:支持标签管理;支持深色模式跟随系统 2025-11-18 12:26:54 +08:00
sean908 a86e8b522d Feat: Add tag management system
- Add tag CRUD APIs (single file and batch operations)
  - Add tag autocomplete endpoint
  - Add tag search support in file listing
  - Update database schema with tags column
  - Add tag validation and normalization utilities
  - Initialize Tags:[] for all new uploads
2025-10-10 14:43:11 +08:00