Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
3bc5886
Add pikaratikka to the maps
jhanninen Sep 8, 2023
9412f31
Add icons and colors for pikaratikka
jhanninen Sep 8, 2023
67b730a
Fix typo on color code
jhanninen Sep 11, 2023
ca949f3
Merge pull request #107 from HSLdevcom/MM-511
jhanninen Sep 14, 2023
3bfe059
Change pikaratikka to updated color
jhanninen Sep 28, 2023
1b52131
Merge pull request #110 from HSLdevcom/MM-511
jhanninen Sep 28, 2023
df46413
MM-523: Fix rendering error about minimum radius on circle vectors (#…
e-halinen Sep 28, 2023
c1a9a16
#25217: Initialize this.root in component constructors
e-halinen Oct 17, 2023
210a9d3
Cleanup
e-halinen Oct 17, 2023
7d2cd01
25664: Prevent large generations timeout and left on pending state
e-halinen Nov 2, 2023
e21ee8b
Merge pull request #112 from HSLdevcom/25217_map_generation_race_cond…
ahjyrkia Dec 11, 2023
3a4d741
Merge pull request #114 from HSLdevcom/25664_pending_large_maps
ahjyrkia Dec 19, 2023
fe95731
Bump hsl-map-style version to 1.1.3 (#117)
e-halinen Apr 24, 2024
4ef2d65
AB#48634: Bump hsl-map-style version to 1.2.0 (#118)
e-halinen Dec 30, 2024
689aa5f
zoneSymbol positioning fix (#115)
ahjyrkia Feb 7, 2025
e3474d7
Merge branch 'master' into development
e-halinen Feb 7, 2025
a33f132
AB#57971 improve access control (#120)
e-halinen May 6, 2025
15a61b1
AB#56581: Add version numbering and check against prod (#122)
e-halinen May 23, 2025
9eb1e45
AB#56568: Change license to AGPL-3.0-only (#124)
e-halinen Jun 4, 2025
78ef518
react updates (#116)
ahjyrkia Jun 4, 2025
38fc477
AB#57970: Switch prod login provider (#125)
e-halinen Jun 12, 2025
7b4e871
v1.1.0
e-halinen Jun 12, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .env.prod
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ AZURE_STORAGE_KEY=
AZURE_FONTS_SAS_URL=
AZURE_UPLOAD_CONTAINER=routemap-prod

CLIENT_ID=7833861618225795
CLIENT_ID=0704589208046070
CLIENT_SECRET=
API_CLIENT_ID=2411181397763460
API_CLIENT_SECRET=
REDIRECT_URI=https://kartat.hsl.fi/kartta
LOGIN_PROVIDER_URI=https://hslid-uat.cinfra.fi
LOGIN_PROVIDER_URI=https://id.hsl.fi
DOMAINS_ALLOWED_TO_GENERATE=
DOMAINS_ALLOWED_TO_LOGIN=
22 changes: 0 additions & 22 deletions .env.stage

This file was deleted.

22 changes: 22 additions & 0 deletions .github/workflows/check_version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Check version numbering is updated prior to merging

on:
pull_request:
branches:
- master

jobs:
check_version:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Check if version has been updated
id: check
uses: EndBug/version-check@v2
- name: Fail if version is not changed prior to merge
if: steps.check.outputs.changed == 'false'
uses: actions/github-script@v7
with:
script: |
core.setFailed('No version number change found. Run `yarn version`-command to upgrade version before merge can be completed.')
211 changes: 211 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hsl-routemap-server",
"version": "0.1.0",
"version": "1.1.0",
"description": "HSL Routemap server",
"main": "index.js",
"scripts": {
Expand Down Expand Up @@ -30,7 +30,7 @@
"url": "git+https://github.com/HSLdevcom/hsl-routemap-server.git"
},
"author": "",
"license": "MIT",
"license": "AGPL-3.0-only",
"bugs": {
"url": "https://github.com/HSLdevcom/hsl-routemap-server/issues"
},
Expand Down Expand Up @@ -96,13 +96,14 @@
"pg": "^8.7.3",
"prop-types": "^15.6.0",
"puppeteer": "^15.4.1",
"react": "16.8.6",
"react": "18.2.0",
"react-apollo": "^2.0.1",
"react-dom": "16.8.6",
"react-dom": "18.2.0",
"recompose": "^0.30.0",
"segseg": "^0.2.2",
"serve": "^13.0.2",
"uuid": "^3.1.0",
"validator": "^13.15.0",
"viewport-mercator-project": "^4.1.1"
}
}
15 changes: 11 additions & 4 deletions scripts/auth/authEndpoints.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,26 @@
const { get, last, clone } = require('lodash');
const AuthService = require('./authService');
const validator = require('validator');

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

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

const hasAllowedDomain = async (userInfo) => {
const groupNames = get(userInfo, 'groups');
const domain = last(userInfo.email.toLowerCase().split('@')) || '';
const groups = get(userInfo, 'groups');

if (groupNames.includes(ROUTEMAP_TEST_GROUP)) {
const emailValidationOptions = {
host_whitelist: allowedDomains,
};

if (groups.includes(ROUTEMAP_TEST_GROUP)) {
return true;
}

if (!allowedDomains.includes(domain)) {
if (
!validator.isEmail(userInfo.email, emailValidationOptions) &&
!groups.includes(ROUTEMAP_TEST_GROUP)
) {
console.log(`User does not have allowed domain. Logging out.`);
return false;
}
Expand Down
13 changes: 8 additions & 5 deletions scripts/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,14 @@ async function renderComponent(options) {
timeout: 5 * 60000,
};

const contents = await page.pdf(printOptions);

await fs.outputFile(pdfPath(id), contents);
await page.close();
await uploadPosterToCloud(pdfPath(id));
try {
const contents = await page.pdf(printOptions);
await fs.outputFile(pdfPath(id), contents);
await page.close();
await uploadPosterToCloud(pdfPath(id));
} catch (e) {
throw new Error('PDF Generation failed', e);
}
}

async function renderComponentRetry(options) {
Expand Down
6 changes: 4 additions & 2 deletions src/components/labelPlacement/itemFixed.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ class ItemFixed extends Component {
super(props);
this.state = { top: props.top, left: props.left };
this.visible = true;
this.root = React.createRef();
}

setPosition(top, left) {
Expand Down Expand Up @@ -46,10 +47,11 @@ class ItemFixed extends Component {

return (
<div
ref={ref => {
ref={(ref) => {
this.root = ref;
}}
style={style}>
style={style}
>
{this.props.children}
</div>
);
Expand Down
6 changes: 4 additions & 2 deletions src/components/labelPlacement/itemPositioned.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class ItemPositioned extends Component {
left: props.x,
visible: props.visible || !props.allowHidden,
};
this.root = React.createRef();
}

setPosition(top, left, visible) {
Expand Down Expand Up @@ -59,10 +60,11 @@ class ItemPositioned extends Component {
if (this.state.visible) {
return (
<div
ref={ref => {
ref={(ref) => {
this.root = ref;
}}
style={style}>
style={style}
>
{this.props.children}
</div>
);
Expand Down
15 changes: 10 additions & 5 deletions src/components/routeMap/routeMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,11 +188,16 @@ const RouteMap = (props) => {
))}
{projectedSymbols &&
projectedSymbols.length > 0 &&
projectedSymbols.map((symbol, index) => (
<ItemFixed key={index} left={symbol.sy} top={symbol.sx}>
<ZoneSymbol size={symbol.size} zone={symbol.zone} />
</ItemFixed>
))}
projectedSymbols.map((symbol, index) => {
const matchValues = symbol.size.match(/\d+/);
const symbolSizeNumber = matchValues ? parseInt(matchValues[0], 10) : null;
const offset = symbolSizeNumber ? symbolSizeNumber / 2 : 0;
return (
<ItemFixed key={index} left={symbol.sy - offset} top={symbol.sx - offset}>
<ZoneSymbol size={symbol.size} zone={symbol.zone} />
</ItemFixed>
);
})}
{props.projectedTerminuses.map((terminus, index) => (
<ItemPositioned
key={index}
Expand Down
81 changes: 36 additions & 45 deletions src/util/promiseWrapper.js
Original file line number Diff line number Diff line change
@@ -1,59 +1,50 @@
import React, { Component } from 'react';
import React, { useState, useEffect } from 'react';
import renderQueue from 'util/renderQueue';

const hocFactory = propName => WrappedComponent =>
class PromiseWrapper extends Component {
constructor(props) {
super(props);
this.state = { loading: !!props[propName] };
}

componentDidMount() {
if (this.props[propName]) {
this.handlePromise(this.props[propName]);
}
}
const hocFactory = (propName) => (WrappedComponent) => (props) => {
const [state, setState] = useState({
loading: !!props[propName],
value: null,
error: null,
});

componentWillReceiveProps(nextProps) {
if (nextProps[propName] && nextProps[propName] !== this.props[propName]) {
this.setState({ loading: true });
this.handlePromise(nextProps[propName]);
}
}

componentWillUnmount() {
this.promise = null;
}
useEffect(() => {
let isMounted = true;
const promise = props[propName];

handlePromise(promise) {
this.promise = promise;
if (promise) {
setState((prevState) => ({ ...prevState, loading: true }));
renderQueue.add(promise);

promise
.then(value => {
const callback = () => renderQueue.remove(promise);
if (this.promise !== promise) {
callback();
} else {
this.setState({ value, loading: false }, callback);
.then((value) => {
if (isMounted) {
setState({ value, loading: false, error: null });
renderQueue.remove(promise);
}
})
.catch(error => {
const callback = () => renderQueue.remove(promise, { error });
if (this.promise !== promise) {
callback();
} else {
this.setState({ error, loading: false }, callback);
.catch((error) => {
if (isMounted) {
setState({ error, loading: false });
renderQueue.remove(promise, { error });
}
});
}

render() {
if (this.state.loading || this.state.error) {
return null;
}
const props = { ...this.props, [propName]: this.state.value };
return <WrappedComponent {...props} />;
}
};
return () => {
isMounted = false;
renderQueue.remove(promise);
};
}, [props[propName]]);

const { loading, error, value } = state;

if (loading || error) {
return null;
}

const newProps = { ...props, [propName]: value };
return <WrappedComponent {...newProps} />;
};

export default hocFactory;
43 changes: 21 additions & 22 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4980,8 +4980,8 @@ hpack.js@^2.1.6:
wbuf "^1.1.0"

hsl-map-style@hsldevcom/hsl-map-style#master:
version "1.1.2"
resolved "https://codeload.github.com/hsldevcom/hsl-map-style/tar.gz/207a8de2664c9a50b5a5f886d30f5b1628f995c7"
version "1.2.0"
resolved "https://codeload.github.com/hsldevcom/hsl-map-style/tar.gz/68b1642ce364ebcea115bc3f20465d3c2ee83c0d"
dependencies:
lodash "^4.17.4"

Expand Down Expand Up @@ -7475,7 +7475,7 @@ prompt@0.2.14:
utile "0.2.x"
winston "0.8.x"

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:
prop-types@^15.6.0, prop-types@^15.6.1, prop-types@^15.7.2, prop-types@^15.8.1:
version "15.8.1"
resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.8.1.tgz#67d87bf1a694f48435cf332c24af10214a3140b5"
integrity sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==
Expand Down Expand Up @@ -7687,15 +7687,13 @@ react-apollo@^2.0.1:
ts-invariant "^0.4.2"
tslib "^1.9.3"

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

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

react@16.8.6:
version "16.8.6"
resolved "https://registry.yarnpkg.com/react/-/react-16.8.6.tgz#ad6c3a9614fd3a4e9ef51117f54d888da01f2bbe"
integrity sha512-pC0uMkhLaHm11ZSJULfOBqV4tIZkx87ZLvbbQYunNixAAvjnC+snJCg0XQXn9VIsttVsbZP/H/ewzgsd5fxKXw==
react@18.2.0:
version "18.2.0"
resolved "https://registry.yarnpkg.com/react/-/react-18.2.0.tgz#555bd98592883255fa00de14f1151a917b5d77d5"
integrity sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ==
dependencies:
loose-envify "^1.1.0"
object-assign "^4.1.1"
prop-types "^15.6.2"
scheduler "^0.13.6"

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

scheduler@^0.13.6:
version "0.13.6"
resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.13.6.tgz#466a4ec332467b31a91b9bf74e5347072e4cd889"
integrity sha512-IWnObHt413ucAYKsD9J1QShUKkbKLQQHdxRyw73sw4FN26iWr3DY/H34xGPe4nmL1DwXyWmSWmMrA9TfQbE/XQ==
scheduler@^0.23.0:
version "0.23.0"
resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.23.0.tgz#ba8041afc3d30eb206a487b6b384002e4e61fdfe"
integrity sha512-CtuThmgHNg7zIZWAXi3AsyIzA3n4xx7aNyjwC2VJldO2LMVDhFK+63xGqq6CsJH4rTAt6/M+N4GhZiDYPx9eUw==
dependencies:
loose-envify "^1.1.0"
object-assign "^4.1.1"

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

validator@^13.15.0:
version "13.15.0"
resolved "https://registry.yarnpkg.com/validator/-/validator-13.15.0.tgz#2dc7ce057e7513a55585109eec29b2c8e8c1aefd"
integrity sha512-36B2ryl4+oL5QxZ3AzD0t5SsMNGvTtQHpjgFO5tbNxfXbMFkY822ktCDe1MnlqV3301QQI9SLHDNJokDI+Z9pA==

vary@^1.1.2, vary@~1.1.2:
version "1.1.2"
resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc"
Expand Down
Loading