Commit Graph

32 Commits

Author SHA1 Message Date
3fde67c86f [M] ignore .env 2026-03-04 13:06:26 +08:00
46d9f3a299 fix: set cookie secure flag based on request protocol
Fix login issue when accessing via IP address over HTTP. Previously,
the cookie secure flag was set based on NODE_ENV which caused
cookies to not be sent when accessing via HTTP in production mode.
Now it uses the actual request protocol (checking x-forwarded-proto
header or request URL).

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-03-04 13:03:44 +08:00
8227f36cbe refactor: organize tests and extract formatting utilities
- Move test files to lib/__tests__/ directory
- Extract formatting utilities (formatVersion, formatFileSize, formatDateTime)
  from fs-utils.ts to new utils.ts module
- Add Jest test configuration and test scripts
- Update component imports to use new utils module
- Add CLAUDE.md documentation for project structure

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-03-04 02:33:30 +08:00
17a23611b6 docs: add README 2026-03-04 02:16:35 +08:00
93d43c8451 feat: redirect home page to download page 2026-03-04 02:15:38 +08:00
240fd8b528 feat: add download page with SearchForm and ApkList 2026-03-04 02:14:16 +08:00
993ce520f0 fix: add 'use client' directive and fix prop mismatch
- Add 'use client' directive at top of ApkList.tsx to support useSWR hook
- Remove highlightCommit prop from ApkCard component call as it's not accepted by ApkCard interface

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-03-04 02:12:39 +08:00
608d67c7fd feat: add ApkList component 2026-03-04 02:11:04 +08:00
36b60687f0 fix: remove XSS vulnerability and add security attributes
- Removed dangerouslySetInnerHTML with unsanitized user input
- Removed highlightCommit prop and related highlighting logic
- Added download and rel="noopener noreferrer" attributes to download link
- Simplified component to safely display filename without HTML rendering

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-03-04 02:10:06 +08:00
99694cbc4c feat: add ApkCard component 2026-03-04 02:08:50 +08:00
df5c0b4237 fix: add error handling and use existing utility
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-03-04 02:08:09 +08:00
fdeb42f212 feat: add SearchForm component 2026-03-04 02:06:53 +08:00
5365352331 fix: add cookie security attributes and error handling
- Add secure and sameSite attributes to cookie configuration
- Add try-catch block to handle malformed JSON and other errors
- Add validation for missing username or password fields

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-03-04 02:05:55 +08:00
bdb4d0cf32 feat: add login page and API 2026-03-04 02:04:50 +08:00
e2b4105fb6 fix: remove font overrides to use Tailwind configuration 2026-03-04 02:04:02 +08:00
0329bd2ff6 fix: improve font configuration for Chinese support 2026-03-04 02:03:22 +08:00
f3b0d79ef9 feat: update root layout with metadata
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-03-04 02:02:31 +08:00
cf7d3d5618 fix: use streaming and add path validation
- Replace fs.readFileSync() with fs.createReadStream() to prevent memory exhaustion
- Export validatePath() from fs-utils.ts
- Use validatePath() to validate full path including project and version parameters
- Fix incomplete path traversal protection
- Add filename encoding in Content-Disposition header

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-03-04 02:01:38 +08:00
7d5ee36f56 feat: add /api/download endpoint for APK file downloads
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-03-04 02:00:36 +08:00
91c94bde88 fix: add URL encoding and remove unused import
- Add encodeURIComponent() for project, version, and filename parameters in downloadUrl to prevent XSS and URL breakage
- Remove unused formatDateTime import

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-03-04 01:59:53 +08:00
0d1ba31175 feat: add /api/apks endpoint 2026-03-04 01:58:52 +08:00
c032c7fd5d feat: add /api/versions endpoint 2026-03-04 01:57:46 +08:00
5be115d323 feat: add /api/projects endpoint 2026-03-04 01:56:47 +08:00
7609e99076 fix: use constant for cookie value and remove unused import
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-03-04 01:56:14 +08:00
db479c9da1 feat: implement simple cookie-based authentication middleware 2026-03-04 01:54:56 +08:00
2a883c23f9 fix: address race conditions and add path validation
- Fixed race condition in getProjects() by using Promise.all with proper async/await
- Fixed race condition in getVersions() by using Promise.all with proper async/await
- Fixed race condition in getApks() by ensuring Promise.all wraps the async map
- Added validatePath() helper function to prevent path traversal attacks
- Applied path validation to all file system operations

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-03-04 01:54:07 +08:00
5e00e36e57 feat: add file system utility functions 2026-03-04 01:52:44 +08:00
c4a25fced2 fix: address security concerns in constants (path and credentials)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-03-04 01:52:02 +08:00
af080cee2a feat: add constants configuration 2026-03-04 01:51:09 +08:00
37e2e2e7d3 fix: remove .env.local from git and add .env.example
Remove credentials file from git tracking and provide template for
environment variables.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-03-04 01:49:47 +08:00
9b793b9b93 feat: initialize Next.js project with Tailwind CSS and SWR
- Initialize Next.js 16.1.6 with TypeScript and App Router
- Configure Tailwind CSS for styling
- Install SWR for API state management
- Set up environment variables for authentication and resource path
- Update .gitignore to track .env.local

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-03-04 01:47:15 +08:00
a78f029e03 Initial commit from Create Next App 2026-03-04 01:45:44 +08:00