height: 100vh
Serves me right for trying to use an existing template, instead of writing my own. Thought I'd save time and effort, because I don't particularly like writing HTML & CSS. I'm pretty sure I wasted more time debugging and fixing layout bugs and other shortcomings than if I wrote the entire thing from scratch.
After a "bit" of fighting with CSS and a third party theme, the updated iocaine website is now live.
There's plenty to improve, but... at this point, I'd just rather write the theme myself, rather than trying to monkey patch the third party theme I chose a while ago. But that's a task for another day, I had enough of HTML & CSS for one day.
Lets tag a release instead, then maybe write some more documentation! And if there's still time: start laying out an iocaine 3.0 roadmap.
fn main(request: Request) -> Verdict[Response, Unit] {
let ua = request.user_agent();
if ua.matches(NSOE_AI_ROBOTS_TXT_PATTERNS) {
accept Response.template("garbage")
}
if ua.matches(NSOE_MOZILLA) {
accept Response.template("challenge")
}
if request.path().ends_with(".png") {
accept Response.binary(QR.new().as_png(), "image/png")
}
if request.path().ends_with(".jpg") {
accept Response.binary(FakeJpeg.new(), "image/jpeg")
}
reject
}
A first approximation of what I'm planning for #iocaine 3.0.
In this example, NSOE_AI_ROBOTS_TXT_PATTERNS
is an AhoCorasick
instance wrapped in Matcher::AhoCorasick
, wrapped in Val
. No more HashMaps to do named lookups from, no more kind-of backwards haystack.is_match(needle)
, but a uniform String.matches(<Matcher>)
.
NSOE_MOZILLA
is a PrefixMatch
, a small helper that ends up doing .starts_with()
under the hood.
Initializing them would look like this:
fn init() -> Verdict[Unit, String] {
iocaine_matchers.add(
"NSOE_MOZILLA",
PrefixMatch.new("Mozilla/"
);
iocaine_matchers.add(
"NSOE_AI_ROBOTS_TXT_PATTERNS",
PatternMatch.new(
Json.load("robots.json").get_keys()
)
);
}
Not very different from iocaine 2.0, but there's only iocaine_matchers
, to collect all kind of matchers. No more iocaine_patterns
, iocaine_regexes
, iocaine_regexsets
, and iocaine_networks
and all that.
A space for Bonfire maintainers and contributors to communicate