fetched: what the heck, ship it

This commit is contained in:
mehbark 2023-09-23 14:22:01 -04:00
parent 85e2f718da
commit 0d90f710fe

View file

@ -14,12 +14,18 @@ const ctx = canvas.getContext("2d");
const default_fill = "#3B0920";
const bg_fill = "#FFE8D4";
const border_stroke = "#83254F";
ctx.fillStyle = "#FFE8D4";
ctx.strokeStyle = "#83254F";
ctx.strokeStyle = border_stroke;
ctx.lineWidth = 10;
ctx.fillRect(0, 0, 413, 413);
ctx.strokeRect(0, 0, 413, 413);
const fix_border = () => {
ctx.strokeStyle = border_stroke;
ctx.strokeRect(0, 0, 413, 413);
};
const clear_rect = (x: number, y: number, w: number, h: number) => {
ctx.strokeStyle = "";
ctx.fillStyle = bg_fill;
@ -70,7 +76,7 @@ const secret_messages = [
"i prefer having things getting really really squishy to inserting newlines or-- perish the thought-- *actually being smart* I LIED AND DID IT RIGHT",
"i should make most of these short though",
"eggbug BONUS SECRET MESSAGE: eggbug TWO (pronounced like peggle TWO)",
"this is literal cope but i love how messed up the text gets",
"this is literal cope but i love how messed up the text gets (old message, things are a bit better now)",
"i think i'll make one hundred",
"who is your favorite homestuck troll? (i have a favorite)",
"how do you feel about hiveswap?",
@ -116,7 +122,7 @@ const secret_messages = [
"drink water or something",
"FLKDHK: if you're reading this, go to pyrope.net/fetched.png and refresh until you see a message that starts with FLKDHK",
"have you seen this post? cohost.org/mehbark /post/2902858-this-post",
"you should go find the code together https://cohost.org/mehbark/post/2576955-find-the-code-togeth",
"you should go find the code together cohost.org/mehbark /post/2576955-find-the-code-togeth",
"you should play pyrope.net/ew it's genuinely fun",
"odds are you are just a computer program... actually the odds are 100% really because browser etc etc",
"is the number goku yet? will the number ever be goku? dm me on discord @mehbark if it is",
@ -201,7 +207,7 @@ function printAtWordWrap(
}
}
if (idx > 0) {
context.fillText(words.join(" "), x, y + (lineHeight * currentLine));
context.fillText(words.join(" ") + " ", x, y + (lineHeight * currentLine));
}
}
@ -220,12 +226,6 @@ function draw_secret_message(message?: string) {
// ctx.fillText(, 10, 340, 395);
}
draw_times(999);
draw_times(1000);
draw_secret_message(secret_messages[secret_messages.length - 1]);
await Deno.writeFile("/tmp/canvas.png", canvas.toBuffer());
const kv = await Deno.openKv();
Deno.args.includes("--reset-count") && await kv.set(["fetched"], 0);
@ -240,10 +240,12 @@ async function num_requests(): Promise<number> {
async function count_request() {
await kv.set(["fetched"], await num_requests() + 1);
}
Deno.serve({ port: 61261 }, async () => {
await count_request();
draw_times(await num_requests());
draw_secret_message();
fix_border();
const image_format = "png";
return new Response(canvas.toBuffer(), {