Basic version
This commit is contained in:
parent
78bf5f77e9
commit
96a8b95c47
59
index.html
59
index.html
|
@ -2,17 +2,62 @@
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>Hello World!</title>
|
<title>Chimeverse</title>
|
||||||
|
<link rel="stylesheet" type="text/css" media="screen" href="node_modules/converse.js/css/converse.css">
|
||||||
|
<link rel="stylesheet" href="node_modules/uikit/dist/css/uikit.min.css">
|
||||||
|
<link rel="stylesheet" href="css/login.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body ng-app="app">
|
||||||
<h1>Hello World!</h1>
|
<!-- Account form -->
|
||||||
<!-- All of the Node.js APIs are available in this renderer process. -->
|
<div class="main-window" ng-controller="AppController">
|
||||||
We are using Node.js <script>document.write(process.versions.node)</script>,
|
<div ng-hide="loginExist" class="uk-section uk-section-muted uk-flex uk-flex-middle uk-animation-fade" uk-height-viewport ng-controller="LoginController">
|
||||||
Chromium <script>document.write(process.versions.chrome)</script>,
|
<div class="uk-width-1-1">
|
||||||
and Electron <script>document.write(process.versions.electron)</script>.
|
<div class="uk-container">
|
||||||
|
<h3 class="uk-card-title uk-text-center">Welcome to Chimeverse</h3>
|
||||||
|
<div class="uk-text-center">Jabber/XMPP client based on Converse.js and Electron</div>
|
||||||
|
<div class="uk-grid-margin uk-grid uk-grid-stack" uk-grid>
|
||||||
|
<div class="uk-width-1-1@m">
|
||||||
|
<div class="uk-margin uk-width-large uk-margin-auto uk-card uk-card-default uk-card-body uk-box-shadow-large">
|
||||||
|
<form name="accountForm">
|
||||||
|
<div class="uk-margin">
|
||||||
|
<div class="uk-inline uk-width-1-1">
|
||||||
|
<span class="uk-form-icon" uk-icon="icon: link"></span>
|
||||||
|
<input ng-model="boshService" class="uk-input uk-form-large" type="text" placeholder="Bosh service url" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="uk-margin">
|
||||||
|
<div class="uk-inline uk-width-1-1">
|
||||||
|
<span class="uk-form-icon" uk-icon="icon: user"></span>
|
||||||
|
<input ng-model="login" class="uk-input uk-form-large" type="text" placeholder="jid@jabber.org" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="uk-margin">
|
||||||
|
<div class="uk-inline uk-width-1-1">
|
||||||
|
<span class="uk-form-icon" uk-icon="icon: lock"></span>
|
||||||
|
<input ng-model="password" class="uk-input uk-form-large" type="password" placeholder="Password" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="uk-margin">
|
||||||
|
<button class="uk-button uk-button-primary uk-button-large uk-width-1-1" ng-click="addAccountAction()" ng-disabled="accountForm.$invalid" disabled>Add account</button>
|
||||||
|
</div>
|
||||||
|
<div class="uk-text-small uk-text-center">
|
||||||
|
Credentials stored via Keychain
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- /Account form -->
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script src="node_modules/uikit/dist/js/uikit.min.js"></script>
|
||||||
|
<script src="node_modules/uikit/dist/js/uikit-icons.min.js"></script>
|
||||||
<script>
|
<script>
|
||||||
// You can also require other files to run in this process
|
// You can also require other files to run in this process
|
||||||
|
require('converse.js');
|
||||||
require('./renderer.js')
|
require('./renderer.js')
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
4
main.js
4
main.js
|
@ -1,5 +1,5 @@
|
||||||
// Modules to control application life and create native browser window
|
// Modules to control application life and create native browser window
|
||||||
const {app, BrowserWindow} = require('electron')
|
const {app, BrowserWindow, Tray} = require('electron')
|
||||||
|
|
||||||
// Keep a global reference of the window object, if you don't, the window will
|
// Keep a global reference of the window object, if you don't, the window will
|
||||||
// be closed automatically when the JavaScript object is garbage collected.
|
// be closed automatically when the JavaScript object is garbage collected.
|
||||||
|
@ -28,6 +28,8 @@ function createWindow () {
|
||||||
// when you should delete the corresponding element.
|
// when you should delete the corresponding element.
|
||||||
mainWindow = null
|
mainWindow = null
|
||||||
})
|
})
|
||||||
|
|
||||||
|
mainWindow.webContents.openDevTools();
|
||||||
}
|
}
|
||||||
|
|
||||||
// This method will be called when Electron has finished
|
// This method will be called when Electron has finished
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
12
package.json
12
package.json
|
@ -17,6 +17,16 @@
|
||||||
"author": "GitHub",
|
"author": "GitHub",
|
||||||
"license": "CC0-1.0",
|
"license": "CC0-1.0",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"electron": "^4.1.4"
|
"electron": "^4.1.4",
|
||||||
|
"electron-builder": "^20.39.0",
|
||||||
|
"electron-rebuild": "^1.8.4"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"angular": "^1.7.8",
|
||||||
|
"angular-route": "^1.7.8",
|
||||||
|
"converse.js": "^4.2.0",
|
||||||
|
"electron-settings": "^3.2.0",
|
||||||
|
"keytar": "^4.4.1",
|
||||||
|
"uikit": "^3.1.4"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
37
renderer.js
37
renderer.js
|
@ -1,3 +1,40 @@
|
||||||
// This file is required by the index.html file and will
|
// This file is required by the index.html file and will
|
||||||
// be executed in the renderer process for that window.
|
// be executed in the renderer process for that window.
|
||||||
// All of the Node.js APIs are available in this process.
|
// All of the Node.js APIs are available in this process.
|
||||||
|
|
||||||
|
const keytar = require('keytar');
|
||||||
|
const angular = require('angular');
|
||||||
|
const settings = require('electron-settings');
|
||||||
|
|
||||||
|
var angApp = angular.module('app', []);
|
||||||
|
|
||||||
|
angApp.controller('AppController', function ($scope) {
|
||||||
|
$scope.loginExist = false;
|
||||||
|
$scope.login = settings.get('login');
|
||||||
|
if ($scope.login) {
|
||||||
|
$scope.loginExist = true;
|
||||||
|
$scope.boshService = settings.get('bosh');
|
||||||
|
var xmppService = $scope.login.split('@').pop();
|
||||||
|
var password = keytar.getPassword(xmppService, $scope.login);
|
||||||
|
password.then((result) => {
|
||||||
|
$scope.password = result;
|
||||||
|
converse.initialize({
|
||||||
|
bosh_service_url: $scope.boshService,
|
||||||
|
view_mode: 'fullscreen',
|
||||||
|
jid: $scope.login,
|
||||||
|
password: $scope.password,
|
||||||
|
auto_login: true
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
angApp.controller('LoginController', function ($scope) {
|
||||||
|
$scope.addAccountAction = function() {
|
||||||
|
var xmppService = $scope.login.split('@').pop();
|
||||||
|
settings.set('bosh', $scope.boshService);
|
||||||
|
settings.set('login', $scope.login);
|
||||||
|
keytar.setPassword(xmppService, $scope.login, $scope.password);
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
Loading…
Reference in New Issue