Initial Commit

This commit is contained in:
2025-09-28 22:45:26 +02:00
commit ceef69ca09
13 changed files with 456 additions and 0 deletions

131
example/index.typ Normal file
View File

@@ -0,0 +1,131 @@
#import "@preview/cades:0.3.0": qr-code
#import "@preview/digestify:0.1.0": *
#import "@preview/suiji:0.4.0": *
#import "@preview/cetz:0.3.4"
#import "lib.typ"
#show: lib.ieee.with(
title: [Typst Framework: A web server running typst],
abstract: [
Typst framework is a go web server that uses typst as its scripting language. It's like PHP but for the modern web!
],
authors: (
(
name: "Michael",
department: [Inventor of this Bullshit],
organization: [mikee.dev],
email: "typst@mikee.dev"
),
),
index-terms: ("Web-Technology", "Shitpost"),
figure-supplement: [Fig.],
)
#show: lib.styling
= Introduction
Hey there! What a nice #datetime.today().display("[weekday]")! It's currently #lib.currentDateTime.display("[hour]:[minute]") and I'm feeling great! #if lib.currentDateTime.hour() <= 6 {
"(I should probably still be sleeping, but I'm feeling great regardless!)"
} else if lib.currentDateTime.hour() <= 8 {
"I just got up, not sure what to eat for breakfeast yet..."
} else if lib.currentDateTime.hour() <= 11 {
"I'm just getting started with my day, what about you?"
} else if lib.currentDateTime.hour() <= 12 {
"Just had lunch, yum."
} else if lib.currentDateTime.hour() <= 16 {
"I'm kind of in the middle of something here."
} else if lib.currentDateTime.hour() <= 20 {
"Watching YouTube rn, wbu?"
} else {
"But tired, I'm going to sleep soon."
} Anyways, allow me to introduce myself: My name is Typst and I am v#sys.version old.
= Introduction
Please allow me to intruduce *yourself* now!
Your user agent is
#box(
raw(
lib.ua,
block: true
),
fill: rgb("#ddd"),
inset: 1em
)
Hm... that must mean you are using *#lib.browser* on *#lib.platform*! Wow, how exciting, I love #lib.browser!!
If you were to look at your URL bar, it probably says something boring like "#lib.request.path", you could change that by #link("./page2.typ")[clicking here], you know...
= Fun games
Here is a QR code with your IP address!
#align(center)[
#qr-code(lib.request.ip, width: 3cm)
]
#if lib.request.headers.at("cf-connecting-ip", default: "").len() > 0 {
text("But this website is behind two HTTP proxies, so here is a SHA256 hash of your real IP: ")
bytes-to-hex(sha256(bytes(lib.request.headers.at("cf-connecting-ip", default: false))))
}
Here are some cute drawings I made!
#let seed1 = int(lib.currentDateTime.display().replace(" ", "").replace("-", "").replace(":", ""))
#let seed2 = array(sha256(bytes(lib.ua + lib.request.headers.at("accept-language", default: "")))).fold(0, (acc, b) => acc * 2 + b)
This one changes every second:
#align(center)[
#cetz.canvas(length: 12pt, {
import cetz.draw: *
let n = 20
let (x, y) = (0, 0)
let (x-new, y-new) = (0, 0)
let rng = gen-rng-f(seed1)
let v = ()
for i in range(n) {
(rng, v) = uniform-f(rng, low: -2.0, high: 2.0, size: 2)
(x-new, y-new) = (x - v.at(1), y - v.at(0))
let col = color.mix((blue.transparentize(20%), 1-i/n), (green.transparentize(20%), i/n))
line(stroke: (paint: col, cap: "round", thickness: 2pt),
(x, y), (x-new, y-new)
)
(x, y) = (x-new, y-new)
}
})
]
And this one is based on your unique browser fingerprint!
#align(center)[
#cetz.canvas(length: 12pt, {
import cetz.draw: *
let n = 20
let (x, y) = (0, 0)
let (x-new, y-new) = (0, 0)
let rng = gen-rng-f(seed2)
let v = ()
for i in range(n) {
(rng, v) = uniform-f(rng, low: -2.0, high: 2.0, size: 2)
(x-new, y-new) = (x - v.at(1), y - v.at(0))
let col = color.mix((red.transparentize(20%), 1-i/n), (yellow.transparentize(20%), i/n))
line(stroke: (paint: col, cap: "round", thickness: 2pt),
(x, y), (x-new, y-new)
)
(x, y) = (x-new, y-new)
}
})
]
= A word from our sponsor
#lorem(900)