// SPDX-License-Identifier: AGPL-3.0
import { Dispatch } from "redux";
-import { setBreadcrumbs } from "~/store/breadcrumbs/breadcrumbs-actions";
-import { RootState } from "~/store/store";
-import { ServiceRepository, createServices, setAuthorizationHeader } from "~/services/services";
-import Axios from "axios";
-import { User, getUserDisplayName } from "~/models/user";
-import { authActions } from "~/store/auth/auth-action";
+import { setBreadcrumbs } from "store/breadcrumbs/breadcrumbs-actions";
+import { RootState } from "store/store";
+import { ServiceRepository, createServices, setAuthorizationHeader } from "services/services";
+import Axios, { AxiosInstance } from "axios";
+import { User, getUserDisplayName } from "models/user";
+import { authActions } from "store/auth/auth-action";
import {
Config, ClusterConfigJSON, CLUSTER_CONFIG_PATH, DISCOVERY_DOC_PATH,
buildConfig, mockClusterConfigJSON
-} from "~/common/config";
-import { normalizeURLPath } from "~/common/url";
-import { Session, SessionStatus } from "~/models/session";
-import { progressIndicatorActions } from "~/store/progress-indicator/progress-indicator-actions";
-import { AuthService } from "~/services/auth-service/auth-service";
-import { snackbarActions, SnackbarKind } from "~/store/snackbar/snackbar-actions";
-import * as jsSHA from "jssha";
+} from "common/config";
+import { normalizeURLPath } from "common/url";
+import { Session, SessionStatus } from "models/session";
+import { progressIndicatorActions } from "store/progress-indicator/progress-indicator-actions";
+import { AuthService } from "services/auth-service/auth-service";
+import { snackbarActions, SnackbarKind } from "store/snackbar/snackbar-actions";
+import jsSHA from "jssha";
const getClusterConfig = async (origin: string, apiClient: AxiosInstance): Promise<Config | null> => {
let configFromDD: Config | undefined;
configFromDD = {
baseUrl: normalizeURLPath(dd.baseUrl),
keepWebServiceUrl: dd.keepWebServiceUrl,
+ keepWebInlineServiceUrl: dd.keepWebInlineServiceUrl,
remoteHosts: dd.remoteHosts,
rootUrl: dd.rootUrl,
uuidPrefix: dd.uuidPrefix,
return null;
};
-const getRemoteHostConfig = async (remoteHost: string, useApiClient?: AxiosInstance): Promise<Config | null> => {
+export const getRemoteHostConfig = async (remoteHost: string, useApiClient?: AxiosInstance): Promise<Config | null> => {
const apiClient = useApiClient || Axios.create({ headers: {} });
let url = remoteHost;
throw new Error(invalidV2Token);
}
let salted = secret;
- if (uuid.substr(0, 5) !== clusterId) {
+ if (uuid.substring(0, 5) !== clusterId) {
shaObj.setHMACKey(secret, "TEXT");
shaObj.update(clusterId);
salted = shaObj.getHMAC("HEX");
const svc = createServices(config, { progressFn: () => { }, errorFn: () => { } });
setAuthorizationHeader(svc, saltedToken);
- const user = await svc.authService.getUserDetails();
+ const user = await svc.authService.getUserDetails(false);
return {
user,
token: saltedToken,
places in Workbench2. */
await dispatch(validateSession(session, activeSession, useApiClient));
} catch (e) {
- dispatch(snackbarActions.OPEN_SNACKBAR({
- message: e.message,
- kind: SnackbarKind.ERROR
- }));
+ // Don't do anything here. User may get
+ // spammed with multiple messages that are not
+ // helpful. They can see the individual
+ // errors by going to site manager and trying
+ // to toggle the session.
}
}
}
(dispatch: Dispatch<any>) => {
const sessions = authService.buildSessions(config, user);
dispatch(authActions.SET_SESSIONS(sessions));
- dispatch(validateSessions(authService.apiClient));
+ dispatch(validateSessions(authService.getApiClient()));
};
export const loadSiteManagerPanel = () =>