Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

On-demand fix #108

Merged
merged 2 commits into from
Jun 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions src/auth/resolvers/OnDemand/OnDemand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,16 @@ export class OnDemand implements IAuthResolver {
private saveAuthData(dataPath: string): ICookie[] {

const electronExecutable = this._authOptions.electron || 'electron';
const isWindows = (process.platform.lastIndexOf('win') === 0);
const options: any = isWindows ? { shell: true } : undefined;
const output = childProcess.execFileSync(electronExecutable, [path.join(__dirname, 'electron/main.js'), '--', this._siteUrl, this._authOptions.force.toString()], options).toString();
const electronProc = childProcess.spawnSync(
electronExecutable,
[
path.join(__dirname, 'electron/main.js'),
'--',
this._siteUrl,
this._authOptions.force === true ? 'true' : 'false'
]
);
const output = electronProc.stdout.toString();

const cookieRegex = /#\{([\s\S]+?)\}#/gm;
const cookieData = cookieRegex.exec(output);
Expand Down
1 change: 1 addition & 0 deletions src/auth/resolvers/ondemand/electron/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const process = require('process');
// Module to control application life.
const app = electron.app;
app.commandLine.appendSwitch('ignore-certificate-errors');
app.commandLine.appendSwitch('no-sandbox');
// Module to create native browser window.
const BrowserWindow = electron.BrowserWindow;

Expand Down