Skip to content

Commit 5057edd

Browse files
committed
Merge branch 'release/2.1.1'
2 parents d6ee0be + d4d31a5 commit 5057edd

File tree

8 files changed

+44
-13
lines changed

8 files changed

+44
-13
lines changed

.docker/vhost.conf

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@ 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;
10+
11+
add_header Cache-Control "no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0";
12+
add_header Pragma "no-cache";
13+
add_header Expires "0";
1214
}
1315

1416
location /client/ws {

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file.
44

55
## Unreleased
66

7+
## [2.1.1] - 2024-10-23
8+
9+
- [#138](https://github.com/os2display/display-client/pull/138)
10+
- Avoided setting ER105 in url when no token exists in local storage.
11+
- [#137](https://github.com/os2display/display-client/pull/137)
12+
- Add `no-cache´ directive to nginx setup.
13+
714
## [2.1.0] - 2024-10-23
815

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

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,15 @@ server {
33
server_name localhost;
44
root /var/www/html;
55

6+
add_header Cache-Control "no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0";
7+
add_header Pragma "no-cache";
8+
add_header Expires "0";
9+
610
location {{ getenv "APP_SCREEN_CLIENT_PATH" "/" }} {
711
rewrite ^{{ getenv "APP_SCREEN_CLIENT_PATH" "/" }}(.*) /$1 break;
812
index index.html;
913
autoindex off;
10-
add_header Cache-Control "public, max-age=604800";
11-
expires 7d;
14+
1215
try_files $uri $uri/ =404;
1316
}
1417

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,15 @@ server {
33
server_name localhost;
44
root /var/www/html;
55

6+
add_header Cache-Control "no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0";
7+
add_header Pragma "no-cache";
8+
add_header Expires "0";
9+
610
location {{ getenv "APP_SCREEN_CLIENT_PATH" "/" }} {
711
rewrite ^{{ getenv "APP_SCREEN_CLIENT_PATH" "/" }}(.*) /$1 break;
812
index index.html;
913
autoindex off;
10-
add_header Cache-Control "public, max-age=604800";
11-
expires 7d;
14+
1215
try_files $uri $uri/ =404;
1316
}
1417

public/online-check/index.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
}
1919

2020
body {
21-
background-color: #333333;
21+
background-color: #000000;
2222
margin-top: 10%;
2323
text-align: center;
2424
font-family: Arial,Helvetica,sans-serif;
@@ -71,7 +71,7 @@
7171

7272
const checkOnlineStatus = async () => {
7373
try {
74-
const online = await fetch("1pixel.png?no_cache=" + Date.now());
74+
const online = await fetch("1pixel.png?ts=" + Date.now());
7575
return online.status >= 200 && online.status < 300; // either true or false
7676
} catch (err) {
7777
return false; // definitely offline
@@ -87,7 +87,7 @@
8787
helpDisplay.textContent = "Redirecting to client...";
8888

8989
setTimeout(async () => {
90-
window.location.assign("../");
90+
window.location.assign("../?ts="+ Date.now());
9191
}, 3000
9292
)
9393
}

src/app.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ body {
2727
color: white;
2828
padding: 0;
2929
margin: 0;
30+
font-family: monospace;
31+
font-size: 2em;
3032
}
3133

3234
.bind-key-container {

src/service/token-service.js

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,17 @@ class TokenService {
5353
getExpireState = () => {
5454
const expire = appStorage.getTokenExpire();
5555
const issueAt = appStorage.getTokenIssueAt();
56+
const token = appStorage.getToken();
57+
58+
if (expire === null) {
59+
return constants.NO_EXPIRE;
60+
}
61+
if (issueAt === null) {
62+
return constants.NO_ISSUED_AT;
63+
}
64+
if (token === null) {
65+
return constants.NO_TOKEN;
66+
}
5667

5768
const timeDiff = expire - issueAt;
5869
const nowSeconds = Math.floor(new Date().getTime() / 1000);
@@ -121,11 +132,11 @@ class TokenService {
121132
checkToken = () => {
122133
const expiredState = this.getExpireState();
123134

124-
if (expiredState === constants.TOKEN_EXPIRED) {
135+
if ([constants.NO_EXPIRE, constants.NO_ISSUED_AT, constants.NO_TOKEN].includes(expiredState)) {
136+
// Ignore. No token saved in storage.
137+
} else if (expiredState === constants.TOKEN_EXPIRED) {
125138
statusService.setError(constants.ERROR_TOKEN_EXPIRED);
126-
} else if (
127-
expiredState === constants.TOKEN_VALID_SHOULD_HAVE_BEEN_REFRESHED
128-
) {
139+
} else if (expiredState === constants.TOKEN_VALID_SHOULD_HAVE_BEEN_REFRESHED) {
129140
statusService.setError(
130141
constants.ERROR_TOKEN_VALID_SHOULD_HAVE_BEEN_REFRESHED
131142
);

src/util/constants.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ const constants = {
1414
ERROR_RELEASE_FILE_NOT_LOADED: 'ER104', // Release file could not be loaded.
1515
ERROR_TOKEN_EXPIRED: 'ER105', // Token is expired.
1616
ERROR_TOKEN_VALID_SHOULD_HAVE_BEEN_REFRESHED: 'ER106', // Token is valid but should have been refreshed.
17+
NO_TOKEN: 'NO_TOKEN',
18+
NO_EXPIRE: 'NO_EXPIRE',
19+
NO_ISSUED_AT: 'NO_ISSUED_AT',
1720
};
1821

1922
export default constants;

0 commit comments

Comments
 (0)