Skip to content

Commit 3d5ebda

Browse files
authored
Suppoert for secondary screen showing live receipts (#7)
1 parent 7709e47 commit 3d5ebda

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+948
-229
lines changed

build/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<link rel="stylesheet" type="text/css" href="/static/css/font-awesome.min.css"/>
88
</head>
99
<body>
10-
<div id="app"></div>
10+
<div id="app" style="width: 100%; height: 100%;"></div>
1111
<script src="/static/js/socks.js"></script>
1212
<script src="/static/js/thunderpush.js"></script>
1313
<script src="/build.js"></script>

config.example.js

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
// Example config, rename to config.js.
22
module.exports = {
33
api: {
4-
host: "",
5-
key: ""
4+
host: "localhost:8000",
5+
key: "03f21b939e022176e87feb7704477bbc"
66
}
77
thunder: {
8-
host: "",
9-
key: ""
8+
host: "localhost:8080",
9+
key: "public123",
10+
secret: "secret123"
1011
},
11-
sentry: ""
12+
sentry: "https://[email protected]/7331"
1213
};

deploy/group_vars/live/vars.yml

+2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
deploy_branch: master
2+
thunder_host: 10.10.0.2
23
thunder_port: 8080
34
rfid_device: /dev/ttyUSB0
45
web_server_port: 8000
6+
scanner_device: 'USB-SON-V1'

deploy/group_vars/live/vault.yml

+21-21
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
$ANSIBLE_VAULT;1.1;AES256
2-
30353535666134653935663730313930613435333437386130383661333330643763366463313932
3-
3433333239323734346239383834303030363966373663330a616362316539613833383163663335
4-
35303738346639303137646136306431366437653565666664333466393462336461323638313065
5-
6464376336656233340a316662656137373761313666383565623564373166373737326333656434
6-
62643466313334613338313764373162386536663364383536353333333436313562383432626663
7-
66373738663666303435656238313936326466396439316230316164613531343565313463333933
8-
61616463623865643031643466326562306365653433383536313735316335656330363165396336
9-
63363632323838316130353365303763393135333535383430616261373737633765633165623139
10-
65633065373137363334653035326561653538656266363965616137393331613031383938343136
11-
37363734653832393831613931646636663036306533366332633461393863323462663965383964
12-
64346231636139316664376531363034616538633330393437393331306339643166376637386135
13-
31653761636362333539303233666634323339346330616533306663383663636436613931376164
14-
31396530643832326261383731366463653161303430333064373932303362613362303366383631
15-
37666330343536633235336130396433393233623662333639313036306136643030343837316362
16-
65363763393665396162653661663738653832353431326463623363616238323635316662323461
17-
31353438373562636233333430343466356265663964616665363565363237343334386263356631
18-
34363632633733346638353266333839666334393737306264626539366365613838623766303666
19-
65383031636139326436356362643432636661616465326231303736383238633461363833333162
20-
63653865626165323037653736616439336232373766613862663036626366643964323265316331
21-
62653261666265323333646334363732656361393538663665386235306531346533313337626234
22-
3439
2+
34646463333564346432323861316561306162653830313233346563643365663639613963353030
3+
3739653033646633626434646664373130396230363336330a303862623436323261626231336230
4+
31316234626133306635343434646136323664663162393930343334366536343361306433316662
5+
3766373235356535300a646563616133643233643764646166396637343235363065373135376533
6+
35396163366163666638613265653863316130373337643864303861626430326166623537663536
7+
64376662666261393966616231373839653138396663666364356539346261303239613637613130
8+
33303039303939643233656637613665383530333063306334343937653961373430623930663238
9+
30633236316538646361383433653161313933313366663031373464396133336631643835646232
10+
31373931386439393633663664616138633635396134663062613166323336373162303437366465
11+
39663331316630303163383331633334616662646237323866333861613864626631666237626439
12+
33633436613439353330333134663833306530633539613538353530346230623665363937306133
13+
32373563336465393939356464376465363731346135336232303231336162363635303535626634
14+
38363365316531373130613330326666663534613238643161623865353466626561616436653161
15+
34666561656265343336333531663362326161343738353432636235613838383863376630356261
16+
62373138346530373638376263323032366162616662393137336361323864396562393161646664
17+
35353439326336376339646364313365656634356136363565393434386436376530643066333161
18+
34613830346266303237306361366666366331393730313566633032636634633732666364343431
19+
37633330633166303831623762623731393662343332333333323430633030333866636462613431
20+
64366139363766663232313265343435653236323664613233383430646139616661376561366666
21+
61383938313235633338346132653061346139343133303330356464373964646230613535306161
22+
31303061363864623131613930353635386366643630313434616461346130633237
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
screen: primary
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
screen: secondary

deploy/inventory.cfg

+11-7
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
$ANSIBLE_VAULT;1.1;AES256
2-
33393733323330366632646434333063343834643866613563333263353333623461343964643132
3-
6531383361366661613438653234343135636433316534640a653564323362313666306262363863
4-
64363038623837346565653361366563313264353962316662306638343137646435383765656537
5-
6566366262386334330a323165666631323539656337363636366135303965636539356330396165
6-
31336564646230613930323363393261646666316233316561316438396230313161613437383665
7-
32623931343431313632326537623731306231343734323935613638336362653162313339643362
8-
623662373266303163373332353534363364
2+
33313535373035303161643264366661396266613362336636396332303431656132393066663034
3+
3435313862653161313666643939323634373935663831620a626438663166396336313730356266
4+
64633163373661303661626662633431656139303130306566386632396266666337663036346562
5+
3131633038333161650a346139663462656562383463373637663564353335653136633734396535
6+
62343132343464323862373131336666643763666466376330646635356466316138373761656163
7+
65376338303966353361303435373162653164636137303661376138303731336263366563343861
8+
35646635376531363865346432653334323636303166646433636133343633353736333138636464
9+
61323063383738646461316131393839356161333138643461366530363663373133636638303735
10+
34366663383166306637386364313937646537363362626530356663376362323131663932373466
11+
33656561306561626362396238323036306433626237613362636433323134626535626466643238
12+
623432663033393030346637633833363433

deploy/playbook.yml

+7-4
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
become: yes
1010

1111
- name: Restart chrome
12-
command: killall chromium-browser
12+
command: killall -q chromium-browser
1313
ignore_errors: yes
1414

1515
- name: Restart ssh
@@ -31,10 +31,11 @@
3131
become: yes
3232

3333
- name: Configure UFW
34-
ufw: rule=allow port={{port}} proto=tcp
34+
ufw: rule=allow to_port={{item}} proto=tcp
3535
with_items:
3636
- 22
3737
- 161
38+
- 8080
3839
become: yes
3940
tags:
4041
- security
@@ -98,9 +99,11 @@
9899
become: yes
99100
notify:
100101
- Reload supervisor
102+
tags:
103+
- supervisor
101104

102105
- name: Build the application
103-
local_action: shell npm run build
106+
local_action: shell SCREEN={{screen}} npm run build
104107
tags:
105108
- deploy
106109

@@ -109,6 +112,6 @@
109112
tags:
110113
- deploy
111114
notify:
112-
- Reload supervisor
115+
# - Reload supervisor
113116
- Restart chrome
114117

deploy/roles/raspi-information-radiator/templates/xinitrc.j2

+1
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,5 @@ while true; do
3737

3838
# Start the browser (See http://peter.sh/experiments/chromium-command-line-switches/)
3939
chromium-browser --app={{ boot_to_url }} --kiosk {% if enable_remote_debugging %} --remote-debugging-port=9222 {% endif %}
40+
4041
done;

deploy/templates/config.txt

+2
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,13 @@ disable_overscan=1
3131
config_hdmi_boost=4
3232

3333
#set specific CVT mode
34+
{% if screen == 'primary' %}
3435
hdmi_cvt 800 480 60 6 0 0 0
3536

3637
#set CVT as default
3738
hdmi_group=2
3839
hdmi_mode=87
40+
{% endif %}
3941

4042
# uncomment to force a HDMI mode rather than DVI. This can make audio work in
4143
# DMT (computer monitor) modes

deploy/templates/supervisor/foobar.conf

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
[program:thunderpush]
2-
command=thunderpush -v -p {{ thunder_port }} {{ thunder_publickey }} {{ thunder_secretkey }}
2+
command=thunderpush -H {{ thunder_host }} -v -p {{ thunder_port }} {{ thunder_publickey }} {{ thunder_secretkey }}
33

4+
{% if screen == 'primary' %}
45
[program:barcode-scanner]
56
chown=root
67
directory=/usr/app/drivers/
7-
command=python3 barcode.py -v --port {{ thunder_port }} 'Barcode Reader' localhost {{ thunder_publickey }} {{ thunder_secretkey }}
8+
command=python3 barcode.py -v --port {{ thunder_port }} '{{ scanner_device }}' {{ thunder_host }} {{ thunder_publickey }} {{ thunder_secretkey }}
89

910
[program:rfid-scanner]
1011
chown=root
@@ -13,13 +14,14 @@ command=python3 rfid.py -v {{ rfid_device }}
1314

1415
[program:rfid-forwarder-local]
1516
directory=/usr/app/drivers/
16-
command=python3 rfid_forwarder.py -v --tport {{ thunder_port }} {{ thunder_publickey }} {{ thunder_secretkey }}
17+
command=python3 rfid_forwarder.py -v --thost {{ thunder_host }} --tport {{ thunder_port }} {{ thunder_publickey }} {{ thunder_secretkey }}
1718

1819
{% if remote_thunder_enabled|bool %}
1920
[program:rfid-forwarder-remote]
2021
directory=/usr/app/drivers/
2122
command=python3 rfid_forwarder.py -v --tport {{ remote_thunder_port }} --thost {{ remote_thunder_host }} {{ remote_thunder_publickey }} {{ remote_thunder_secretkey }}
2223
{% endif %}
24+
{% endif %}
2325

2426
[program:webserver]
2527
directory=/usr/app/web/

package.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
"@types/redux": "3.5.28",
2828
"@types/redux-logger": "2.6.31",
2929
"@types/redux-thunk": "2.1.30",
30+
"apeman-react-clock": "^3.0.3",
3031
"autoprefixer": "6.4.0",
3132
"awesome-typescript-loader": "2.2.4",
3233
"classnames": "2.2.5",
@@ -38,9 +39,9 @@
3839
"object-assign": "4.1.0",
3940
"postcss": "5.1.2",
4041
"postcss-loader": "0.11.0",
42+
"qrcode.react": "^0.6.1",
4143
"raven-for-redux": "0.3.0",
4244
"raven-js": "3.12.1",
43-
"qrcode.react": "^0.6.1",
4445
"react": "15.3.1",
4546
"react-addons-css-transition-group": "15.3.1",
4647
"react-dom": "15.3.1",
@@ -51,7 +52,7 @@
5152
"redux-logger": "2.6.1",
5253
"redux-router": "2.1.2",
5354
"redux-thunk": "2.1.0",
54-
"reflexbox": "2.1.0",
55+
"reflexbox": "2.2.3",
5556
"requirejs": "2.2.0",
5657
"sass-loader": "4.0.0",
5758
"style-loader": "0.13.1",

server.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
var webpack = require("webpack");
22
var WebpackDevServer = require("webpack-dev-server");
33
var config = require("./webpack.config");
4+
var port = process.env.PORT || 3000;
45

56
new WebpackDevServer(webpack(config), {
67
publicPath: config.output.publicPath,
@@ -25,10 +26,10 @@ new WebpackDevServer(webpack(config), {
2526
warnings: true,
2627
publicPath: false
2728
}
28-
}).listen(3000, "0.0.0.0", function (err, result) {
29+
}).listen(port, "0.0.0.0", function (err, result) {
2930
if (err) {
3031
console.log(err);
3132
}
3233

33-
console.log("Listening at http://localhost:3000");
34+
console.log("Listening at http://localhost:" + port);
3435
});

0 commit comments

Comments
 (0)