Skip to content

Commit e78812f

Browse files
committed
Basic system chrome and system services capable of loading a URL - closes #1
1 parent 24ee392 commit e78812f

21 files changed

+2809
-2
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules/

LICENSE

Lines changed: 674 additions & 0 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,42 @@
1-
# shell-kiosk
2-
Webian Shell - A graphical shell for the web (kiosk version)
1+
# Webian Shell Kiosk
2+
3+
A graphical shell for the web (kiosk version).
4+
5+
This application is for interactive kiosks and digital signage which can be remotely controlled over the Internet.
6+
7+
It acts as both a web client and a web server in order to render web content and expose system services via the Web of Things.
8+
9+
## Getting Started
10+
11+
To get started hacking on Webian Shell Kiosk first make sure that you have [Git](https://git-scm.com/), [NodeJS](https://nodejs.org/en/) and [NPM](https://www.npmjs.com/) installed.
12+
13+
Then simply clone the Shell Kiosk repository from GitHub and run it.
14+
15+
```
16+
$ git clone https://github.com/webianproject/shell-kiosk.git
17+
$ cd shell-kiosk
18+
$ npm install
19+
$ npm start
20+
```
21+
22+
The web client uses Electron and the web server uses NodeJS.
23+
24+
## Copyrights, Trademarks and Licensing
25+
26+
© Ben Francis 2019
27+
28+
Webian is not affiliated with Firefox which is a registered trademark of the [Mozilla Foundation](http://mozilla.org), or Debian which is a registered trademark of [SPI](http://www.spi-inc.org/corporate/trademarks/).
29+
30+
Webian Shell Kiosk is free software: you can redistribute it and/or modify
31+
it under the terms of the GNU General Public License as published by
32+
the Free Software Foundation, either version 3 of the License, or
33+
(at your option) any later version.
34+
35+
Webian Shell Kiosk is distributed in the hope that it will be useful,
36+
but WITHOUT ANY WARRANTY; without even the implied warranty of
37+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
38+
GNU General Public License for more details.
39+
40+
You should have received a copy of the GNU General Public License
41+
along with Webian Shell Kiosk in the LICENSE file. If not, see
42+
<http://www.gnu.org/licenses/>.

chrome.js

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
const electron = require('electron');
2+
const url = require('url');
3+
const path = require('path');
4+
const BrowserWindow = electron.BrowserWindow;
5+
6+
/**
7+
* Top level chrome module which creates the main Electron BrowserWindow and
8+
* loads the system chrome inside it.
9+
*/
10+
var Chrome = {
11+
12+
/**
13+
* Create main window and load shell as system chrome.
14+
*/
15+
start: function() {
16+
// Create the main window
17+
this.mainWindow = new BrowserWindow({
18+
fullscreen: true,
19+
webPreferences: {
20+
nodeIntegration: true,
21+
webviewTag: true
22+
}
23+
});
24+
// Load shell.html as chrome
25+
this.mainWindow.loadURL(url.format({
26+
pathname: path.join(__dirname, 'chrome/shell.html'),
27+
protocol: 'file:',
28+
slashes: true
29+
}));
30+
31+
// Uncomment the following line to open DevTools
32+
//this.mainWindow.webContents.openDevTools();
33+
},
34+
35+
/**
36+
* Send a message to the system chrome over IPC.
37+
*
38+
* @param String channel The channel over which to send the message.
39+
* @param String message The message to send.
40+
*/
41+
sendMessage: function(channel, message){
42+
this.mainWindow.webContents.send(channel, message);
43+
}
44+
}
45+
46+
module.exports = Chrome;

chrome/css/shell.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
html, body, #webview {
2+
width: 100%;
3+
height: 100%;
4+
margin: 0;
5+
padding: 0;
6+
}

chrome/js/shell.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
const {ipcRenderer} = require('electron');
2+
3+
/**
4+
* Shell is the system chrome loaded inside the top level window.
5+
*/
6+
var Shell = {
7+
/**
8+
* Start Shell.
9+
*/
10+
start: function() {
11+
console.log('Starting shell...');
12+
this.webview = document.getElementById('webview');
13+
14+
ipcRenderer.on('loadURL', (event, url) => {
15+
this.webview.src = url;
16+
});
17+
}
18+
}
19+
20+
/**
21+
* Start Shell on page load.
22+
*/
23+
window.addEventListener('load', function shell_onLoad() {
24+
window.removeEventListener('load', shell_onLoad);
25+
Shell.start();
26+
});

chrome/shell.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8">
5+
<title>Webian Shell Kiosk</title>
6+
<link rel="stylesheet" href="css/shell.css" type="text/css" />
7+
<script type="text/javascript" src="js/shell.js"></script>
8+
</head>
9+
<body>
10+
<webview id="webview" src="http://localhost:8080"></webview>
11+
</body>
12+
</html>

main.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/**
2+
* Webian Shell Kiosk.
3+
*
4+
* Main script starts up Webian Shell chrome and services.
5+
*/
6+
const electron = require('electron');
7+
const app = electron.app;
8+
const services = require('./services');
9+
const chrome = require('./chrome');
10+
11+
function startShell() {
12+
services.start();
13+
chrome.start();
14+
}
15+
16+
app.on('ready', startShell);

0 commit comments

Comments
 (0)