diff --git a/scripts/build_deploy.ts b/scripts/build_deploy.ts index ac4c54c8..623e17ae 100755 --- a/scripts/build_deploy.ts +++ b/scripts/build_deploy.ts @@ -90,7 +90,7 @@ const build = (buildParameters: BuildParameters) => { */ return new Promise((resolve) => { /* Run npm run build for these parameters. */ - const proc = spawn('npm', ['run', 'build'], { timeout: 60000 }); + const proc = spawn('npm', ['run', 'build'], { timeout: 300000 }); /* Print stdout. This is not necessary, strictly speaking, but is a good * place to start if something goes wrong. @@ -126,7 +126,7 @@ const main = async () => { const hash = process.env.HASH || ''; const tag = process.env.TAG || ''; const keysSort = Object.keys(envs).sort(); - const maxWorkers = 4; + const maxWorkers = 2; /* Run at most maxWorkers builds at a time: */ const envGroups = chunk(keysSort, maxWorkers); /* Wait for each group of builds to run for each environment in the group. */ diff --git a/src/common/api/authService.ts b/src/common/api/authService.ts index 9b441398..9ba779dc 100644 --- a/src/common/api/authService.ts +++ b/src/common/api/authService.ts @@ -1,5 +1,5 @@ // import { store } from '../../app/store'; -import { Me } from '../types/auth'; +import { Me, MfaStatus } from '../types/auth'; import { uriEncodeTemplateTag as encode } from '../utils/stringUtils'; import { baseApi } from './index'; import { httpService } from './utils/serviceHelpers'; @@ -25,7 +25,7 @@ interface TokenResponse { type: string; user: string; cachefor: number; - mfa: 'USED' | 'NOT_USED' | 'UNKNOWN'; + mfa: MfaStatus; } interface AuthParams { @@ -159,7 +159,7 @@ interface AuthResults { device: string; ip: string; name?: string; - mfa: 'USED' | 'NOT_USED' | 'UNKNOWN'; + mfa: MfaStatus; }[]; user: string; revokeallurl: string; diff --git a/src/common/types/auth.ts b/src/common/types/auth.ts index 508377b3..52d0bbc2 100644 --- a/src/common/types/auth.ts +++ b/src/common/types/auth.ts @@ -1,4 +1,6 @@ /* types/auth */ +export type MfaStatus = 'Used' | 'NotUsed' | 'Unknown'; + export interface Me { anonid: string; created: number; diff --git a/src/features/account/LogInSessions.tsx b/src/features/account/LogInSessions.tsx index de6259a3..079ca831 100644 --- a/src/features/account/LogInSessions.tsx +++ b/src/features/account/LogInSessions.tsx @@ -15,18 +15,24 @@ import { } from '@mui/material'; import { FC } from 'react'; import { getTokens, revokeToken } from '../../common/api/authService'; +import { MfaStatus } from '../../common/types/auth'; import { Loader } from '../../common/components'; import { useAppSelector } from '../../common/hooks'; import { useLogout } from '../login/LogIn'; +const mfaConfig: Record< + MfaStatus, + { label: string; tooltip: string; color: string } +> = { + Used: { label: 'Y', tooltip: 'MFA used', color: 'green' }, + NotUsed: { label: 'N', tooltip: 'Single factor', color: 'red' }, + Unknown: { label: '?', tooltip: 'MFA status unknown', color: 'grey' }, +}; + export const MfaStatusIndicator: FC<{ - mfa: 'USED' | 'NOT_USED' | 'UNKNOWN'; + mfa: MfaStatus; }> = ({ mfa }) => { - const config = { - USED: { label: 'Y', tooltip: 'MFA used', color: 'green' }, - NOT_USED: { label: 'N', tooltip: 'Single factor', color: 'red' }, - UNKNOWN: { label: '?', tooltip: 'MFA status unknown', color: 'grey' }, - }[mfa]; + const config = mfaConfig[mfa]; return ( diff --git a/src/features/auth/authSlice.ts b/src/features/auth/authSlice.ts index a2df724e..33cf8d0d 100644 --- a/src/features/auth/authSlice.ts +++ b/src/features/auth/authSlice.ts @@ -1,7 +1,7 @@ import { createSlice, PayloadAction } from '@reduxjs/toolkit'; import { RootState } from '../../app/store'; import { revokeToken } from '../../common/api/authService'; -import { Me } from '../../common/types/auth'; +import { Me, MfaStatus } from '../../common/types/auth'; export interface TokenInfo { created: number; @@ -11,7 +11,7 @@ export interface TokenInfo { type: string; user: string; cachefor: number; - mfa: 'USED' | 'NOT_USED' | 'UNKNOWN'; + mfa: MfaStatus; } interface AuthState {