This commit is contained in:
proddy
2021-05-14 12:45:57 +02:00
parent 15df0c0552
commit fec5ff3132
108 changed files with 3508 additions and 2455 deletions

View File

@@ -1,24 +1,24 @@
import { ENDPOINT_ROOT } from './Env'
import { ENDPOINT_ROOT } from './Env';
export const FEATURES_ENDPOINT = ENDPOINT_ROOT + 'features'
export const NTP_STATUS_ENDPOINT = ENDPOINT_ROOT + 'ntpStatus'
export const NTP_SETTINGS_ENDPOINT = ENDPOINT_ROOT + 'ntpSettings'
export const TIME_ENDPOINT = ENDPOINT_ROOT + 'time'
export const AP_SETTINGS_ENDPOINT = ENDPOINT_ROOT + 'apSettings'
export const AP_STATUS_ENDPOINT = ENDPOINT_ROOT + 'apStatus'
export const SCAN_NETWORKS_ENDPOINT = ENDPOINT_ROOT + 'scanNetworks'
export const LIST_NETWORKS_ENDPOINT = ENDPOINT_ROOT + 'listNetworks'
export const NETWORK_SETTINGS_ENDPOINT = ENDPOINT_ROOT + 'networkSettings'
export const NETWORK_STATUS_ENDPOINT = ENDPOINT_ROOT + 'networkStatus'
export const OTA_SETTINGS_ENDPOINT = ENDPOINT_ROOT + 'otaSettings'
export const UPLOAD_FIRMWARE_ENDPOINT = ENDPOINT_ROOT + 'uploadFirmware'
export const MQTT_SETTINGS_ENDPOINT = ENDPOINT_ROOT + 'mqttSettings'
export const MQTT_STATUS_ENDPOINT = ENDPOINT_ROOT + 'mqttStatus'
export const SYSTEM_STATUS_ENDPOINT = ENDPOINT_ROOT + 'systemStatus'
export const SIGN_IN_ENDPOINT = ENDPOINT_ROOT + 'signIn'
export const FEATURES_ENDPOINT = ENDPOINT_ROOT + 'features';
export const NTP_STATUS_ENDPOINT = ENDPOINT_ROOT + 'ntpStatus';
export const NTP_SETTINGS_ENDPOINT = ENDPOINT_ROOT + 'ntpSettings';
export const TIME_ENDPOINT = ENDPOINT_ROOT + 'time';
export const AP_SETTINGS_ENDPOINT = ENDPOINT_ROOT + 'apSettings';
export const AP_STATUS_ENDPOINT = ENDPOINT_ROOT + 'apStatus';
export const SCAN_NETWORKS_ENDPOINT = ENDPOINT_ROOT + 'scanNetworks';
export const LIST_NETWORKS_ENDPOINT = ENDPOINT_ROOT + 'listNetworks';
export const NETWORK_SETTINGS_ENDPOINT = ENDPOINT_ROOT + 'networkSettings';
export const NETWORK_STATUS_ENDPOINT = ENDPOINT_ROOT + 'networkStatus';
export const OTA_SETTINGS_ENDPOINT = ENDPOINT_ROOT + 'otaSettings';
export const UPLOAD_FIRMWARE_ENDPOINT = ENDPOINT_ROOT + 'uploadFirmware';
export const MQTT_SETTINGS_ENDPOINT = ENDPOINT_ROOT + 'mqttSettings';
export const MQTT_STATUS_ENDPOINT = ENDPOINT_ROOT + 'mqttStatus';
export const SYSTEM_STATUS_ENDPOINT = ENDPOINT_ROOT + 'systemStatus';
export const SIGN_IN_ENDPOINT = ENDPOINT_ROOT + 'signIn';
export const VERIFY_AUTHORIZATION_ENDPOINT =
ENDPOINT_ROOT + 'verifyAuthorization'
export const SECURITY_SETTINGS_ENDPOINT = ENDPOINT_ROOT + 'securitySettings'
export const GENERATE_TOKEN_ENDPOINT = ENDPOINT_ROOT + 'generateToken'
export const RESTART_ENDPOINT = ENDPOINT_ROOT + 'restart'
export const FACTORY_RESET_ENDPOINT = ENDPOINT_ROOT + 'factoryReset'
ENDPOINT_ROOT + 'verifyAuthorization';
export const SECURITY_SETTINGS_ENDPOINT = ENDPOINT_ROOT + 'securitySettings';
export const GENERATE_TOKEN_ENDPOINT = ENDPOINT_ROOT + 'generateToken';
export const RESTART_ENDPOINT = ENDPOINT_ROOT + 'restart';
export const FACTORY_RESET_ENDPOINT = ENDPOINT_ROOT + 'factoryReset';

View File

@@ -1,24 +1,24 @@
export const PROJECT_NAME = process.env.REACT_APP_PROJECT_NAME!
export const PROJECT_PATH = process.env.REACT_APP_PROJECT_PATH!
export const PROJECT_NAME = process.env.REACT_APP_PROJECT_NAME!;
export const PROJECT_PATH = process.env.REACT_APP_PROJECT_PATH!;
export const ENDPOINT_ROOT = calculateEndpointRoot('/rest/')
export const WEB_SOCKET_ROOT = calculateWebSocketRoot('/ws/')
export const ENDPOINT_ROOT = calculateEndpointRoot('/rest/');
export const WEB_SOCKET_ROOT = calculateWebSocketRoot('/ws/');
function calculateEndpointRoot(endpointPath: string) {
const httpRoot = process.env.REACT_APP_HTTP_ROOT
const httpRoot = process.env.REACT_APP_HTTP_ROOT;
if (httpRoot) {
return httpRoot + endpointPath
return httpRoot + endpointPath;
}
const location = window.location
return location.protocol + '//' + location.host + endpointPath
const location = window.location;
return location.protocol + '//' + location.host + endpointPath;
}
function calculateWebSocketRoot(webSocketPath: string) {
const webSocketRoot = process.env.REACT_APP_WEB_SOCKET_ROOT
const webSocketRoot = process.env.REACT_APP_WEB_SOCKET_ROOT;
if (webSocketRoot) {
return webSocketRoot + webSocketPath
return webSocketRoot + webSocketPath;
}
const location = window.location
const webProtocol = location.protocol === 'https:' ? 'wss:' : 'ws:'
return webProtocol + '//' + location.host + webSocketPath
const location = window.location;
const webProtocol = location.protocol === 'https:' ? 'wss:' : 'ws:';
return webProtocol + '//' + location.host + webSocketPath;
}

View File

@@ -1,2 +1,2 @@
export * from './Env'
export * from './Endpoints'
export * from './Env';
export * from './Endpoints';