Commit Graph
150 Commits
Author SHA1 Message Date
asepharyana ad3f4ce75e test: enable strict AWS SDK multipart coverage 2026-07-07 04:47:07 +07:00
asepharyana 339f788dc9 fix: ensure multipart part sizeBytes are Numbers, not DB strings 2026-07-07 04:42:07 +07:00
asepharyana 2e447ee58a fix: stream complete multipart S3 objects 2026-07-07 04:37:20 +07:00
asepharyana ad45404132 feat: support ranged S3 GetObject responses
Wire createGetObjectResponse into single-part GetObject handler for
proper Range/Content-Range support (200, 206, 416). Update presigned
E2E test to require 200. Add SDK Range request test.
2026-07-07 04:30:04 +07:00
asepharyana 378a084fd3 feat: stream S3 object bodies from Telegram parts 2026-07-07 04:25:05 +07:00
asepharyana 5253fb384d fix: verify presigned S3 URLs against public host 2026-07-07 04:21:01 +07:00
asepharyana 85aa54592a feat: add S3 byte range parser 2026-07-07 04:14:10 +07:00
asepharyana 2bf0fa5af5 docs: plan S3 compatibility completion 2026-07-07 04:03:11 +07:00
asepharyana dbdc5ed1ee docs: design remaining S3 compatibility fixes 2026-07-07 03:56:40 +07:00
asepharyana 9a48fbf227 fix: satisfy deploy lint gate for S3 compatibility work
- Apply Biome organize-import/formatting fixes across changed S3 files
- Replace remaining string concatenations with template literals for lint
- Make home page inline handlers explicit via window.* and add button types
- Clean S3 auth lint issues with dot-property access and optional chaining
- Keep GetObject proxy and production/S3 SDK tests passing

Verification:
- bun run lint (0 errors, 1 CSS specificity warning)
- S3_SECRET_KEY=<env> bun test test/production-e2e.test.ts (29 pass)
- S3_SECRET_KEY=<env> bun test test/s3-sdk.test.ts (20 pass)
- bun test test/s3-auth.test.ts (5 pass)
2026-07-07 03:07:51 +07:00
asepharyana 06f93e30f6 feat: proxy GetObject from Telegram CDN for real S3 client compatibility
- Add proxyS3Get config (PROXY_S3_GET env, default true) to env.ts
- Proxy handleGetObject and handleGetMultipartObject: fetch from Telegram
  CDN and return 200 with streaming body instead of 302 redirect
- Real S3 clients (AWS SDK v3) expect 200+body on GetObject, not redirect
- Legacy 302 redirect path preserved when proxyS3Get=false
- Updated production-e2e: GetObject asserts 200 with body content
- Updated s3-sdk.test.ts: GetObject asserts 200 with body (removed try/catch)
- Cleaned up unused multipart imports in s3-sdk.test.ts

All 49 tests pass (29 production-e2e + 20 s3-sdk).
2026-07-07 02:54:51 +07:00
asepharyana f88ac1a124 test: add real AWS SDK v3 S3 compatibility tests (20 tests)
Tests use @aws-sdk/client-s3 against https://upload.asepharyana.my.id
with forcePathStyle=true. Covers all standard S3 operations:
ListBuckets, CreateBucket, HeadBucket, DeleteBucket, PutObject,
GetObject, HeadObject, ListObjectsV1/V2 (prefix, delimiter),
CopyObject, DeleteObject, DeleteObjects (batch), error handling.

Multipart is excluded from SDK tests — the SDK adds amz-sdk-* /
x-amz-user-agent to signed headers, which can differ between
signing time and the actual request through Cloudflare, causing
403 SignatureDoesNotMatch. Multipart is verified via manual
SigV4 signing in test/production-e2e.test.ts.
2026-07-07 01:59:17 +07:00
asepharyana 57f2740df9 fix: production bugs + comprehensive production e2e tests
Fixes:
- RowList bug: postgres.js returns array directly, not {rows}. Fix in
  buckets.ts, files-ext.ts, multipart.ts (3 files, 8 functions)
- S3 ListBuckets routing: GET / was intercepted by handleHome route
- Presigned URL detection: isS3Request() only checked Authorization header
- FK constraint on bucket delete: cascade-delete files & multipart rows first
- docker-compose.yml: pass S3_ACCESS_KEY / S3_SECRET_KEY to container
- Dockerfile: copy home.html to runner stage for handleHome

Tests:
- test/production-e2e.test.ts: 29 tests (11 Web API + 18 S3 SigV4)
  All pass against https://upload.asepharyana.my.id
- Creates and cleans up real buckets/objects on production
2026-07-07 00:49:45 +07:00
asepharyana b731ddd7e1 fix: sequential test execution to avoid mock pollution between files 2026-07-06 22:50:59 +07:00
asepharyana 245138e23a Refactor code for improved readability and consistency
- Updated formatting in web-api.ts for better alignment and readability.
- Enhanced XML builders in xml.ts for clearer structure and maintainability.
- Improved test cases in s3-auth.test.ts and s3-operations.test.ts for better clarity and consistency.
- Refactored mock data in web-api.test.ts for improved readability.
2026-07-06 22:36:15 +07:00
asepharyana 2d3d7891a0 refactor: auto-run DB migration at startup, robust schema.sql path resolution 2026-07-06 22:32:06 +07:00
asepharyana 0ad783b794 fix: PutObject raw body, presigned URL auth guard, DeleteObjects tracking, home.ts path 2026-07-06 21:38:17 +07:00
asepharyana e175a27512 test: add S3 auth, operations, and web API tests 2026-07-06 21:15:26 +07:00
asepharyana 5e38f80267 feat: add web file manager UI and S3 catch-all route 2026-07-06 20:56:55 +07:00
asepharyana a4f902a37b feat: add JSON v1 web API for S3 management UI 2026-07-06 16:10:17 +07:00
asepharyana dd61e7e0fc feat: implement S3 protocol dispatcher with bucket, object, listing, and multipart operations 2026-07-06 15:52:42 +07:00
asepharyana 084ff3fb9d fix: add region validation, fix presigned URL canonical request (add method, fix headers), normalizeUri decode 2026-07-06 15:31:06 +07:00
asepharyana ee758aa939 feat: add S3 SigV4 auth verification and XML builders 2026-07-06 14:56:39 +07:00
asepharyana a2ca489039 fix: add explicit snake_case-to-camelCase mapping for S3FileRecord, add missing findOrphanFilesByBucket 2026-07-06 14:33:27 +07:00
asepharyana caef31c703 feat: add DB CRUD layer for buckets, multipart, and S3 file extensions 2026-07-06 14:23:37 +07:00
asepharyana e37fb00295 feat: add S3 env config, bucket and multipart DB schema 2026-07-06 13:59:03 +07:00
asepharyana 0d0d7a5dfa chore: remove GitHub Actions workflow for notifying parent repository 2026-07-06 01:25:37 +07:00
asepharyana 52bd704d21 refactor: enhance file handling and metrics tracking; remove unused bot health tracker 2026-07-06 01:25:18 +07:00
asepharyana bbf420759b chore: update Dockerfile and docker-compose for improved deployment process; add deploy script 2026-07-05 22:06:52 +07:00
MythEclipse 20b622c4c2 fix(core): resolve wrong file_id error and zip stream memory leaks
- Refactored Telegram bot pool iteration to handle 'wrong file_id' properly by verifying against all active bots
- Upgraded TelegramFileInfo interface to track owner bot_token
- Patched MaxListenersExceededWarning memory leak in zip.ts stream writes with events.once and async iteration
2026-06-20 22:24:23 +07:00
MythEclipseandClaude Opus 4.8 50176e5764 chore: migrate domain asepharyana.tech to asepharyana.my.id
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-06 12:39:26 +07:00
MythEclipse 2a833d3908 feat: include bot token in file info response for Telegram API 2026-05-30 00:15:35 +07:00
MythEclipse 3ca5ab7983 refactor: update Telegram file handling to use new getFileInfo function and include bot token in cache 2026-05-29 16:53:55 +07:00
Asep Haryana Saputra cc0f1dde79 ci: remove obsolete deploy.yml, replaced by notify-parent.yml 2026-05-29 15:00:00 +07:00
Asep Haryana Saputra e88e5dbc39 ci: slim deploy.yml to test-only; build/push/deploy handled by monorepo 2026-05-29 14:08:50 +07:00
Asep Haryana Saputra 0e2f09012f ci: add notify-parent workflow for monorepo integration 2026-05-29 14:08:21 +07:00
MythEclipse 134a7d4bf6 feat: update Traefik router rules to support additional domains and change TLS certresolver to Cloudflare 2026-05-29 03:45:57 +07:00
MythEclipse 8508b36026 feat: update file handling to redirect to Telegram CDN and adjust Swagger documentation 2026-05-29 03:43:49 +07:00
MythEclipse 5425f6d33d feat: enhance configuration and rate limiting
- Added new configuration options: trustProxy, uploadConcurrency, batchMaxItems, batchMaxSizeBytes, and maxRequestBodyBytes to AppConfig.
- Implemented utility functions for parsing environment variables and masking sensitive data.
- Updated rate limiting logic to use configurable window size and maximum requests per window.
- Introduced a middleware for rate limiting on specific routes.
- Refactored file handling routes to support streaming downloads instead of redirects.
- Improved error handling and response formatting in file routes.
- Added support for oversized request rejection based on Content-Length header.
- Updated Swagger documentation to reflect changes in API behavior and responses.
- Enhanced tests to cover new features and ensure proper functionality.
2026-05-29 03:33:39 +07:00
MythEclipse be813b1c0e feat: update Traefik router rule to use new domain for file upload service 2026-05-29 02:57:50 +07:00
MythEclipse db5de1367d feat: extend file schema with archive metadata, implement batch upload processing, and add zip utilities for file handling 2026-05-22 00:51:49 +07:00
MythEclipse 56b929ffb1 feat: enhance file upload process with temporary file handling, improved error management, and metrics logging 2026-05-22 00:29:54 +07:00
MythEclipse fd5eb98586 feat: implement caching for file info, add rate limiting, and enhance upload handling with retry logic 2026-05-21 23:31:49 +07:00
MythEclipse 10c968cf01 feat: add file_hash column and related index to files table; refactor Telegram API utilities for improved file handling 2026-05-21 22:55:42 +07:00
MythEclipse 52340ee77d feat: enhance file upload handling with improved file detection, size limits, and response formatting 2026-05-21 22:31:55 +07:00
MythEclipse 06844f1fa1 docs: update CLAUDE.md to include details on temporary file handling for API uploads 2026-05-18 22:03:55 +07:00
MythEclipse 884710fd42 feat: implement temporary file handling for uploads and update tests for dynamic ID verification 2026-05-18 22:01:26 +07:00
MythEclipse cc3f85284b docs: add dynamic image fetching details for unit tests in CLAUDE.md 2026-05-18 21:54:57 +07:00
MythEclipse d58b2390ef refactor: remove concurrency limit from Telegram upload queue and enhance media group handling 2026-05-18 21:54:39 +07:00
MythEclipse b91b276214 feat: add support for batch uploads of media groups to Telegram with debounce handling 2026-05-18 21:31:20 +07:00