Merge pull request #532 from Tria-plc/dev

merge
This commit is contained in:
Abubeker Yasin
2026-07-08 09:58:11 +03:00
committed by GitHub
5 changed files with 28 additions and 4 deletions

View File

@@ -65,6 +65,8 @@ import { AppReleasesModule } from './modules/app-releases/app-releases.module';
import { ConfigurableFareModule } from './modules/configurable-fare/configurable-fare.module';
import { SegmentFareSeeder } from './seed/segment-fare.seeder';
import { EOtpType } from "@tria-plc/iamapi-common";
@Module({
imports: [
ThrottlerModule.forRoot([
@@ -97,6 +99,16 @@ import { SegmentFareSeeder } from './seed/segment-fare.seeder';
TriaIamModule.forRoot({
applications: [EDR_PASSENGER_APPLICATION],
permissions: EDR_PASSENGER_PERMISSIONS,
otpMessages: {
[EOtpType.MFA_LOGIN]: ({ otp }) =>
`Your EDR Passenger login code is ${otp}. It will expire in 5 minutes.`,
[EOtpType.VERIFY_PHONE_NUMBER]: ({ otp }) =>
`Your EDR Passenger phone verification code is ${otp}. It will expire in 5 minutes.`,
[EOtpType.RESET_PASSWORD]: ({ route }) =>
`Reset your EDR Passenger password using this link: ${route}`,
[EOtpType.SET_PASSWORD]: ({ route }) =>
`Set your EDR Passenger password using this link: ${route}`,
},
}),
SharedAuthModule,
PrismaModule,

View File

@@ -37,7 +37,9 @@ export function useSupportSocket(
`${SOCKET_ORIGIN}/${Passenger.PASSENGER_SUPPORT_WS_NAMESPACE}`,
{
auth: { token },
transports: ['websocket'],
// Prefer WebSocket, fall back to HTTP long-polling if the proxy blocks
// the upgrade (polling rides normal HTTPS, already CSP-allowed).
transports: ['websocket', 'polling'],
withCredentials: true,
},
);

View File

@@ -35,8 +35,12 @@ function buildCsp(nonce: string): string {
? `'self' 'nonce-${nonce}' 'strict-dynamic'`
: `'self' 'unsafe-inline' 'unsafe-eval'`;
// The Socket.IO WebSocket upgrade connects to wss://<api-host>; under CSP a
// `https://host` source does NOT cover `wss://host`, so add it explicitly.
const wsOrigin = apiOrigin.replace(/^http/, 'ws'); // https→wss, http→ws
const connectSrc = isProd
? `'self' ${apiOrigin}`.trim()
? `'self' ${apiOrigin} ${wsOrigin}`.trim()
: `'self' ${apiOrigin} ws: wss:`.trim();
const directives = [

View File

@@ -26,7 +26,9 @@ export function useSupportSocket(enabled: boolean) {
`${SOCKET_ORIGIN}/${Passenger.PASSENGER_SUPPORT_WS_NAMESPACE}`,
{
auth: { guestId: getDeviceId() },
transports: ['websocket'],
// Prefer WebSocket, fall back to HTTP long-polling if the proxy blocks
// the upgrade (polling rides normal HTTPS, already CSP-allowed).
transports: ['websocket', 'polling'],
withCredentials: true,
},
);

View File

@@ -48,8 +48,12 @@ function buildCsp(nonce: string): string {
? `'self' 'nonce-${nonce}' 'strict-dynamic'`
: `'self' 'unsafe-inline' 'unsafe-eval'`;
// The Socket.IO WebSocket upgrade connects to wss://<api-host>; under CSP a
// `https://host` source does NOT cover `wss://host`, so add it explicitly.
const wsOrigin = apiOrigin.replace(/^http/, 'ws'); // https→wss, http→ws
const connectSrc = isProd
? `'self' ${apiOrigin}`.trim()
? `'self' ${apiOrigin} ${wsOrigin}`.trim()
: `'self' ${apiOrigin} ws: wss:`.trim();
const directives = [