fbshipit-source-id: cad5f527363fe09c2eea5b05ce1f3f2ecb86941b
This commit is contained in:
@@ -9,7 +9,6 @@ import type {ElementID, Element, ElementSearchResultSet} from 'sonar';
|
||||
import {
|
||||
colors,
|
||||
Glyph,
|
||||
GK,
|
||||
FlexRow,
|
||||
FlexColumn,
|
||||
Toolbar,
|
||||
@@ -540,17 +539,15 @@ export default class Layout extends SonarPlugin<InspectorState> {
|
||||
}
|
||||
/>
|
||||
</SearchIconContainer>
|
||||
{GK.get('sonar_layout_search') && (
|
||||
<SearchBox tabIndex={-1}>
|
||||
<SearchIcon
|
||||
name="magnifying-glass"
|
||||
color={colors.macOSTitleBarIcon}
|
||||
size={16}
|
||||
/>
|
||||
<LayoutSearchInput onSubmit={this.search.bind(this)} />
|
||||
{outstandingSearchQuery && <LoadingSpinner size={16} />}
|
||||
</SearchBox>
|
||||
)}
|
||||
<SearchBox tabIndex={-1}>
|
||||
<SearchIcon
|
||||
name="magnifying-glass"
|
||||
color={colors.macOSTitleBarIcon}
|
||||
size={16}
|
||||
/>
|
||||
<LayoutSearchInput onSubmit={this.search.bind(this)} />
|
||||
{outstandingSearchQuery && <LoadingSpinner size={16} />}
|
||||
</SearchBox>
|
||||
</Toolbar>
|
||||
<FlexRow fill={true}>
|
||||
{initialised ? (
|
||||
|
||||
@@ -8,7 +8,10 @@
|
||||
import LogManager from '../fb-stubs/Logger';
|
||||
const fs = require('fs');
|
||||
const adb = require('adbkit-fb');
|
||||
import {openssl} from './openssl-wrapper-with-promises';
|
||||
import {
|
||||
openssl,
|
||||
isInstalled as opensslInstalled,
|
||||
} from './openssl-wrapper-with-promises';
|
||||
const path = require('path');
|
||||
|
||||
// Desktop file paths
|
||||
@@ -68,6 +71,7 @@ export default class CertificateProvider {
|
||||
os: string,
|
||||
appDirectory: string,
|
||||
): Promise<void> {
|
||||
this.ensureOpenSSLIsAvailable();
|
||||
if (!appDirectory.match(allowedAppDirectoryRegex)) {
|
||||
return Promise.reject(
|
||||
new Error(
|
||||
@@ -98,6 +102,15 @@ export default class CertificateProvider {
|
||||
);
|
||||
}
|
||||
|
||||
ensureOpenSSLIsAvailable(): void {
|
||||
if (!opensslInstalled()) {
|
||||
const e = Error(
|
||||
"It looks like you don't have OpenSSL installed. Please install it to continue.",
|
||||
);
|
||||
this.server.emit('error', e);
|
||||
}
|
||||
}
|
||||
|
||||
getCACertificate(): Promise<string> {
|
||||
return new Promise((resolve, reject) => {
|
||||
fs.readFile(caCert, (err, data) => {
|
||||
@@ -121,7 +134,7 @@ export default class CertificateProvider {
|
||||
CAkey: caKey,
|
||||
CAcreateserial: true,
|
||||
}).then(cert => {
|
||||
fs.unlink(csrFile);
|
||||
fs.unlinkSync(csrFile);
|
||||
return cert;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
*/
|
||||
|
||||
import {exec as opensslWithCallback} from 'openssl-wrapper';
|
||||
const child_process = require('child_process');
|
||||
|
||||
export function openssl(action: string, options: {}): Promise<string> {
|
||||
return new Promise((resolve, reject) => {
|
||||
@@ -17,3 +18,7 @@ export function openssl(action: string, options: {}): Promise<string> {
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
export function isInstalled(): boolean {
|
||||
return !child_process.spawnSync('openssl', ['version']).error;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user