update kiosk browser

This commit is contained in:
2022-05-10 14:10:50 +02:00
parent 02c9ebc141
commit 5188deba37
5 changed files with 34 additions and 151 deletions
+4 -4
View File
@@ -1,8 +1,8 @@
Package: tooloop-kiosk-browser Package: tooloop-kiosk-browser
Version: 0.1.0 Version: 1.0.0
Maintainer: vollstock Maintainer: Tooloop Multimedia
Homepage: https://www.vollstock.de Homepage: https://www.tooloop.de
Bugs: https://github.com/vollstock/Tooloop-Examples Bugs: https://github.com/Tooloop/Tooloop-Packages
Section: tooloop/presentation Section: tooloop/presentation
Architecture: amd64 Architecture: amd64
Depends: chromium-browser Depends: chromium-browser
+26 -24
View File
@@ -2,23 +2,21 @@
<meta charset="utf-8"> <meta charset="utf-8">
<html> <html>
<head> <head>
<title>Simple Kiosk</title> <title>Simple Kiosk</title>
<style type="text/css"> <style type="text/css">
canvas { canvas {
display: block; display: block;
vertical-align: bottom;
} }
#particles { #particles {
position:absolute; position: absolute;
width: 100%; width: 100%;
height: 100%; height: 100%;
background-color: #172e4d; background-color: #172e4d;
/*background: radial-gradient(ellipse at center, #224a5e 0%,#172e4d 100%);*/ background: radial-gradient(ellipse at center, #224a5e 0%, #172e4d 50%, #050b23 100%);
background: radial-gradient(ellipse at center, #224a5e 0%,#172e4d 50%,#050b23 100%);
background-repeat: no-repeat; background-repeat: no-repeat;
background-size: cover; background-size: cover;
background-position: 50% 50%; background-position: 50% 50%;
@@ -27,7 +25,7 @@
#box { #box {
width: 50%; width: 50%;
position: absolute; position: absolute;
background: rgba(255,255,255,0.9); background: rgba(255, 255, 255, 0.9);
left: 25%; left: 25%;
top: 25%; top: 25%;
border-radius: 2px; border-radius: 2px;
@@ -35,10 +33,13 @@
max-width: 640px; max-width: 640px;
box-sizing: border-box; box-sizing: border-box;
padding: 50px 40px 50px 40px; padding: 50px 40px 50px 40px;
-webkit-user-select: none; /* Chrome all / Safari all */ -webkit-user-select: none;
-moz-user-select: none; /* Firefox all */ /* Chrome all / Safari all */
-ms-user-select: none; /* IE 10+ */ -moz-user-select: none;
user-select: none; /* Firefox all */
-ms-user-select: none;
/* IE 10+ */
user-select: none;
} }
#credits { #credits {
@@ -51,7 +52,10 @@
font-weight: lighter; font-weight: lighter;
} }
body, div, h1, p { body,
div,
h1,
p {
margin: 0; margin: 0;
font-family: 'ClearSans', sans-serif; font-family: 'ClearSans', sans-serif;
font-weight: 100; font-weight: 100;
@@ -59,7 +63,8 @@
line-height: 1.25em; line-height: 1.25em;
} }
h1, p { h1,
p {
margin: 0 0 1em 0; margin: 0 0 1em 0;
} }
@@ -69,10 +74,11 @@
font-size: 2em; font-size: 2em;
} }
a, a:visited, a:active { a,
a:visited,
a:active {
color: #b1148e; color: #b1148e;
} }
</style> </style>
</head> </head>
@@ -85,17 +91,17 @@
<h1>Simple Kiosk</h1> <h1>Simple Kiosk</h1>
<p>This is a simple browser for your show room or trade fair booth.</p> <p>This is a simple browser for your show room or trade fair booth.</p>
<p>It has very few features but works for simple things.</p> <p>It has very few features but works for simple things.</p>
<p>By default it loads <span style="font-family: monospace;">/assets/data/index.html</span> but you can choose any page you like.</p> <p>By default it loads <span style="font-family: monospace;">/assets/data/index.html</span> but you can choose
any page you like.</p>
<p>Simple Kiosk comes with a plugin for the Tooloop Settings Server so you can configure it in there.</p> <p>Simple Kiosk comes with a plugin for the Tooloop Settings Server so you can configure it in there.</p>
</div> </div>
<div id="credits"><a href="http://vincentgarreau.com/particles.js/">particles.js</a> by Vincent Garreau</div> <div id="credits"><a href="http://vincentgarreau.com/particles.js/">particles.js</a> by Vincent Garreau</div>
<!-- particles.js lib - https://github.com/VincentGarreau/particles.js -->
<script src="particles.min.js"></script> <script src="particles.min.js"></script>
<script type="text/javascript"> <script type="text/javascript">
particlesJS("particles", { particlesJS("particles", {
"particles": { "particles": {
"number": { "number": {
@@ -116,12 +122,7 @@
}, },
"polygon": { "polygon": {
"nb_sides": 8 "nb_sides": 8
}, }
// "image": {
// "src": "img/github.svg",
// "width": 100,
// "height": 100
// }
}, },
"opacity": { "opacity": {
"value": 0.5, "value": 0.5,
@@ -206,7 +207,7 @@
}, },
"retina_detect": true "retina_detect": true
}); });
var update = function() { var update = function () {
requestAnimationFrame(update); requestAnimationFrame(update);
}; };
requestAnimationFrame(update);; requestAnimationFrame(update);;
@@ -214,4 +215,5 @@
</script> </script>
</body> </body>
</html> </html>
@@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
URL="file:///assets/data/index.html" URL="/media/assets/data/index.html"
# List of Chromium Command Line Switches # List of Chromium Command Line Switches
# https://peter.sh/experiments/chromium-command-line-switches/ # https://peter.sh/experiments/chromium-command-line-switches/
@@ -20,13 +20,12 @@ COMMAND="chromium-browser \
--class=TooloopKiosk \ --class=TooloopKiosk \
$URL" $URL"
killall chrome
sleep 0.1
if [ $EUID == 0 ]; then if [ $EUID == 0 ]; then
pkill chromium
sleep 0.1
su tooloop -c "$COMMAND" & su tooloop -c "$COMMAND" &
else else
pkill chromium
sleep 0.1
$COMMAND & $COMMAND &
fi fi
@@ -1,75 +0,0 @@
# -*- coding: utf-8 -*-
from flask import Flask, jsonify, request, abort
from os import chown
from pwd import getpwnam
from grp import getgrnam
class InstalledApp(object):
def __init__(self, flask):
super(InstalledApp, self).__init__()
# default homepage
self.homepage = 'file:///assets/data/index.html';
# connect flask routes to tooloop api calls
self.add_routes(flask)
def add_routes(self, flask):
@flask.route('/simple-kiosk/change-homepage', methods=['POST'])
def change_homepage():
if not request.form or not 'homepage' in request.form:
abort(400)
try:
self.homepage = request.form['homepage'];
file = open('/assets/presentation/reset-kiosk.sh','w')
file.write('#!/bin/bash\n')
file.write('\n')
file.write('URL="'+self.homepage+'"\n')
file.write('\n')
file.write('# List of Chromium Command Line Switches\n')
file.write('# https://peter.sh/experiments/chromium-command-line-switches/\n')
file.write('COMMAND="chromium-browser \\\n')
file.write('--kiosk \\\n')
file.write('--bwsi \\\n')
file.write('--overscroll-history-navigation=1 \\\n')
file.write('--incognito \\\n')
file.write('--disable-infobars \\\n')
file.write('--disable-translate \\\n')
file.write('--no-default-browser-check \\\n')
file.write('--no-first-run \\\n')
file.write('--disable-translate-new-ux \\\n')
file.write('--num-raster-threads=4 \\\n')
file.write('--enable-zero-copy \\\n')
file.write('--noerrdialogs \\\n')
file.write('--class=TooloopKiosk \\\n')
file.write('$URL"\n')
file.write('\n')
file.write('if [ $EUID == 0 ]; then\n')
file.write(' pkill chromium\n')
file.write(' sleep 0.1\n')
file.write(' su tooloop -c "$COMMAND" &\n')
file.write('else\n')
file.write(' pkill chromium\n')
file.write(' sleep 0.1\n')
file.write(' $COMMAND &\n')
file.write('fi\n')
file.write('\n')
file.write('exit 0\n')
file.close()
uid = getpwnam('tooloop').pw_uid
gid = getgrnam('tooloop').gr_gid
chown('/assets/presentation/reset-kiosk.sh', uid, gid)
return jsonify({'message':'homepage changed'})
except Exception as e:
abort(500)
@@ -1,43 +0,0 @@
{% extends "base.html" %}
{% block content %}
<table class="settings-table">
<tr><td colspan="2"><h2>{{installed_app.name}}</h2></td></tr>
<tr>
<td class="label-column" style="vertical-align: top; padding-top: 1.1em;">Homepage</td>
<td class="value-column">
<form id="homepage-form">
<input type="text" id="homepage-input" value="{{app_controller.homepage}}">
<button type="submit">Save</button>
</form>
</td>
</tr>
</table>
{% endblock %}
{% block page_footer_scripts %}
<script type="text/javascript">
$('#homepage-form').on('submit', function(event) {
event.preventDefault();
var feedback = attachFeedback(event.target);
$.ajax({
method: "POST",
data: { "homepage":$('#homepage-input').val() },
url: "/simple-kiosk/change-homepage"
}).done(function( data ) {
displayConfirmFeedback(feedback, 'Saved');
$.ajax( {url:"/tooloop/api/v1.0/presentation/reset"} );
}).error(function( jqXHR, textStatus, errorThrown ) {
displayErrorFeedback(feedback, errorThrown);
});
});
</script>
{% endblock %}