Compare commits

...

4 Commits

Author SHA1 Message Date
a995ba76bc Bump node
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2025-08-23 09:15:08 +01:00
fdacb09bde Update logging
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2025-08-23 09:14:57 +01:00
614c9b7821 Fix release task
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2025-08-23 09:11:28 +01:00
885f508996 Fix image in makefile
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2025-08-23 09:08:52 +01:00
3 changed files with 7 additions and 7 deletions

View File

@@ -1,4 +1,4 @@
FROM node:10-alpine FROM node:24-alpine
WORKDIR /app WORKDIR /app

View File

@@ -1,6 +1,6 @@
.DEFAULT_GOAL := default .DEFAULT_GOAL := default
IMAGE ?= docker.cluster.fun/averagemarcus/cors-proxy:latest IMAGE ?= rg.fr-par.scw.cloud/averagemarcus/cors-proxy:latest
.PHONY: test # Run all tests, linting and format checks .PHONY: test # Run all tests, linting and format checks
test: lint check-format run-tests test: lint check-format run-tests
@@ -47,7 +47,7 @@ ci:
.PHONY: release # Release the latest version of the application .PHONY: release # Release the latest version of the application
release: release:
@kubectl --namespace cors-proxy set image deployment cors-proxy web=docker.cluster.fun/averagemarcus/cors-proxy:$(SHA) @kubectl --namespace cors-proxy set image deployment cors-proxy web=rg.fr-par.scw.cloud/averagemarcus/cors-proxy:$(SHA)
.PHONY: help # Show this list of commands .PHONY: help # Show this list of commands
help: help:

View File

@@ -25,12 +25,12 @@ http.createServer((req, response) => {
if(!remoteURL.hostname || remoteURL.hostname === 'localhost') return response.end(); if(!remoteURL.hostname || remoteURL.hostname === 'localhost') return response.end();
if(blockList.some(b => remoteURL.hostname == b || remoteURL.hostname.endsWith("." + b))) { if(blockList.some(b => remoteURL.hostname == b || remoteURL.hostname.endsWith("." + b))) {
console.log("Domain is in blocklist") console.log(`Domain '${remoteURL.hostname}' is in blocklist`)
response.writeHead(403); response.writeHead(403);
return response.end(); return response.end();
} }
if(allowList.length > 0 && !allowList.some(b => remoteURL.hostname == b || remoteURL.hostname.endsWith("." + b))) { if(allowList.length > 0 && !allowList.some(b => remoteURL.hostname == b || remoteURL.hostname.endsWith("." + b))) {
console.log("Domain is not in allowlist") console.log(`Domain '${remoteURL.hostname}' is not in allowlist`)
response.writeHead(403); response.writeHead(403);
return response.end(); return response.end();
} }
@@ -87,8 +87,8 @@ function loadWebpage(req, res) {
res.writeHead(200); res.writeHead(200);
res.end( res.end(
contents contents
.replaceAll('[[BLOCKLIST]]', JSON.stringify(blockList)) .replaceAll('[[BLOCKLIST]]', JSON.stringify(blockList))
.replaceAll('[[ALLOWLIST]]', JSON.stringify(allowList)) .replaceAll('[[ALLOWLIST]]', JSON.stringify(allowList))
); );
}) })
.catch(err => { .catch(err => {