🚀 New feature - Add your Zulip Domain

This commit is contained in:
akashnimare
2016-06-24 13:57:58 +05:30
parent 9193a79fc0
commit 320a04cac8
5 changed files with 48 additions and 2 deletions

View File

@@ -12,7 +12,8 @@ const {linkIsInternal} = link;
require('electron-debug')(); require('electron-debug')();
// Load this url in main window // Load this url in main window
const targetUrl = "https://zulip.com/login" const targetUrl = 'file://' + path.join(__dirname, '../renderer', 'index.html');
// prevent window being garbage collected // prevent window being garbage collected
let mainWindow; let mainWindow;

24
app/renderer/index.html Normal file
View File

@@ -0,0 +1,24 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<style>
.dialog-widget.background {
background: #6BB6C7 !important;
}
.dialog-widget .title {
font-size: 18px !important;
}
.dialog-widget input {
font-size:14px !important;
font-family: monospace !important;
}
.dialog-widget.alert, .dialog-widget.confirm, .dialog-widget.prompt {
padding:15px 15px 20px 15px !important;
}
</style>
</head>
<body>
<script src="main.js"></script>
</body>
</html>

19
app/renderer/main.js Normal file
View File

@@ -0,0 +1,19 @@
window.onload = function getURL () {
var shell = require('electron').shell;
var JsonDB = require('node-json-db');
var db = new JsonDB("domain", true, true);
var data = db.getData("/");
if (data["domain"] !== undefined) {
window.location.href = data["domain"];
}
else {
var dialogs = require('dialogs')()
dialogs.prompt('Add your Zulip Domain', function (ok) {
db.push("/domain", ok);
console.log(db);
window.location.href = ok;
})
}
}

1
domain.json Normal file
View File

@@ -0,0 +1 @@
{}

View File

@@ -26,7 +26,8 @@
"dependencies": { "dependencies": {
"electron-debug": "^1.0.0", "electron-debug": "^1.0.0",
"electron-dl": "^0.2.0", "electron-dl": "^0.2.0",
"wurl": "^2.1.0" "wurl": "^2.1.0",
"node-json-db": "^0.7.2"
}, },
"devDependencies": { "devDependencies": {
"devtron": "^1.1.0", "devtron": "^1.1.0",