First pass on CI support
This commit is contained in:
parent
746e99b8c2
commit
990e501850
7 changed files with 55 additions and 19 deletions
|
@ -13,6 +13,7 @@
|
||||||
"updatesPublicKey": "05fd7dd3de7149dc0a127909fee7de0f7620ddd0de061b37a2c303e37de802a401",
|
"updatesPublicKey": "05fd7dd3de7149dc0a127909fee7de0f7620ddd0de061b37a2c303e37de802a401",
|
||||||
"sfuUrl": "https://sfu.voip.signal.org/",
|
"sfuUrl": "https://sfu.voip.signal.org/",
|
||||||
"updatesEnabled": false,
|
"updatesEnabled": false,
|
||||||
|
"enableCI": false,
|
||||||
"openDevTools": false,
|
"openDevTools": false,
|
||||||
"buildExpiration": 0,
|
"buildExpiration": 0,
|
||||||
"certificateAuthority": "-----BEGIN CERTIFICATE-----\nMIID7zCCAtegAwIBAgIJAIm6LatK5PNiMA0GCSqGSIb3DQEBBQUAMIGNMQswCQYD\nVQQGEwJVUzETMBEGA1UECAwKQ2FsaWZvcm5pYTEWMBQGA1UEBwwNU2FuIEZyYW5j\naXNjbzEdMBsGA1UECgwUT3BlbiBXaGlzcGVyIFN5c3RlbXMxHTAbBgNVBAsMFE9w\nZW4gV2hpc3BlciBTeXN0ZW1zMRMwEQYDVQQDDApUZXh0U2VjdXJlMB4XDTEzMDMy\nNTIyMTgzNVoXDTIzMDMyMzIyMTgzNVowgY0xCzAJBgNVBAYTAlVTMRMwEQYDVQQI\nDApDYWxpZm9ybmlhMRYwFAYDVQQHDA1TYW4gRnJhbmNpc2NvMR0wGwYDVQQKDBRP\ncGVuIFdoaXNwZXIgU3lzdGVtczEdMBsGA1UECwwUT3BlbiBXaGlzcGVyIFN5c3Rl\nbXMxEzARBgNVBAMMClRleHRTZWN1cmUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAw\nggEKAoIBAQDBSWBpOCBDF0i4q2d4jAXkSXUGpbeWugVPQCjaL6qD9QDOxeW1afvf\nPo863i6Crq1KDxHpB36EwzVcjwLkFTIMeo7t9s1FQolAt3mErV2U0vie6Ves+y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VHcxuFrEeBaYJbLE\nrwLV\n-----END CERTIFICATE-----\n",
|
||||||
|
|
|
@ -193,17 +193,7 @@
|
||||||
this.setDeviceNameDefault();
|
this.setDeviceNameDefault();
|
||||||
|
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
this.$('#link-phone').submit(e => {
|
const onDeviceName = name => {
|
||||||
e.stopPropagation();
|
|
||||||
e.preventDefault();
|
|
||||||
|
|
||||||
let name = this.$(DEVICE_NAME_SELECTOR).val();
|
|
||||||
name = name.replace(/\0/g, ''); // strip unicode null
|
|
||||||
if (name.trim().length === 0) {
|
|
||||||
this.$(DEVICE_NAME_SELECTOR).focus();
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.selectStep(Steps.PROGRESS_BAR);
|
this.selectStep(Steps.PROGRESS_BAR);
|
||||||
|
|
||||||
const finish = () => {
|
const finish = () => {
|
||||||
|
@ -227,6 +217,26 @@
|
||||||
);
|
);
|
||||||
return finish();
|
return finish();
|
||||||
});
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
if (window.CI) {
|
||||||
|
onDeviceName(window.CI.deviceName);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// eslint-disable-next-line consistent-return
|
||||||
|
this.$('#link-phone').submit(e => {
|
||||||
|
e.stopPropagation();
|
||||||
|
e.preventDefault();
|
||||||
|
|
||||||
|
let name = this.$(DEVICE_NAME_SELECTOR).val();
|
||||||
|
name = name.replace(/\0/g, ''); // strip unicode null
|
||||||
|
if (name.trim().length === 0) {
|
||||||
|
this.$(DEVICE_NAME_SELECTOR).focus();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
onDeviceName(name);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
20
main.js
20
main.js
|
@ -81,6 +81,8 @@ const importMode =
|
||||||
const development =
|
const development =
|
||||||
config.environment === 'development' || config.environment === 'staging';
|
config.environment === 'development' || config.environment === 'staging';
|
||||||
|
|
||||||
|
const enableCI = Boolean(config.get('enableCI'));
|
||||||
|
|
||||||
// We generally want to pull in our own modules after this point, after the user
|
// We generally want to pull in our own modules after this point, after the user
|
||||||
// data directory has been set.
|
// data directory has been set.
|
||||||
const attachments = require('./app/attachments');
|
const attachments = require('./app/attachments');
|
||||||
|
@ -221,7 +223,8 @@ function prepareURL(pathSegments, moreKeys) {
|
||||||
cdnUrl0: config.get('cdn').get('0'),
|
cdnUrl0: config.get('cdn').get('0'),
|
||||||
cdnUrl2: config.get('cdn').get('2'),
|
cdnUrl2: config.get('cdn').get('2'),
|
||||||
certificateAuthority: config.get('certificateAuthority'),
|
certificateAuthority: config.get('certificateAuthority'),
|
||||||
environment: config.environment,
|
environment: enableCI ? 'production' : config.environment,
|
||||||
|
enableCI,
|
||||||
node_version: process.versions.node,
|
node_version: process.versions.node,
|
||||||
hostname: os.hostname(),
|
hostname: os.hostname(),
|
||||||
appInstance: process.env.NODE_APP_INSTANCE,
|
appInstance: process.env.NODE_APP_INSTANCE,
|
||||||
|
@ -432,7 +435,7 @@ async function createWindow() {
|
||||||
mainWindow.loadURL(prepareURL([__dirname, 'background.html'], moreKeys));
|
mainWindow.loadURL(prepareURL([__dirname, 'background.html'], moreKeys));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.get('openDevTools')) {
|
if (!enableCI && config.get('openDevTools')) {
|
||||||
// Open the DevTools.
|
// Open the DevTools.
|
||||||
mainWindow.webContents.openDevTools();
|
mainWindow.webContents.openDevTools();
|
||||||
}
|
}
|
||||||
|
@ -956,7 +959,12 @@ app.on('ready', async () => {
|
||||||
// We use this event only a single time to log the startup time of the app
|
// We use this event only a single time to log the startup time of the app
|
||||||
// from when it's first ready until the loading screen disappears.
|
// from when it's first ready until the loading screen disappears.
|
||||||
ipc.once('signal-app-loaded', () => {
|
ipc.once('signal-app-loaded', () => {
|
||||||
console.log('App loaded - time:', Date.now() - startTime);
|
const loadTime = Date.now() - startTime;
|
||||||
|
console.log('App loaded - time:', loadTime);
|
||||||
|
|
||||||
|
if (enableCI) {
|
||||||
|
console._log('ci: app_loaded=%j', { loadTime });
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const userDataPath = await getRealPath(app.getPath('userData'));
|
const userDataPath = await getRealPath(app.getPath('userData'));
|
||||||
|
@ -1292,6 +1300,12 @@ app.on('will-finish-launching', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (enableCI) {
|
||||||
|
ipc.on('set-provisioning-url', (event, provisioningURL) => {
|
||||||
|
console._log('ci: provisioning_url=%j', provisioningURL);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
ipc.on('set-badge-count', (event, count) => {
|
ipc.on('set-badge-count', (event, count) => {
|
||||||
app.badgeCount = count;
|
app.badgeCount = count;
|
||||||
});
|
});
|
||||||
|
|
|
@ -518,6 +518,10 @@ try {
|
||||||
getRegionCode: () => window.storage.get('regionCode'),
|
getRegionCode: () => window.storage.get('regionCode'),
|
||||||
logger: window.log,
|
logger: window.log,
|
||||||
});
|
});
|
||||||
|
window.CI = config.enableCI && {
|
||||||
|
setProvisioningURL: url => ipc.send('set-provisioning-url', url),
|
||||||
|
deviceName: title,
|
||||||
|
};
|
||||||
|
|
||||||
// these need access to window.Signal:
|
// these need access to window.Signal:
|
||||||
require('./ts/models/messages');
|
require('./ts/models/messages');
|
||||||
|
|
|
@ -220,8 +220,9 @@ export default class AccountManager extends EventTarget {
|
||||||
encodeURIComponent(btoa(utils.getString(pubKey))),
|
encodeURIComponent(btoa(utils.getString(pubKey))),
|
||||||
].join('');
|
].join('');
|
||||||
|
|
||||||
// eslint-disable-next-line no-console
|
if (window.CI) {
|
||||||
console._log(`provisioning url ${url}`);
|
window.CI.setProvisioningURL(url);
|
||||||
|
}
|
||||||
|
|
||||||
setProvisioningUrl(url);
|
setProvisioningUrl(url);
|
||||||
request.respond(200, 'OK');
|
request.respond(200, 'OK');
|
||||||
|
|
|
@ -879,7 +879,7 @@
|
||||||
"rule": "jQuery-$(",
|
"rule": "jQuery-$(",
|
||||||
"path": "js/views/install_view.js",
|
"path": "js/views/install_view.js",
|
||||||
"line": " this.$('#link-phone').submit(e => {",
|
"line": " this.$('#link-phone').submit(e => {",
|
||||||
"lineNumber": 196,
|
"lineNumber": 228,
|
||||||
"reasonCategory": "usageTrusted",
|
"reasonCategory": "usageTrusted",
|
||||||
"updated": "2020-03-24T19:03:04.861Z",
|
"updated": "2020-03-24T19:03:04.861Z",
|
||||||
"reasonDetail": "Protected from arbitrary input"
|
"reasonDetail": "Protected from arbitrary input"
|
||||||
|
@ -888,7 +888,7 @@
|
||||||
"rule": "jQuery-$(",
|
"rule": "jQuery-$(",
|
||||||
"path": "js/views/install_view.js",
|
"path": "js/views/install_view.js",
|
||||||
"line": " let name = this.$(DEVICE_NAME_SELECTOR).val();",
|
"line": " let name = this.$(DEVICE_NAME_SELECTOR).val();",
|
||||||
"lineNumber": 200,
|
"lineNumber": 232,
|
||||||
"reasonCategory": "usageTrusted",
|
"reasonCategory": "usageTrusted",
|
||||||
"updated": "2020-03-24T19:03:04.861Z",
|
"updated": "2020-03-24T19:03:04.861Z",
|
||||||
"reasonDetail": "Protected from arbitrary input"
|
"reasonDetail": "Protected from arbitrary input"
|
||||||
|
@ -897,7 +897,7 @@
|
||||||
"rule": "jQuery-$(",
|
"rule": "jQuery-$(",
|
||||||
"path": "js/views/install_view.js",
|
"path": "js/views/install_view.js",
|
||||||
"line": " this.$(DEVICE_NAME_SELECTOR).focus();",
|
"line": " this.$(DEVICE_NAME_SELECTOR).focus();",
|
||||||
"lineNumber": 203,
|
"lineNumber": 235,
|
||||||
"reasonCategory": "usageTrusted",
|
"reasonCategory": "usageTrusted",
|
||||||
"updated": "2020-03-24T19:03:04.861Z",
|
"updated": "2020-03-24T19:03:04.861Z",
|
||||||
"reasonDetail": "Protected from arbitrary input"
|
"reasonDetail": "Protected from arbitrary input"
|
||||||
|
|
6
ts/window.d.ts
vendored
6
ts/window.d.ts
vendored
|
@ -259,6 +259,12 @@ declare global {
|
||||||
};
|
};
|
||||||
|
|
||||||
Backbone: typeof Backbone;
|
Backbone: typeof Backbone;
|
||||||
|
CI:
|
||||||
|
| {
|
||||||
|
setProvisioningURL: (url: string) => void;
|
||||||
|
deviceName: string;
|
||||||
|
}
|
||||||
|
| undefined;
|
||||||
Signal: {
|
Signal: {
|
||||||
Backbone: any;
|
Backbone: any;
|
||||||
AttachmentDownloads: {
|
AttachmentDownloads: {
|
||||||
|
|
Loading…
Reference in a new issue