mirror of
https://github.com/Tooloop/Tooloop-Packages.git
synced 2026-04-27 20:41:37 +02:00
update kiosk browser
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
Package: tooloop-kiosk-browser
|
||||
Version: 0.1.0
|
||||
Maintainer: vollstock
|
||||
Homepage: https://www.vollstock.de
|
||||
Bugs: https://github.com/vollstock/Tooloop-Examples
|
||||
Version: 1.0.0
|
||||
Maintainer: Tooloop Multimedia
|
||||
Homepage: https://www.tooloop.de
|
||||
Bugs: https://github.com/Tooloop/Tooloop-Packages
|
||||
Section: tooloop/presentation
|
||||
Architecture: amd64
|
||||
Depends: chromium-browser
|
||||
|
||||
@@ -2,23 +2,21 @@
|
||||
<meta charset="utf-8">
|
||||
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>Simple Kiosk</title>
|
||||
|
||||
<style type="text/css">
|
||||
|
||||
canvas {
|
||||
display: block;
|
||||
vertical-align: bottom;
|
||||
}
|
||||
|
||||
#particles {
|
||||
position:absolute;
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
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-size: cover;
|
||||
background-position: 50% 50%;
|
||||
@@ -27,7 +25,7 @@
|
||||
#box {
|
||||
width: 50%;
|
||||
position: absolute;
|
||||
background: rgba(255,255,255,0.9);
|
||||
background: rgba(255, 255, 255, 0.9);
|
||||
left: 25%;
|
||||
top: 25%;
|
||||
border-radius: 2px;
|
||||
@@ -35,10 +33,13 @@
|
||||
max-width: 640px;
|
||||
box-sizing: border-box;
|
||||
padding: 50px 40px 50px 40px;
|
||||
-webkit-user-select: none; /* Chrome all / Safari all */
|
||||
-moz-user-select: none; /* Firefox all */
|
||||
-ms-user-select: none; /* IE 10+ */
|
||||
user-select: none;
|
||||
-webkit-user-select: none;
|
||||
/* Chrome all / Safari all */
|
||||
-moz-user-select: none;
|
||||
/* Firefox all */
|
||||
-ms-user-select: none;
|
||||
/* IE 10+ */
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
#credits {
|
||||
@@ -51,7 +52,10 @@
|
||||
font-weight: lighter;
|
||||
}
|
||||
|
||||
body, div, h1, p {
|
||||
body,
|
||||
div,
|
||||
h1,
|
||||
p {
|
||||
margin: 0;
|
||||
font-family: 'ClearSans', sans-serif;
|
||||
font-weight: 100;
|
||||
@@ -59,7 +63,8 @@
|
||||
line-height: 1.25em;
|
||||
}
|
||||
|
||||
h1, p {
|
||||
h1,
|
||||
p {
|
||||
margin: 0 0 1em 0;
|
||||
}
|
||||
|
||||
@@ -69,10 +74,11 @@
|
||||
font-size: 2em;
|
||||
}
|
||||
|
||||
a, a:visited, a:active {
|
||||
a,
|
||||
a:visited,
|
||||
a:active {
|
||||
color: #b1148e;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
</head>
|
||||
@@ -85,17 +91,17 @@
|
||||
<h1>Simple Kiosk</h1>
|
||||
<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>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>
|
||||
</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 type="text/javascript">
|
||||
|
||||
|
||||
particlesJS("particles", {
|
||||
"particles": {
|
||||
"number": {
|
||||
@@ -116,12 +122,7 @@
|
||||
},
|
||||
"polygon": {
|
||||
"nb_sides": 8
|
||||
},
|
||||
// "image": {
|
||||
// "src": "img/github.svg",
|
||||
// "width": 100,
|
||||
// "height": 100
|
||||
// }
|
||||
}
|
||||
},
|
||||
"opacity": {
|
||||
"value": 0.5,
|
||||
@@ -206,7 +207,7 @@
|
||||
},
|
||||
"retina_detect": true
|
||||
});
|
||||
var update = function() {
|
||||
var update = function () {
|
||||
requestAnimationFrame(update);
|
||||
};
|
||||
requestAnimationFrame(update);;
|
||||
@@ -214,4 +215,5 @@
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
URL="file:///assets/data/index.html"
|
||||
URL="/media/assets/data/index.html"
|
||||
|
||||
# List of Chromium Command Line Switches
|
||||
# https://peter.sh/experiments/chromium-command-line-switches/
|
||||
@@ -20,13 +20,12 @@ COMMAND="chromium-browser \
|
||||
--class=TooloopKiosk \
|
||||
$URL"
|
||||
|
||||
killall chrome
|
||||
sleep 0.1
|
||||
|
||||
if [ $EUID == 0 ]; then
|
||||
pkill chromium
|
||||
sleep 0.1
|
||||
su tooloop -c "$COMMAND" &
|
||||
else
|
||||
pkill chromium
|
||||
sleep 0.1
|
||||
$COMMAND &
|
||||
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 %}
|
||||
Reference in New Issue
Block a user