Initial motionEye commit.
This commit is contained in:
+12
-13
@@ -11,23 +11,22 @@ export const getEndpointAddressOrDispatchError = async (
|
||||
endpoint: CameraEndpoint,
|
||||
expires?: number,
|
||||
): Promise<string | null> => {
|
||||
let address: string | null;
|
||||
if (!endpoint.sign) {
|
||||
address = endpoint.endpoint;
|
||||
} else {
|
||||
let response: string | null | undefined;
|
||||
try {
|
||||
response = await homeAssistantSignPath(hass, endpoint.endpoint, expires);
|
||||
} catch (e) {
|
||||
errorToConsole(e as Error);
|
||||
return null;
|
||||
}
|
||||
address = response ? response.replace(/^http/i, 'ws') : null;
|
||||
return endpoint.endpoint;
|
||||
}
|
||||
|
||||
if (!address) {
|
||||
let response: string | null | undefined;
|
||||
try {
|
||||
response = await homeAssistantSignPath(hass, endpoint.endpoint, expires);
|
||||
} catch (e) {
|
||||
errorToConsole(e as Error);
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!response) {
|
||||
dispatchErrorMessageEvent(element, localize('error.failed_sign'));
|
||||
return null;
|
||||
}
|
||||
return address;
|
||||
|
||||
return response.replace(/^http/i, 'ws');
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user