Wha1eChai
f2f0a7452e
merge: integrate upstream/main (v1.2.15) into feature/webui
...
- Resolved conflict in src/constants.js: kept config-driven approach
- Adopted upstream 10-second cooldown default
- Added MAX_EMPTY_RESPONSE_RETRIES constant from upstream
- Incorporated new test files and GitHub issue templates
2026-01-09 18:08:45 +08:00
Wha1eChai
c9c5e7d486
feat(webui): add hot-reload account management with OAuth support
2026-01-08 23:52:31 +08:00
Badri Narayanan S
59d0a92b37
Merge pull request #55 from jgor20/fix/oauth-callback-utf8-encoding
...
fix(oauth): add UTF-8 encoding to callback HTML pages
2026-01-06 21:49:02 +05:30
jgor20
df9b935329
fix(auth): add UTF-8 charset to OAuth callback HTML responses
...
Ensure proper encoding for international characters in error and success pages
by specifying charset=utf-8 in Content-Type headers and adding meta charset tags.
2026-01-05 01:43:15 +00:00
jgor20
e29cd5fa9d
refactor(auth): use NativeModuleError for native module load failures
...
Replace generic Error instances with NativeModuleError in loadDatabaseModule
to provide more structured error information, including rebuild status and
restart requirements. Update getAuthStatus to re-throw NativeModuleError
instances without wrapping.
2026-01-05 01:20:35 +00:00
jgor20
69b7e130a0
refactor(auth): move clearRequireCache to utils and update import
...
Remove the local clearRequireCache function from database.js and import it from
utils/native-module-helper.js. Update the function call to pass require.cache
as the second parameter for proper cache clearing.
2026-01-05 01:13:55 +00:00
jgor20
e6027ec5a6
feat: auto-rebuild native modules on Node.js version mismatch
...
When Node.js is updated, native modules like better-sqlite3 can become
incompatible due to NODE_MODULE_VERSION differences. This change adds
automatic detection and rebuild capability:
- Add native-module-helper.js utility for detecting version errors
- Lazy-load better-sqlite3 to catch import errors at runtime
- Automatically run npm rebuild when version mismatch is detected
- Clear require cache and retry loading after successful rebuild
- Provide clear instructions if automatic rebuild fails
Fixes the issue where users running via npx encounter module errors
after updating Node.js.
2026-01-05 00:43:21 +00:00
Caixiaopig
573ba57db6
feat: add --no-browser OAuth mode for headless servers
...
## Feature Description
Enables adding Google accounts on remote servers without a desktop
environment (headless Linux, Docker containers, SSH sessions) where
automatic browser opening is not possible. Users can manually copy the
authorization URL to a device with a browser, complete authentication,
and paste the authorization code back.
## Usage
npm run accounts:add -- --no-browser
## Code Architecture
### New Modules
1. oauth.js - extractCodeFromInput()
- Parses user input (full callback URL or raw authorization code)
- Extracts code and state parameters
- Handles OAuth error responses
2. accounts.js - addAccountNoBrowser()
- Account addition flow for no-browser mode
- Displays authorization URL for manual copying
- Waits for user to paste authorization code
- Calls extractCodeFromInput to parse input
- Completes OAuth flow and saves account
3. tests/test-oauth-no-browser.cjs
- 13 unit tests covering valid URLs, raw codes, error handling, edge cases
### Modified Modules
1. accounts.js - interactiveAdd()
- Added noBrowser parameter
- Selects addAccount or addAccountNoBrowser based on mode
2. accounts.js - main()
- Parses --no-browser CLI argument
- Updated help information
## User Flow
┌─────────────────────────────────────────────────────────────┐
│ Headless Server Terminal │
└─────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────┐
│ npm run accounts:add -- --no-browser │
└─────────────────────────────────┘
│
▼
┌─────────────────────────────────┐
│ Display Google OAuth URL │
│ (manual copy required) │
└─────────────────────────────────┘
│
┌────────────────────┴────────────────────┐
│ │
▼ ▼
┌─────────────────┐ ┌─────────────────────┐
│ Local Browser │ │ Phone/Other Device │
│ Open URL │ │ Open URL │
│ Google Sign-in │ │ Google Sign-in │
│ Authorize App │ │ Authorize App │
└─────────────────┘ └─────────────────────┘
│ │
└────────────────────┬────────────────────┘
│
▼
┌─────────────────────────────────┐
│ Browser redirects to localhost │
│ (page won't load - this is OK) │
│ Copy full URL or code parameter │
└─────────────────────────────────┘
│
▼
┌─────────────────────────────────┐
│ Return to server terminal │
│ Paste URL or authorization code │
└─────────────────────────────────┘
│
▼
┌─────────────────────────────────┐
│ ✓ Account added successfully │
└─────────────────────────────────┘
## Security Considerations
- Supports state parameter validation (when user pastes full URL)
- Warns on state mismatch but allows continuation (manual mode tolerance)
- Authorization code length validation to prevent incorrect input
## Compatibility
- Does not affect existing automatic browser OAuth flow
- All changes are additive, no modifications to upstream logic
- Easy to merge future upstream updates
2026-01-04 14:46:16 +05:30
Badri Narayanan S
f02364d4ef
refactor: Reorganize src/ into modular folder structure
...
Split large monolithic files into focused modules:
- cloudcode-client.js (1,107 lines) → src/cloudcode/ (9 files)
- account-manager.js (639 lines) → src/account-manager/ (5 files)
- Move auth files to src/auth/ (oauth, token-extractor, database)
- Move CLI to src/cli/accounts.js
Update all import paths and documentation.
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
2026-01-01 15:13:43 +05:30