aboutsummaryrefslogtreecommitdiff
path: root/cgi/user.cgi
blob: 94cf6acd8dd57b96812de0fd2140c00f1aae2150 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#!/usr/bin/env ruby

require 'cgi'

def llink(href, text)
  if $cgi.path_info == href
    $cgi.a(href) { "[ #{text} ⇓ ]" }
  else
    $cgi.a(href) { "[ #{text} ]" }
  end
end

def rlink(href, text)
  $cgi.a(href: href, target: "_blank") { "[ #{text} ⇗ ] " }
end

def toplinks
  $cgi.table(id: "toplinks") {
    $cgi.tr {
      $cgi.td { llink("/"                      , "Home"        ) } +
      $cgi.td { rlink("https://git.4574.co.uk/", "Git"         ) } +
      $cgi.td { llink("/stuff-i-want"          , "Stuff I Want") }
    }
  }
end

def rquote
  [
    "~ sweet ~",
    "User_4574 uses Linux, and loves life.",
    "User_4574 shall arrange the blocks and toil, for ever and a day.",
    "User_4574 likes the number 7.",
    "ex scientia veritas",
    "User_4574 will blow things up for money.",
    "User_4574 dreams it possible.",
    "(define (! ?) (? ?)) (! !)",
    "User_4574 lets her pain fade down.",
    "User_4574 maintains vigilance during disablement conditions.",
    "User_4574 is established on the localiser.",
    "Memetic Hazard.",
    "Every six months User_4574 checks the oil level of the drive housing, and if necessary tops up with IBM 15 to the level of the inspection hole.",
    "User_4574 remembers tomorrow.",
    "User_4574 <3s OpenBSD",
    "Expectation is directly proportional to performance.",
    "User_4574 is taking hits! Hull strength falling.",
    "User_4574 is not on fire.",
    "User_4574 syncs on green.",
    "User_4574 always reads the plaque.",
    "User_4574's work ethic is IEFBR14.",
    "User_4574 clears the link pack area.",
    "vivat diu et prosperet.",
    "The White Zone is for loading and unloading only.",
    "User_4574 copies run start.",
    "User_4574 shows standby brie.",
    "All hail the glow cloud.",
    "User_4574 tries at all times, without surrender, to be on good terms with all people.",
    "This is Delta Team. All production is down, repeat, all production is down.",
    "User_4574 glows in the dark turning dust to gold.",
    "NAT is evil.",
    "User_4574 chooses to have the ball in hand behind the headstring.",
    "User_4574 likes to think she could make Knuth cry if she wanted to.",
    "Due to a lack of interest, tomorrow has been cancelled. We apologize for any inconvenience caused.",
    "This is the panic office: Section 9-17 may have been hit. Activate the following procedure.",
    "Nothing, and everything, is possimpable."
  ].sample
end

def page(title, jumbotitle = title)
  load "#{title.downcase.gsub(?\s, ?-)}.cgi"

  $cgi.out {
    $cgi.html {
      $cgi.head {
        $cgi.title { "User_4574's Lair / #{title}" } +
        $cgi.link(rel: "stylesheet", href: "styles.css")
      } +
      $cgi.body {
        $cgi.h1("class" => "jumbo") { jumbotitle } +
        $cgi.div { toplinks } +
        $page +
        $cgi.div(id: "quote") { rquote }
      }
    }
  }
end

$cgi = CGI.new("html5")

case $cgi.path_info
when "/"
  page("Home", "User_4574's Lair")
when /^\/stuff-i-want/
  page("Stuff I Want")
when /^\/bv/
  $cgi.out("status" => "MOVED", "Location" => "https://bv.miller.cm/") {}
end