mirror of
https://github.com/hansjone/dsh-im-ops.git
synced 2026-10-09 01:43:14 +08:00
11 lines
446 B
JavaScript
11 lines
446 B
JavaScript
const RPC_AUTHORITIES = new Set(['loopback', 'trusted-host']);
|
|
|
|
/**
|
|
* Resolve the browser authority accepted by an IM management RPC channel.
|
|
* The default keeps credential and bot-management operations on loopback.
|
|
*/
|
|
export function resolveRpcAuthority(value) {
|
|
if (value === undefined) return 'loopback';
|
|
if (RPC_AUTHORITIES.has(value)) return value;
|
|
throw new TypeError('dsh-im rpcAuthority must be "loopback" or "trusted-host"');
|
|
}
|