Skip to content

Commit

Permalink
43 secure output route (#46)
Browse files Browse the repository at this point in the history
* [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
  • Loading branch information
Type-Style committed Mar 21, 2024
1 parent ce6e636 commit 45c3a89
Show file tree
Hide file tree
Showing 26 changed files with 1,485 additions and 204 deletions.
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"]
"ignorePatterns": ["dist", "jest.config.js", "httpdocs"]

}
9 changes: 4 additions & 5 deletions .github/workflows/eslint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ jobs:
with:
node-version: 16
- run: npm ci # or yarn install
- uses: sibiraj-s/action-eslint@v3
with:
eslint-args: '--ignore-path=.gitignore --quiet'
extensions: 'js,jsx,ts,tsx'
annotations: true
- name: Lint server-side code
run: npx eslint src/ --fix
- name: Lint client-side code
run: npx eslint httpdocs/js/ --fix
28 changes: 22 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Node3
name: Tests

on:
workflow_dispatch:
Expand All @@ -10,7 +10,13 @@ on:
jobs:
build:
runs-on: ubuntu-latest

env:
NODE_ENV: ${{ vars.NODE_ENV }}
LOCALHOST: ${{ vars.LOCALHOST }}
LOCALHOSTV6: ${{ vars.LOCALHOSTV6 }}
KEYA: ${{ secrets.KEYA }}
KEYB: ${{ secrets.KEYB }}
USER_TEST: ${{ secrets.USER_TEST }}

steps:
- uses: actions/checkout@v3
Expand All @@ -19,14 +25,24 @@ jobs:
with:
node-version: '20'
cache: 'npm'
- run: echo "NODE_ENV = $NODE_ENV"
- run: npm ci
- run: npm run build --if-present
- name: Start server
run: |
sudo npm start &
sleep 8 # Give server some time to start
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
- name: Check if server is running
run: |
curl --fail http://localhost:80 || exit 1
- name: Run tests
run: npm run test
- name: Run app tests
run: npm run test:app
- name: Run login tests
run: npm run test:login
- name: Run unit tests
run: npm run test:unit
- name: Run integration tests
run: npm run test:integration



159 changes: 159 additions & 0 deletions httpdocs/color-table.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
95 changes: 95 additions & 0 deletions httpdocs/css/colors.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
/*
created by atmos https://app.atmos.style/65cc9eaec76d443c0a796d4b
** base configuration colors **
Main: #f90
Info: #231aee
Danger: #ff0000
Success: #59ec04
Neutral: #131211
*/

[class*=color] {
--lightness: 67.66%;
--hue: 64.55;
--chroma: 0.007;
color: oklch(var(--lightness) var(--chroma) var(--hue));

&[class*=l1] {--lightness: 10%;}
&[class*=l2] {--lightness: 25%;}
&[class*=l3] {--lightness: 37.5%;}
&[class*=l4] {--lightness: 50%;}
&[class*=l5] {--lightness: 62.5%;}
&[class*=l6] {--lightness: 77.2%;}
&[class*=l7] {--lightness: 90%;}

&[class*=main] {
--lightness: 77.2%;
--chroma: 0.1738;
--hue: 64.55;

&[class*=l1] {--chroma: 0.02;}
&[class*=l2] {--chroma: 0.056;}
&[class*=l3] {--chroma: 0.085;}
&[class*=l4] {--chroma: 0.114;}
&[class*=l5] {--chroma: 0.142;}
&[class*=l6] {--chroma: 0.1738;} /* base */
&[class*=l7] {--chroma: 0.06;}
}

&[class*=info] {
--lightness: 44.87%;
--chroma: 0.2838;
--hue: 268.0;

&[class*=l1] {--chroma: 0.055;}
&[class*=l2] {--chroma: 0.158;}
&[class*=l3] {--chroma: 0.237;}
&[class*=l4] {--chroma: 0.2838;} /* base */
&[class*=l5] {--chroma: 0.19;}
&[class*=l6] {--chroma: 0.109;}
&[class*=l7] {--chroma: 0.04;}
}

&[class*=alert] {
--lightness: 62.8%;
--chroma: 0.2577;
--hue: 29.23;

&[class*=l1] {--chroma: 0.036;}
&[class*=l2] {--chroma: 0.103;}
&[class*=l3] {--chroma: 0.154;}
&[class*=l4] {--chroma: 0.195;}
&[class*=l5] {--chroma: 0.2577;} /* base */
&[class*=l6] {--chroma: 0.133;}
&[class*=l7] {--chroma: 0.045;}
}

&[class*=success] {
--lightness: 83%;
--chroma: 0.2607;
--hue: 138.96;

&[class*=l1] {--chroma: 0.029;}
&[class*=l2] {--chroma: 0.083;}
&[class*=l3] {--chroma: 0.124;}
&[class*=l4] {--chroma: 0.157;}
&[class*=l5] {--chroma: 0.208;}
&[class*=l6] {--chroma: 0.2607;} /* base */
&[class*=l7] {--chroma: 0.201;}
}

&[class*=neutral] {
--lightness: 18.3%;
--chroma: 0.0026;
--hue: 67.66;

&[class*=l1] {--chroma: 0.001;}
&[class*=l2] {--chroma: 0.0026;} /* base */
&[class*=l3] {--chroma: 0.006;}
&[class*=l4] {--chroma: 0.007;}
&[class*=l5] {--chroma: 0.009;}
&[class*=l6] {--chroma: 0.011;}
&[class*=l7] {--chroma: 0.004;}
}
}
20 changes: 20 additions & 0 deletions httpdocs/css/login.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
form {
margin-inline: auto;
display: flex;
flex-wrap: wrap;
justify-content: space-between;
max-width: 500px;
gap: 10px;
}
input, button {
flex-grow: 1;
}
textarea, h1 {
flex-basis: 100%;
}
textarea {
height: 50vh;
}
h1 {
text-align: center;
}
12 changes: 12 additions & 0 deletions httpdocs/js/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"root": true,
"env": {
"browser": true,
"es2021": true
},
"extends": "eslint:recommended",
"parserOptions": {
"ecmaVersion": 2021,
"sourceType": "module"
}
}
1 change: 1 addition & 0 deletions httpdocs/js/login.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

8 changes: 8 additions & 0 deletions nodemon-static.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"watch": [
"httpdocs"
],
"ext": "*",
"ignore": [],
"exec": "cp -R httpdocs/ dist/"
}
File renamed without changes.
Loading

0 comments on commit 45c3a89

Please sign in to comment.