Skip to content

Commit 68991fe

Browse files
committed
Merge branch 'develop'
2 parents 52b8f8f + 96dd619 commit 68991fe

File tree

19 files changed

+195
-85
lines changed

19 files changed

+195
-85
lines changed

.docker/vhost.conf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,7 @@ server {
77
proxy_set_header X-Forwarded-For $remote_addr;
88
proxy_set_header Host $http_host;
99
proxy_pass http://node:3000;
10+
add_header Cache-Control "public, max-age=604800";
11+
expires 7d;
1012
}
1113
}

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,19 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
## [2.0.2] - 2024-04-25
6+
7+
- [#123](https://github.com/os2display/display-client/pull/123)
8+
- Ensured real ip is logged in nginx.
9+
- [#124](https://github.com/os2display/display-client/pull/124)
10+
- Changed to apply max-age 7d to all files and added cache busting to config.json and release.json.
11+
- Added "loginCheckTimeout", "configFetchInterval", "refreshTokenTimeout", "releaseTimestampIntervalTimeout" to config.json.
12+
- Simplified config.json.
13+
- [#122](https://github.com/os2display/display-client/pull/122)
14+
- Added max-age and expires 1 hour to config.json and release.json.
15+
- [#121](https://github.com/os2display/display-client/pull/120)
16+
- Add releaseVersion, releaseTimestamp and screenId searchParams when starting app.
17+
518
## [2.0.1] - 2024-04-10
619

720
- [#120](https://github.com/os2display/display-client/pull/120)

README.md

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5,30 +5,30 @@ See [https://github.com/os2display/display-docs/blob/main/client.md](https://git
55

66
## Config
77
The client can be configured by creating `public/config.json` with relevant values.
8-
See `public/example_config.json` for values.
9-
10-
```json
11-
{
12-
"apiEndpoint": "",
13-
"authenticationEndpoint": "/v2/authentication/screen",
14-
"authenticationRefreshTokenEndpoint": "/v2/authentication/token/refresh",
15-
"dataStrategy": {
16-
"type": "pull",
17-
"config": {
18-
"interval": 30000,
19-
"endpoint": ""
20-
}
21-
},
22-
"colorScheme": {
23-
"type": "library",
24-
"lat": 56.0,
25-
"lng": 10.0
26-
},
27-
"schedulingInterval": 60000,
28-
"debug": false
29-
}
30-
```
31-
All endpoint should be configured with out a trailing slash. The endpoints `apiEndpoint` and `dataStrategy.config.endpoint` can be
8+
See `public/example_config.json` for example values.
9+
10+
Values explained:
11+
12+
* apiEndpoint - The endpoint where the API is located.
13+
* loginCheckTimeout - How often (milliseconds) should the screen check for
14+
status when it is not logged in, and waiting for being activated in the
15+
administration.
16+
* configFetchInterval - How often (milliseconds) should a fresh
17+
config.json be fetched.
18+
* refreshTokenTimeout - How often (milliseconds) should it be checked
19+
whether the token needs to be refreshed?
20+
* releaseTimestampIntervalTimeout - How often (milliseconds) should the
21+
code check if a new release has been deployed, and reload if true?
22+
* dataStrategy.config.interval - How often (milliseconds) should data be fetched
23+
for the logged in screen?
24+
* colorScheme.lat - Where is the screen located? Used for darkmode.
25+
* colorScheme.lng - Where is the screen located? Used for darkmode.
26+
* schedulingInterval - How often (milliseconds) should scheduling for the
27+
screen be checked.
28+
* debug - Should the screen be in debug mode? If true, the cursor will be
29+
invisible.
30+
31+
All endpoint should be configured without a trailing slash. The endpoints `apiEndpoint` can be
3232
left empty if the api is hosted from the root of the same domain as the client. E.g. if the api is at https://example.org and the client is at
3333
https://example.org/client
3434

infrastructure/itkdev/etc/confd/templates/config.tmpl

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
{
22
"apiEndpoint": "{{ getenv "APP_API_ENDPOINT" "" }}",
3-
"authenticationEndpoint": "{{ getenv "APP_API_AUTHENTICATION_ENDPOINT" "/v2/authentication/token" }}",
4-
"authenticationRefreshTokenEndpoint": "{{ getenv "APP_API_AUTHENTICATION_REFRESH_ENDPOINT" "/v2/authentication/token/refresh" }}",
3+
"loginCheckTimeout": {{ getenv "APP_LOGIN_CHECK_TIMEOUT" "20000" }},
4+
"configFetchInterval": {{ getenv "APP_CONFIG_FETCH_INTERVAL" "600000" }},
5+
"refreshTokenTimeout": {{ getenv "APP_REFRESH_TOKEN_TIMEOUT" "60000" }},
6+
"releaseTimestampIntervalTimeout": {{ getenv "APP_RELEASE_TIMESTAMP_INTERVAL_TIMEOUT" "600000" }},
57
"dataStrategy": {
68
"type": "pull",
79
"config": {
8-
"interval": {{ getenv "APP_DATA_PULL_INTERVAL" "30000" }},
9-
"endpoint": "{{ getenv "APP_API_PATH" "" }}"
10+
"interval": {{ getenv "APP_DATA_PULL_INTERVAL" "30000" }}
1011
}
1112
},
1213
"colorScheme": {

infrastructure/itkdev/etc/confd/templates/default.conf.tmpl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ server {
77
rewrite ^{{ getenv "APP_SCREEN_CLIENT_PATH" "/" }}(.*) /$1 break;
88
index index.html;
99
autoindex off;
10+
add_header Cache-Control "public, max-age=604800";
11+
expires 7d;
1012
try_files $uri $uri/ =404;
1113
}
1214

infrastructure/itkdev/etc/confd/templates/nginx.conf.tmpl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,11 @@ http {
3434
include /etc/nginx/mime.types;
3535
default_type application/octet-stream;
3636

37-
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
37+
set_real_ip_from 172.16.0.0/8;
38+
real_ip_recursive on;
39+
real_ip_header X-Forwarded-For;
40+
41+
log_format main '$http_x_real_ip - $remote_user [$time_local] "$request" '
3842
'$status $body_bytes_sent "$http_referer" '
3943
'"$http_user_agent" "$http_x_forwarded_for"';
4044

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,26 @@
11
# OS2display image build
22

33
This folder contains the infrastructure files for building the `os2display/display-client` image.
4+
5+
## Environment variables that can be set
6+
7+
### config.json
8+
9+
* APP_API_ENDPOINT - The endpoint where the API can be called.
10+
* APP_LOGIN_CHECK_TIMEOUT - How often (milliseconds) should the screen check for
11+
status when it is not logged in, and waiting for being activated in the
12+
administration.
13+
* APP_CONFIG_FETCH_INTERVAL - How often (milliseconds) should a fresh
14+
config.json be fetched.
15+
* APP_REFRESH_TOKEN_TIMEOUT - How often (milliseconds) should it be checked
16+
whether the token needs to be refreshed?
17+
* APP_RELEASE_TIMESTAMP_INTERVAL_TIMEOUT - How often (milliseconds) should the
18+
code check if a new release has been deployed, and reload if true?
19+
* APP_DATA_PULL_INTERVAL - How often (milliseconds) should data be fetched for
20+
the logged in screen?
21+
* APP_CLIENT_LATITUDE - Where is the screen located? Used for darkmode.
22+
* APP_CLIENT_LONGITUDE - Where is the screen located? Used for darkmode.
23+
* APP_SCHEDULING_INTERVAL - How often (milliseconds) should scheduling for the
24+
screen be checked.
25+
* APP_DEBUG - Should the screen be in debug mode? If true, the cursor will be
26+
invisible.

infrastructure/os2display/etc/confd/templates/config.tmpl

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
{
22
"apiEndpoint": "{{ getenv "APP_API_ENDPOINT" "/" }}",
3-
"authenticationEndpoint": "{{ getenv "APP_API_AUTHENTICATION_ENDPOINT" "/v2/authentication/token" }}",
4-
"authenticationRefreshTokenEndpoint": "{{ getenv "APP_API_AUTHENTICATION_REFRESH_ENDPOINT" "/v2/authentication/token/refresh" }}",
3+
"loginCheckTimeout": {{ getenv "APP_LOGIN_CHECK_TIMEOUT" "20000" }},
4+
"configFetchInterval": {{ getenv "APP_CONFIG_FETCH_INTERVAL" "600000" }},
5+
"refreshTokenTimeout": {{ getenv "APP_REFRESH_TOKEN_TIMEOUT" "60000" }},
6+
"releaseTimestampIntervalTimeout": {{ getenv "APP_RELEASE_TIMESTAMP_INTERVAL_TIMEOUT" "600000" }},
57
"dataStrategy": {
68
"type": "pull",
79
"config": {
8-
"interval": {{ getenv "APP_DATA_PULL_INTERVAL" "30000" }},
9-
"endpoint": "{{ getenv "APP_API_PATH" "/" }}"
10+
"interval": {{ getenv "APP_DATA_PULL_INTERVAL" "30000" }}
1011
}
1112
},
1213
"colorScheme": {

infrastructure/os2display/etc/confd/templates/default.conf.tmpl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ server {
77
rewrite ^{{ getenv "APP_SCREEN_CLIENT_PATH" "/" }}(.*) /$1 break;
88
index index.html;
99
autoindex off;
10+
add_header Cache-Control "public, max-age=604800";
11+
expires 7d;
1012
try_files $uri $uri/ =404;
1113
}
1214

infrastructure/os2display/etc/confd/templates/nginx.conf.tmpl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,11 @@ http {
3434
include /etc/nginx/mime.types;
3535
default_type application/octet-stream;
3636

37-
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
37+
set_real_ip_from 172.16.0.0/8;
38+
real_ip_recursive on;
39+
real_ip_header X-Forwarded-For;
40+
41+
log_format main '$http_x_real_ip - $remote_user [$time_local] "$request" '
3842
'$status $body_bytes_sent "$http_referer" '
3943
'"$http_user_agent" "$http_x_forwarded_for"';
4044

0 commit comments

Comments
 (0)