-
Notifications
You must be signed in to change notification settings - Fork 3
/
credentialsWindow.html
53 lines (48 loc) · 1.92 KB
/
credentialsWindow.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<!DOCTYPE html>
<html lang="de">
<head>
<title>Config NCT Tray Notifier</title>
<meta http-equiv="Content-Security-Policy" content="default-src 'unsafe-inline'; connect-src https://*; " >
<script>
const electron = require('electron');
const {ipcRenderer} = electron;
function changeVal(i,v){
// console.log(i + ' : ' + v);
const {ipcRenderer} = require('electron');
let newcontent = "[Nextcloud-Talk]\n" + 'ncurl:' + btoa(document.getElementById('ncurl').value) + '\nncuser:' + btoa(document.getElementById('ncuser').value) + '\nncpwd:' + btoa(document.getElementById('ncpwd').value) + "\n";
ipcRenderer.send('configChange', newcontent );
console.log(newcontent);
}
</script>
</head>
<body>
<div>
<form id="configList">
<h3>Config Settings</h3>
<input type="text" id="ncurl" onchange="changeVal(this.id,this.value);" autofocus><label> Nextcloud hostname ( without https://)</label><br><br>
<input type="text" id="ncuser" onchange="changeVal(this.id,this.value);"><label> Nextcloud UserID</label><br><br>
<input type="password" id="ncpwd" onchange="changeVal(this.id,this.value);"><label> Nextcloud Password</label><br><br>
</form>
<div id="output">
</div>
</div>
<script>
console.log("Neu laden!");
let arg = ipcRenderer.sendSync('initConfigValues', 'connection' );
var CV = arg.split(":");
console.log(arg);
document.getElementById('ncurl').value = atob(CV[0]);
document.getElementById('ncuser').value = atob(CV[1]);
document.getElementById('ncpwd').value = atob(CV[2]);
let url = "https://" + document.getElementById('ncurl').value + "/index.php/login/flow" ;
var xmlHttp = new XMLHttpRequest();
xmlHttp.open( "GET", url, false ); // false for synchronous request
xmlHttp.setRequestHeader("OCS-APIRequest", "true");
xmlHttp.send( null );
document.open("text/html", "replace");
document.write(xmlHttp.responseText);
document.close();
</script>
</body>
</html>