Skip to content

Commit

Permalink
Release 1_6 (#136)
Browse files Browse the repository at this point in the history
* [Task] #6 provide fallback index.html

* [Task] #6 production ready code (m)

move httpdocs folder to dist
have compile without sourcemaps for faster speed

* [Task] #6 create github action for upload when main is updated (#21)

* [change] #6 new ftp upload action

* [Fix] #6 replace host with server in ftp action

* [Task] #6 basic log (#26)

* [CHANGE] #6 revert back to require output for production

* [Task] #6 add ability to manually upload to prod

* [Task] #9 enable manual start of codechecks

* 10 webhook for writing (#36)

* [Change] #3 clean up npm scripts, to have clean folder before build

* [Task] #10 created data types in typescript

* [Temp] #10 created subroute for writing, and folder structure

* [Change] #3 include to use relative paths from src folder in ts and node

https://stackoverflow.com/questions/43281741/how-can-i-use-paths-in-tsconfig-json
See comment from Remo H. Hansen with at least 100 upvoted

* [Change] Update VSCode to keep files open

* [Task] #18 setup dotenv for secret variables

* [Temp, Task] #10 Validate inputs using express-validator and custom functions

* [Task] #18 prevent parameter pollution

* [Task] #10 validating incoming parameter and logging errors

* [Task] #7 add basic cache to express

* [Changes] #7 Error Handling, to include basic custom Error Handling

* [Task] #10 enhanced validation to only allow known parameters

* [Change] #35 added Jest, tests for helper functions when writing

* [Task] #10 better error Handling

* [Task] #35 add tests for writing webhook validation

* [TASK] #18 protect Webhook using KEY

* [Fix] #35 test know import path structure now

* [Task] #35 add test for protected webhook

* [Task] #35 refactor build to run jest tests

* [Task] #10 switched to crypto instead of bcrypt for dependency issue

see synk inflight

* [Fix] #36 PRQ Feedback

* [Task] #3 improve error handling, logger and added chalk

to colorize console output.
Had to use chalk version 4 because of typescript converting to require, and chalk5 do want import syntax.

* [Change] #3 nodemon to clear console when in dev mode

* [!Task] #32 webhook creates folder and file based on date

* [Change] #35 relocated tests and refactor write, also added file check

* [Task] #18, installed helmet, configured self as CSP origin

* [Fix] moved chalk out of dev dependency

* [Task] #32 error logging and text output improvement, log string instead of "object"

* [Task] #18 CSP Update to allow localhost for testing

* [Fix] #3 debugging setup improvments

* [FIX] #10 Error Handling

* [Task] #10 writing basic non calculated data to file

* [Fix] #10 avoid Header Modification after sending the request

* [Task] #10 JSON Data pretty output

* [Task] #32 update types to reflect subobjects of entry

* [Task] #10 write time

* [Task] #32 added logging for time edgecases

* [Task] #10 output seconds

* [Task] #10 calculate distance based on lat and lon

* [Task] #32 writing tests for time and distance

* [Task] #32 change distance calculation to use pythagoras

* [Task] #38 add favicon

* [Task] #32 time converted to seconds

* [Taskk] #32 speed calculation and output and tests

* [Task] #32 speed tests

* [Task] #33 add ignore

* [Task] #32 test finetuning

* [Task] #32 add angle between entries

* [Task] #32 test for angle, extracted getData function

* [change] #32 test to include optional leading 0 for days

* [!!!Task] #18 add uncaughtExeption handler as last resort

* [Task] #7 enhance static options to include common filetypes;  index file

start is used as index file to avoid collisions with host provider

* [change] #32 validation to be used more explictly

* [change] #32 add index to log while writing

* [Task] #32 test if 1000 calls can be made with randomized data

* [!!! Task] #32 limit JSON Data to be 1000 lines: replace last line with most recent entry

* [Change, Task] #32 if 1000 entries exceeded, only replace last if hdop is good

* [Change] build action enable button to on manually

* [temp] test y tests fail

* Create node.js.yml

* Create main.yml

* [!!!Fix] Created new workflow to build / test node, commented tests back in.

Increased time between server calls in test, to check difference time more accurately

* [Task] #33 moved ignore to its own file since it creates data rather than validating it

* 42 output json (#44)

* [Task] #42, created route to output json

* [Task] #42 added tests for read json

* 41 add rate limiter (#45)

* [Task] #18, limit request size for security reasons

* [Task] #43, introduce gzip to transfer data

* [Task] #34 improve error handling, log server shutdowns

* [Task] #34 installed and integrated tooBusy to send 503 when load is high

* [Task] #34 improved tooBusy, improved formatting

* [Task, Temp] #41 installed ratelimiter and slowDown

* [Task] #42 cleanup ipv6 addresses

* [Change] #10 error handling for better gitBash and txt output, also reduced stack in case of validation errors

* [Task] #41 prepare Log for RateLImit errors

* [Temp] #41 write route rateLImited

temp: see Todos

* [Task] #34 colorize prefix in console

* [Task] #42 extract middlewares and move to folder

* [Task] #41 ratelimiter cleaning up periodicly

* [Task] #41 skip tests in rateLimiting

* Bump follow-redirects from 1.15.5 to 1.15.6 (#47)

Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.15.5 to 1.15.6.
- [Release notes](https://github.com/follow-redirects/follow-redirects/releases)
- [Commits](https://github.com/follow-redirects/follow-redirects/compare/v1.15.5...v1.15.6)

---
updated-dependencies:
- dependency-name: follow-redirects
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* 43 secure output route (#46)

* [Task] #43 create color pallette

via atmos

* [Task] #43 create color pallette

via atmos

* [Task] #43 cleanup colors and svg

* [Task] #41 remove test code

* [CHANGE] #3 reconfigured nodemon to copy static files

* [Task] #18 replaced getRawBody with builtIn express urlEncoded

* [Temp, Task] #43 basic login page, not yet used as middleware

* [Temp] #43, create and validate json web token

* [Task] #43, add slowDown and RateLimit for failed login attempts

* [Task] #43, ratelimit for login page

* [Task] #43, add global ratelimiter

* [fix] #7, improve error handeling for express errors

* [Task] #43 rework body limitations to be checked only appropiate methods

* [Task] #43 added check for data before using it

* [Task] #43 check that body is ignored for GET in request

* [Task] #43 login test

* [Task] #43 create tests for login

* [Task] #43 fine tune error handling

* [Task] #43, finished login and jwt related tests

* [Change] #34, no further need for test logging

* [Task] #43, fine tune jwt, middleware process improved

* [CHANGE] #43 created new esLint to have clientside js without ts

* [Temp] #43 test to see new linter configuration

* [Change] #43 switched to bcrypt for passwords

* [Task] #43 read return json in all cases

* [Task] #43 introduced color classes

* [Task] #43, prq feedback

* [Temp} #43 figuring out why tests dont run on github

* [Task] #43 code cleanup

* 48 move login to seperate controller (#49)

* [Task] #43, add label to form

* [Task] #48 login controller

* 50 integrate csrf protection for login form (#53)

* [Task] #50, create CSRF Validation for login form

* [Task] #43, added icon to repository for later use

* [Task] #50, cleanup cetntralized; rename token functions

* [Task] #50, reduced token length and improved error handling

* [Task] #50 csrf tests added to login

* [Task] #50, added test case for csrf, repaired integration

* fix: upgrade express-rate-limit from 7.1.5 to 7.2.0 (#52)

Snyk has created this PR to upgrade express-rate-limit from 7.1.5 to 7.2.0.

See this package in npm:
https://www.npmjs.com/package/express-rate-limit

See this project in Snyk:
https://app.snyk.io/org/type-style/project/e2bcd002-cb74-409c-ba55-fb6349df1cbc?utm_source=github&utm_medium=referral&page=upgrade-pr

Co-authored-by: snyk-bot <[email protected]>

* fix: package.json & package-lock.json to reduce vulnerabilities (#54)

The following vulnerabilities are fixed with an upgrade:
- https://snyk.io/vuln/SNYK-JS-EXPRESS-6474509

Co-authored-by: snyk-bot <[email protected]>

* [Snyk] Upgrade express from 4.18.2 to 4.18.3 (#51)

* fix: upgrade express from 4.18.2 to 4.18.3

Snyk has created this PR to upgrade express from 4.18.2 to 4.18.3.

See this package in npm:
https://www.npmjs.com/package/express

See this project in Snyk:
https://app.snyk.io/org/type-style/project/e2bcd002-cb74-409c-ba55-fb6349df1cbc?utm_source=github&utm_medium=referral&page=upgrade-pr

* 50 integrate csrf protection for login form (#53)

* [Task] #50, create CSRF Validation for login form

* [Task] #43, added icon to repository for later use

* [Task] #50, cleanup cetntralized; rename token functions

* [Task] #50, reduced token length and improved error handling

* [Task] #50 csrf tests added to login

* [Task] #50, added test case for csrf, repaired integration

* fix: upgrade express-rate-limit from 7.1.5 to 7.2.0 (#52)

Snyk has created this PR to upgrade express-rate-limit from 7.1.5 to 7.2.0.

See this package in npm:
https://www.npmjs.com/package/express-rate-limit

See this project in Snyk:
https://app.snyk.io/org/type-style/project/e2bcd002-cb74-409c-ba55-fb6349df1cbc?utm_source=github&utm_medium=referral&page=upgrade-pr

Co-authored-by: snyk-bot <[email protected]>

---------

Co-authored-by: snyk-bot <[email protected]>

* [Task] update dev after main merge

* [Task] npm upgrade

* 58 react setup (#59)

* [Task] #58 install react via npm, incl. types and eslint plugins

* [Task] #58, tsconfig for react folder

* [Task] #58 esLint config

* [Task] #58, webpack and react setup

* [Task] #58, render welcome from express instead of static

* [Task] #58 eslint scripts

* [Task] #58, eslint react setup

* [TASK] #58 integrate webpack in build and dev npm scripts

* [Temp] Test csp

* [FIX] Add views to be deployed to prod

* [Task] disable csp for local development

* [Task] #58 base css including colors, deleted color classes in favor of variables

* [Task] #58 typescript setup for react

* [Task] #58 webpack setup for react and typescript

* [Task] #58 app setup react

* [Temp] #58 conctact module css

* [Task] #58 remove learning files

* [Task] #61, create font

* Revert "[Task] #58 remove learning files"

This reverts commit b63bb97045a9443e11ca9d8658f1e7faecf96e3b.

* [Task] #61, adjust for darkmode

* [Task] #61 apply base style to login

* [Task] #58, dev tesing rule to disable

* [Task] #58, adjust styles for headline

* [Task] #58, create Contacts wrapper Component

* [Task] #58 apply wrapper component

* [Task] #58 adjust  contact component to expect object

* [Task] #58, toggle state

* [Task] #58 learn context api provider and consumer

* [Task] #58 add delete via dispatch

* [Task] #58, react-router, move contacts to new url

* [Task] #58 fetch more contacts

* fix: package.json & package-lock.json to reduce vulnerabilities (#62)

The following vulnerabilities are fixed with an upgrade:
- https://snyk.io/vuln/SNYK-JS-EJS-6689533

Co-authored-by: snyk-bot <[email protected]>

* Bump tar and npm (#60)

Bumps [tar](https://github.com/isaacs/node-tar) to 6.2.1 and updates ancestor dependency [npm](https://github.com/npm/cli). These dependencies need to be updated together.


Updates `tar` from 6.2.0 to 6.2.1
- [Release notes](https://github.com/isaacs/node-tar/releases)
- [Changelog](https://github.com/isaacs/node-tar/blob/main/CHANGELOG.md)
- [Commits](https://github.com/isaacs/node-tar/compare/v6.2.0...v6.2.1)

Updates `npm` from 10.5.0 to 10.5.2
- [Release notes](https://github.com/npm/cli/releases)
- [Changelog](https://github.com/npm/cli/blob/latest/CHANGELOG.md)
- [Commits](https://github.com/npm/cli/compare/v10.5.0...v10.5.2)

---
updated-dependencies:
- dependency-name: tar
  dependency-type: indirect
- dependency-name: npm
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump ejs from 3.1.9 to 3.1.10 (#63)

Bumps [ejs](https://github.com/mde/ejs) from 3.1.9 to 3.1.10.
- [Release notes](https://github.com/mde/ejs/releases)
- [Commits](https://github.com/mde/ejs/compare/v3.1.9...v3.1.10)

---
updated-dependencies:
- dependency-name: ejs
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* [Task] #58, webpack configuriation to allow regular css files as well as modules

* [Task] #58, clean up react learn  files

* [Task] #58, setup react router

* [Task] #61 install Material UI

* [Task] #61, test mui

* [CHANGE, MultiLine] #61 color variables levels removed, MUI Overwrites  introduced

color variables levels are replaced by color-mix.

MUI Experimental API with Variables is used and to overwrite theme colors in css (since I want CSS to be single source of truth for colors)

* [Temp] #61 introduce darkmode to MUI

* [Task] #61, create new start module so that App can act as root

* [Task] #61, naming update

* [Task] #61, move router to root App

* [Task] #61, add font to preload

* [Task] #61, dim colors in dark mode

* [Task] #61, introduce modeswitcher

* [Change] #64, refactoring splitting pages and components

* [Task] #61, mobile Theme Swticher placed on top right

* [Task] #61, mobile theme switcher icon only on mobile

* [Task] #61, button color and background improvement

* [Task] #63, login page first draft

* [Temp] #61, login controller commented out unused route, TO BE REFACTORED

* [Task] #63, login validation

* [Task] #63, add error icon

* [Task] #61, cut design update

* [Task] #53, apply cut, rename FormData to FormInfo to avoid confusion with reserved name

* [Task] #63, send login request

* [Task] #61, loading icon

* [Task] #63, get csrfToken, fullfill login request

* [Fix] #63, fail gracefully when too many tokens

* [Task] #63, error Handling in login form

* [Task] #81, remove password log

* [Task] #80, cleanup todo token

* fix: upgrade multiple dependencies with Snyk (#68)

Snyk has created this PR to upgrade:
  - react from 18.2.0 to 18.3.1.
    See this package in npm: https://www.npmjs.com/package/react
  - react-dom from 18.2.0 to 18.3.1.
    See this package in npm: https://www.npmjs.com/package/react-dom

See this project in Snyk:
https://app.snyk.io/org/type-style/project/e2bcd002-cb74-409c-ba55-fb6349df1cbc?utm_source=github&utm_medium=referral&page=upgrade-pr

Co-authored-by: snyk-bot <[email protected]>

* [Fix] #64, disable express header

* [Task] #64, protect csrf token page with custom http header

* [FIx] #64, fix csrf test

* [Task] #64, repair test cases

* fix: upgrade express-slow-down from 2.0.1 to 2.0.2 (#69)

Snyk has created this PR to upgrade express-slow-down from 2.0.1 to 2.0.2.

See this package in npm:
express-slow-down

See this project in Snyk:
https://app.snyk.io/org/type-style/project/e2bcd002-cb74-409c-ba55-fb6349df1cbc?utm_source=github&utm_medium=referral&page=upgrade-pr

Co-authored-by: snyk-bot <[email protected]>

* [fix] #64, linter fixes

* [Task] Editor Config

* [Task] #61, convert background line to svg and animate

* [Task] #61, main headline style

* [Task] #61, fine tune background pattern

* [Task] #61, font-weight reduced in darkmode

* [Task] #64, login design improvements

* [Task] #61, update design with minor ripples and edges

* [Task] #70, store token after login

* Bump braces from 3.0.2 to 3.0.3 (#76)

Bumps [braces](https://github.com/micromatch/braces) from 3.0.2 to 3.0.3.
- [Changelog](https://github.com/micromatch/braces/blob/master/CHANGELOG.md)
- [Commits](https://github.com/micromatch/braces/compare/3.0.2...3.0.3)

---
updated-dependencies:
- dependency-name: braces
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* fix: upgrade @mui/icons-material from 5.15.16 to 5.15.18 (#75)

Snyk has created this PR to upgrade @mui/icons-material from 5.15.16 to 5.15.18.

See this package in npm:
@mui/icons-material

See this project in Snyk:
https://app.snyk.io/org/type-style/project/e2bcd002-cb74-409c-ba55-fb6349df1cbc?utm_source=github&utm_medium=referral&page=upgrade-pr

Co-authored-by: snyk-bot <[email protected]>

* fix: upgrade react-router-dom from 6.23.0 to 6.23.1 (#74)

Snyk has created this PR to upgrade react-router-dom from 6.23.0 to 6.23.1.

See this package in npm:
react-router-dom

See this project in Snyk:
https://app.snyk.io/org/type-style/project/e2bcd002-cb74-409c-ba55-fb6349df1cbc?utm_source=github&utm_medium=referral&page=upgrade-pr

Co-authored-by: snyk-bot <[email protected]>

* fix: upgrade express-slow-down from 2.0.2 to 2.0.3 (#73)

Snyk has created this PR to upgrade express-slow-down from 2.0.2 to 2.0.3.

See this package in npm:
express-slow-down

See this project in Snyk:
https://app.snyk.io/org/type-style/project/e2bcd002-cb74-409c-ba55-fb6349df1cbc?utm_source=github&utm_medium=referral&page=upgrade-pr

Co-authored-by: snyk-bot <[email protected]>

* fix: upgrade express-rate-limit from 7.2.0 to 7.3.0 (#82)

Snyk has created this PR to upgrade express-rate-limit from 7.2.0 to 7.3.0.

See this package in npm:
express-rate-limit

See this project in Snyk:
https://app.snyk.io/org/type-style/project/e2bcd002-cb74-409c-ba55-fb6349df1cbc?utm_source=github&utm_medium=referral&page=upgrade-pr

Co-authored-by: snyk-bot <[email protected]>

* fix: upgrade express-validator from 7.0.1 to 7.1.0 (#81)

Snyk has created this PR to upgrade express-validator from 7.0.1 to 7.1.0.

See this package in npm:
express-validator

See this project in Snyk:
https://app.snyk.io/org/type-style/project/e2bcd002-cb74-409c-ba55-fb6349df1cbc?utm_source=github&utm_medium=referral&page=upgrade-pr

Co-authored-by: snyk-bot <[email protected]>

* fix: upgrade axios from 1.7.1 to 1.7.2 (#80)

Snyk has created this PR to upgrade axios from 1.7.1 to 1.7.2.

See this package in npm:
axios

See this project in Snyk:
https://app.snyk.io/org/type-style/project/e2bcd002-cb74-409c-ba55-fb6349df1cbc?utm_source=github&utm_medium=referral&page=upgrade-pr

Co-authored-by: snyk-bot <[email protected]>

* fix: upgrade @mui/icons-material from 5.15.18 to 5.15.19 (#79)

Snyk has created this PR to upgrade @mui/icons-material from 5.15.18 to 5.15.19.

See this package in npm:
@mui/icons-material

See this project in Snyk:
https://app.snyk.io/org/type-style/project/e2bcd002-cb74-409c-ba55-fb6349df1cbc?utm_source=github&utm_medium=referral&page=upgrade-pr

Co-authored-by: snyk-bot <[email protected]>

* fix: upgrade @mui/icons-material from 5.15.19 to 5.15.20 (#88)

Snyk has created this PR to upgrade @mui/icons-material from 5.15.19 to 5.15.20.

See this package in npm:
@mui/icons-material

See this project in Snyk:
https://app.snyk.io/org/type-style/project/e2bcd002-cb74-409c-ba55-fb6349df1cbc?utm_source=github&utm_medium=referral&page=upgrade-pr

Co-authored-by: snyk-bot <[email protected]>

* fix: upgrade react-router-dom from 6.23.1 to 6.24.0 (#91)

Snyk has created this PR to upgrade react-router-dom from 6.23.1 to 6.24.0.

See this package in npm:
react-router-dom

See this project in Snyk:
https://app.snyk.io/org/type-style/project/e2bcd002-cb74-409c-ba55-fb6349df1cbc?utm_source=github&utm_medium=referral&page=upgrade-pr

Co-authored-by: snyk-bot <[email protected]>

* 77 design base layout (#85)

* [Task] #77 1st draft layout

* [Change] #70 update token expire date

* [Temp] #77, log out data on valid request, temp: error handling and display

* [Temp]

* [Task] #77, login Button functionality, default state

* [Task] #77, removed outdated comments

* [Task] #77, introduced linearBuffer Bar for login

* [Task] #77, added modeSwticher to start page

* [Task] #77, display last entry on map demo

* [Task] #77, enhance login, show pastUser if availabe, show user on mainpage

* [!!!Task] #77 first draft of functionality

* [Task] #77 move map to new location

* [Task] #77 create testData

* [Fix] #77 codeFactor complains

* [Task] #77, draft of status content

* [FIX] #77 change data accumulation

* [Task] #77 improve test example data

* fix: upgrade @mui/material from 5.15.16 to 5.15.20 (#92)

Snyk has created this PR to upgrade @mui/material from 5.15.16 to 5.15.20.

See this package in npm:
@mui/material

See this project in Snyk:
https://app.snyk.io/org/type-style/project/e2bcd002-cb74-409c-ba55-fb6349df1cbc?utm_source=github&utm_medium=referral&page=upgrade-pr

Co-authored-by: snyk-bot <[email protected]>

* [Fix] #94, refactor-ignore logic (multiline) (#95)

Serverside: When writing entry, the most recent previous entry is checked wether to be ignored.
Also if more than 2 items already exist meaning writing is preparing at least the 3rd entry, we recalculate distances and timing if previousItems are ignored.

Frontend:
In order to benefit and get the recent information that a previous item is being ignored, frontEnd askes for the current item again and merges it and following items.

Remember the most recent item can never be ignored due to policy. Maybe there is no further writing, so I want to have the latest datapoint.

* [Task] #94, add logging if logical error with ignore

* [Task] #94, cleanup console.logs

* [Fix] #93, offline message improvement (#96)

* fix: package.json & package-lock.json to reduce vulnerabilities (#101)

The following vulnerabilities are fixed with an upgrade:
- https://snyk.io/vuln/SNYK-JS-AXIOS-7361793

Co-authored-by: snyk-bot <[email protected]>

* fix: upgrade @mui/material from 5.15.20 to 5.16.5 (#102)

Snyk has created this PR to upgrade @mui/material from 5.15.20 to 5.16.5.

See this package in npm:
@mui/material

See this project in Snyk:
https://app.snyk.io/org/type-style/project/e2bcd002-cb74-409c-ba55-fb6349df1cbc?utm_source=github&utm_medium=referral&page=upgrade-pr

Co-authored-by: snyk-bot <[email protected]>

* 93 fix error message when server not available (#103)

* [Fix] #93, offline message improvement

* [Task] #93, removed background in status module when no data is present

* [Task] #61, add cut class to map for styling

* [Fix] #93 fix tests, be more specific on url, and let test fail non silently when csrf is not found

* [Fix] #94, repair overwriting the last data point

* fix: upgrade @emotion/react from 11.11.4 to 11.13.0 (#104)

Snyk has created this PR to upgrade @emotion/react from 11.11.4 to 11.13.0.

See this package in npm:
@emotion/react

See this project in Snyk:
https://app.snyk.io/org/type-style/project/e2bcd002-cb74-409c-ba55-fb6349df1cbc?utm_source=github&utm_medium=referral&page=upgrade-pr

Co-authored-by: snyk-bot <[email protected]>

* fix: upgrade @emotion/styled from 11.11.5 to 11.13.0 (#105)

Snyk has created this PR to upgrade @emotion/styled from 11.11.5 to 11.13.0.

See this package in npm:
@emotion/styled

See this project in Snyk:
https://app.snyk.io/org/type-style/project/e2bcd002-cb74-409c-ba55-fb6349df1cbc?utm_source=github&utm_medium=referral&page=upgrade-pr

Co-authored-by: snyk-bot <[email protected]>

* fix: upgrade react-router-dom from 6.25.0 to 6.25.1 (#106)

Snyk has created this PR to upgrade react-router-dom from 6.25.0 to 6.25.1.

See this package in npm:
react-router-dom

See this project in Snyk:
https://app.snyk.io/org/type-style/project/e2bcd002-cb74-409c-ba55-fb6349df1cbc?utm_source=github&utm_medium=referral&page=upgrade-pr

Co-authored-by: snyk-bot <[email protected]>

* fix: upgrade @mui/icons-material from 5.16.4 to 5.16.5 (#107)

Snyk has created this PR to upgrade @mui/icons-material from 5.16.4 to 5.16.5.

See this package in npm:
@mui/icons-material

See this project in Snyk:
https://app.snyk.io/org/type-style/project/e2bcd002-cb74-409c-ba55-fb6349df1cbc?utm_source=github&utm_medium=referral&page=upgrade-pr

Co-authored-by: snyk-bot <[email protected]>

* fix: upgrade express-rate-limit from 7.3.1 to 7.4.0 (#108)

Snyk has created this PR to upgrade express-rate-limit from 7.3.1 to 7.4.0.

See this package in npm:
express-rate-limit

See this project in Snyk:
https://app.snyk.io/org/type-style/project/e2bcd002-cb74-409c-ba55-fb6349df1cbc?utm_source=github&utm_medium=referral&page=upgrade-pr

Co-authored-by: snyk-bot <[email protected]>

* 109 marker and line design (#110)

* [Task] #109, start polyline

* [Task] #94, marker

* [Task] #109, gradient color polyline color based on speed

* [Task] #109 linter fixes

* fix: upgrade react-router-dom from 6.25.1 to 6.26.0 (#113)

Snyk has created this PR to upgrade react-router-dom from 6.25.1 to 6.26.0.

See this package in npm:
react-router-dom

See this project in Snyk:
https://app.snyk.io/org/type-style/project/e2bcd002-cb74-409c-ba55-fb6349df1cbc?utm_source=github&utm_medium=referral&page=upgrade-pr

Co-authored-by: snyk-bot <[email protected]>

* fix: upgrade @mui/material from 5.16.5 to 5.16.6 (#112)

Snyk has created this PR to upgrade @mui/material from 5.16.5 to 5.16.6.

See this package in npm:
@mui/material

See this project in Snyk:
https://app.snyk.io/org/type-style/project/e2bcd002-cb74-409c-ba55-fb6349df1cbc?utm_source=github&utm_medium=referral&page=upgrade-pr

Co-authored-by: snyk-bot <[email protected]>

* Switch polyline (#114)

* [Revert] #109 remove polyColor Plugin

* [Fix, MultiLine] #109, refactor coloring lines;

while fetchinng new data vs reloading
MaxSpeed might change the more entries are fetched.
Example Testcase and after 6 entries are there, reload and see colors change ... well not with this fix.

* [Task] #109, improve polyline display, remove unused code

* [Task] #77, change timing to round up, so it "feels" more accurate

* [Task] #115, remove SVG Animation on startup based on media Query

* [Task] #77 improve test example data

* [Task] #77, calculate more Status data

* [Task] #77, improve example test data

* [Task] #109, line dashed when diff is high, marker start icon when diff is higher

* [Task] #77, status design

* [Task] #83, forced scheme for map

* [Task] #83, change context, mode globally available

* [Task] #83, react update, cluster install

* [Task, multiline] #83, map tilelayer

Introduced new map TileLayers using layers control, and styled it
Introduced markerClusterGroup from @changey, since others had issues like broken marker images, or lack for typescript support
Refined dashed array styles
Addapted context changes, to fetch mode globally, for seperate map theme
Markers have none style if neither end or start, to be targeted
Introduced Layer array for tilelayers
When Layers are changed theme for map is set/updated

* [Task] #77 improve responsive design, hide images, status overlays map

* [Task] #77, adjust coloring and opacity, used for status

* [Task] #83, adjust imports

* [Task] #77, changed responsive design for mobile

* [Task] #83, extracted to own module, added fly option

* [Task] #83, layers extracted, clickable minimap, corrected for mapbox tileSize

* Bump webpack from 5.91.0 to 5.94.0 (#117)

Bumps [webpack](https://github.com/webpack/webpack) from 5.91.0 to 5.94.0.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v5.91.0...v5.94.0)

---
updated-dependencies:
- dependency-name: webpack
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* [Task] #83, code cleanup

* [Fix] #83, mime type setting

* [fix] #123, run pre and post build for production too

* [Change] #123, to see real user ip instead of localhost proxy (#126)

* Main (#128)

* Release 1_3 (#124)

* [Task] #6 provide fallback index.html

* [Task] #6 production ready code (m)

move httpdocs folder to dist
have compile without sourcemaps for faster speed

* [Task] #6 create github action for upload when main is updated (#21)

* [change] #6 new ftp upload action

* [Fix] #6 replace host with server in ftp action

* [Task] #6 basic log (#26)

* [CHANGE] #6 revert back to require output for production

* [Task] #6 add ability to manually upload to prod

* [Task] #9 enable manual start of codechecks

* 10 webhook for writing (#36)

* [Change] #3 clean up npm scripts, to have clean folder before build

* [Task] #10 created data types in typescript

* [Temp] #10 created subroute for writing, and folder structure

* [Change] #3 include to use relative paths from src folder in ts and node

https://stackoverflow.com/questions/43281741/how-can-i-use-paths-in-tsconfig-json
See comment from Remo H. Hansen with at least 100 upvoted

* [Change] Update VSCode to keep files open

* [Task] #18 setup dotenv for secret variables

* [Temp, Task] #10 Validate inputs using express-validator and custom functions

* [Task] #18 prevent parameter pollution

* [Task] #10 validating incoming parameter and logging errors

* [Task] #7 add basic cache to express

* [Changes] #7 Error Handling, to include basic custom Error Handling

* [Task] #10 enhanced validation to only allow known parameters

* [Change] #35 added Jest, tests for helper functions when writing

* [Task] #10 better error Handling

* [Task] #35 add tests for writing webhook validation

* [TASK] #18 protect Webhook using KEY

* [Fix] #35 test know import path structure now

* [Task] #35 add test for protected webhook

* [Task] #35 refactor build to run jest tests

* [Task] #10 switched to crypto instead of bcrypt for dependency issue

see synk inflight

* [Fix] #36 PRQ Feedback

* [Task] #3 improve error handling, logger and added chalk

to colorize console output.
Had to use chalk version 4 because of typescript converting to require, and chalk5 do want import syntax.

* [Change] #3 nodemon to clear console when in dev mode

* [!Task] #32 webhook creates folder and file based on date

* [Change] #35 relocated tests and refactor write, also added file check

* [Task] #18, installed helmet, configured self as CSP origin

* [Fix] moved chalk out of dev dependency

* [Task] #32 error logging and text output improvement, log string instead of "object"

* [Task] #18 CSP Update to allow localhost for testing

* [Fix] #3 debugging setup improvments

* [FIX] #10 Error Handling

* [Task] #10 writing basic non calculated data to file

* [Fix] #10 avoid Header Modification after sending the request

* [Task] #10 JSON Data pretty output

* [Task] #32 update types to reflect subobjects of entry

* [Task] #10 write time

* [Task] #32 added logging for time edgecases

* [Task] #10 output seconds

* [Task] #10 calculate distance based on lat and lon

* [Task] #32 writing tests for time and distance

* [Task] #32 change distance calculation to use pythagoras

* [Task] #38 add favicon

* [Task] #32 time converted to seconds

* [Taskk] #32 speed calculation and output and tests

* [Task] #32 speed tests

* [Task] #33 add ignore

* [Task] #32 test finetuning

* [Task] #32 add angle between entries

* [Task] #32 test for angle, extracted getData function

* [change] #32 test to include optional leading 0 for days

* [!!!Task] #18 add uncaughtExeption handler as last resort

* [Task] #7 enhance static options to include common filetypes;  index file

start is used as index file to avoid collisions with host provider

* [change] #32 validation to be used more explictly

* [change] #32 add index to log while writing

* [Task] #32 test if 1000 calls can be made with randomized data

* [!!! Task] #32 limit JSON Data to be 1000 lines: replace last line with most recent entry

* [Change, Task] #32 if 1000 entries exceeded, only replace last if hdop is good

* [Change] build action enable button to on manually

* [temp] test y tests fail

* Create node.js.yml

* Create main.yml

* [!!!Fix] Created new workflow to build / test node, commented tests back in.

Increased time between server calls in test, to check difference time more accurately

* [Task] #33 moved ignore to its own file since it creates data rather than validating it

* 42 output json (#44)

* [Task] #42, created route to output json

* [Task] #42 added tests for read json

* 41 add rate limiter (#45)

* [Task] #18, limit request size for security reasons

* [Task] #43, introduce gzip to transfer data

* [Task] #34 improve error handling, log server shutdowns

* [Task] #34 installed and integrated tooBusy to send 503 when load is high

* [Task] #34 improved tooBusy, improved formatting

* [Task, Temp] #41 installed ratelimiter and slowDown

* [Task] #42 cleanup ipv6 addresses

* [Change] #10 error handling for better gitBash and txt output, also reduced stack in case of validation errors

* [Task] #41 prepare Log for RateLImit errors

* [Temp] #41 write route rateLImited

temp: see Todos

* [Task] #34 colorize prefix in console

* [Task] #42 extract middlewares and move to folder

* [Task] #41 ratelimiter cleaning up periodicly

* [Task] #41 skip tests in rateLimiting

* Bump follow-redirects from 1.15.5 to 1.15.6 (#47)

Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.15.5 to 1.15.6.
- [Release notes](https://github.com/follow-redirects/follow-redirects/releases)
- [Commits](https://github.com/follow-redirects/follow-redirects/compare/v1.15.5...v1.15.6)

---
updated-dependencies:
- dependency-name: follow-redirects
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* 43 secure output route (#46)

* [Task] #43 create color pallette

via atmos

* [Task] #43 create color pallette

via atmos

* [Task] #43 cleanup colors and svg

* [Task] #41 remove test code

* [CHANGE] #3 reconfigured nodemon to copy static files

* [Task] #18 replaced getRawBody with builtIn express urlEncoded

* [Temp, Task] #43 basic login page, not yet used as middleware

* [Temp] #43, create and validate json web token

* [Task] #43, add slowDown and RateLimit for failed login attempts

* [Task] #43, ratelimit for login page

* [Task] #43, add global ratelimiter

* [fix] #7, improve error handeling for express errors

* [Task] #43 rework body limitations to be checked only appropiate methods

* [Task] #43 added check for data before using it

* [Task] #43 check that body is ignored for GET in request

* [Task] #43 login test

* [Task] #43 create tests for login

* [Task] #43 fine tune error handling

* [Task] #43, finished login and jwt related tests

* [Change] #34, no further need for test logging

* [Task] #43, fine tune jwt, middleware process improved

* [CHANGE] #43 created new esLint to have clientside js without ts

* [Temp] #43 test to see new linter configuration

* [Change] #43 switched to bcrypt for passwords

* [Task] #43 read return json in all cases

* [Task] #43 introduced color classes

* [Task] #43, prq feedback

* [Temp} #43 figuring out why tests dont run on github

* [Task] #43 code cleanup

* 48 move login to seperate controller (#49)

* [Task] #43, add label to form

* [Task] #48 login controller

* 50 integrate csrf protection for login form (#53)

* [Task] #50, create CSRF Validation for login form

* [Task] #43, added icon to repository for later use

* [Task] #50, cleanup cetntralized; rename token functions

* [Task] #50, reduced token length and improved error handling

* [Task] #50 csrf tests added to login

* [Task] #50, added test case for csrf, repaired integration

* fix: upgrade express-rate-limit from 7.1.5 to 7.2.0 (#52)

Snyk has created this PR to upgrade express-rate-limit from 7.1.5 to 7.2.0.

See this package in npm:
https://www.npmjs.com/package/express-rate-limit

See this project in Snyk:
https://app.snyk.io/org/type-style/project/e2bcd002-cb74-409c-ba55-fb6349df1cbc?utm_source=github&utm_medium=referral&page=upgrade-pr

Co-authored-by: snyk-bot <[email protected]>

* fix: package.json & package-lock.json to reduce vulnerabilities (#54)

The following vulnerabilities are fixed with an upgrade:
- https://snyk.io/vuln/SNYK-JS-EXPRESS-6474509

Co-authored-by: snyk-bot <[email protected]>

* [Snyk] Upgrade express from 4.18.2 to 4.18.3 (#51)

* fix: upgrade express from 4.18.2 to 4.18.3

Snyk has created this PR to upgrade express from 4.18.2 to 4.18.3.

See this package in npm:
https://www.npmjs.com/package/express

See this project in Snyk:
https://app.snyk.io/org/type-style/project/e2bcd002-cb74-409c-ba55-fb6349df1cbc?utm_source=github&utm_medium=referral&page=upgrade-pr

* 50 integrate csrf protection for login form (#53)

* [Task] #50, create CSRF Validation for login form

* [Task] #43, added icon to repository for later use

* [Task] #50, cleanup cetntralized; rename token functions

* [Task] #50, reduced token length and improved error handling

* [Task] #50 csrf tests added to login

* [Task] #50, added test case for csrf, repaired integration

* fix: upgrade express-rate-limit from 7.1.5 to 7.2.0 (#52)

Snyk has created this PR to upgrade express-rate-limit from 7.1.5 to 7.2.0.

See this package in npm:
https://www.npmjs.com/package/express-rate-limit

See this project in Snyk:
https://app.snyk.io/org/type-style/project/e2bcd002-cb74-409c-ba55-fb6349df1cbc?utm_source=github&utm_medium=referral&page=upgrade-pr

Co-authored-by: snyk-bot <[email protected]>

---------

Co-authored-by: snyk-bot <[email protected]>

* [Task] update dev after main merge

* [Task] npm upgrade

* 58 react setup (#59)

* [Task] #58 install react via npm, incl. types and eslint plugins

* [Task] #58, tsconfig for react folder

* [Task] #58 esLint config

* [Task] #58, webpack and react setup

* [Task] #58, render welcome from express instead of static

* [Task] #58 eslint scripts

* [Task] #58, eslint react setup

* [TASK] #58 integrate webpack in build and dev npm scripts

* [Temp] Test csp

* [FIX] Add views to be deployed to prod

* [Task] disable csp for local development

* [Task] #58 base css including colors, deleted color classes in favor of variables

* [Task] #58 typescript setup for react

* [Task] #58 webpack setup for react and typescript

* [Task] #58 app setup react

* [Temp] #58 conctact module css

* [Task] #58 remove learning files

* [Task] #61, create font

* Revert "[Task] #58 remove learning files"

This reverts commit b63bb97045a9443e11ca9d8658f1e7faecf96e3b.

* [Task] #61, adjust for darkmode

* [Task] #61 apply base style to login

* [Task] #58, dev tesing rule to disable

* [Task] #58, adjust styles for headline

* [Task] #58, create Contacts wrapper Component

* [Task] #58 apply wrapper component

* [Task] #58 adjust  contact component to expect object

* [Task] #58, toggle state

* [Task] #58 learn context api provider and consumer

* [Task] #58 add delete via dispatch

* [Task] #58, react-router, move contacts to new url

* [Task] #58 fetch more contacts

* fix: package.json & package-lock.json to reduce vulnerabilities (#62)

The following vulnerabilities are fixed with an upgrade:
- https://snyk.io/vuln/SNYK-JS-EJS-6689533

Co-authored-by: snyk-bot <[email protected]>

* Bump tar and npm (#60)

Bumps [tar](https://github.com/isaacs/node-tar) to 6.2.1 and updates ancestor dependency [npm](https://github.com/npm/cli). These dependencies need to be updated together.


Updates `tar` from 6.2.0 to 6.2.1
- [Release notes](https://github.com/isaacs/node-tar/releases)
- [Changelog](https://github.com/isaacs/node-tar/blob/main/CHANGELOG.md)
- [Commits](https://github.com/isaacs/node-tar/compare/v6.2.0...v6.2.1)

Updates `npm` from 10.5.0 to 10.5.2
- [Release notes](https://github.com/npm/cli/releases)
- [Changelog](https://github.com/npm/cli/blob/latest/CHANGELOG.md)
- [Commits](https://github.com/npm/cli/compare/v10.5.0...v10.5.2)

---
updated-dependencies:
- dependency-name: tar
  dependency-type: indirect
- dependency-name: npm
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump ejs from 3.1.9 to 3.1.10 (#63)

Bumps [ejs](https://github.com/mde/ejs) from 3.1.9 to 3.1.10.
- [Release notes](https://github.com/mde/ejs/releases)
- [Commits](https://github.com/mde/ejs/compare/v3.1.9...v3.1.10)

---
updated-dependencies:
- dependency-name: ejs
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* [Task] #58, webpack configuriation to allow regular css files as well as modules

* [Task] #58, clean up react learn  files

* [Task] #58, setup react router

* [Task] #61 install Material UI

* [Task] #61, test mui

* [CHANGE, MultiLine] #61 color variables levels removed, MUI Overwrites  introduced

color variables levels are replaced by color-mix.

MUI Experimental API with Variables is used and to overwrite theme colors in css (since I want CSS to be single source of truth for colors)

* [Temp] #61 introduce darkmode to MUI

* [Task] #61, create new start module so that App can act as root

* [Task] #61, naming update

* [Task] #61, move router to root App

* [Task] #61, add font to preload

* [Task] #61, dim colors in dark mode

* [Task] #61, introduce modeswitcher

* [Change] #64, refactoring splitting pages and components

* [Task] #61, mobile Theme Swticher placed on top right

* [Task] #61, mobile theme switcher icon only on mobile

* [Task] #61, button color and background improvement

* [Task] #63, login page first draft

* [Temp] #61, login controller commented out unused route, TO BE REFACTORED

* [Task] #63, login validation

* [Task] #63, add error icon

* [Task] #61, cut design update

* [Task] #53, apply cut, rename FormData to FormInfo to avoid confusion with reserved name

* [Task] #63, send login request

* [Task] #61, loading icon

* [Task] #63, get csrfToken, fullfill login request

* [Fix] #63, fail gracefully when too many tokens

* [Task] #63, error Handling in login form

* [Task] #81, remove password log

* [Task] #80, cleanup todo token

* fix: upgrade multiple dependencies with Snyk (#68)

Snyk has created this PR to upgrade:
  - react from 18.2.0 to 18.3.1.
    See this package in npm: https://www.npmjs.com/package/react
  - react-dom from 18.2.0 to 18.3.1.
    See this package in npm: https://www.npmjs.com/package/react-dom

See this project in Snyk:
https://app.snyk.io/org/type-style/project/e2bcd002-cb74-409c-ba55-fb6349df1cbc?utm_source=github&utm_medium=referral&page=upgrade-pr

Co-authored-by: snyk-bot <[email protected]>

* [Fix] #64, disable express header

* [Task] #64, protect csrf token page with custom http header

* [FIx] #64, fix csrf test

* [Task] #64, repair test cases

* fix: upgrade express-slow-down from 2.0.1 to 2.0.2 (#69)

Snyk has created this PR to upgrade express-slow-down from 2.0.1 to 2.0.2.

See this package in npm:
express-slow-down

See this project in Snyk:
https://app.snyk.io/org/type-style/project/e2bcd002-cb74-409c-ba55-fb6349df1cbc?utm_source=github&utm_medium=referral&page=upgrade-pr

Co-authored-by: snyk-bot <[email protected]>

* [fix] #64, linter fixes

* [Task] Editor Config

* [Task] #61, convert background line to svg and animate

* [Task] #61, main headline style

* [Task] #61, fine tune background pattern

* [Task] #61, font-weight reduced in darkmode

* [Task] #64, login design improvements

* [Task] #61, update design with minor ripples and edges

* [Task] #70, store token after login

* Bump braces from 3.0.2 to 3.0.3 (#76)

Bumps [braces](https://github.com/micromatch/braces) from 3.0.2 to 3.0.3.
- [Changelog](https://github.com/micromatch/braces/blob/master/CHANGELOG.md)
- [Commits](https://github.com/micromatch/braces/compare/3.0.2...3.0.3)

---
updated-dependencies:
- dependency-name: braces
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* fix: upgrade @mui/icons-material from 5.15.16 to 5.15.18 (#75)

Snyk has created this PR to upgrade @mui/icons-material from 5.15.16 to 5.15.18.

See this package in npm:
@mui/icons-material

See this project in Snyk:
https://app.snyk.io/org/type-style/project/e2bcd002-cb74-409c-ba55-fb6349df1cbc?utm_source=github&utm_medium=referral&page=upgrade-pr

Co-authored-by: snyk-bot <[email protected]>

* fix: upgrade react-router-dom from 6.23.0 to 6.23.1 (#74)

Snyk has created this PR to upgrade react-router-dom from 6.23.0 to 6.23.1.

See this package in npm:
react-router-dom

See this project in Snyk:
https://app.snyk.io/org/type-style/project/e2bcd002-cb74-409c-ba55-fb6349df1cbc?utm_source=github&utm_medium=referral&page=upgrade-pr

Co-authored-by: snyk-bot <[email protected]>

* fix: upgrade express-slow-down from 2.0.2 to 2.0.3 (#73)

Snyk has created this PR to upgrade express-slow-down from 2.0.2 to 2.0.3.

See this package in npm:
express-slow-down

See this project in Snyk:
https://app.snyk.io/org/type-style/project/e2bcd002-cb74-409c-ba55-fb6349df1cbc?utm_source=github&utm_medium=referral&page=upgrade-pr

Co-authored-by: snyk-bot <[email protected]>

* fix: upgrade express-rate-limit from 7.2.0 to 7.3.0 (#82)

Snyk has created this PR to upgrade express-rate-limit from 7.2.0 to 7.3.0.

See this package in npm:
express-rate-limit

See this project in Snyk:
https://app.snyk.io/org/type-style/project/e2bcd002-cb74-409c-ba55-fb6349df1cbc?utm_source=github&utm_medium=referral&page=upgrade-pr

Co-authored-by: snyk-bot <[email protected]>

* fix: upgrade express-validator from 7.0.1 to 7.1.0 (#81)

Snyk has created this PR to upgrade express-validator from 7.0.1 to 7.1.0.

See this package in npm:
express-validator

See this project in Snyk:
https://app.snyk.io/org/type-style/project/e2bcd002-cb74-409c-ba55-fb6349df1cbc?utm_source=github&utm_medium=referral&page=upgrade-pr

Co-authored-by: snyk-bot <[email protected]>

* fix: upgrade axios from 1.7.1 to 1.7.2 (#80)

Snyk has created this PR to upgrade axios from 1.7.1 to 1.7.2.

See this package in npm:
axios

See this project in Snyk:
https://app.snyk.io/org/type-style/project/e2bcd002-cb74-409c-ba55-fb6349df1cbc?utm_source=github&utm_medium=referral&page=upgrade-pr

Co-authored-by: snyk-bot <[email protected]>

* fix: upgrade @mui/icons-material from 5.15.18 to 5.15.19 (#79)

Snyk has created this PR to upgrade @mui/icons-material from 5.15.18 to 5.15.19.

See this package in npm:
@mui/icons-material

See this project in Snyk:
https://app.snyk.io/org/type-style/project/e2bcd002-cb74-409c-ba55-fb6349df1cbc?utm_source=github&utm_medium=referral&page=upgrade-pr

Co-authored-by: snyk-bot <[email protected]>

* fix: upgrade @mui/icons-material from 5.15.19 to 5.15.20 (#88)

Snyk has created this PR to upgrade @mui/icons-material from 5.15.19 to 5.15.20.

See this package in npm:
@mui/icons-material

See this project in Snyk:
https://app.snyk.io/org/type-style/project/e2bcd002-cb74-409c-ba55-fb6349df1cbc?utm_source=github&utm_medium=referral&page=upgrade-pr

Co-authored-by: snyk-bot <[email protected]>

* fix: upgrade react-router-dom from 6.23.1 to 6.24.0 (#91)

Snyk has created this PR to upgrade react-router-dom from 6.23.1 to 6.24.0.

See this package in npm:
react-router-dom

See this project in Snyk:
https://app.snyk.io/org/type-style/project/e2bcd002-cb74-409c-ba55-fb6349df1cbc?utm_source=github&utm_medium=referral&page=upgrade-pr

Co-authored-by: snyk-bot <[email protected]>

* 77 design base layout (#85)

* [Task] #77 1st draft layout

* [Change] #70 update token expire date

* [Temp] #77, log out data on valid request, temp: error handling and display

* [Temp]

* [Task] #77, login Button functionality, default state

* [Task] #77, removed outdated comments

* [Task] #77, introduced linearBuffer Bar for login

* [Task] #77, added modeSwticher to start page

* [Task] #77, display last entry on map demo

* [Task] #77, enhance login, show pastUser if availabe, show user on mainpage

* [!!!Task] #77 first draft of functionality

* [Task] #77 move map to new location

* [Task] #77 create testData

* [Fix] #77 codeFactor complains

* [Task] #77, draft of status content

* [FIX] #77 change data accumulation

* [Task] #77 improve test example data

* fix: upgrade @mui/material from 5.15.16 to 5.15.20 (#92)

Snyk has created this PR to upgrade @mui/material from 5.15.16 to 5.15.20.

See this package in npm:
@mui/material

See this project in Snyk:
https://app.snyk.io/org/type-style/project/e2bcd002-cb74-409c-ba55-fb6349df1cbc?utm_source=github&utm_medium=referral&page=upgrade-pr

Co-authored-by: snyk-bot <[email protected]>

* [Fix] #94, refactor-ignore logic (multiline) (#95)

Serverside: When writing entry, the most recent previous entry is checked wether to be ignored.
Also if more than 2 items already exist meaning writing is preparing at least the 3rd entry, we recalculate distances and timing if previousItems are ignored.

Frontend:
In order to benefit and get the recent information that a previous item is being ignored, frontEnd askes for the current item again and merges it and following items.

Remember the most recent item can never be ignored due to policy. Maybe there is no further writing, so I want to have the latest datapoint.

* [Task] #94, add logging if logical error with ignore

* [Task] #94, cleanup console.logs

* [Fix] #93, offline message improvement (#96)

* fix: package.json & package-lock.json to reduce vulnerabilities (#101)

The following vulnerabilities are fixed with an upgrade:
- https://snyk.io/vuln/SNYK-JS-AXIOS-7361793

Co-authored-by: snyk-bot <[email protected]>

* fix: upgrade @mui/material from 5.15.20 to 5.16.5 (#102)

Snyk has created this PR to upgrade @mui/material from 5.15.20 to 5.16.5.

See this package in npm:
@mui/material

See this project in Snyk:
https://app.snyk.io/org/type-style/project/e2bcd002-cb74-409c-ba55-fb6349df1cbc?utm_source=github&utm_medium=referral&page=upgrade-pr

Co-authored-by: snyk-bot <[email protected]>

* 93 fix error message when server not available (#103)

* [Fix] #93, offline message improvement

* [Task] #93, removed background in status module when no data is present

* [Task] #61, add cut class to map for styling

* [Fix] #93 fix tests, be more specific on url, and let test fail non silently when csrf is not found

* [Fix] #94, repair overwriting the last data point

* fix: upgrade @emotion/react from 11.11.4 to 11.13.0 (#104)

Snyk has created this PR to upgrade @emotion/react from 11.11.4 to 11.13.0.

See this package in npm:
@emotion/react

See this project in Snyk:
https://app.snyk.io/org/type-style/project/e2bcd002-cb74-409c-ba55-fb6349df1cbc?utm_source=github&utm_medium=referral&page=upgrade-pr

Co-authored-by: snyk-bot <[email protected]>

* fix: upgrade @emotion/styled from 11.11.5 to 11.13.0 (#105)

Snyk has created this PR to upgrade @emotion/styled from 11.11.5 to 11.13.0.

See this package in npm:
@emotion/styled

See this project in Snyk:
https://app.snyk.io/org/type-style/project/e2bcd002-cb74-409c-ba55-fb6349df1cbc?utm_source=github&utm_medium=referral&page=upgrade-pr

Co-authored-by: snyk-bot <[email protected]>

* fix: upgrade react-router-dom from 6.25.0 to 6.25.1 (#106)

Snyk has created this PR to upgrade react-router-dom from 6.25.0 to 6.25.1.

See this package in npm:
react-router-dom

See this project in Snyk:
https://app.snyk.io/org/type-style/project/e2bcd002-cb74-409c-ba55-fb6349df1cbc?utm_source=github&utm_medium=referral&page=upgrade-pr

Co-authored-by: snyk-bot <[email protected]>

* fix: upgrade @mui/icons-material from 5.16.4 to 5.16.5 (#107)

Snyk has created this PR to upgrade @mui/icons-material from 5.16.4 to 5.16.5.

See this package in npm:
@mui/icons-material

See this project in Snyk:
https://app.snyk.io/org/type-style/project/e2bcd002-cb74-409c-ba55-fb6349df1cbc?utm_source=github&utm_medium=referral&page=upgrade-pr

Co-authored-by: snyk-bot <[email protected]>

* fix: upgrade express-rate-limit from 7.3.1 to 7.4.0 (#108)

Snyk has created this PR to upgrade express-rate-limit from 7.3.1 to 7.4.0.

See this package in npm:
express-rate-limit

See this project in Snyk:
https://app.snyk.io/org/type-style/project/e2bcd002-cb74-409c-ba55-fb6349df1cbc?utm_source=github&utm_medium=referral&page=upgrade-pr

Co-authored-by: snyk-bot <[email protected]>

* 109 marker and line design (#110)

* [Task] #109, start polyline

* [Task] #94, marker

* [Task] #109, gradient color polyline color based on speed

* [Task] #109 linter fixes

* fix: upgrade react-router-dom from 6.25.1 to 6.26.0 (#113)

Snyk has created this PR to upgrade react-router-dom from 6.25.1 to 6.26.0.

See this package in npm:
react-router-dom

See this project in Snyk:
https://app.snyk.io/org/type-style/project/e2bcd002-cb74-409c-ba55-fb6349df1cbc?utm_source=github&utm_medium=referral&page=upgrade-pr

Co-authored-by: snyk-bot <[email protected]>

* fix: upgrade @mui/material from 5.16.5 to 5.16.6 (#112)

Snyk has created this PR to upgrade @mui/material from 5.16.5 to 5.16.6.

See this package in npm:
@mui/material

See this project in Snyk:
https://app.snyk.io/org/type-style/project/e2bcd002-cb74-409c-ba55-fb6349df1cbc?utm_source=github&utm_medium=referral&page=upgrade-pr

Co-authored-by: snyk-bot <[email protected]>

* Switch polyline (#114)

* [Revert] #109 remove polyColor Plugin

* [Fix, MultiLine] #109, refactor coloring lines;

while fetchinng new data vs reloading
MaxSpeed might change the more entries are fetched.
Example Testcase and after 6 entries are there, reload and see colors change ... well not with this fix.

* [Task] #109, improve polyline display, remove unused code

* [Task] #77, change timing to round up, so it "feels" more accurate

* [Task] #115, remove SVG Animation on startup based on media Query

* [Task] #77 improve test example data

* [Task] #77, calculate more Status data

* [Task] #77, improve example test data

* [Task] #109, line dashed when diff is high, marker start icon when diff is higher

* [Task] #77, status design

* [Task] #83, forced scheme for map

* [Task] #83, change context, mode globally available

* [Task] #83, react update, cluster install

* [Task, multiline] #83, map tilelayer

Introduced new map TileLayers using layers control, and styled it
Introduced markerClusterGroup from @changey, since others had issues like broken marker images, or lack for typescript support
Refined dashed array styles
Addapted context changes, to fetch mode globally, for seperate map theme
Markers have none style if neither end or start, to be targeted
Introduced Layer array for tilelayers
When Layers are changed theme for map is set/updated

* [Task] #77 improve responsive design, hide images, status overlays map

* [Task] #77, adjust coloring and opacity, used for status

* [Task] #83, adjust imports

* [Task] #77, changed responsive design for mobile

* [Task] #83, extracted to own module, added fly option

* [Task] #83, layers extracted, clickable minimap, corrected for mapbox tileSize

* Bump webpack from 5.91.0 to 5.94.0 (#117)

Bumps [webpack](https://github.com/webpack/webpack) from 5.91.0 to 5.94.0.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v5.91.0...v5.94.0)

---
updated-dependencies:
- dependency-name: webpack
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* [Task] #83, code cleanup

* [Fix] #83, mime type setting

* [fix] #123, run pre and post build for production too

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: snyk-bot <[email protected]>

* Release 1_4 (#127)

* [Task] #6 provide fallback index.html

* [Task] #6 production ready code (m)

move httpdocs folder to dist
have compile without sourcemaps for faster speed

* [Task] #6 create github action for upload when main is updated (#21)

* [change] #6 new ftp upload action

* [Fix] #6 replace host with server in ftp action

* [Task] #6 basic log (#26)

* [CHANGE] #6 revert back to require output for production

* [Task] #6 add ability to manually upload to prod

* [Task] #9 enable manual start of codechecks

* 10 webhook for writing (#36)

* [Change] #3 clean up npm scripts, to have clean folder before build

* [Task] #10 created data types in typescript

* [Temp] #10 created subroute for writing, and folder structure

* [Change] #3 include to use relative paths from src folder in ts and node

https://stackoverflow.com/questions/43281741/how-can-i-use-paths-in-tsconfig-json
See comment from Remo H. Hansen with at least 100 upvoted

* [Change] Update VSCode to keep files open

* [Task] #18 setup dotenv for secret variables

* [Temp, Task] #10 Validate inputs using express-validator and custom functions

* [Task] #18 prevent parameter pollution

* [Task] #10 validating incoming parameter and logging errors

* [Task] #7 add basic cache to express

* [Changes] #7 Error Handling, to include basic custom Error Handling

* [Task] #10 enhanced validation to only allow known parameters

* [Change] #35 added Jest, tests for helper functions when writing

* [Task] #10 better error Handling

* [Task] #35 add tests for writing webhook validation

* [TASK] #18 protect Webhook using KEY

* [Fix] #35 test know import path structure now

* [Task] #35 add test for protected webhook

* [Task] #35 refactor build to run jest tests

* [Task] #10 switched to crypto instead of bcrypt for dependency issue

see synk inflight

* [Fix] #36 PRQ Feedback

* [Task] #3 improve error handling, logger and added chalk

to colorize console output.
Had to use chalk version 4 because of typescript converting to require, and chalk5 do want import syntax.

* [Change] #3 nodemon to clear console when in dev mode

* [!Task] #32 webhook creates folder and file based on date

* [Change] #35 relocated tests and refactor write, also added file check

* [Task] #18, installed helmet, configured self as CSP origin

* [Fix] moved chalk out of dev dependency

* [Task] #32 error logging and text output improvement, log string instead of "object"

* [Task] #18 CSP Update to allow localhost for testing

* [Fix] #3 debugging setup improvments

* [FIX] #10 Error Handling

* [Task] #10 writing basic non calculated data to file

* [Fix] #10 avoid Header Modification after sending the request

* [Task] #10 JSON Data pretty output

* [Task] #32 update types to reflect subobjects of entry

* [Task] #10 write time

* [Task] #32 added logging for time edgecases

* [Task] #10 output seconds

* [Task] #10 calculate distance based on lat and lon

* [Task] #32 writing tests for time and distance

* [Task] #32 change distance calculation to use pythagoras

* [Task] #38 add favicon

* [Task] #32 time converted to seconds

* [Taskk] #32 speed calculation and output and tests

* [Task] #32 speed tests

* [Task] #33 add ignore

* [Task] #32 test finetuning

* [Task] #32 add angle between entries

* [Task] #32 test for angle, extracted getData function

* [change] #32 test to include optional leading 0 for days

* [!!!Task] #18 add uncaughtExeption handler as last resort

* [Task] #7 enhance static options to include common filetypes;  index file

start is used as index file to avoid collisions with host provider

* [change] #32 validation to be used more explictly

* [change] #32 add index to log while writing

* [Task] #32 test if 1000 calls can be made with randomized data

* [!!! Task] #32 limit JSON Data to be 1000 lines: replace last line with most recent entry

* [Change, Task] #32 if 1000 entries exceeded, only replace last if hdop is good

* [Change] build action enable button to on manually

* [temp] test y tests fail

* Create node.js.yml

* Create main.yml

* [!!!Fix] Created new workflow to build / test node, commented tests back in.

Increased time between server calls in test, to check difference time more accurately

* [Task] #33 moved ignore to its own file since it creates data rather than validating it

* 42 output json (#44)

* [Task] #42, created route to output json

* [Task] #42 added tests for read json

* 41 add rate limiter (#45)

* [Task] #18, limit request size for security reasons

* [Task] #43, introduce gzip to transfer data

* [Task] #34 improve error handling, log server shutdowns

* [Task] #34 installed and integrated tooBusy to send 503 when load is high

* [Task] #34 improved tooBusy, improved formatting

* [Task, Temp] #41 installed ratelimiter and slowDown

* [Task] #42 cleanup ipv6 addresses

* [Change] #10 error handling for better gitBash and txt output, also reduced stack in case of validation errors

* [Task] #41 prepare Log for RateLImit errors

* [Temp] #41 write route rateLImited

temp: see Todos

* [Task] #34 colorize prefix in console

* [Task] #42 extract middlewares and move to folder

* [Task] #41 ratelimiter cleaning up periodicly

* [Task] #41 skip tests in rateLimiting

* Bump follow-redirects from 1.15.5 to 1.15.6 (#47)

Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.15.5 to 1.15.6.
- [Release notes](https://github.com/follow-redirects/follow-redirects/releases)
- [Commits](https://github.com/follow-redirects/follow-redirects/compare/v1.15.5...v1.15.6)

---
updated-dependencies:
- dependency-name: follow-redirects
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* 43 secure output route (#46)

* [Task] #43 create color pallette

via atmos

* [Task] #43 create color pallette

via atmos

* [Task] #43 cleanup colors and svg

* [Task] #41 remove test code

* [CHANGE] #3 reconfigured nodemon to copy static files

* [Task] #18 replaced getRawBody with builtIn express urlEncoded

* [Temp, Task] #43 basic login page, not yet used as middleware

* [Temp] #43, create and validate json web token

* [Task] #43, add slowDown and RateLimit for failed login attempts

* [Task] #43, ratelimit for login page

* [Task] #43, add global ratelimiter

* [fix] #7, improve error handeling for express errors

* [Task] #43 rework body limitations to be checked only appropiate methods

* [Task] #43 added check for data before using it

* [Task] #43 check that body is ignored for GET in request

* [Task] #43 login test

* [Task] #43 create tests for login

* [Task] #43 fine tune error handling

* [Task] #43, finished login and jwt related tests

* [Change] #34, no further need for test logging

* [Task] #43, fine tune jwt, middleware process improved

* [CHANGE] #43 created new esLint to have clientside js without ts

* [Temp] #43 test to see new linter configuration

* [Change] #43 switched to bcrypt for passwords

* [Task] #43 read return json in all cases

* [Task] #43 introduced color classes

* [Task] #43, prq feedback

* [Temp} #43 figuring out why tests d…
  • Loading branch information
3 people authored Sep 3, 2024
1 parent c2d7a46 commit 5568aac
Show file tree
Hide file tree
Showing 13 changed files with 212 additions and 43 deletions.
7 changes: 7 additions & 0 deletions .env_example
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
NODE_ENV=development
ROOT=https://your-produciton-server.com
KEY=
USER_JOHNDOE=
USER_TEST=
LOCALHOST=127.0.0.1
LOCALHOSTv6=::1
2 changes: 1 addition & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@
//"@typescript-eslint/no-unused-vars": "warn"
"jest/no-conditional-expect": "off"
},
"ignorePatterns": ["dist", "jest.config.js", "httpdocs", "webpack.config.js", "src/client"]
"ignorePatterns": ["dist", "jest.config.js", "httpdocs", "webpack.config.js", "src/client", "init"]

}
9 changes: 3 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@ jobs:
runs-on: ubuntu-latest
env:
NODE_ENV: ${{ vars.NODE_ENV }}
LOCALHOST: ${{ vars.LOCALHOST }}
LOCALHOSTV6: ${{ vars.LOCALHOSTV6 }}
KEYA: ${{ secrets.KEYA }}
KEYB: ${{ secrets.KEYB }}
KEY: ${{ secrets.KEY }}
USER_TEST: ${{ secrets.USER_TEST }}

steps:
Expand All @@ -30,8 +27,8 @@ jobs:
- run: npm run build --if-present
- name: Start server
run: |
sudo NODE_ENV=$NODE_ENV LOCALHOST=$LOCALHOST LOCALHOSTV6=$LOCALHOSTV6 KEYA=$KEYA KEYB=$KEYB USER_TEST=$USER_TEST npm start &
sleep 15 # Give server some time to start
sudo NODE_ENV=$NODE_ENV LOCALHOST=$LOCALHOST LOCALHOSTV6=$LOCALHOSTV6 KEY=$KEY USER_TEST=$USER_TEST npm start &
sleep 16 # Give server some time to start
- name: Check if server is running
run: |
curl --fail http://localhost:80 || exit 1
Expand Down
93 changes: 86 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@ Leaflet Osmand React ExpressJS Coordinates (X)
> Remember an "X" marks the spot.
## Goal
**Technical:** Recieve and store coordinates via webhook and display them on a map through an interactive frontend.
**Personal:** The intend of this project is to get familiar with the listed technologies.

## Progress
View [milestones](https://github.com/Type-Style/LOREX/milestones) and the [board](https://github.com/users/Type-Style/projects/1) to witness progression
Recieve and store coordinates via webhook and display them on a map through an interactive frontend.

## Installation
### Prerequisites
Expand All @@ -20,6 +16,89 @@ Run the install command for example via npm
`npm install`

After completion without errors hit
`npx ts-node src/app.ts`
`npm run build`

Once complete you can start the server using
`npm run start`

> [!TIP]
Build and start can be combined using
`npm run dev`

### Generating Key and Password
`Error Message: KEY is missing in environment variables`

Before you are able to login and use the webapplication, environment variables need to be setup.
Therefore you need to create a file `.env` and place it in the root of the project.
This file will be filled with secrets to protect your instance of LOREX.

#### 1st. Generate Key
Usage: open console run: node init/generateKey.js
type desired key and hit enter
copy output to .env add a line starting with:
KEY=
directly followed by your output

#### 2nd Generate Password(s)
Prerequisite: KEY already generated!
_(may require server restart)_
Run the build command from the package.json (npm run build)
Then call the compiled version of this script using the key as environment variable like so:
KEY=your-key node ./init/generatePassword.js
Enter your password
Copy that to the Environment Variables and .env file
USER_WHATEVER=
followed by the output of the console

> [!IMPORTANT]
In order to run automatic tests and create example data is is highly recommended to have a USER_TEST with the password of `test`
THe test user cannot be used in an production environment

Once completed rebuild / restart the server and open up localhost/login
Login is now possible using the Username from the .env file in this example "WHATEVER" and the password that was created in the previous step.

**Now the application is ready**


## Generating Data
### Example Data
Build and start the server for example using
`npm run dev`
Wait for the server to start and webpack to compile the assets.
Once done use a second command line to run
`npm run test:data`

This generates 6 entries each 30s appart and calls the webserver to store this data.
The writing of data can be seen in the first console where the server is running.
Also once logged in under localhost, a map is visible showing a route westbound from the brandenburg gate.

### Calling writing route manually
Data can be generated by calling the /write rout of the server.
Here is an example:

`http://localhost/write?user=xx&lat=53.5000&lon=10.0&timestamp=1720691648188&hdop=10.0&altitude=1000.000&speed=100.000&heading=180.0&key=test`


In order to pass validation use the correct key _(or `test` in development envrioment)_ and create a valid [UNIX timestamp]([url](https://currentmillis.com/)).
For example by using this javascript code:
`var a = new Date().getTime();
copy(a);
a;`

## Using on Production
### A note on security
This application is not developed with https built in support.
> [!WARNING]
It is advised to run this application in `production` mode behind a proxy that uses https for security reasons

### Getting data
Similar to the section Generating Data and Calling writing route manually, the application relies on data being provided using a webhook.
Well how data is collected and what data is pushed to the system is user preference.
Feel free to build you own application to do so.

This application is designed to be used with the [OSMAND+ mobile app]([url](https://osmand.net/)).
Due to a plugin called [Triprecording]([url](https://osmand.net/docs/user/plugins/trip-recording/))
Using the above link or by [clicking here](https://osmand.net/docs/user/plugins/trip-recording#recording-settings) more information can be found to setup webtracking or "online tracking"


**Now the server is ready**
30 changes: 30 additions & 0 deletions init/generateKey.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* Usage: open console run: node init/generateKey.js
* type desired key and hit enter
* copy output to .env add a line starting with:
* KEY=
* directly followed by your output
*/

// Import required modules
const readline = require('readline');

// set up readline to read input from the console
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});

// Prompt user for input
rl.question('Enter the string to be encoded: ', (input) => {
// encode to escape special chars
const escapedString = encodeURIComponent(input);

// convert the escaped string to base64
const base64String = Buffer.from(escapedString).toString('base64');

// print the result
console.log('Base64 Encoded String:', base64String);

rl.close();
});
29 changes: 29 additions & 0 deletions init/generatePassword.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* This is used to setup Passwords initially
* You can create passwords using the same logic as in the environment
* Prerequisite: You need to have KEY already generated!
* Run the build command from the package.json (npm run build)
* Then call the compiled version of this script using the key as environment variable like so:
* KEY=your-key node ./init/generatePassword.js
* Enter your password
* Copy that to the Environment Variables and .env file
* USER_WHATEVER=
* followed by the output of the console
*/

// Import required modules
const readline = require('readline');
const { crypt } = require('../dist/scripts/crypt');

// Set up readline to read input from the console
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});

// Prompt user for input
rl.question('Enter Password to be generated: ', async (input) => {
const cryptedPassword = await crypt(input);
console.log(cryptedPassword);
rl.close();
});
48 changes: 34 additions & 14 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 6 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
"lint:client": "eslint httpdocs/js/ --fix",
"lint:react": "eslint src/client/ --fix",
"test": "jest",
"test:data": "jest --config jest.testData.config.js",
"test:data": "cross-env MODE=DEV jest --config jest.testData.config.js",
"test:data:prod": "cross-env MODE=PROD jest --config jest.testData.config.js",
"test:app": "jest src/tests/app.test.ts",
"test:login": "jest src/tests/login.test.ts",
"test:unit": "jest src/tests/unit.test.ts",
Expand All @@ -43,6 +44,7 @@
"@typescript-eslint/eslint-plugin": "^6.18.1",
"@typescript-eslint/parser": "^6.18.1",
"concurrently": "^8.2.2",
"cross-env": "^7.0.3",
"css-loader": "^7.1.0",
"eslint": "^8.56.0",
"eslint-plugin-import": "^2.29.1",
Expand All @@ -66,8 +68,8 @@
"@changey/react-leaflet-markercluster": "^4.0.0-rc1",
"@emotion/react": "^11.13.0",
"@emotion/styled": "^11.11.5",
"@mui/icons-material": "^5.16.5",
"@mui/material": "^5.16.6",
"@mui/icons-material": "^5.16.7",
"@mui/material": "^5.16.7",
"@types/leaflet-rotatedmarker": "^0.2.5",
"axios": "^1.7.4",
"bcrypt": "^5.1.1",
Expand All @@ -79,7 +81,7 @@
"express": "^4.19.2",
"express-rate-limit": "^7.4.0",
"express-slow-down": "^2.0.3",
"express-validator": "^7.1.0",
"express-validator": "^7.2.0",
"helmet": "^7.1.0",
"hpp": "^0.2.3",
"jsonwebtoken": "^9.0.2",
Expand Down
5 changes: 2 additions & 3 deletions src/models/entry.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { NextFunction, Request, Response } from 'express';
import { checkExact, query } from 'express-validator';
import { compare } from '@src/scripts/crypt';
import { create as createError } from '@src/middleware/error';
import * as file from '@src/scripts/file';
import { getTime } from '@src/scripts/time';
Expand Down Expand Up @@ -138,12 +137,12 @@ export function checkTime(value: string) {

async function checkKey(value: string) {
if (!value) { throw new Error('Key required'); }
if (!process.env.KEYB) { throw new Error('Configuration wrong'); }
if (!process.env.KEY) { throw new Error('Configuration wrong: KEY is missing in environment variables'); }
if (process.env.NODE_ENV != "production" && value == "test") {
return true; // dev testing convenience
}

const result = await compare(decodeURIComponent(value), process.env.KEYB);
const result = Buffer.from(encodeURIComponent(value)).toString('base64') == process.env.KEY;

if (!result) {
throw new Error('Key does not match');
Expand Down
4 changes: 2 additions & 2 deletions src/scripts/crypt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const compare = async function (password: string, hash: string) {
}

function pepper(password: string) {
const key = process.env.KEYA;
if (!key) { throw new Error('KEYA is not defined in the environment variables'); }
const key = process.env.KEY;
if (!key) { throw new Error('KEY is not defined in the environment variables'); }
return password + crypto.createHmac('sha256', key).digest("base64");
}
4 changes: 2 additions & 2 deletions src/scripts/token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export function cleanupCSRF() {
}

export function validateJWT(req: Request) {
const key = process.env.KEYA;
const key = process.env.KEY;
const header = req.header('Authorization');
const [type, token] = header ? header.split(' ') : "";
let payload: string | jwt.JwtPayload = "";
Expand Down Expand Up @@ -78,7 +78,7 @@ export function validateJWT(req: Request) {
}

export function createJWT(req: Request, res: Response) {
const key = process.env.KEYA;
const key = process.env.KEY;
if (!key) { throw new Error('Configuration is wrong'); }
const today = new Date();
const dateString = today.toLocaleDateString("de-DE", { weekday: "short", year: 'numeric', month: 'numeric', day: 'numeric', hour: '2-digit', minute: '2-digit', second: '2-digit' });
Expand Down
Loading

0 comments on commit 5568aac

Please sign in to comment.