diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a755f3f..5eaaa85 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -24,7 +24,7 @@ jobs: - name: Start server run: | sudo npm start & - sleep 6 # Give server some time to start + sleep 8 # Give server some time to start - name: Check if server is running run: | curl --fail http://localhost:80 || exit 1 diff --git a/src/app.ts b/src/app.ts index 3761d0b..1e59d96 100644 --- a/src/app.ts +++ b/src/app.ts @@ -69,6 +69,7 @@ app.use(function (req, res, next) { // limit request size limit when recieving d // routes app.get('/', (req, res) => { + console.log(req.ip + " - " + res.locals.ip); res.send('Hello World, via TypeScript and Node.js! ' + res.locals.ip); }); diff --git a/src/middleware/limit.ts b/src/middleware/limit.ts index e6596e4..a73e6c8 100644 --- a/src/middleware/limit.ts +++ b/src/middleware/limit.ts @@ -10,7 +10,7 @@ import logger from '@src/scripts/logger'; const baseOptions: Partial = { windowMs: 30 * 60 * 1000, - skip: (req, res) => (res.locals.ip == process.env.LOCALHOST) + skip: (req, res) => (res.locals.ip == "127.0.0.1" || res.locals.ip == "::1") } const baseSlowDownOptions: Partial = { diff --git a/src/tests/integration.test.ts b/src/tests/integration.test.ts index 2d40ced..6133c1d 100644 --- a/src/tests/integration.test.ts +++ b/src/tests/integration.test.ts @@ -129,7 +129,7 @@ describe("GET /write", () => { expect(entry.time.created).toBeGreaterThan(date.getTime()); expect(entry.time.diff).toBeGreaterThan(3.5); - expect(entry.time.diff).toBeLessThan(4); + expect(entry.time.diff).toBeLessThan(4.6); const germanDayPattern = "(Montag|Dienstag|Mittwoch|Donnerstag|Freitag|Samstag|Sonntag)";