Skip to content

Commit 70799cf

Browse files
committed
Merge branch 'dev-adwaitha'
2 parents ba70e4a + c4de757 commit 70799cf

5 files changed

Lines changed: 30 additions & 13 deletions

File tree

.github/workflows/ci-cd-pipeline.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ jobs:
5050
${{ runner.os }}-pnpm-server-
5151
5252
- name: Install dependencies
53-
run: pnpm install --no-frozen-lockfile
53+
run: pnpm install --frozen-lockfile
5454
working-directory: .
5555

5656
- name: TypeScript compile check
@@ -59,10 +59,10 @@ jobs:
5959
- name: Run server tests
6060
run: npm test || true
6161
env:
62-
SUPABASE_URL: ${{ secrets.SUPABASE_URL || 'https://placeholder.supabase.co' }}
63-
SUPABASE_KEY: ${{ secrets.SUPABASE_KEY || 'placeholder-key' }}
64-
SUPABASE_SERVICE_KEY: ${{ secrets.SUPABASE_SERVICE_KEY || 'placeholder-service-key' }}
65-
JWT_SECRET: ${{ secrets.JWT_SECRET || 'ci-test-jwt-secret' }}
62+
SUPABASE_URL: ${{ secrets.SUPABASE_URL }}
63+
SUPABASE_KEY: ${{ secrets.SUPABASE_KEY }}
64+
SUPABASE_SERVICE_KEY: ${{ secrets.SUPABASE_SERVICE_KEY }}
65+
JWT_SECRET: ${{ secrets.JWT_SECRET }}
6666
NODE_ENV: test
6767

6868
# ──────────────────────────────────────────────────────────
@@ -98,7 +98,7 @@ jobs:
9898
${{ runner.os }}-pnpm-client-
9999
100100
- name: Install dependencies
101-
run: pnpm install --no-frozen-lockfile
101+
run: pnpm install --frozen-lockfile
102102
working-directory: .
103103

104104
- name: Lint
@@ -107,8 +107,8 @@ jobs:
107107
- name: Build (type check + bundle)
108108
run: npm run build
109109
env:
110-
NEXT_PUBLIC_SUPABASE_URL: ${{ secrets.NEXT_PUBLIC_SUPABASE_URL || 'https://placeholder.supabase.co' }}
111-
NEXT_PUBLIC_SUPABASE_ANON_KEY: ${{ secrets.NEXT_PUBLIC_SUPABASE_ANON_KEY || 'placeholder-anon-key' }}
110+
NEXT_PUBLIC_SUPABASE_URL: ${{ secrets.NEXT_PUBLIC_SUPABASE_URL }}
111+
NEXT_PUBLIC_SUPABASE_ANON_KEY: ${{ secrets.NEXT_PUBLIC_SUPABASE_ANON_KEY }}
112112
NEXT_PUBLIC_API_URL: http://localhost:5000/api
113113

114114
# ──────────────────────────────────────────────────────────
@@ -133,7 +133,7 @@ jobs:
133133
version: 9
134134

135135
- name: Install dependencies
136-
run: pnpm install --no-frozen-lockfile
136+
run: pnpm install --frozen-lockfile
137137

138138
- name: Audit server dependencies
139139
run: cd server && pnpm audit --audit-level=high || true

client/src/hooks/useSocket.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,13 @@ interface UseSocketOptions {
5050
}
5151

5252
export function useSocket(options: UseSocketOptions = {}) {
53+
const defaultUrl = process.env.NEXT_PUBLIC_SOCKET_URL || "http://localhost:3001";
54+
const dynamicUrl = typeof window !== 'undefined' && defaultUrl.includes('localhost') && window.location.hostname !== 'localhost'
55+
? defaultUrl.replace('localhost', window.location.hostname)
56+
: defaultUrl;
57+
5358
const {
54-
url = process.env.NEXT_PUBLIC_SOCKET_URL || "http://localhost:3001",
59+
url = dynamicUrl,
5560
autoConnect = true,
5661
reconnection = true,
5762
reconnectionAttempts = 5,

client/src/lib/api.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,15 @@
99
import axios, { AxiosError, AxiosInstance } from 'axios';
1010

1111
const getApiUrl = () => {
12-
return process.env.NEXT_PUBLIC_API_URL || 'http://localhost:3001/api/v1';
12+
const envUrl = process.env.NEXT_PUBLIC_API_URL || 'http://localhost:3001/api/v1';
13+
14+
// If we're executing in the browser and accessing via a network IP,
15+
// dynamically replace localhost with the actual hostname so mobile devices can reach the backend
16+
if (typeof window !== 'undefined' && envUrl.includes('localhost') && window.location.hostname !== 'localhost') {
17+
return envUrl.replace('localhost', window.location.hostname);
18+
}
19+
20+
return envUrl;
1321
};
1422

1523
const API_URL = getApiUrl();

client/src/lib/dateUtils.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,12 @@ export function dateToApiFormat(date: Date): string {
7474
*/
7575
export function getCurrentIST(): Date {
7676
const now = new Date();
77-
// Shift by 5.5 hours to match server side
78-
return new Date(now.getTime() + (5.5 * 60 * 60 * 1000));
77+
// Shift by 5.5 hours to get the actual IST time footprint
78+
const istTime = new Date(now.getTime() + (5.5 * 60 * 60 * 1000));
79+
// Convert to ISO string to preserve the IST time values in UTC representation
80+
const iso = istTime.toISOString();
81+
// Strip the Z to parse as a local Date - aligns perfectly with utcToIstShifted
82+
return new Date(iso.replace('Z', ''));
7983
}
8084

8185
/**

server/out.json

36.5 KB
Binary file not shown.

0 commit comments

Comments
 (0)