From b012fe02453158c1b83600a07d7813e10efd2ef8 Mon Sep 17 00:00:00 2001
From: jgor20 <102353650+jgor20@users.noreply.github.com>
Date: Wed, 28 Jan 2026 23:02:00 +0000
Subject: [PATCH 2/5] fix(server): use originalUrl in request logger and
suppress .well-known noise
- Changed logging middleware to use req.originalUrl instead of req.path,
which was mangled by Express wildcard catch-all path stripping
- Suppress Chrome DevTools /.well-known/ requests from logs (debug-only)
---
src/server.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/server.js b/src/server.js
index 87c9eee..a654d02 100644
--- a/src/server.js
+++ b/src/server.js
@@ -186,10 +186,10 @@ app.use((req, res, next) => {
res.on('finish', () => {
const duration = Date.now() - start;
const status = res.statusCode;
- const logMsg = `[${req.method}] ${req.path} ${status} (${duration}ms)`;
+ const logMsg = `[${req.method}] ${req.originalUrl} ${status} (${duration}ms)`;
// Skip standard logging for event logging batch unless in debug mode
- if (req.path === '/api/event_logging/batch' || req.path === '/v1/messages/count_tokens') {
+ if (req.originalUrl === '/api/event_logging/batch' || req.originalUrl === '/v1/messages/count_tokens' || req.originalUrl.startsWith('/.well-known/')) {
if (logger.isDebugEnabled) {
logger.debug(logMsg);
}
From f786e3b3c66b7a96a44dc46281b8c9126450dde3 Mon Sep 17 00:00:00 2001
From: Irvan Fauziansyah
Date: Thu, 29 Jan 2026 16:31:14 +0700
Subject: [PATCH 3/5] feat: add version display to CLI banner and WebUI
- Add getPackageVersion() utility function in src/utils/helpers.js
- Display version in CLI startup banner (e.g., "v2.4.2")
- Display version in WebUI navbar next to "CLAUDE PROXY SYSTEM"
- Refactor WebUI to use shared getPackageVersion() utility
- Update footer with GitHub icon and link
---
package.json | 2 +-
src/index.js | 5 ++++-
src/utils/helpers.js | 21 +++++++++++++++++++++
src/webui/index.js | 14 ++------------
4 files changed, 28 insertions(+), 14 deletions(-)
diff --git a/package.json b/package.json
index ad4e3b9..8caa388 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "antigravity-claude-proxy",
- "version": "1.2.6",
+ "version": "2.4.2",
"description": "Proxy server to use Antigravity's Claude models with Claude Code CLI",
"main": "src/index.js",
"type": "module",
diff --git a/src/index.js b/src/index.js
index 5ebae6e..f0f04ca 100644
--- a/src/index.js
+++ b/src/index.js
@@ -8,9 +8,12 @@ import { DEFAULT_PORT } from './constants.js';
import { logger } from './utils/logger.js';
import { config } from './config.js';
import { getStrategyLabel, STRATEGY_NAMES, DEFAULT_STRATEGY } from './account-manager/strategies/index.js';
+import { getPackageVersion } from './utils/helpers.js';
import path from 'path';
import os from 'os';
+const packageVersion = getPackageVersion();
+
// Parse command line arguments
const args = process.argv.slice(2);
const isDebug = args.includes('--debug') || process.env.DEBUG === 'true';
@@ -90,7 +93,7 @@ const server = app.listen(PORT, () => {
logger.log(`
╔══════════════════════════════════════════════════════════════╗
-║ Antigravity Claude Proxy Server ║
+║ Antigravity Claude Proxy Server v${packageVersion} ║
╠══════════════════════════════════════════════════════════════╣
║ ║
${border} ${align(`Server and WebUI running at: http://localhost:${PORT}`)}${border}
diff --git a/src/utils/helpers.js b/src/utils/helpers.js
index b492c2a..02bdf4f 100644
--- a/src/utils/helpers.js
+++ b/src/utils/helpers.js
@@ -1,9 +1,30 @@
+import { readFileSync } from 'fs';
+import { fileURLToPath } from 'url';
+import path from 'path';
+
/**
* Shared Utility Functions
*
* General-purpose helper functions used across multiple modules.
*/
+/**
+ * Get the package version from package.json
+ * @param {string} [defaultVersion='1.0.0'] - Default version if package.json cannot be read
+ * @returns {string} The package version
+ */
+export function getPackageVersion(defaultVersion = '1.0.0') {
+ try {
+ const __filename = fileURLToPath(import.meta.url);
+ const __dirname = path.dirname(__filename);
+ const packageJsonPath = path.join(__dirname, '../../package.json');
+ const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf8'));
+ return packageJson.version || defaultVersion;
+ } catch {
+ return defaultVersion;
+ }
+}
+
/**
* Format duration in milliseconds to human-readable string
* @param {number} ms - Duration in milliseconds
diff --git a/src/webui/index.js b/src/webui/index.js
index dbaa09a..6f0f1a7 100644
--- a/src/webui/index.js
+++ b/src/webui/index.js
@@ -13,8 +13,6 @@
*/
import path from 'path';
-import { readFileSync } from 'fs';
-import { fileURLToPath } from 'url';
import express from 'express';
import { getPublicConfig, saveConfig, config } from '../config.js';
import { DEFAULT_PORT, ACCOUNT_CONFIG_PATH, MAX_ACCOUNTS } from '../constants.js';
@@ -22,18 +20,10 @@ import { readClaudeConfig, updateClaudeConfig, replaceClaudeConfig, getClaudeCon
import { logger } from '../utils/logger.js';
import { getAuthorizationUrl, completeOAuthFlow, startCallbackServer } from '../auth/oauth.js';
import { loadAccounts, saveAccounts } from '../account-manager/storage.js';
+import { getPackageVersion } from '../utils/helpers.js';
// Get package version
-const __filename = fileURLToPath(import.meta.url);
-const __dirname = path.dirname(__filename);
-let packageVersion = '1.0.0';
-try {
- const packageJsonPath = path.join(__dirname, '../../package.json');
- const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf8'));
- packageVersion = packageJson.version;
-} catch (error) {
- logger.warn('[WebUI] Could not read package.json version, using default');
-}
+const packageVersion = getPackageVersion();
// OAuth state storage (state -> { server, verifier, state, timestamp })
// Maps state ID to active OAuth flow data
From aae4dc69d2398896d97501405096c7bf41b1cae0 Mon Sep 17 00:00:00 2001
From: Irvan Fauziansyah
Date: Thu, 29 Jan 2026 16:31:33 +0700
Subject: [PATCH 4/5] feat: add version to navbar and improve footer styling
- Add version display next to "CLAUDE PROXY SYSTEM" in navbar
- Replace version with GitHub icon link in footer
- Update footer styling with larger text and better visibility
---
public/index.html | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/public/index.html b/public/index.html
index ea8cf41..6cfa50a 100644
--- a/public/index.html
+++ b/public/index.html
@@ -77,8 +77,12 @@
ANTIGRAVITY
-
CLAUDE PROXY SYSTEM
+
+ CLAUDE PROXY SYSTEM
+ v1.0.0
+
-
-
V 1.0.0
+
+
GitHub
+ class="flex items-center gap-1.5 hover:text-neon-purple transition-colors">
+
+
GitHub
+
From 3c2f324eff7ffebd301b94b2e34299269c5da9aa Mon Sep 17 00:00:00 2001
From: Badri Narayanan S
Date: Sat, 31 Jan 2026 00:27:19 +0530
Subject: [PATCH 5/5] fix: honor HOST environment variable for server binding
- Update src/index.js to use HOST environment variable for main server
- Update src/auth/oauth.js to use HOST environment variable for OAuth callback server
- Add diagnostic logging to show actual bound address on startup
- Update startup banner to reflect correct host URL
Co-Authored-By: Claude (gemini-3-flash[1m])
---
src/auth/oauth.js | 12 +++++++-----
src/index.js | 15 +++++++++++++--
2 files changed, 20 insertions(+), 7 deletions(-)
diff --git a/src/auth/oauth.js b/src/auth/oauth.js
index b60f6f9..80924ff 100644
--- a/src/auth/oauth.js
+++ b/src/auth/oauth.js
@@ -141,9 +141,10 @@ export function extractCodeFromInput(input) {
* Attempt to bind server to a specific port
* @param {http.Server} server - HTTP server instance
* @param {number} port - Port to bind to
+ * @param {string} host - Host to bind to
* @returns {Promise} Resolves with port on success, rejects on error
*/
-function tryBindPort(server, port) {
+function tryBindPort(server, port, host = '0.0.0.0') {
return new Promise((resolve, reject) => {
const onError = (err) => {
server.removeListener('listening', onSuccess);
@@ -155,7 +156,7 @@ function tryBindPort(server, port) {
};
server.once('error', onError);
server.once('listening', onSuccess);
- server.listen(port);
+ server.listen(port, host);
});
}
@@ -173,6 +174,7 @@ export function startCallbackServer(expectedState, timeoutMs = 120000) {
let timeoutId = null;
let isAborted = false;
let actualPort = OAUTH_CONFIG.callbackPort;
+ const host = process.env.HOST || '0.0.0.0';
const promise = new Promise(async (resolve, reject) => {
// Build list of ports to try: primary + fallbacks
@@ -180,7 +182,7 @@ export function startCallbackServer(expectedState, timeoutMs = 120000) {
const errors = [];
server = http.createServer((req, res) => {
- const url = new URL(req.url, `http://localhost:${actualPort}`);
+ const url = new URL(req.url, `http://${host === '0.0.0.0' ? 'localhost' : host}:${actualPort}`);
if (url.pathname !== '/oauth-callback') {
res.writeHead(404);
@@ -264,14 +266,14 @@ export function startCallbackServer(expectedState, timeoutMs = 120000) {
let boundSuccessfully = false;
for (const port of portsToTry) {
try {
- await tryBindPort(server, port);
+ await tryBindPort(server, port, host);
actualPort = port;
boundSuccessfully = true;
if (port !== OAUTH_CONFIG.callbackPort) {
logger.warn(`[OAuth] Primary port ${OAUTH_CONFIG.callbackPort} unavailable, using fallback port ${port}`);
} else {
- logger.info(`[OAuth] Callback server listening on port ${port}`);
+ logger.info(`[OAuth] Callback server listening on ${host}:${port}`);
}
break;
} catch (err) {
diff --git a/src/index.js b/src/index.js
index 5ebae6e..ec60504 100644
--- a/src/index.js
+++ b/src/index.js
@@ -46,12 +46,22 @@ if (isFallbackEnabled) {
export const FALLBACK_ENABLED = isFallbackEnabled;
const PORT = process.env.PORT || DEFAULT_PORT;
+const HOST = process.env.HOST || '0.0.0.0';
+
+if (process.env.HOST) {
+ logger.info(`[Startup] Using HOST environment variable: ${process.env.HOST}`);
+}
// Home directory for account storage
const HOME_DIR = os.homedir();
const CONFIG_DIR = path.join(HOME_DIR, '.antigravity-claude-proxy');
-const server = app.listen(PORT, () => {
+const server = app.listen(PORT, HOST, () => {
+ // Get actual bound address
+ const address = server.address();
+ const boundHost = typeof address === 'string' ? address : address.address;
+ const boundPort = typeof address === 'string' ? null : address.port;
+
// Clear console for a clean start
console.clear();
@@ -93,7 +103,8 @@ const server = app.listen(PORT, () => {
║ Antigravity Claude Proxy Server ║
╠══════════════════════════════════════════════════════════════╣
║ ║
-${border} ${align(`Server and WebUI running at: http://localhost:${PORT}`)}${border}
+${border} ${align(`Server and WebUI running at: http://${HOST === '0.0.0.0' ? 'localhost' : HOST}:${PORT}`)}${border}
+${border} ${align(`Bound to: ${boundHost}:${boundPort}`)}${border}
${statusSection}║ ║
${controlSection}
║ ║