mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-27 07:22:53 +00:00
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
},
|
||||
);
|
||||
|
||||
@@ -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 = [
|
||||
|
||||
@@ -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,
|
||||
},
|
||||
);
|
||||
|
||||
@@ -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 = [
|
||||
|
||||
Reference in New Issue
Block a user