mirror of
https://github.com/keymanapp/keyman.git
synced 2026-08-23 00:37:41 +00:00
fix(developer): address review comments
Co-authored-by: Darcy Wong <darcy_wong@sil.org> Co-authored-by: Eberhard Beilharz <ermshiperete@users.noreply.github.com>
This commit is contained in:
parent
058df11f0c
commit
b2dbd357b8
3 changed files with 32 additions and 29 deletions
|
|
@ -8,7 +8,6 @@ export class Configuration {
|
|||
public readonly lockFilename: string;
|
||||
public readonly pidFilename: string;
|
||||
public readonly configFilename: string;
|
||||
public readonly ngrokBinPath: string;
|
||||
|
||||
/* Configuration values - set in config.json by TIKE */
|
||||
|
||||
|
|
@ -17,7 +16,6 @@ export class Configuration {
|
|||
/* ngrok Configuration */
|
||||
|
||||
public readonly useNgrok: boolean;
|
||||
public readonly ngrokControlPort: number;
|
||||
public readonly ngrokToken: string;
|
||||
public readonly ngrokVisible: boolean;
|
||||
|
||||
|
|
@ -42,8 +40,6 @@ export class Configuration {
|
|||
|
||||
// ngrok configuration
|
||||
this.useNgrok = cfg?.useNgrok ?? false;
|
||||
this.ngrokBinPath = this.appDataPath + 'bin/';
|
||||
this.ngrokControlPort = cfg?.ngrokControlPort ?? 8009;
|
||||
this.ngrokToken = cfg?.ngrokToken ?? '';
|
||||
this.ngrokVisible = cfg?.ngrokVisible ?? false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -125,30 +125,36 @@ async function startNGrok() {
|
|||
return false;
|
||||
}
|
||||
|
||||
let started = false;
|
||||
const listener = await ngrok.forward({
|
||||
proto: 'http',
|
||||
addr: configuration.port,
|
||||
authtoken: configuration.ngrokToken,
|
||||
onLogEvent: (msg: string) => {
|
||||
if(options.ngrokLog) {
|
||||
console.log(chalk.cyan(('\n'+msg).split('\n').join('\n[ngrok] ').trim()));
|
||||
try {
|
||||
let started = false;
|
||||
const listener = await ngrok.forward({
|
||||
proto: 'http',
|
||||
addr: configuration.port,
|
||||
authtoken: configuration.ngrokToken,
|
||||
onLogEvent: (msg: string) => {
|
||||
if(options.ngrokLog) {
|
||||
console.log(chalk.cyan(('\n'+msg).split('\n').join('\n[ngrok] ').trim()));
|
||||
}
|
||||
},
|
||||
onStatusChange: (state: string) => {
|
||||
if(state == 'connected' && started) {
|
||||
// We only announce reconnection after initial start
|
||||
configuration.ngrokEndpoint = listener.url() ?? '';
|
||||
console.log(chalk.blueBright('ngrok tunnel reconnected at %s'), configuration.ngrokEndpoint);
|
||||
} else if(state == 'closed') {
|
||||
configuration.ngrokEndpoint = '';
|
||||
console.log(chalk.blueBright('ngrok tunnel closed'));
|
||||
}
|
||||
}
|
||||
},
|
||||
onStatusChange: (state: string) => {
|
||||
if(state == 'connected' && started) {
|
||||
// We only announce reconnection after initial start
|
||||
configuration.ngrokEndpoint = listener.url();
|
||||
console.log(chalk.blueBright('ngrok tunnel reconnected at %s'), configuration.ngrokEndpoint);
|
||||
} else if(state == 'closed') {
|
||||
configuration.ngrokEndpoint = '';
|
||||
console.log(chalk.blueBright('ngrok tunnel closed'));
|
||||
}
|
||||
}
|
||||
});
|
||||
started = true;
|
||||
configuration.ngrokEndpoint = listener.url();
|
||||
console.log(chalk.blueBright('ngrok tunnel established at %s'), configuration.ngrokEndpoint);
|
||||
});
|
||||
started = true;
|
||||
configuration.ngrokEndpoint = listener.url();
|
||||
console.log(chalk.blueBright('ngrok tunnel established at %s'), configuration.ngrokEndpoint);
|
||||
} catch(e) {
|
||||
configuration.ngrokEndpoint = '';
|
||||
console.error(chalk.red('ngrok tunnel failed to connect with an error: %s'), e);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -82,7 +82,8 @@ const
|
|||
SUrlNgrokSignup = 'https://dashboard.ngrok.com/signup';
|
||||
|
||||
// Note, we manually update the version of ngrok as required in subsequent
|
||||
// releases, rather than trying to handle a potentially moving target
|
||||
// releases, rather than trying to handle a potentially moving target. This
|
||||
// should match developer/src/server/package.json version for ngrok.
|
||||
SNgrokVersion = 'v1.7.0';
|
||||
SUrlNgrokDownload = 'https://github.com/ngrok/ngrok-javascript/releases/download/'+SNgrokVersion+'/ngrok.win32-ia32-msvc.node';
|
||||
SNgrokNodeModuleFilename = 'ngrok-win32-ia32-msvc.node';
|
||||
|
|
@ -317,7 +318,7 @@ end;
|
|||
|
||||
function TfrmServerOptions.RedistInstallerPath: string;
|
||||
begin
|
||||
Result := TServerDebugAPI.ServerBinPath + SVCRedistExeFilename;
|
||||
Result := TServerDebugAPI.ServerBinPath + '\' + SVCRedistExeFilename;
|
||||
end;
|
||||
|
||||
procedure TfrmServerOptions.UpdateVersionLabel;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue