mirror of
https://github.com/finos/SymphonyElectron.git
synced 2025-02-25 18:55:29 -06:00
Remove Citrix code (#2220)
This commit is contained in:
parent
f9baa9d453
commit
5488ef8452
@ -1,69 +0,0 @@
|
||||
import {
|
||||
getCitrixMediaRedirectionStatus,
|
||||
RedirectionStatus,
|
||||
} from '../src/app/citrix-handler';
|
||||
|
||||
let regKeyValue;
|
||||
|
||||
jest.mock('winreg', () => {
|
||||
return jest.fn().mockImplementation(() => {
|
||||
return {
|
||||
get: (_file, callback) => callback(null, regKeyValue),
|
||||
};
|
||||
});
|
||||
});
|
||||
|
||||
jest.mock('../src/common/env', () => {
|
||||
return {
|
||||
isWindowsOS: true,
|
||||
isLinux: false,
|
||||
isMac: false,
|
||||
isDevEnv: true,
|
||||
};
|
||||
});
|
||||
|
||||
describe('citrix handler', () => {
|
||||
beforeEach(() => {
|
||||
jest.clearAllMocks().resetModules();
|
||||
});
|
||||
|
||||
it('status inactive', async () => {
|
||||
regKeyValue = null;
|
||||
const status = await getCitrixMediaRedirectionStatus();
|
||||
expect(status).toBe(RedirectionStatus.INACTIVE);
|
||||
});
|
||||
|
||||
it('should return supported when having the right registry with value 1', async () => {
|
||||
regKeyValue = { value: '0x01', type: 'REG_DWORD' };
|
||||
const status = await getCitrixMediaRedirectionStatus();
|
||||
expect(status).toBe(RedirectionStatus.SUPPORTED);
|
||||
});
|
||||
|
||||
it('should return unsupported when having the right registry with the wrong registry type', async () => {
|
||||
regKeyValue = { value: '0x01', type: 'REG_BINARY' };
|
||||
const status = await getCitrixMediaRedirectionStatus();
|
||||
expect(status).toBe(RedirectionStatus.UNSUPPORTED);
|
||||
});
|
||||
|
||||
it('should return unsupported when finding the right registry with value 0 ', async () => {
|
||||
regKeyValue = { value: '0x00', type: 'REG_DWORD' };
|
||||
const status = await getCitrixMediaRedirectionStatus();
|
||||
expect(status).toBe(RedirectionStatus.UNSUPPORTED);
|
||||
});
|
||||
|
||||
it('should return inactive on non windows Oses', async () => {
|
||||
jest.mock('../src/common/env', () => {
|
||||
return {
|
||||
isWindowsOS: false,
|
||||
isLinux: true,
|
||||
isMac: false,
|
||||
};
|
||||
});
|
||||
const {
|
||||
getCitrixMediaRedirectionStatus,
|
||||
RedirectionStatus,
|
||||
} = require('../src/app/citrix-handler');
|
||||
const status = await getCitrixMediaRedirectionStatus();
|
||||
expect(status).toBe(RedirectionStatus.INACTIVE);
|
||||
});
|
||||
});
|
@ -1,65 +0,0 @@
|
||||
import { isWindowsOS } from '../common/env';
|
||||
import { logger } from '../common/logger';
|
||||
|
||||
export enum RedirectionStatus {
|
||||
/**
|
||||
* Citrix virtual environment is not active
|
||||
*/
|
||||
INACTIVE = 'inactive',
|
||||
|
||||
/**
|
||||
* Citrix virtual environment is active and media redirection is supported
|
||||
*/
|
||||
SUPPORTED = 'supported',
|
||||
|
||||
/**
|
||||
* Citrix virtual environment is active but media redirection is not supported
|
||||
*/
|
||||
UNSUPPORTED = 'unsupported',
|
||||
}
|
||||
|
||||
export enum RegistryValueType {
|
||||
REG_DWORD = 'REG_DWORD',
|
||||
}
|
||||
|
||||
const CITRIX_REGISTRY_KEY = '\\Software\\Citrix\\HDXMediaStream';
|
||||
const CITRIX_REGISTRY_KEY_NAME = 'MSTeamsRedirSupport';
|
||||
|
||||
export const getCitrixMediaRedirectionStatus = async (): Promise<RedirectionStatus> => {
|
||||
if (!isWindowsOS) {
|
||||
// Citrix virtual environments are not supported on non-Windows OSes
|
||||
return RedirectionStatus.INACTIVE;
|
||||
}
|
||||
const Registry = require('winreg');
|
||||
|
||||
const regKey = new Registry({
|
||||
hive: Registry.HKCU,
|
||||
key: CITRIX_REGISTRY_KEY,
|
||||
});
|
||||
|
||||
return new Promise((resolve, _reject) => {
|
||||
regKey.get(CITRIX_REGISTRY_KEY_NAME, (err, redirectionSupportItem) => {
|
||||
if (err) {
|
||||
logger.info('citrix-handler: error occurred. Details: ', err);
|
||||
resolve(RedirectionStatus.INACTIVE);
|
||||
} else {
|
||||
if (!redirectionSupportItem) {
|
||||
resolve(RedirectionStatus.INACTIVE);
|
||||
}
|
||||
if (redirectionSupportItem.type === 'REG_DWORD') {
|
||||
const redirectionSupportValue = parseInt(
|
||||
redirectionSupportItem.value,
|
||||
16,
|
||||
);
|
||||
if (redirectionSupportValue === 1) {
|
||||
resolve(RedirectionStatus.SUPPORTED);
|
||||
} else {
|
||||
resolve(RedirectionStatus.UNSUPPORTED);
|
||||
}
|
||||
} else {
|
||||
resolve(RedirectionStatus.UNSUPPORTED);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
@ -25,7 +25,6 @@ import appStateHandler from './app-state-handler';
|
||||
import { analytics } from './bi/analytics-handler';
|
||||
import { closeC9Pipe, connectC9Pipe, writeC9Pipe } from './c9-pipe-handler';
|
||||
import { loadC9Shell, terminateC9Shell } from './c9-shell-handler';
|
||||
import { getCitrixMediaRedirectionStatus } from './citrix-handler';
|
||||
import { CloudConfigDataTypes, config, ICloudConfig } from './config-handler';
|
||||
import { downloadHandler } from './download-handler';
|
||||
import { getContentWindowHandle } from './hwnd-handler';
|
||||
@ -620,8 +619,6 @@ ipcMain.handle(
|
||||
return getContentWindowHandle(windowHandle);
|
||||
}
|
||||
break;
|
||||
case apiCmds.getCitrixMediaRedirectionStatus:
|
||||
return getCitrixMediaRedirectionStatus();
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -66,7 +66,6 @@ export enum apiCmds {
|
||||
handleSwiftSearchMessageEvents = 'handle-shift-search-message-events',
|
||||
onSwiftSearchMessage = 'on-shift-search-message',
|
||||
getNativeWindowHandle = 'get-native-window-handle',
|
||||
getCitrixMediaRedirectionStatus = 'get-citrix-media-redirection-status',
|
||||
getSources = 'getSources',
|
||||
launchCloud9 = 'launch-cloud9',
|
||||
terminateCloud9 = 'terminate-cloud9',
|
||||
|
@ -108,6 +108,7 @@
|
||||
</style>
|
||||
<link rel="stylesheet" href="download-manager.css" />
|
||||
</head>
|
||||
|
||||
<body style="background-color: white">
|
||||
<h1>Symphony Electron API Demo</h1>
|
||||
<div class="origin-reminder">
|
||||
@ -539,13 +540,6 @@ Writes some thing to the file</textarea
|
||||
<input type="text" id="text-window-handle" />
|
||||
<hr />
|
||||
<br />
|
||||
|
||||
<hr />
|
||||
<p>Citrix Media Redirection Status:</p>
|
||||
<button id="get-citrix-media-redir">Get status</button>
|
||||
<input type="text" id="text-citrix-media-redir" />
|
||||
<hr />
|
||||
<br />
|
||||
</body>
|
||||
<script>
|
||||
const inputs = document.querySelectorAll('input');
|
||||
@ -599,7 +593,6 @@ Writes some thing to the file</textarea
|
||||
checkMediaPermission: 'check-media-permission',
|
||||
restartApp: 'restart-app',
|
||||
getNativeWindowHandle: 'get-native-window-handle',
|
||||
getCitrixMediaRedirectionStatus: 'get-citrix-media-redirection-status',
|
||||
};
|
||||
let requestId = 0;
|
||||
|
||||
@ -1577,22 +1570,5 @@ Writes some thing to the file</textarea
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
document
|
||||
.getElementById('get-citrix-media-redir')
|
||||
.addEventListener('click', () => {
|
||||
const resultCallback = (status) => {
|
||||
document.getElementById('text-citrix-media-redir').value = status;
|
||||
};
|
||||
if (window.ssf) {
|
||||
window.ssf.getCitrixMediaRedirectionStatus().then(resultCallback);
|
||||
} else if (window.manaSSF) {
|
||||
window.manaSSF.getCitrixMediaRedirectionStatus().then(resultCallback);
|
||||
} else {
|
||||
postRequest(apiCmds.getCitrixMediaRedirectionStatus, null, {
|
||||
successCallback: resultCallback,
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</html>
|
||||
|
@ -93,8 +93,6 @@ if (ssfWindow.ssf) {
|
||||
getZoomLevel: ssfWindow.ssf.getZoomLevel,
|
||||
supportedSettings: ssfWindow.ssf.supportedSettings,
|
||||
getNativeWindowHandle: ssfWindow.ssf.getNativeWindowHandle,
|
||||
getCitrixMediaRedirectionStatus:
|
||||
ssfWindow.ssf.getCitrixMediaRedirectionStatus,
|
||||
registerClientBanner: ssfWindow.ssf.registerClientBanner,
|
||||
launchCloud9: ssfWindow.ssf.launchCloud9,
|
||||
terminateCloud9: ssfWindow.ssf.terminateCloud9,
|
||||
|
@ -7,7 +7,6 @@ import {
|
||||
} from '../../package.json';
|
||||
import { AutoUpdateTrigger } from '../app/auto-update-handler';
|
||||
import { IShellStatus } from '../app/c9-shell-handler';
|
||||
import { RedirectionStatus } from '../app/citrix-handler';
|
||||
import { IDownloadItem } from '../app/download-handler';
|
||||
import {
|
||||
apiCmds,
|
||||
@ -827,16 +826,6 @@ export class SSFApi {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the current status of Citrix' media redirection feature
|
||||
* @returns status
|
||||
*/
|
||||
public getCitrixMediaRedirectionStatus(): Promise<RedirectionStatus> {
|
||||
return ipcRenderer.invoke(apiName.symphonyApi, {
|
||||
cmd: apiCmds.getCitrixMediaRedirectionStatus,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows JS to register a function to display a client banner
|
||||
* @param callback
|
||||
|
Loading…
Reference in New Issue
Block a user