diff options
| author | Rosa <rosaontheweb@proton.me> | 2026-05-27 13:24:15 -0400 |
|---|---|---|
| committer | Rosa <rosaontheweb@proton.me> | 2026-05-27 13:24:15 -0400 |
| commit | 16e4f8f2a9ead0f79b5b275dc547b517cc8891e9 (patch) | |
| tree | 79ef9796388c4b8a0f1fec99ba5d4b75f8b475f7 | |
| parent | 72983cf263053cd40dafbd5f1cb63d3f0b9f1eb8 (diff) | |
add 404.html, remove legacy code
Diffstat (limited to '')
| -rw-r--r-- | build.zig.zon | 4 | ||||
| -rw-r--r-- | src/pages/errors/404.html | 8 | ||||
| -rw-r--r-- | src/pages/index.html | 6 | ||||
| -rw-r--r-- | src/pages/members/index.html | 7 | ||||
| -rw-r--r-- | src/pages/services/index.html | 28 | ||||
| -rw-r--r-- | src/templates/base.html | 43 | ||||
| -rw-r--r-- | src/templates/error.html | 15 | ||||
| -rw-r--r-- | src/templates/page.html | 19 | ||||
| -rw-r--r-- | util/generate_html.zig | 74 | ||||
| -rw-r--r-- | util/lighttpd.conf | 1 | ||||
| -rw-r--r-- | util/pages.zig | 27 |
11 files changed, 101 insertions, 131 deletions
diff --git a/build.zig.zon b/build.zig.zon index 56320c1..b92e6c9 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -3,8 +3,8 @@ .version = "0.16.0", .dependencies = .{ .webgen = .{ - .url = "git+https://git.eviltransgenders.club/~rosa/webgen.git?ref=main#e4857bef052bee6c31b2a7bf21893f175aed241c", - .hash = "webgen-0.1.0-XDIIqYUjAABUdAGaQ_tqcFCVRBefdGxd87n5fccnRg-v", + .url = "git+https://git.eviltransgenders.club/~rosa/webgen.git?ref=main#a71731ebe33cd2e26b52934253cb294a7aee1fe6", + .hash = "webgen-0.1.0-XDIIqTIlAAD42hVLDYUStcFKG1vMHAR4lJyHelYqbB7j", }, }, .paths = .{""}, diff --git a/src/pages/errors/404.html b/src/pages/errors/404.html new file mode 100644 index 0000000..1bae3fb --- /dev/null +++ b/src/pages/errors/404.html @@ -0,0 +1,8 @@ +<!--: extends error.html --> +<!--: replace title --> +not found +<!--: endreplace --> + +<!--: replace message --> +The requested file was not found. +<!--: endreplace --> diff --git a/src/pages/index.html b/src/pages/index.html index 4009dac..231cc02 100644 --- a/src/pages/index.html +++ b/src/pages/index.html @@ -1,4 +1,4 @@ -<!--: extends base.html --> +<!--: extends page.html --> <!--: replace title --> home <!--: endreplace --> @@ -15,8 +15,10 @@ home community primarily for queer people and allies, though anyone who is cool is welcome! :) </p> - <p> + If you'd like to chat about tech or video games or being queer, or if you're + perhaps interested in accessing our <a href="/services">services</a>, you + can <a href="/join">ask to join</a>. </p> </section> </main> diff --git a/src/pages/members/index.html b/src/pages/members/index.html index fdf76fe..d3ab8f6 100644 --- a/src/pages/members/index.html +++ b/src/pages/members/index.html @@ -1,4 +1,4 @@ -<!--: extends base.html --> +<!--: extends page.html --> <!--: replace title --> members <!--: endreplace --> @@ -14,6 +14,7 @@ members section.member-info header h2, section.member-info p { margin: 0.5rem 5px; + text-align: left; } section.member-info div#image-container { @@ -38,7 +39,7 @@ members <img src="rosa.jpeg" alt="Rosa's profile picture" /> </div> <div id="name-and-intro"> - <header> + <header id="rosa"> <h2>Rosa</h2> </header> <p> @@ -68,7 +69,7 @@ members <img src="your-image.jpeg" onerror="this.src = '/fallback.jpeg';" alt="{name}'s profile picture" /> </div> <div id="name-and-intro"> - <header> + <header id="your-name"> <h2>Name</h2> </header> <p> diff --git a/src/pages/services/index.html b/src/pages/services/index.html new file mode 100644 index 0000000..3714be1 --- /dev/null +++ b/src/pages/services/index.html @@ -0,0 +1,28 @@ +<!--: extends page.html --> +<!--: skipreplace extraHead --> +<!--: replace title --> +services +<!--: endreplace --> +<!--: replace body --> +<main> + <header> + <h2>services</h2> + <p> + the evil transgenders club hosts some services for use by its members. the + following is a list of those services: + </p> + </header> + <ul> + <li> + <a href="https://git.eviltransgenders.club" rel="external">cgit</a> - web + frontend for our git repositories + </li> + <li> + members are allowed to host websites under the eviltransgenders.club + domain, whether on our infrastructure or their own. alternatively you can + be given a directory to host static files on this very website + </li> + <li>soon: matrix</li> + </ul> +</main> +<!--: endreplace --> diff --git a/src/templates/base.html b/src/templates/base.html index 11f6f57..c72c6cf 100644 --- a/src/templates/base.html +++ b/src/templates/base.html @@ -3,14 +3,12 @@ <head> <meta charset="utf-8" /> <meta name="viewport" content="initial-scale=1,width=device-width" /> - <!-- - <link rel="preload" href="/FiraCodeNerdFontMono-Regular.ttf" as="font" type="font/ttf" /> - --> <title>{{title}} - the evil transgenders club</title> <style> :root { --trans-blue: #5bcefa; --trans-pink: #f5a9b8; + --red: #ff5555; } @font-face { @@ -23,24 +21,26 @@ background: black; color: white; font-family: 'FiraCode Nerd Font Mono', monospace; - font-size: 10pt; + font-size: 11pt; margin-left: 15%; margin-right: 15%; } header h1 { color: var(--trans-blue); - text-align: center; } + header h1, header p.subtitle { + text-align: center; + } a { - color: #fff; + color: white; } a:hover { - background-color: #fff; - color: #000; + background-color: white; + color: black; } a[rel="external"]:after { @@ -48,7 +48,6 @@ } main { - /*border: 2px solid #fff;*/ margin-top: 5px; } @@ -83,25 +82,29 @@ footer a:hover { background-color: #333; - color: #000; + color: black; } .trans-shadow { text-shadow: 1px 1px var(--trans-pink), 2px 2px white, 3px 3px var(--trans-pink), 4px 4px var(--trans-blue); } - .subtitle { - text-align: center; - } - .heart { - color: #ff5555; + color: var(--red); font-style: normal; } .odd { background-color: #111; } + + .error { + color: var(--red); + } + + .subtle { + color: #333; + } </style> {{extraHead}} </head> @@ -109,17 +112,11 @@ <body> <header> <h1 class="trans-shadow">the evil transgenders club</h1> - <nav id="main-navigation"> - <ul> - <li><a href="/">home</a></li> - <li><a href="/members">members</a></li> - <li><a href="/services">services</a></li> - </ul> - </nav> + {{afterTitle}} </header> {{body}} <footer> - <p>made with <em class="heart">♥</em> // <a rel="external" href="https://git.eviltransgenders.club/www.eviltransgenders.club">view the source</a>.</p> + {{footer}} </footer> </body> </html> diff --git a/src/templates/error.html b/src/templates/error.html new file mode 100644 index 0000000..7398774 --- /dev/null +++ b/src/templates/error.html @@ -0,0 +1,15 @@ +<!--: extends base.html --> +<!--: skipreplace extraHead --> +<!--: replace afterTitle --> +<p class="subtle subtitle">well, this is awkward...</p> +<!--: endreplace --> + +<!--: replace body --> +<main> + <p class="error">{{message}}</p> +</main> +<!--: endreplace --> + +<!--: replace footer --> +<p></3 // <a href="/">go home</a></p> +<!--: endreplace --> diff --git a/src/templates/page.html b/src/templates/page.html new file mode 100644 index 0000000..7854a72 --- /dev/null +++ b/src/templates/page.html @@ -0,0 +1,19 @@ +<!--: extends base.html --> + +<!--: replace afterTitle --> +<nav id="main-navigation"> + <ul> + <li><a href="/">home</a></li> + <li><a href="/members">members</a></li> + <li><a href="/services">services</a></li> + <li><a href="/join">join!</a></li> + </ul> +</nav> +<!--: endreplace --> + +<!--: replace footer --> +<p> + made with <em class="heart"><3</em> by <a href="/members#rosa">rosa</a> + // <a rel="external" href="https://git.eviltransgenders.club/www.eviltransgenders.club">view the source</a> +</p> +<!--: endreplace --> diff --git a/util/generate_html.zig b/util/generate_html.zig deleted file mode 100644 index 0933d18..0000000 --- a/util/generate_html.zig +++ /dev/null @@ -1,74 +0,0 @@ -const std = @import("std"); -const pages = @import("pages.zig").pages; - -pub fn main(init: std.process.Init) !void { - const sources_dir = try std.Io.Dir.cwd().createDirPathOpen(init.io, "src", .{}); - defer sources_dir.close(init.io); - const out_dir = try std.Io.Dir.cwd().createDirPathOpen(init.io, "html-out", .{}); - defer out_dir.close(init.io); - - const templates_dir = try sources_dir.createDirPathOpen(init.io, "templates", .{ .open_options = .{ .iterate = true } }); - defer templates_dir.close(init.io); - const pages_dir = try sources_dir.createDirPathOpen(init.io, "pages", .{ .open_options = .{ .iterate = true } }); - defer pages_dir.close(init.io); - try generateHtmlPages(init.io, init.arena.allocator(), templates_dir, pages_dir, out_dir); - - const static_dir = try sources_dir.createDirPathOpen(init.io, "static", .{ .open_options = .{ .iterate = true } }); - defer static_dir.close(init.io); - try copyStaticFiles(init.io, init.arena.allocator(), static_dir, out_dir); -} - -fn generateHtmlPages(io: std.Io, ally: std.mem.Allocator, templates_dir: std.Io.Dir, pages_dir: std.Io.Dir, out_dir: std.Io.Dir) !void { - for (pages) |page_def| { - const template = try templates_dir.openFile(io, page_def.template_path, .{}); - defer template.close(io); - const template_buf = try ally.alloc(u8, (try template.stat(io)).size); - _ = try template.readPositionalAll(io, template_buf, 0); - - const page = try pages_dir.openFile(io, page_def.source_path, .{}); - defer page.close(io); - const page_buf = try ally.alloc(u8, (try page.stat(io)).size); - _ = try page.readPositionalAll(io, page_buf, 0); - - var out_buf: []u8 = template_buf; - for (page_def.replacements) |replacement| { - switch (replacement.replacement) { - .file_content => { - out_buf = try std.mem.replaceOwned(u8, ally, out_buf, replacement.placeholder, page_buf); - }, - .literal => |value| { - out_buf = try std.mem.replaceOwned(u8, ally, out_buf, replacement.placeholder, value); - }, - } - } - - const maybeDirname = std.mem.cutLast(u8, page_def.source_path, "/"); - if (maybeDirname) |dirname| { - try out_dir.createDirPath(io, dirname[0]); - } - const out = try out_dir.createFile(io, page_def.source_path, .{}); - defer out.close(io); - std.debug.print("Writing page {s}...\n", .{page_def.source_path}); - try out.writeStreamingAll(io, out_buf); - } -} - -fn copyStaticFiles(io: std.Io, ally: std.mem.Allocator, sources_dir: std.Io.Dir, out_dir: std.Io.Dir) !void { - var walker = try sources_dir.walk(ally); - defer walker.deinit(); - while (try walker.next(io)) |entry| { - switch (entry.kind) { - .file, .sym_link => { - std.debug.print("Copying static file {s}...\n", .{entry.path}); - try entry.dir.copyFile(entry.basename, out_dir, entry.basename, io, .{}); - }, - .directory => { - const new_out = try out_dir.createDirPathOpen(io, entry.basename, .{ .open_options = .{ .iterate = true } }); - defer new_out.close(io); - try copyStaticFiles(io, ally, sources_dir, out_dir); - }, - - else => {}, - } - } -} diff --git a/util/lighttpd.conf b/util/lighttpd.conf index b4f012f..ba34f3f 100644 --- a/util/lighttpd.conf +++ b/util/lighttpd.conf @@ -2,3 +2,4 @@ index-file.names = ( "index.html" ) server.bind = "127.0.0.1" server.document-root = var.CWD + "/html-out" server.port = 8888 +server.errorfile-prefix = server.document-root + "/errors/" diff --git a/util/pages.zig b/util/pages.zig deleted file mode 100644 index 1881aff..0000000 --- a/util/pages.zig +++ /dev/null @@ -1,27 +0,0 @@ -const std = @import("std"); - -pub const pages = [_]Page{Page{ - .source_path = "index.html", - .template_path = "base.html", - .replacements = &[_]Replacement{ Replacement{ - .placeholder = "{{title}}", - .replacement = .{ .literal = "home" }, - }, Replacement{ - .placeholder = "{{body}}", - .replacement = .{ .file_content = {} }, - } }, -}}; - -const Page = struct { - source_path: []const u8, - template_path: []const u8, - replacements: []const Replacement, -}; - -const Replacement = struct { - placeholder: []const u8, - replacement: union(enum) { - file_content, - literal: []const u8, - }, -}; |
