Compare commits

..

6 Commits

Author SHA1 Message Date
0bbac24981 Merge pull request 'satisfy typescript for github actions' (#4) from master into pages
Some checks failed
Build Saki and Deploy to Github Pages / build (push) Has been cancelled
Build Saki and Deploy to Github Pages / deploy (push) Has been cancelled
Reviewed-on: #4
2026-04-12 08:02:59 +01:00
stjet
4cde2c88aa satisfy typescript for github actions 2026-04-12 07:02:36 +00:00
221ad67911 Merge pull request 'but it worked locally -q-' (#3) from master into pages
Some checks failed
Build Saki and Deploy to Github Pages / build (push) Has been cancelled
Build Saki and Deploy to Github Pages / deploy (push) Has been cancelled
Reviewed-on: #3
2026-04-12 07:50:22 +01:00
stjet
641c57377e but it worked locally -q- 2026-04-12 06:49:56 +00:00
91a517448e Merge pull request 'for ts 6.0 or whatever' (#2) from master into pages
Some checks failed
Build Saki and Deploy to Github Pages / build (push) Has been cancelled
Build Saki and Deploy to Github Pages / deploy (push) Has been cancelled
Reviewed-on: #2
2026-04-12 07:47:14 +01:00
stjet
dc915d99ce for ts 6.0 or whatever 2026-04-12 06:46:09 +00:00
3 changed files with 17 additions and 12 deletions

View File

@@ -6,13 +6,14 @@ const port: number = 8042;
createServer((req, res) => { createServer((req, res) => {
let req_path: string; let req_path: string;
if (!req.url.includes(".")) { let req_url = req.url ?? ""; //fucking typescript shit. there will be a url trust me
req_path = path.join(__dirname, "build", req.url, "index.html"); if (!req_url.includes(".")) {
req_path = path.join(__dirname, "build", req_url, "index.html");
} else { } else {
req_path = path.join(__dirname, "build", req.url); req_path = path.join(__dirname, "build", req_url);
} }
let status_code = 200; let status_code = 200;
//req.url.includes("..") //req_url.includes("..")
if (!req_path.startsWith(path.join(__dirname, "build"))) { if (!req_path.startsWith(path.join(__dirname, "build"))) {
//nice try, bad request //nice try, bad request
res.writeHead(400); res.writeHead(400);

View File

@@ -39,7 +39,8 @@ export class Renderer {
return `${path1.slice(0, path1.length-1)}${path2}`; return `${path1.slice(0, path1.length-1)}${path2}`;
} else if ((!path1.endsWith("/") && path2.startsWith("/")) || (path1.endsWith("/") && !path2.startsWith("/"))) { } else if ((!path1.endsWith("/") && path2.startsWith("/")) || (path1.endsWith("/") && !path2.startsWith("/"))) {
return `${path1}${path2}`; return `${path1}${path2}`;
} else if (!path1.endsWith("/") && !path2.startsWith("/")) { } else {
//} else if (!path1.endsWith("/") && !path2.startsWith("/")) {
return `${path1}/${path2}`; return `${path1}/${path2}`;
} }
} }
@@ -133,7 +134,7 @@ export class Renderer {
if (var_value.length === 0) { if (var_value.length === 0) {
//skip straight to the endfor //skip straight to the endfor
let sliced = matches.slice(index+1, matches.length); let sliced = matches.slice(index+1, matches.length);
let new_index: number; let new_index: number | undefined;
let extra_fors: number = 0; let extra_fors: number = 0;
for (let i=0; i < sliced.length; i++) { for (let i=0; i < sliced.length; i++) {
if (sliced[i][0].startsWith("[[ for:")) { if (sliced[i][0].startsWith("[[ for:")) {
@@ -198,7 +199,7 @@ export class Renderer {
} }
let var_value2 = Renderer.get_var(var_name2, vars); let var_value2 = Renderer.get_var(var_name2, vars);
if (if_in) { if (if_in) {
var_value2 = var_value2.find((ele) => ele === var_value); var_value2 = var_value2.find((ele: any) => ele === var_value);
} }
if (if_not) { if (if_not) {
//make sure the two compared variables are NOT equal //make sure the two compared variables are NOT equal
@@ -232,6 +233,7 @@ export class Renderer {
extra_ifs--; extra_ifs--;
} }
} }
// @ts-ignore
if (typeof new_index === "undefined") throw Error("`if:` statement missing an `[[ endif ]]`"); if (typeof new_index === "undefined") throw Error("`if:` statement missing an `[[ endif ]]`");
index += new_index+1; index += new_index+1;
continue; continue;
@@ -257,8 +259,8 @@ export class Renderer {
if (current_last[i] !== " ") break; if (current_last[i] !== " ") break;
indentation++; indentation++;
} }
let var_lines: string[] = var_value.split("\n"); let var_lines: string[] = var_value.split("\n") as string[]; //dunno why typescript thinks it could be undefined
let var_first: string = var_lines.shift(); let var_first: string = var_lines.shift() as string; //we know var_lines has at least one element
//append spaces //append spaces
var_value = var_lines.length === 0 ? var_first : var_first+"\n"+var_lines.map((var_line) => " ".repeat(indentation)+var_line).join("\n"); var_value = var_lines.length === 0 ? var_first : var_first+"\n"+var_lines.map((var_line) => " ".repeat(indentation)+var_line).join("\n");
if (exp_parts[0] === "html") { if (exp_parts[0] === "html") {

View File

@@ -1,8 +1,10 @@
{ {
"compilerOptions": { "compilerOptions": {
"target": "esnext", "target": "esnext",
"module": "commonjs", "strict": true,
"moduleResolution": "node", "module": "nodenext",
"moduleResolution": "nodenext",
"types": ["node"],
"typeRoots": [ "typeRoots": [
"./node_modules/@types", "./node_modules/@types",
], ],
@@ -15,4 +17,4 @@
"node_modules", "node_modules",
".build" ".build"
] ]
} }