Skip to content

Commit b2db212

Browse files
e-halinenjhanninenahjyrkia
authored
Production release v1.1.0 (#126)
* Add pikaratikka to the maps * Add icons and colors for pikaratikka * Fix typo on color code * Change pikaratikka to updated color * MM-523: Fix rendering error about minimum radius on circle vectors (#109) * #25217: Initialize this.root in component constructors * Cleanup * 25664: Prevent large generations timeout and left on pending state * Bump hsl-map-style version to 1.1.3 (#117) * AB#48634: Bump hsl-map-style version to 1.2.0 (#118) * zoneSymbol positioning fix (#115) * AB#57971 improve access control (#120) * AB#57971: Switch user domain validation to validation library * Add dependency changes * AB#56581: Add version numbering and check against prod (#122) * AB#56568: Change license to AGPL-3.0-only (#124) * react updates (#116) * AB#57970: Switch prod login provider (#125) * v1.1.0 --------- Co-authored-by: Juho Hänninen <juho.hanninen@cgi.com> Co-authored-by: Anton Jyrkiäinen <anton.jyrkiainen@helsinki.fi>
1 parent cb1b43d commit b2db212

File tree

8 files changed

+306
-97
lines changed

8 files changed

+306
-97
lines changed

.env.prod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ AZURE_STORAGE_KEY=
1212
AZURE_FONTS_SAS_URL=
1313
AZURE_UPLOAD_CONTAINER=routemap-prod
1414

15-
CLIENT_ID=7833861618225795
15+
CLIENT_ID=0704589208046070
1616
CLIENT_SECRET=
1717
API_CLIENT_ID=2411181397763460
1818
API_CLIENT_SECRET=
1919
REDIRECT_URI=https://kartat.hsl.fi/kartta
20-
LOGIN_PROVIDER_URI=https://hslid-uat.cinfra.fi
20+
LOGIN_PROVIDER_URI=https://id.hsl.fi
2121
DOMAINS_ALLOWED_TO_GENERATE=
2222
DOMAINS_ALLOWED_TO_LOGIN=

.env.stage

Lines changed: 0 additions & 22 deletions
This file was deleted.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Check version numbering is updated prior to merging
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- master
7+
8+
jobs:
9+
check_version:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v4
14+
- name: Check if version has been updated
15+
id: check
16+
uses: EndBug/version-check@v2
17+
- name: Fail if version is not changed prior to merge
18+
if: steps.check.outputs.changed == 'false'
19+
uses: actions/github-script@v7
20+
with:
21+
script: |
22+
core.setFailed('No version number change found. Run `yarn version`-command to upgrade version before merge can be completed.')

LICENSE

Lines changed: 211 additions & 0 deletions
Large diffs are not rendered by default.

package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "hsl-routemap-server",
3-
"version": "0.1.0",
3+
"version": "1.1.0",
44
"description": "HSL Routemap server",
55
"main": "index.js",
66
"scripts": {
@@ -30,7 +30,7 @@
3030
"url": "git+https://github.com/HSLdevcom/hsl-routemap-server.git"
3131
},
3232
"author": "",
33-
"license": "MIT",
33+
"license": "AGPL-3.0-only",
3434
"bugs": {
3535
"url": "https://github.com/HSLdevcom/hsl-routemap-server/issues"
3636
},
@@ -96,13 +96,14 @@
9696
"pg": "^8.7.3",
9797
"prop-types": "^15.6.0",
9898
"puppeteer": "^15.4.1",
99-
"react": "16.8.6",
99+
"react": "18.2.0",
100100
"react-apollo": "^2.0.1",
101-
"react-dom": "16.8.6",
101+
"react-dom": "18.2.0",
102102
"recompose": "^0.30.0",
103103
"segseg": "^0.2.2",
104104
"serve": "^13.0.2",
105105
"uuid": "^3.1.0",
106+
"validator": "^13.15.0",
106107
"viewport-mercator-project": "^4.1.1"
107108
}
108109
}

scripts/auth/authEndpoints.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,26 @@
11
const { get, last, clone } = require('lodash');
22
const AuthService = require('./authService');
3+
const validator = require('validator');
34

45
const { DOMAINS_ALLOWED_TO_LOGIN, ROUTEMAP_TEST_GROUP } = require('../../constants');
56

67
const allowedDomains = DOMAINS_ALLOWED_TO_LOGIN.split(',');
78

89
const hasAllowedDomain = async (userInfo) => {
9-
const groupNames = get(userInfo, 'groups');
10-
const domain = last(userInfo.email.toLowerCase().split('@')) || '';
10+
const groups = get(userInfo, 'groups');
1111

12-
if (groupNames.includes(ROUTEMAP_TEST_GROUP)) {
12+
const emailValidationOptions = {
13+
host_whitelist: allowedDomains,
14+
};
15+
16+
if (groups.includes(ROUTEMAP_TEST_GROUP)) {
1317
return true;
1418
}
1519

16-
if (!allowedDomains.includes(domain)) {
20+
if (
21+
!validator.isEmail(userInfo.email, emailValidationOptions) &&
22+
!groups.includes(ROUTEMAP_TEST_GROUP)
23+
) {
1724
console.log(`User does not have allowed domain. Logging out.`);
1825
return false;
1926
}

src/util/promiseWrapper.js

Lines changed: 36 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,50 @@
1-
import React, { Component } from 'react';
1+
import React, { useState, useEffect } from 'react';
22
import renderQueue from 'util/renderQueue';
33

4-
const hocFactory = propName => WrappedComponent =>
5-
class PromiseWrapper extends Component {
6-
constructor(props) {
7-
super(props);
8-
this.state = { loading: !!props[propName] };
9-
}
10-
11-
componentDidMount() {
12-
if (this.props[propName]) {
13-
this.handlePromise(this.props[propName]);
14-
}
15-
}
4+
const hocFactory = (propName) => (WrappedComponent) => (props) => {
5+
const [state, setState] = useState({
6+
loading: !!props[propName],
7+
value: null,
8+
error: null,
9+
});
1610

17-
componentWillReceiveProps(nextProps) {
18-
if (nextProps[propName] && nextProps[propName] !== this.props[propName]) {
19-
this.setState({ loading: true });
20-
this.handlePromise(nextProps[propName]);
21-
}
22-
}
23-
24-
componentWillUnmount() {
25-
this.promise = null;
26-
}
11+
useEffect(() => {
12+
let isMounted = true;
13+
const promise = props[propName];
2714

28-
handlePromise(promise) {
29-
this.promise = promise;
15+
if (promise) {
16+
setState((prevState) => ({ ...prevState, loading: true }));
3017
renderQueue.add(promise);
18+
3119
promise
32-
.then(value => {
33-
const callback = () => renderQueue.remove(promise);
34-
if (this.promise !== promise) {
35-
callback();
36-
} else {
37-
this.setState({ value, loading: false }, callback);
20+
.then((value) => {
21+
if (isMounted) {
22+
setState({ value, loading: false, error: null });
23+
renderQueue.remove(promise);
3824
}
3925
})
40-
.catch(error => {
41-
const callback = () => renderQueue.remove(promise, { error });
42-
if (this.promise !== promise) {
43-
callback();
44-
} else {
45-
this.setState({ error, loading: false }, callback);
26+
.catch((error) => {
27+
if (isMounted) {
28+
setState({ error, loading: false });
29+
renderQueue.remove(promise, { error });
4630
}
4731
});
4832
}
4933

50-
render() {
51-
if (this.state.loading || this.state.error) {
52-
return null;
53-
}
54-
const props = { ...this.props, [propName]: this.state.value };
55-
return <WrappedComponent {...props} />;
56-
}
57-
};
34+
return () => {
35+
isMounted = false;
36+
renderQueue.remove(promise);
37+
};
38+
}, [props[propName]]);
39+
40+
const { loading, error, value } = state;
41+
42+
if (loading || error) {
43+
return null;
44+
}
45+
46+
const newProps = { ...props, [propName]: value };
47+
return <WrappedComponent {...newProps} />;
48+
};
5849

5950
export default hocFactory;

yarn.lock

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7475,7 +7475,7 @@ prompt@0.2.14:
74757475
utile "0.2.x"
74767476
winston "0.8.x"
74777477

7478-
prop-types@^15.6.0, prop-types@^15.6.1, prop-types@^15.6.2, prop-types@^15.7.2, prop-types@^15.8.1:
7478+
prop-types@^15.6.0, prop-types@^15.6.1, prop-types@^15.7.2, prop-types@^15.8.1:
74797479
version "15.8.1"
74807480
resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.8.1.tgz#67d87bf1a694f48435cf332c24af10214a3140b5"
74817481
integrity sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==
@@ -7687,15 +7687,13 @@ react-apollo@^2.0.1:
76877687
ts-invariant "^0.4.2"
76887688
tslib "^1.9.3"
76897689

7690-
react-dom@16.8.6:
7691-
version "16.8.6"
7692-
resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-16.8.6.tgz#71d6303f631e8b0097f56165ef608f051ff6e10f"
7693-
integrity sha512-1nL7PIq9LTL3fthPqwkvr2zY7phIPjYrT0jp4HjyEQrEROnw4dG41VVwi/wfoCneoleqrNX7iAD+pXebJZwrwA==
7690+
react-dom@18.2.0:
7691+
version "18.2.0"
7692+
resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-18.2.0.tgz#22aaf38708db2674ed9ada224ca4aa708d821e3d"
7693+
integrity sha512-6IMTriUmvsjHUjNtEDudZfuDQUoWXVxKHhlEGSk81n4YFS+r/Kl99wXiwlVXtPBtJenozv2P+hxDsw9eA7Xo6g==
76947694
dependencies:
76957695
loose-envify "^1.1.0"
7696-
object-assign "^4.1.1"
7697-
prop-types "^15.6.2"
7698-
scheduler "^0.13.6"
7696+
scheduler "^0.23.0"
76997697

77007698
react-hot-loader@^4.13.1:
77017699
version "4.13.1"
@@ -7721,15 +7719,12 @@ react-lifecycles-compat@^3.0.2, react-lifecycles-compat@^3.0.4:
77217719
resolved "https://registry.yarnpkg.com/react-lifecycles-compat/-/react-lifecycles-compat-3.0.4.tgz#4f1a273afdfc8f3488a8c516bfda78f872352362"
77227720
integrity sha512-fBASbA6LnOU9dOU2eW7aQ8xmYBSXUIWr+UmF9b1efZBazGNO+rcXT/icdKnYm2pTwcRylVUYwW7H1PHfLekVzA==
77237721

7724-
react@16.8.6:
7725-
version "16.8.6"
7726-
resolved "https://registry.yarnpkg.com/react/-/react-16.8.6.tgz#ad6c3a9614fd3a4e9ef51117f54d888da01f2bbe"
7727-
integrity sha512-pC0uMkhLaHm11ZSJULfOBqV4tIZkx87ZLvbbQYunNixAAvjnC+snJCg0XQXn9VIsttVsbZP/H/ewzgsd5fxKXw==
7722+
react@18.2.0:
7723+
version "18.2.0"
7724+
resolved "https://registry.yarnpkg.com/react/-/react-18.2.0.tgz#555bd98592883255fa00de14f1151a917b5d77d5"
7725+
integrity sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ==
77287726
dependencies:
77297727
loose-envify "^1.1.0"
7730-
object-assign "^4.1.1"
7731-
prop-types "^15.6.2"
7732-
scheduler "^0.13.6"
77337728

77347729
read@1.0.x:
77357730
version "1.0.7"
@@ -8149,13 +8144,12 @@ sax@>=0.6.0:
81498144
resolved "https://registry.yarnpkg.com/sax/-/sax-1.2.4.tgz#2816234e2378bddc4e5354fab5caa895df7100d9"
81508145
integrity sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==
81518146

8152-
scheduler@^0.13.6:
8153-
version "0.13.6"
8154-
resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.13.6.tgz#466a4ec332467b31a91b9bf74e5347072e4cd889"
8155-
integrity sha512-IWnObHt413ucAYKsD9J1QShUKkbKLQQHdxRyw73sw4FN26iWr3DY/H34xGPe4nmL1DwXyWmSWmMrA9TfQbE/XQ==
8147+
scheduler@^0.23.0:
8148+
version "0.23.0"
8149+
resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.23.0.tgz#ba8041afc3d30eb206a487b6b384002e4e61fdfe"
8150+
integrity sha512-CtuThmgHNg7zIZWAXi3AsyIzA3n4xx7aNyjwC2VJldO2LMVDhFK+63xGqq6CsJH4rTAt6/M+N4GhZiDYPx9eUw==
81568151
dependencies:
81578152
loose-envify "^1.1.0"
8158-
object-assign "^4.1.1"
81598153

81608154
schema-utils@^1.0.0:
81618155
version "1.0.0"
@@ -9408,6 +9402,11 @@ uuid@^9.0.0:
94089402
resolved "https://registry.yarnpkg.com/uuid/-/uuid-9.0.0.tgz#592f550650024a38ceb0c562f2f6aa435761efb5"
94099403
integrity sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg==
94109404

9405+
validator@^13.15.0:
9406+
version "13.15.0"
9407+
resolved "https://registry.yarnpkg.com/validator/-/validator-13.15.0.tgz#2dc7ce057e7513a55585109eec29b2c8e8c1aefd"
9408+
integrity sha512-36B2ryl4+oL5QxZ3AzD0t5SsMNGvTtQHpjgFO5tbNxfXbMFkY822ktCDe1MnlqV3301QQI9SLHDNJokDI+Z9pA==
9409+
94119410
vary@^1.1.2, vary@~1.1.2:
94129411
version "1.1.2"
94139412
resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc"

0 commit comments

Comments
 (0)