- Include the script's directory path #304. - Exclude Windows-specific instructions on non-Windows OS. - Standardize language across dialogs for consistency. Other supporting changes: - Add script diagnostics data collection from main process. - Document script file storage and execution tamper protection in SECURITY.md. - Remove redundant comment in `NodeReadbackFileWriter`. - Centralize error display for uniformity and simplicity. - Simpify `WindowVariablesValidator` to omit checks when not on the renderer process. - Improve and centralize Electron environment detection. - Use more emphatic language (don't worry) in error messages.
58 lines
1.8 KiB
TypeScript
58 lines
1.8 KiB
TypeScript
import { OperatingSystem } from '@/domain/OperatingSystem';
|
|
import { Logger } from '@/application/Common/Log/Logger';
|
|
import { WindowVariables } from '@/infrastructure/WindowVariables/WindowVariables';
|
|
import { CodeRunner } from '@/application/CodeRunner/CodeRunner';
|
|
import { Dialog } from '@/presentation/common/Dialog';
|
|
import { ScriptDiagnosticsCollector } from '@/application/ScriptDiagnostics/ScriptDiagnosticsCollector';
|
|
import { LoggerStub } from './LoggerStub';
|
|
import { CodeRunnerStub } from './CodeRunnerStub';
|
|
import { DialogStub } from './DialogStub';
|
|
import { ScriptDiagnosticsCollectorStub } from './ScriptDiagnosticsCollectorStub';
|
|
|
|
export class WindowVariablesStub implements WindowVariables {
|
|
public codeRunner?: CodeRunner = new CodeRunnerStub();
|
|
|
|
public isRunningAsDesktopApplication: true | undefined = true;
|
|
|
|
public os?: OperatingSystem = OperatingSystem.BlackBerryOS;
|
|
|
|
public log?: Logger = new LoggerStub();
|
|
|
|
public dialog?: Dialog = new DialogStub();
|
|
|
|
public scriptDiagnosticsCollector?
|
|
: ScriptDiagnosticsCollector = new ScriptDiagnosticsCollectorStub();
|
|
|
|
public withScriptDiagnosticsCollector(
|
|
scriptDiagnosticsCollector: ScriptDiagnosticsCollector,
|
|
): this {
|
|
this.scriptDiagnosticsCollector = scriptDiagnosticsCollector;
|
|
return this;
|
|
}
|
|
|
|
public withLog(log: Logger): this {
|
|
this.log = log;
|
|
return this;
|
|
}
|
|
|
|
public withDialog(dialog: Dialog): this {
|
|
this.dialog = dialog;
|
|
return this;
|
|
}
|
|
|
|
public withIsRunningAsDesktopApplication(isRunningAsDesktopApplication: true | undefined): this {
|
|
this.isRunningAsDesktopApplication = isRunningAsDesktopApplication;
|
|
return this;
|
|
}
|
|
|
|
public withOs(value: OperatingSystem | undefined): this {
|
|
this.os = value;
|
|
return this;
|
|
}
|
|
|
|
public withCodeRunner(value?: CodeRunner): this {
|
|
this.codeRunner = value;
|
|
return this;
|
|
}
|
|
}
|