guaclient/main.js

71 lines
2.6 KiB
JavaScript
Raw Permalink Normal View History

2024-11-05 18:46:34 +01:00
/*----------------------------------------------------------------------------*/
/* main.js */
/*----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------*/
/* This file is part of GuaClient. */
/* */
/* GuaClient is free software: you can redistribute it and/or modify it */
/* under the terms of the GNU General Public License as published by */
/* the Free Software Foundation, either version 3 of the License, or */
/* (at your option) any later version. */
/* */
/* GuaClient is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with GuaClient. If not, see <https://www.gnu.org/licenses/>. */
/*----------------------------------------------------------------------------*/
const electron = require('electron');
const { app, BrowserWindow } = electron;
const prompt = require('electron-prompt')
let mainWindow;
app.on('login', (event, webContents, request, authInfo, callback) =>
{
event.preventDefault();
// popup a dialog to let the user enter a username/password
// ...
prompt(
{
title: 'Authentication',
label: 'Enter Login:',
inputAttrs: { type: 'text'},
type: 'input'
}).then((username) =>
{
prompt(
{
title: 'Authentication',
label: 'Enter Password:',
inputAttrs: { type: 'password'},
type: 'input'
}).then((password) =>
{
callback( username, password);
}).catch(console.error);
}).catch(console.error);
});
app.on('ready', () => {
mainWindow = new BrowserWindow({
width: 1000,
height: 700
});
mainWindow.setTitle('Rx3 Guacamole');
mainWindow.loadURL('https://www.rx3.net/tdsots/admin/guacamole/');
mainWindow.on('closed', () => {
mainWindow = null;
});
});