mirror of
https://github.com/finos/SymphonyElectron.git
synced 2025-02-25 18:55:29 -06:00
SDA-3565 Citrix media redirection presence update (#1339)
This commit is contained in:
committed by
GitHub
parent
bf86783621
commit
e028ac0efa
@@ -61,11 +61,13 @@ class Script
|
||||
new Dir(@"%ProgramFiles%\" + productName,
|
||||
new File(new Id("symphony_exe"), @"..\..\..\dist\win-unpacked\Symphony.exe",
|
||||
// Create two shortcuts to the main Symphony.exe file, one on the desktop and one in the program menu
|
||||
new FileShortcut(productName, @"%Desktop%") {
|
||||
new FileShortcut(productName, @"%Desktop%")
|
||||
{
|
||||
IconFile = @"..\..\..\images\icon.ico",
|
||||
Arguments = userDataPathArgument
|
||||
},
|
||||
new FileShortcut(productName, @"%ProgramMenu%") {
|
||||
new FileShortcut(productName, @"%ProgramMenu%")
|
||||
{
|
||||
IconFile = @"..\..\..\images\icon.ico",
|
||||
Arguments = userDataPathArgument
|
||||
}
|
||||
@@ -328,7 +330,8 @@ class Script
|
||||
// Try to close all running symphony instances before installing. Since we have started using the EndSession message to tell the app to exit,
|
||||
// we don't really need to force terminate anymore. But the older versions of SDA does not listen for the EndSession event, so we still need
|
||||
// this code to ensure older versions gets shut down properly.
|
||||
System.Diagnostics.Process.GetProcessesByName("Symphony").ForEach(p => {
|
||||
System.Diagnostics.Process.GetProcessesByName("Symphony").ForEach(p =>
|
||||
{
|
||||
if (System.IO.Path.GetFileName(p.MainModule.FileName) == "Symphony.exe")
|
||||
{
|
||||
if (!p.HasExited)
|
||||
@@ -345,7 +348,8 @@ class Script
|
||||
// We always seem to get this specific exception triggered, but the application still close down correctly.
|
||||
// The exception description is "Only part of a ReadProcessMemory or WriteProcessMemory request was completed".
|
||||
// We ignore that specific exception, so as not to put false error outputs into the log.
|
||||
if (ex.NativeErrorCode != 299) {
|
||||
if (ex.NativeErrorCode != 299)
|
||||
{
|
||||
e.Session.Log("Error trying to close all Symphony instances: " + ex.ToString());
|
||||
}
|
||||
}
|
||||
@@ -554,7 +558,8 @@ public class CustomActions
|
||||
{
|
||||
System.Diagnostics.Process process = new System.Diagnostics.Process();
|
||||
process.StartInfo.FileName = System.IO.Path.Combine(session.Property("INSTALLDIR"), "Symphony.exe");
|
||||
if( session.Property("USER_DATA_PATH") != "" ) {
|
||||
if (session.Property("USER_DATA_PATH") != "")
|
||||
{
|
||||
process.StartInfo.Arguments = "--userDataPath=\"" + session.Property("USER_DATA_PATH") + "\"";
|
||||
}
|
||||
process.Start();
|
||||
|
||||
6
package-lock.json
generated
6
package-lock.json
generated
@@ -18114,6 +18114,12 @@
|
||||
"integrity": "sha1-tDFbtCFKPXBY6+7okuE/ok2YsHU=",
|
||||
"dev": true
|
||||
},
|
||||
"winreg": {
|
||||
"version": "1.2.4",
|
||||
"resolved": "https://repo.symphony.com/artifactory/api/npm/npm-virtual-dev/winreg/-/winreg-1.2.4.tgz",
|
||||
"integrity": "sha1-ugZWKbepJRMOFXeRCM9UCZDpjRs=",
|
||||
"optional": true
|
||||
},
|
||||
"word-wrap": {
|
||||
"version": "1.2.3",
|
||||
"resolved": "https://repo.symphony.com/artifactory/api/npm/npm-virtual-dev/word-wrap/-/word-wrap-1.2.3.tgz",
|
||||
|
||||
@@ -179,7 +179,8 @@
|
||||
"auto-update": "file:auto_update",
|
||||
"screen-snippet": "git+https://github.com/symphonyoss/ScreenSnippet2.git#9.2.2",
|
||||
"screen-share-indicator-frame": "git+https://github.com/symphonyoss/ScreenShareIndicatorFrame.git#v1.4.10",
|
||||
"swift-search": "2.0.3"
|
||||
"swift-search": "2.0.3",
|
||||
"winreg": "^1.2.4"
|
||||
},
|
||||
"ava": {
|
||||
"failFast": true,
|
||||
|
||||
69
spec/citrixHandler.spec.ts
Normal file
69
spec/citrixHandler.spec.ts
Normal file
@@ -0,0 +1,69 @@
|
||||
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);
|
||||
});
|
||||
});
|
||||
66
src/app/citrix-handler.ts
Normal file
66
src/app/citrix-handler.ts
Normal file
@@ -0,0 +1,66 @@
|
||||
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 = 'MSTeamsRedirectionSupport';
|
||||
|
||||
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) => {
|
||||
logger.info('citrix: ', 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);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user