'use strict' ; import { Router , RequestHandler , Request , Response , NextFunction } from 'express' ; import { setupMetaverseAPI , finishMetaverseAPI } from '@Route-Tools/middleware' ; import { domainFromParams , domainAPIkeyFromBody , verifyDomainAccess } from '@Route-Tools/middleware' ; import { Logger } from '@Tools/Logging' ; import { Domains } from '@Entities/Domains' ; const procPutDomainsIceServerAddress = async ( req , resp , next ) => { Logger . debug ( 'procPutDomainsIceServerAddress' ) ; if ( req . vDomain ) { if ( req . body && req . body . domain && req . body . domain . ice_server_address ) { const updates = { 'iceServerAddr' : req . body . domain . ice_server_address } ; Domains . updateEntityFields ( req . vDomain , updates ) ; } ; } else { req . vRestResp . respondFailure ( req . vDomainError ?? 'unauthorized' ) ; } ; next ( ) ; } ; export const name = '/api/v1/domains/:domainId/ice_server_address' ; export const router = Router ( ) ; router . put ( '/api/v1/domains/:domainId/ice_server_address' , [ setupMetaverseAPI , domainFromParams , domainAPIkeyFromBody , verifyDomainAccess , procPutDomainsIceServerAddress , finishMetaverseAPI ] ) ;