format: run prettier tree-wide

Signed-off-by: Xe Iaso <me@xeiaso.net>
This commit is contained in:
Xe Iaso
2026-02-15 11:53:39 +00:00
parent 7075f74764
commit 5e2bff8397
157 changed files with 1741 additions and 1621 deletions

View File

@@ -1,12 +1,12 @@
bots:
- name: deny
user_agent_regex: DENY
action: DENY
- name: deny
user_agent_regex: DENY
action: DENY
- name: challenge
user_agent_regex: CHALLENGE
action: CHALLENGE
- name: challenge
user_agent_regex: CHALLENGE
action: CHALLENGE
status_codes:
CHALLENGE: 401
DENY: 403
DENY: 403

View File

@@ -3,13 +3,13 @@ import { createInterface } from "readline";
async function getPage(path) {
return fetch(`http://localhost:8923${path}`)
.then(resp => {
.then((resp) => {
if (resp.status !== 200) {
throw new Error(`wanted status 200, got status: ${resp.status}`);
}
return resp;
})
.then(resp => resp.text());
.then((resp) => resp.text());
}
(async () => {
@@ -42,4 +42,4 @@ async function getPage(path) {
}
process.exit(failed ? 1 : 0);
})();
})();

View File

@@ -3,25 +3,25 @@ async function getChallengePage() {
headers: {
"Accept-Language": "en",
"User-Agent": "CHALLENGE",
}
},
})
.then(resp => {
.then((resp) => {
if (resp.status !== 200) {
throw new Error(`wanted status 200, got status: ${resp.status}`);
}
return resp;
})
.then(resp => resp.text());
.then((resp) => resp.text());
}
(async () => {
const page = await getChallengePage();
if (!page.includes(`<html lang="de">`)) {
console.log(page)
console.log(page);
throw new Error("force language smoke test failed");
}
console.log("FORCED_LANGUAGE=de caused a page to be rendered in german");
process.exit(0);
})();
})();

View File

@@ -1,12 +1,14 @@
async function fetchLanguages() {
return fetch("http://localhost:8923/.within.website/x/cmd/anubis/static/locales/manifest.json")
.then(resp => {
return fetch(
"http://localhost:8923/.within.website/x/cmd/anubis/static/locales/manifest.json",
)
.then((resp) => {
if (resp.status !== 200) {
throw new Error(`wanted status 200, got status: ${resp.status}`);
}
return resp;
})
.then(resp => resp.json());
.then((resp) => resp.json());
}
async function getChallengePage(lang) {
@@ -14,15 +16,15 @@ async function getChallengePage(lang) {
headers: {
"Accept-Language": lang,
"User-Agent": "CHALLENGE",
}
},
})
.then(resp => {
.then((resp) => {
if (resp.status !== 200) {
throw new Error(`wanted status 200, got status: ${resp.status}`);
}
return resp;
})
.then(resp => resp.text());
.then((resp) => resp.text());
}
(async () => {
@@ -42,7 +44,7 @@ async function getChallengePage(lang) {
console.log(`getting for ${lang}`);
const page = await getChallengePage(lang);
resultSheet[lang] = page.includes(`<html lang="${lang}">`)
resultSheet[lang] = page.includes(`<html lang="${lang}">`);
}
for (const [lang, result] of Object.entries(resultSheet)) {
@@ -59,4 +61,4 @@ async function getChallengePage(lang) {
}
process.exit(0);
})();
})();

View File

@@ -3,4 +3,4 @@ kind: ClusterIssuer
metadata:
name: selfsigned
spec:
selfSigned: {}
selfSigned: {}

View File

@@ -10,4 +10,4 @@ spec:
createNamespace: true
set:
installCRDs: "true"
"prometheus.enabled": "false"
"prometheus.enabled": "false"

View File

@@ -3,16 +3,16 @@ import { statSync } from "fs";
async function getPage(path) {
return fetch(`http://localhost:8923${path}`, {
headers: {
'User-Agent': 'CHALLENGE'
}
"User-Agent": "CHALLENGE",
},
})
.then(resp => {
.then((resp) => {
if (resp.status !== 200) {
throw new Error(`wanted status 200, got status: ${resp.status}`);
}
return resp;
})
.then(resp => resp.text());
.then((resp) => resp.text());
}
async function getFileSize(filePath) {
@@ -63,7 +63,9 @@ async function getFileSize(filePath) {
// Verify that log file size increased
if (finalSize <= initialSize) {
console.error("ERROR: Log file size did not increase after making requests!");
console.error(
"ERROR: Log file size did not increase after making requests!",
);
failed = true;
}
@@ -79,10 +81,14 @@ async function getFileSize(filePath) {
console.log(`Successful requests: ${successCount}/${requests.length}`);
if (failed) {
console.error("Test failed: Some requests failed or log file size did not increase");
console.error(
"Test failed: Some requests failed or log file size did not increase",
);
process.exit(1);
} else {
console.log("Test passed: All requests succeeded and log file size increased");
console.log(
"Test passed: All requests succeeded and log file size increased",
);
process.exit(0);
}
})();
})();

View File

@@ -1,8 +1,2 @@
# /etc/nginx/conf-anubis.inc
# Forward to anubis
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_pass http://anubis;
}
# /etc/nginx/conf-anubis.inc # Forward to anubis location / { proxy_set_header
Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_pass http://anubis; }

View File

@@ -3,25 +3,25 @@ async function getRobotsTxt() {
headers: {
"Accept-Language": "en",
"User-Agent": "Mozilla/5.0",
}
},
})
.then(resp => {
.then((resp) => {
if (resp.status !== 200) {
throw new Error(`wanted status 200, got status: ${resp.status}`);
}
return resp;
})
.then(resp => resp.text());
.then((resp) => resp.text());
}
(async () => {
const page = await getRobotsTxt();
if (page.includes(`<html>`)) {
console.log(page)
console.log(page);
throw new Error("serve robots.txt smoke test failed");
}
console.log("serve-robots-txt serves robots.txt");
process.exit(0);
})();
})();

View File

@@ -1,9 +1,9 @@
<!DOCTYPE html>
<!doctype html>
<html>
<head>
<title>Anubis works!</title>
<link rel="stylesheet" href="/.within.website/x/xess/xess.css"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<link rel="stylesheet" href="/.within.website/x/xess/xess.css" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
</head>
<body id="top">
<main>
@@ -11,7 +11,10 @@
<p>If you see this, everything has gone according to keikaku.</p>
<img height=128 src="/.within.website/x/cmd/anubis/static/img/happy.webp"/>
<img
height="128"
src="/.within.website/x/cmd/anubis/static/img/happy.webp"
/>
</main>
</body>
</html>
</html>

View File

@@ -1,19 +1,20 @@
async function testWithUserAgent(userAgent) {
const statusCode =
await fetch("https://relayd.local.cetacean.club:3004/reqmeta", {
const statusCode = await fetch(
"https://relayd.local.cetacean.club:3004/reqmeta",
{
headers: {
"User-Agent": userAgent,
}
})
.then(resp => resp.status);
},
},
).then((resp) => resp.status);
return statusCode;
}
const codes = {
allow: await testWithUserAgent("ALLOW"),
challenge: await testWithUserAgent("CHALLENGE"),
deny: await testWithUserAgent("DENY")
}
deny: await testWithUserAgent("DENY"),
};
const expected = {
allow: 200,
@@ -26,5 +27,7 @@ console.log("CHALLENGE:", codes.challenge);
console.log("DENY: ", codes.deny);
if (JSON.stringify(codes) !== JSON.stringify(expected)) {
throw new Error(`wanted ${JSON.stringify(expected)}, got: ${JSON.stringify(codes)}`);
}
throw new Error(
`wanted ${JSON.stringify(expected)}, got: ${JSON.stringify(codes)}`,
);
}