interplane.Get Omega
Read in your language

omega-mv

Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.

Brought by drakestapleton

branch main Branches Tags History

omega-mv / apps / interplane-forge / server / pages.om

955 lines · 32526 bytes Raw Blame History
1note forged server/pages.om: layout (header, footer), error pages, /explore, /<owner>, /search,
2note the repo header used by every repo tab, and the stylesheet. Writes fob through util.om helpers.
3global fq uchar 256
4global fql ulong 1
5text tfpsrch "/search"
6text tfulrep "<ul class=\"repos\">\n"
7text tfempty ""
8text tfccpub "public, max-age=300"
9text tfctcss "text/css; charset=utf-8"
10text tfh1 "<!doctype html>\n<html lang=\"en\"><head><meta charset=\"utf-8\"><meta name=\"viewport\" content=\"width=device-width,initial-scale=1\"><meta name=\"color-scheme\" content=\"dark\"><title>"
11text tfh2 " &#183; INTERPLANE Forge</title><link rel=\"stylesheet\" href=\""
12text tfcssp "assets/forge.css"
13text tfh3 "\"><link rel=\"icon\" type=\"image/svg+xml\" href=\""
14text tficop "assets/favicon.svg"
15text tfh3i "\">"
16text tfh3b "</head>\n<body><a class=\"skip\" href=\"#main\">Skip to content</a>"
17text tfhal1 "<link rel=\"alternate\" type=\"application/json\" href=\""
18text tfhal2 "explore.json"
19text tfhal3 ".json"
20text tfhal4 "events.json"
21note ---- the site chrome: the interplane.io header and footer and their stylesheet lines are not kept
22note here. server/chromegen.om makes them at every build from the site's own source (canonical main of
23note rad:z399yKvnXcBQNkKoq86iBDgTvQ5QV, content/_layout.html and public/style.css) into the generated
24note unit .build/chrome.om (run.sh units): texts tchrhead, tchrfoot, tchrcss and the site commit
25note tchrsite. Every site link is absolute, so the same bytes serve the bases / and /forge/; Forge is
26note the current section. server/tests/sitechrome.sh checks the result against the site source.
27note the forge's own controls, a second row under the site header
28text tfh4 "<div class=\"forge-row\"><div class=\"shell forge-bar\"><nav class=\"forge-nav\" aria-label=\"Forge\"><a href=\""
29text tfexp "explore"
30text tfh4b "\">Explore</a><a href=\""
31text tfh5 "\">Stars</a>"
32text tfh5b "</nav><form class=\"search\" method=\"get\" action=\""
33text tfsrch "search"
34text tfh6 "\" role=\"search\"><input type=\"search\" name=\"q\" maxlength=\"200\" placeholder=\"Search the forge\" aria-label=\"Search the forge\" value=\""
35text tfh7 "\"><button type=\"submit\">Search</button></form><a class=\"lang-link\" href=\"https://interplane.io/translate/\">Read in your language</a><div class=\"who\">"
36text tfsignin "\">Sign in</a>"
37text tfahref "<a href=\""
38text tfqgt "\">"
39text tfaend "</a>"
40text tfso1 "<form class=\"inline\" method=\"post\" action=\""
41text tflogout "logout"
42text tflogin "login"
43text tfso2 "\"><input type=\"hidden\" name=\"csrf\" value=\""
44text tfso3 "\"><button type=\"submit\">Sign out</button></form>"
45text tfh8 "</div></div></div>\n<main id=\"main\" tabindex=\"-1\">\n"
46text tff1 "\n</main>\n<footer class=\"site-foot\"><div class=\"shell\">\n"
47text tff2 "\">Explore</a> &#183; <a href=\""
48text tff3 "\">Search</a> &#183; <a href=\""
49text tfstars "stars"
50text tff4 "\">Stars</a> &#183; <a href=\"https://interplane.io/translate/\">Read in your language</a> &#183; <a href=\""
51text tff4q "?format=text"
52text tff4a "&amp;format=text"
53text tff4b "\" rel=\"alternate\" type=\"text/plain\">This page as plain text</a></p>\n<p class=\"foot-fine\">Translation is done by your own browser or tool, on your machine. This forge translates nothing and keeps no translated copies; the English page is the reference, and commands, fingerprints and file names are marked to stay exactly as written.</p>\n</div></footer>\n</body></html>\n"
54text tfq "q"
55note ---- error pages
56text tfe1 "<section class=\"err\"><h1>"
57text tfe2 "</h1><p>"
58text tfe3 "</p><p><a href=\""
59text tfe4 "\">Back to the forge</a></p></section>"
60text tfm400 "Bad request. The forge refused this request."
61text tfm403 "Forbidden. The form token did not match; reload the page and try again."
62text tfm404 "Not found. This page does not exist, or the repository is not public on this forge."
63text tfm405 "Method not allowed."
64text tfm413 "The request body is too large."
65text tfm429 "Too many write requests from this address. Wait a minute and try again."
66text tfm500 "The forge hit an internal error serving this page."
67text tfm501 "Coming soon. This part of the forge is being built and is not served yet; the feature list says what works today."
68text tfmoth "The forge could not serve this request."
69text tfmicut "The stored data behind this page is larger than the forge reads in one piece, so an answer built from it would have been incomplete. The forge sent this notice and no part of it. The data is whole in the repository: read it with git."
70text tfmovf "This page is too large for the forge to send in one piece (the limit is 8 MiB), so the forge sent this notice and no part of the page. The data is whole in the repository: read it with git."
71text tfctj "application/json"
72note fovf: 0, or why this response is the too-large notice (1 page, 2 JSON document); flay: the
73note lengths of the fragment, the head and the foot of a page (flayout)
74global fovf ulong 1
75global flay ulong 3
76text tft400 "Bad request"
77text tft403 "Forbidden"
78text tft404 "Not found"
79text tft405 "Method not allowed"
80text tft413 "Too large"
81text tft429 "Slow down"
82text tft500 "Server error"
83text tft501 "Coming soon"
84text tftmvg "Moving"
85text tfmmvg "This part is moving to the new Interplane store and is not available yet."
86fn ferrmsg st ulong to void
87if ne get fovf 0 0
88if ne get ficut 0 0
89fput tfmicut
90ret
91end
92fput tfmovf
93ret
94end
95if and eq st 503 ne get fmvng 0 0
96fput tfmmvg
97ret
98end
99if eq st 400
100fput tfm400
101ret
102end
103if eq st 403
104fput tfm403
105ret
106end
107if eq st 404
108fput tfm404
109ret
110end
111if eq st 405
112fput tfm405
113ret
114end
115if eq st 413
116fput tfm413
117ret
118end
119if eq st 429
120fput tfm429
121ret
122end
123if eq st 500
124fput tfm500
125ret
126end
127if eq st 501
128fput tfm501
129ret
130end
131fput tfmoth
132end
133fn ferrti st ulong to void
134if and eq st 503 ne get fmvng 0 0
135fsetti tftmvg
136ret
137end
138if eq st 400
139fsetti tft400
140ret
141end
142if eq st 403
143fsetti tft403
144ret
145end
146if eq st 404
147fsetti tft404
148ret
149end
150if eq st 405
151fsetti tft405
152ret
153end
154if eq st 413
155fsetti tft413
156ret
157end
158if eq st 429
159fsetti tft429
160ret
161end
162if eq st 501
163fsetti tft501
164ret
165end
166fsetti tft500
167end
168note fctjson: the content type a handler set starts with application/json
169fn fctjson to bool
170if lt get fctl 0 len tfctj
171ret false
172end
173for i ulong len tfctj
174if ne get fct i get tfctj i
175ret false
176end
177end
178ret true
179end
180note fovfl: the body, its layout or a Location did not fit its buffer (fobtr). Nothing of it is
181note sent. The partial body and what the handler set for it (content type, disposition, Location,
182note ETag, cache rule, Retry-After, sandbox policy) are dropped and the response becomes a whole 500:
183note forge/error/1 when the client asked for JSON or the page was a JSON document (a .json or
184note .receipt name needs no Accept header), the error page otherwise. A Set-Cookie stays: what it
185note records has already happened. 500 because the request is good and the page exists; the
186note server cannot hold this page in its 8 MiB body. Not 413 or 414 (the request is not too large),
187note not 503 (asking again gives the same), not 507 (WebDAV storage).
188fn fovfl to void
189w = ulong 1
190if eq get fkind 0 1
191if fctjson
192w = ulong 2
193end
194end
195put fovf 0 w
196put fobl 0 0
197put fobtr 0 0
198put fctl 0 0
199put fcdl 0 0
200put flocl 0 0
201put fetagl 0 0
202put fccl 0 0
203put fretry 0 0
204put fcspsb 0 0
205ferrpage 500
206if eq get fkind 0 0
207flayout
208end
209end
210note flayout: kind 0. The fragment is fob[0,L); fhead and ffoot are appended after it, before any
211note header is sent, so that an overflow in them is seen too. flay keeps L and the two lengths.
212fn flayout to void
213l = get fobl 0
214fhead
215h = sub get fobl 0 l
216ffoot
217put flay 0 l
218put flay 1 h
219put flay 2 sub sub get fobl 0 l h
220end
221note fovfany: something was dropped while this response was built
222fn fovfany to bool
223ret ne get fobtr 0 0
224end
225note ferrpage: the error page; a JSON request gets the forge/error/1 document (server/jsonp.om)
226fn ferrpage st ulong to void
227put fkind 0 0
228put fobl 0 0
229put fjalt 0 0
230if or fjwant eq get fovf 0 2
231fyerr st
232ret
233end
234ferrti st
235fput tfe1
236fnum st
237fputc 32
238for i ulong get ftil 0 bound 256
239fescc get fti i
240end
241fput tfe2
242ferrmsg st
243fput tfe3
244fputb
245fput tfe4
246end
247note ---- layout: appended AFTER the fragment; main.om sends head, fragment, foot in that order
248fn fwho to void
249if eq get fuserl 0 0
250fput tfahref
251fputb
252fput tflogin
253fput tfsignin
254ret
255end
256fput tfahref
257fputb
258for i ulong get fuserl 0 bound 64
259fescc get fuser i
260end
261fput tfqgt
262for i ulong get fuserl 0 bound 64
263fescc get fuser i
264end
265fput tfaend
266fputc 32
267fput tfso1
268fputb
269fput tflogout
270fput tfso2
271for i ulong get fcsrfl 0 bound 64
272fescc get fcsrf i
273end
274fput tfso3
275end
276fn fhead to void
277fput tfh1
278for i ulong get ftil 0 bound 256
279fescc get fti i
280end
281fput tfh2
282fputb
283fput tfcssp
284fput tfh3
285fputb
286fput tficop
287fput tfh3i
288fhalt
289fput tfh3b
290fput tchrhead
291fput tfh4
292fputb
293fput tfexp
294fput tfh4b
295fputb
296fput tfstars
297fput tfh5
298note each slice may add one entry to the forge row (its seam adds nothing)
299ohnav
300slnav
301rxnav
302evnav
303fput tfh5b
304fputb
305fput tfsrch
306fput tfh6
307fhdq
308fput tfh7
309fwho
310fput tfh8
311end
312note fhalt: the page's JSON form (docs/API.md): 1 explore, 2 the repo home, 3 the page's own URL,
313note 4 the event stream (door/ev5feed.om, the feed page)
314fn fhalt to void
315k = get fjalt 0
316if eq k 0
317ret
318end
319fput tfhal1
320if eq k 4
321fputb
322fput tfhal4
323fput tfqgt
324ret
325end
326if eq k 3
327fhself
328fput tfqgt
329ret
330end
331if eq k 1
332fputb
333fput tfhal2
334else
335fputrl
336fput tfhal3
337end
338fput tfqgt
339end
340note fhself: base, the path without its first /, and the query, escaped for the attribute
341fn fhself to void
342fputb
343n = get fpathl 0
344for k ulong sub n 1 bound 4096
345fescc get fpath add k 1
346end
347if gt get fqsl 0 0
348fputc 63
349for k ulong get fqsl 0 bound 4096
350fescc get fqs k
351end
352end
353end
354note fhdq: echo the search query into the header box on /search
355fn fhdq to void
356if not fpeq tfpsrch
357ret
358end
359for i ulong get fql 0 bound 256
360fescc get fq i
361end
362end
363fn ffoot to void
364fput tff1
365fput tchrfoot
366fput tfsf4
367fputb
368fput tfexp
369fput tff2
370fputb
371fput tfsrch
372fput tff3
373fputb
374fput tfstars
375fput tff4
376note the plain-text form of this page: its own address and query plus format=text (server/tr.om)
377fhself
378if gt get fqsl 0 0
379fput tff4a
380else
381fput tff4q
382end
383fput tff4b
384end
385note ---- the stylesheet (served at <base>assets/forge.css)
386note tchrcss (generated, see the site chrome note above): the site's :root token line, then between
387note the two marks the site's header and footer rule lines. tfcssv: the forge's own names for tokens.
388text tfcssv ":root{--bg:var(--paper);--fg:var(--ink);--mut:var(--muted);--acc:var(--orange-ink);--box:var(--white)}\n"
389note tfcss2: the forge's own rules on the site chrome: Forge marked current, the forge row, main
390text tfcss2 ".site-head nav a[aria-current]{color:var(--ink);text-decoration-color:currentColor}\n:where(.site-foot) p{margin:0;color:var(--muted)}\n.forge-row{border-bottom:1px solid var(--line)}\n.forge-bar{display:flex;flex-wrap:wrap;align-items:center;gap:8px 24px;min-height:60px;padding-top:8px;padding-bottom:8px}\n.forge-nav{display:flex;gap:24px}.forge-nav a{display:inline-flex;align-items:center;min-height:44px;font-size:15px;font-weight:600;text-decoration:underline 2px transparent;text-underline-offset:10px}.forge-nav a:hover{text-decoration-color:currentColor;text-underline-offset:5px}\n.search{display:flex;gap:6px;flex:1;min-width:200px;max-width:460px}\n.search input{flex:1;min-width:0;min-height:44px;padding:8px 12px;border:1px solid var(--line);border-radius:var(--r2);background:var(--white);color:var(--ink);font:inherit;font-size:15px}\nbutton{padding:5px 10px;border:1px solid var(--line);border-radius:var(--r1);background:var(--white);color:var(--ink);cursor:pointer;font:inherit}button:hover{border-color:var(--ink)}\n.search button,.who button{min-height:44px;padding:8px 16px;border-radius:var(--r2);font-size:15px;font-weight:600}\n.who{margin-left:auto;display:flex;flex-wrap:wrap;align-items:center;gap:8px 12px;font-size:15px;font-weight:600}.inline{display:inline}\nmain{max-width:1200px;margin:0 auto;padding:var(--s5) 40px var(--s6);font-size:16px;line-height:1.55}\nmain a{color:var(--acc);text-decoration:none}main a:hover{text-decoration:underline}\nmain h1,main h2,main h3{font-weight:600;letter-spacing:-.03em;line-height:1.2}main h1{font-size:clamp(28px,3.4vw,40px);margin:4px 0 12px}\ncode,pre,.mono{font-size:13px}pre{background:var(--box);border:1px solid var(--line);padding:12px;overflow:auto;border-radius:var(--r2)}\ntable.md{display:block;max-width:100%;overflow-x:auto}\n@media(max-width:1000px){main{padding-left:28px;padding-right:28px}}\n@media(max-width:760px){main{padding:16px 20px var(--s5)}.forge-bar{gap:4px 20px}.search{order:3;flex-basis:100%;max-width:none}.readme{padding:12px 14px}}\n"
391text tfcss3 ".muted,.meta{color:var(--mut)}.meta{font-size:13px;margin:2px 0}\n.repos{list-style:none;padding:0;margin:0}.repos li{padding:14px 0;border-bottom:1px solid var(--line)}\n.rname{font-size:17px;font-weight:600}.desc{margin:4px 0}.stars{float:right;color:var(--mut)}\n.rhead h1{font-size:22px;margin:0 0 4px;font-weight:500}.rhead h1 b{font-weight:700}\n.tabs{display:flex;flex-wrap:wrap;gap:4px;border-bottom:1px solid var(--line);margin:14px 0 18px}\n.tabs a{padding:8px 12px;border-bottom:2px solid transparent;color:var(--fg)}.tabs a.on{border-bottom-color:var(--acc);font-weight:600}\n.clone{background:var(--box);border:1px solid var(--line);border-radius:6px;padding:6px 10px;display:inline-block}\n"
392text tfcss4 ".bar{display:flex;flex-wrap:wrap;gap:8px;align-items:center;margin:8px 0}\ntable{border-collapse:collapse;width:100%}td,th{padding:6px 8px;border-bottom:1px solid var(--line);text-align:left;vertical-align:top}\n.err h1{font-size:26px}.box{border:1px solid var(--line);border-radius:6px;padding:12px 16px;margin:12px 0}\n.ok{color:var(--ok)}.bad{color:var(--bad)}.hit{font-family:ui-monospace,Menlo,monospace;font-size:13px;white-space:pre-wrap;overflow-wrap:anywhere}\ninput[type=text],textarea{width:100%;padding:6px 8px;border:1px solid var(--line);border-radius:6px;background:var(--bg);color:var(--fg);font:inherit}\n@media (max-width:640px){.stars{float:none;display:block}.tabs a{padding:6px 8px}}\n"
393text tfcss5 ".releases .release{border:1px solid var(--line);border-radius:6px;padding:12px 16px;margin:12px 0}.release h3{margin:0 0 4px}\n.label{display:inline-block;padding:0 8px;border:1px solid var(--line);border-radius:10px;font-size:12px;color:var(--mut);margin-right:4px}\n.subject{font-weight:600}.notes{white-space:pre-wrap}.assets td:last-child{text-align:right;color:var(--mut)}\n.pager{display:flex;gap:12px;margin:14px 0}.empty{color:var(--mut)}\ndiv.clone{display:block;padding:10px 14px;margin:14px 0}div.clone h3{margin:0 0 6px;font-size:15px}div.clone dl{margin:0;display:grid;grid-template-columns:max-content 1fr;gap:4px 14px}div.clone dt{color:var(--mut)}div.clone dd{margin:0;overflow-wrap:anywhere}\n"
394text tfcss6 ".md{line-height:1.6;overflow-wrap:break-word}.md img{max-width:100%}.md table{width:auto}.md-l{text-align:left}.md-c{text-align:center}.md-r{text-align:right}.md blockquote{margin:0;padding:0 12px;border-left:3px solid var(--line);color:var(--mut)}\n.so-bar,.so-tabs{display:flex;flex-wrap:wrap;gap:8px;align-items:center;margin:8px 0}.so-form{display:inline}.so-btn{padding:3px 10px}.so-n{color:var(--mut);margin-left:4px}.so-on{font-weight:600}\n.so-muted{color:var(--mut)}.so-err{color:var(--bad)}.so-list{list-style:none;padding:0}.so-list li{padding:6px 0;border-bottom:1px solid var(--line)}.so-cmd{display:block;white-space:pre-wrap;background:var(--box);border:1px solid var(--line);border-radius:6px;padding:8px}.so-steps li{margin:6px 0}.so-f{margin:10px 0}\n"
395text tfcss7 ".crumbs{margin:8px 0;font-size:15px}.ref{display:inline-block;padding:2px 8px;border:1px solid var(--line);border-radius:6px;background:var(--box);font-size:13px;margin-right:8px}\n.latest{border:1px solid var(--line);border-bottom:0;border-radius:6px 6px 0 0;padding:8px 12px;background:var(--box);font-size:13px;color:var(--mut)}\n.files{margin-top:0}.files .dir a{font-weight:600}.files .sz{text-align:right;color:var(--mut);white-space:nowrap}\n.readme{border:1px solid var(--line);border-radius:6px;padding:16px 24px;margin:16px 0}table.md{width:auto}table.md td,table.md th{border:1px solid var(--line)}\n.code{border:1px solid var(--line);border-radius:6px;overflow-x:auto;font-family:ui-monospace,Menlo,monospace;font-size:13px}.code td{border:0;padding:0 8px;line-height:1.5}\n.ln{text-align:right;color:var(--mut);user-select:none;-webkit-user-select:none;width:1%;white-space:nowrap}.lc{white-space:pre}.img img{max-width:100%}\n"
396text tfcss8 ".commits{list-style:none;padding:0;margin:0;border:1px solid var(--line);border-radius:6px}.commits li{padding:8px 12px;border-bottom:1px solid var(--line)}.commits li:last-child{border-bottom:0}\n.box.commit h2{margin:0 0 6px;font-size:18px}pre.msg{white-space:pre-wrap;background:none;border:0;padding:0;margin:6px 0}.stat{font-size:13px;color:var(--mut)}table.stat{width:auto}table.stat td{padding:2px 8px}\n.df{border:1px solid var(--line);border-radius:6px;margin:14px 0;overflow-x:auto}.dfh{padding:6px 12px;background:var(--box);border-bottom:1px solid var(--line);font-family:ui-monospace,Menlo,monospace;font-size:13px}\ntable.diff{font-family:ui-monospace,Menlo,monospace;font-size:13px}table.diff td{border:0;padding:0 8px}td.dc{white-space:pre}tr.da{background:rgba(0,210,148,.15)}tr.dd{background:rgba(255,101,104,.15)}tr.dh,tr.dm{background:var(--box);color:var(--mut)}\ntable.refs td{white-space:nowrap}.badge{display:inline-block;padding:0 8px;border:1px solid var(--acc);border-radius:10px;font-size:12px;color:var(--acc);margin-left:6px}\ntable.code.blame td.bl{white-space:nowrap;color:var(--mut);font-size:12px;border-right:1px solid var(--line);width:1%}tr.bs td{border-top:1px solid var(--line)}p.hit{margin:2px 0}form.inline{display:inline}\n"
397note tfcss9: the project page (server/state.om, frepohd, the "For developers" section) and the marker
398note of a README link that leaves the site (browse/b_md.om class "ext")
399text tfcss9 ".pj-head h1{font-size:34px;line-height:1.15;margin:4px 0 6px;font-weight:700}.pj-head h1 a{color:var(--ink);text-decoration:none}.pj-head h1 a.rname,.pj-by a.rname{font-size:inherit;font-weight:inherit}.pj-head .desc{font-size:19px;margin:0 0 6px;max-width:44em}.pj-by{color:var(--mut);font-size:15px;margin:0 0 10px}\n.state{margin:6px 0 2px;font-size:16px}.state b{display:inline-block;padding:1px 10px;border-radius:999px;margin-right:6px;font-size:14px}.state.ok b{background:var(--panel);color:var(--ok)}.state.no b{background:var(--panel);color:var(--ink)}.state-more{font-size:14px;color:var(--mut);margin:2px 0 8px;max-width:48em}\n.pj-get{margin:14px 0 6px}.pj-get summary{cursor:pointer}.pj-get summary::after{content:\" ▾\"}.pj-get[open] summary::after{content:\" ▴\"}.pj-get code{user-select:all;overflow-wrap:anywhere}.pj-get dd{margin-inline-start:0}.pj-btn{display:inline-flex;align-items:center;min-height:44px;padding:8px 22px;border-radius:var(--r2);background:var(--btn-dark-bg);color:var(--btn-dark-ink);font-weight:700;text-decoration:none}.pj-btn:hover{background:var(--btn-dark-hover);color:var(--btn-dark-ink)}.pj-btn:active{background:var(--btn-dark-press)}.pj-what{color:var(--mut);font-size:14px;max-width:36em}\n.pj-tabs+.readme{border:0;padding:0;margin-top:8px}.pj-tabs+.readme .md{font-size:18px;line-height:1.65}.pj-nordme{font-size:17px;margin:16px 0 8px}\n.pj-dev{margin-top:40px;padding-top:18px;border-top:2px solid var(--line)}.pj-dev h2{font-size:24px;margin:0 0 6px}.pj-terms{display:grid;grid-template-columns:max-content 1fr;gap:6px 16px;margin:10px 0 16px;font-size:15px}.pj-terms dt{font-weight:700}.pj-terms dd{margin:0;overflow-wrap:anywhere}.pj-recs{margin:16px 0}\n.repos .state{font-size:14px;margin:4px 0}.repos .meta .stars{float:none;display:inline}\n.md a.ext::after{content:\" \\2197\";content:\" \\2197\" / \" (leaves this site)\"}\n@media (max-width:640px){.pj-head h1{font-size:28px}.pj-head .desc{font-size:17px}.pj-terms{grid-template-columns:1fr}.pj-terms dd{margin-bottom:8px}}\n"
400fn fcssout to void
401put fkind 0 1
402fsetct tfctcss
403fsetcc tfccpub
404fput tchrcss
405fput tfcssv
406fput tfcss2
407fput tfcss3
408fput tfcss4
409fput tfcss5
410fput tfcss6
411fput tfcss7
412fput tfcss8
413fput tfcss9
414fput tlcss
415end
416note ---- the site icon (served at <base>assets/favicon.svg; the same drawing as interplane.io's
417note /public/favicon.svg). Named in every page head so a browser does not ask /favicon.ico.
418text tfctsvg "image/svg+xml"
419text tfico "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 64 64\"><rect width=\"64\" height=\"64\" rx=\"12\" fill=\"#2563eb\"/><g stroke=\"#ffffff\" stroke-width=\"5\"><path d=\"M32 10v44M10 32h44M16 16l32 32M16 48l32-32\"/></g></svg>\n"
420fn ficoout to void
421put fkind 0 1
422fsetct tfctsvg
423fsetcc tfccpub
424fput tfico
425end
426note ---- repo list item, shared by explore, profile and search: the name, the plain sentence (the
427note description), the state (server/state.om), then the last commit and the stars. The caller runs
428note fpjload first.
429text tfli1 "<li class=\"pj-row\"><a class=\"rname\" href=\""
430text tfli3 "</a><p class=\"desc\">"
431text tfli4 "</p>"
432text tfli4b "<p class=\"meta\">Last commit: "
433text tfli4c " &#183; <span class=\"stars\" title=\"stars\">&#9733; "
434text tfli5 "</span></p></li>\n"
435text tfnodesc "<span class=\"muted\">No description.</span>"
436text tfnolc "unknown"
437fn frepoli i ulong to void
438fput tfli1
439fputb
440fput tfowner
441fputc 47
442fputrn i
443fput tfqgt
444fputrn i
445fput tfli3
446if eq get fadl i 0
447fput tfnodesc
448else
449fdesc i
450end
451fput tfli4
452fpjrow i
453fput tfli4b
454if eq get falcl i 0
455fput tfnolc
456else
457fputlc i
458end
459fput tfli4c
460fnum sostarn i
461fput tfli5
462end
463note ---- /explore (also the forge home /)
464text tfex1 "<h1>Explore repositories</h1><p class=\"muted pj-intro\">"
465text tfex2 " projects. Open one to read what it is and to get it. <b>Checked</b> means someone rebuilt it from its source and published a receipt; <b>Unfinished</b> means there is no such receipt yet.</p>\n<ul class=\"repos\">\n"
466text tfulend "</ul>\n"
467text tfhome1 "<section class=\"box\"><h1>INTERPLANE Forge</h1><p>Agents express intent. The forge retains authority. Read about each project, download it, follow proposed changes and issues, and star the projects you care about.</p></section>\n"
468text tftexp "Explore"
469text tfthome "Home"
470fn fexplore home bool to void
471put fjalt 0 1
472if home
473fsetti tfthome
474fput tfhome1
475else
476fsetti tftexp
477end
478fpjload
479fput tfex1
480fnum get fan 0
481fput tfex2
482for i ulong get fan 0 bound FAMAX
483frepoli i
484end
485fput tfulend
486end
487note ---- /<owner> profile (the node delegate is the only owner)
488text tfpr1 "<section class=\"rhead\"><h1><b>"
489text tfpr2 "</b></h1><p class=\"muted mono\">did:key:"
490text tfpr3 "</p><p><a href=\""
491text tfpfol "/followers"
492text tfpr4 " followers</a> &#183; <a href=\""
493text tfpfg "/following"
494text tfpr5 " following</a> &#183; "
495text tfpr6 " stars received &#183; "
496text tfpr7 " favorites received</p><div class=\"bar\">"
497text tfpr8 "</div></section>\n<h2>Repositories ("
498text tfpr9 ")</h2>\n<ul class=\"repos\">\n"
499text tfpr10 "<h2>Starred</h2>\n"
500fn fstarsum to ulong
501s = ulong 0
502for i ulong get fan 0 bound FAMAX
503s = add s sostarn i
504end
505ret s
506end
507fn ffavsum to ulong
508s = ulong 0
509for i ulong get fan 0 bound FAMAX
510s = add s sofavn i
511end
512ret s
513end
514fn fprofile to void
515fsetti tfowner
516fput tfpr1
517fput tfowner
518fput tfpr2
519fput tfnid
520fput tfpr3
521fputb
522fput tfowner
523fput tfpfol
524fput tfqgt
525fnum sofolln
526fput tfpr4
527fputb
528fput tfowner
529fput tfpfg
530fput tfqgt
531fnum sofollg
532fput tfpr5
533fnum fstarsum
534fput tfpr6
535fnum ffavsum
536fput tfpr7
537sofolbar
538fput tfpr8
539fnum get fan 0
540fput tfpr9
541fpjload
542for i ulong get fan 0 bound FAMAX
543frepoli i
544end
545fput tfulend
546fput tfpr10
547sostarsof
548end
549note Project and owner names carry class rname: server/tr.om marks that class translate="no" when it
550note sends the page, so the page holds no hint of its own (fob sizes stay exact; server/tests/overflow.sh).
551note ---- repo header: a short friendly header (name, the plain sentence, who brought it; on the repo
552note home also the state and one action to get it), then the tabs. Words for developers (the
553note project id, the clone notice, the counts) are in the "For developers" section of the repo home
554note (fpjdev1 / fpjdev2), whose stable address is <repo>#For-developers. The id has an upper-case
555note letter, so no README heading anchor (browse/b_md.om brmslug: lower case only) can take it.
556text tfrh1 "<section class=\"rhead pj-head\"><h1><a class=\"rname\" href=\""
557text tfrh3 "</a></h1><p class=\"desc\">"
558text tfrh3n "This project has not described itself yet."
559text tfrh4 "</p><p class=\"pj-by\">Brought by <a class=\"rname\" href=\""
560text tfrh4b "</a></p>\n"
561text tfrh5 "<div class=\"bar\">"
562text tfrh6b "</div></section>\n<nav class=\"tabs pj-tabs\" aria-label=\"Project\">"
563text tfrh7 "</nav>\n"
564text tfton "\" class=\"on\" aria-current=\"page\">"
565text tfabout "About"
566text tffiles "Files"
567text tfcomm "History"
568text tfrel "Releases"
569text tfpat "Proposed changes"
570text tfiss "Issues"
571text tfdevt "For developers"
572text tfptree "/tree/"
573text tfpcom "/commits"
574text tfpbr "/branches"
575text tfptag "/tags"
576text tfprel "/releases"
577text tfppat "/patches"
578text tfpiss "/issues"
579text tfpdev "#For-developers"
580text tfpjson ".json"
581text tfpzip "/archive/refs/heads/"
582text tfpzipx ".zip"
583text tfget4 "<p class=\"pj-get pj-what\">Nothing to download yet.</p>\n"
584note fpjempty: set by frepohome: the page has no files to offer (no zip link)
585global fpjempty ulong 1
586fn ftab me ulong on ulong p view uchar * t view uchar * to void
587fput tfahref
588fputrl
589fput p
590if eq me on
591fput tfton
592else
593fput tfqgt
594end
595fput t
596fput tfaend
597end
598fn frepohd tab ulong to void
599i = get fridx 0
600ok = lt i get fan 0
601home = and eq tab 0 eq get frestl 0 0
602fput tfrh1
603fputrl
604fput tfqgt
605fputrnm
606fput tfrh3
607if and ok gt get fadl i 0
608fdesc i
609else
610fput tfrh3n
611end
612fput tfrh4
613fputb
614fputown
615fput tfqgt
616fputown
617fput tfrh4b
618if and home ok
619put fjalt 0 2
620fpjload
621fpjfull i
622if ne get fpjempty 0 0
623fput tfget4
624else
625dlclone
626end
627end
628fput tfrh5
629sobar
630fput tfrh6b
631on = tab
632if and eq tab 0 not home
633on = 10
634end
635if or eq tab 2 eq tab 3
636on = 20
637end
638ftab 0 on tfempty tfabout
639fput tfahref
640fputrl
641fput tfptree
642if ok
643fputbr i
644end
645if eq on 10
646fput tfton
647else
648fput tfqgt
649end
650fput tffiles
651fput tfaend
652ftab 1 on tfpcom tfcomm
653ftab 4 on tfprel tfrel
654ftab 5 on tfppat tfpat
655ftab 6 on tfpiss tfiss
656ftab 20 on tfpdev tfdevt
657fput tfrh7
658end
659note ---- the "For developers: proof and records" section of the repo home. fpjdev1 opens it: the
660note words that are kept off the top of the page, each with one line of explanation, then the counts
661note (server/counts.om fzhtml). The caller adds the branch bar, the clone panel, the newest commit and
662note the file list, then fpjdev2 closes it with a link to every record page.
663text tfdv1 "<section class=\"pj-dev\" id=\"For-developers\" tabindex=\"-1\" aria-labelledby=\"pj-dev-h\"><h2 id=\"pj-dev-h\">For developers: proof and records</h2>\n<p class=\"pj-lead\">The full record of this project. Words that are used only here are explained once:</p>\n<dl class=\"pj-terms\">\n"
664text tfdv6 "\">Proposed changes</a>.</dd>\n<dt>Receipt</dt><dd>A public record that someone checked a claim, with the fingerprint of its evidence file. The state at the top of this page is read from the list at <a href=\"https://interplane.io/receipts/\">interplane.io/receipts</a>. "
665text tfdv6b "</dd>\n</dl>"
666text tfdv7 "<p class=\"pj-recs\">Every record: <a href=\""
667text tfdv8 "\">History (commits)</a> &#183; <a href=\""
668text tfdv9 "\">Branches</a> &#183; <a href=\""
669text tfdv10 "\">Tags</a> &#183; <a href=\""
670text tfdv11 "\">Releases, with the SHA-256 of each download</a> &#183; <a href=\""
671text tfdv12 "\">Patches</a> &#183; <a href=\""
672text tfdv13 "\">Issues</a> &#183; <a href=\""
673text tfdv14 "\">This project as JSON</a></p>\n</section>\n"
674text tfdvnl "\n"
675fn fpjdev1 to void
676i = get fridx 0
677fput tfdv1
678fpjterms
679fputrl
680fput tfppat
681fput tfdv6
682fpjrcpt
683fput tfdv6b
684if lt i get fan 0
685fzhtml i
686else
687fput tfdvnl
688end
689end
690fn fpjdev2 to void
691fput tfdv7
692fputrl
693fput tfpcom
694fput tfdv8
695fputrl
696fput tfpbr
697fput tfdv9
698fputrl
699fput tfptag
700fput tfdv10
701fputrl
702fput tfprel
703fput tfdv11
704fputrl
705fput tfppat
706fput tfdv12
707fputrl
708fput tfpiss
709fput tfdv13
710fputrl
711fput tfpjson
712fput tfdv14
713end
714note frepohome: the server's repo home when no slice claimed it (browse seam, or a repository whose
715note default branch cannot be read)
716text tfrhm0 "<p class=\"pj-nordme\">No files to show here yet.</p>\n"
717text tfrhm1 "<p class=\"meta\">Default branch <code>"
718text tfrhm2 "</code> &#183; last commit "
719text tfrhm3 "</p>\n"
720fn frepohome to void
721i = get fridx 0
722put ftil 0 0
723ftirepo
724put fpjempty 0 1
725frepohd 0
726put fpjempty 0 0
727fput tfrhm0
728fpjdev1
729fput tfrhm1
730fputbr i
731fput tfrhm2
732fputlc i
733fput tfrhm3
734fpjdev2
735end
736note ---- /search?q=: repo names and descriptions (case-insensitive), then code via git grep
737text tfsr1 "<h1>Search</h1>\n"
738text tfsr2 "<p class=\"muted\">Type a word in the search box: repository names and descriptions are matched, and code is searched with git grep on each public repository's default branch.</p>\n"
739text tfsr3 "<h2>Repositories ("
740text tfsr4 ")</h2>\n"
741text tfsr5 "<p class=\"muted\">No repository name or description matches.</p>\n"
742text tftsrch "Search"
743fn flow c uchar to uchar
744if and ge c 65 le c 90
745ret uchar add c 32
746end
747ret c
748end
749fn fqcap to void
750n = fqget tfq
751if lt n 0
752n = 0
753end
754m = ulong n
755if gt m 200
756m = 200
757end
758for i ulong m bound 256
759put fq i get fval i
760end
761put fql 0 m
762end
763fn fsubat src ulong o ulong l ulong to bool
764q = get fql 0
765if or eq q 0 gt q l
766ret false
767end
768for s ulong add sub l q 1 bound 70000
769if fsubeq src add o s
770ret true
771end
772end
773ret false
774end
775fn fsubeq src ulong o ulong to bool
776for k ulong get fql 0 bound 256
777c = fsubb src add o k
778if ne flow c flow get fq k
779ret false
780end
781end
782ret true
783end
784fn fsubb src ulong k ulong to uchar
785if eq src 0
786ret get fanm k
787end
788ret get fadesc k
789end
790fn fsrmatch i ulong to bool
791if fsubat 0 get fano i get fanl i
792ret true
793end
794ret fsubat 1 get fado i get fadl i
795end
796fn fsearch to void
797fsetti tftsrch
798fput tfsr1
799if eq get fql 0 0
800fput tfsr2
801ret
802end
803n = ulong 0
804for i ulong get fan 0 bound FAMAX
805if fsrmatch i
806n = add n 1
807end
808end
809fput tfsr3
810fnum n
811fput tfsr4
812if eq n 0
813fput tfsr5
814else
815fpjload
816fput tfulrep
817for i ulong get fan 0 bound FAMAX
818if fsrmatch i
819frepoli i
820end
821end
822fput tfulend
823end
824fcodesr
825end
826note ---- code search: git grep -I -n -i -F --max-count=5 -e <q> <default ref> per repo, at most 100 hits
827text tfcs1 "<h2>Code</h2>\n"
828text tfcs2 "<p class=\"muted\">No code matches.</p>\n"
829text tfcs3 "<div class=\"box\"><p><a href=\""
830text tfcs4 "</a></p>\n"
831text tfcs5 "</div>\n"
832text tfcs6 "<p class=\"hit\"><a href=\""
833text tfcs7 "</a> "
834text tfcs8 "</p>\n"
835text tfcsblob "/blob/"
836text tfcsl "#L"
837text tfgrep "grep"
838text tfgI "-I"
839text tfgn "-n"
840text tfgi "-i"
841text tfgF "-F"
842text tfgmax "--max-count=5"
843text tfge "-e"
844text tfcsmore "<p class=\"muted\">Showing the first 100 code matches.</p>\n"
845global fhits ulong 1
846fn fcodesr to void
847fput tfcs1
848put fhits 0 0
849nscodesr
850if eq get fhits 0 0
851fput tfcs2
852end
853if ge get fhits 0 100
854fput tfcsmore
855end
856end
857fn fgreparg i ulong to void
858fkgiti i
859fka tfgrep
860fka tfgI
861fka tfgn
862fka tfgi
863fka tfgF
864fka tfgmax
865fka tfge
866fkopen
867for k ulong get fql 0 bound 256
868fkc get fq k
869end
870fkopen
871fkt tfrh
872o = get fabo i
873for k ulong get fabl i bound 64
874fkc get fabr add o k
875end
876end
877note fcsrepo: render repo i's git grep output (already in fxo, read by nodes/srch.om nsrun)
878fn fcsrepo i ulong to void
879ln = get fxol 0
880if eq ln 0
881ret
882end
883fput tfcs3
884fputb
885fput tfowner
886fputc 47
887fputrn i
888fput tfqgt
889fput tfowner
890fputc 47
891fputrn i
892fput tfcs4
893p = ulong 0
894for it ulong 100000
895if ge p ln
896break
897end
898if ge get fhits 0 100
899break
900end
901e = fleol p ln
902fcshit i p e
903p = add e 1
904end
905fput tfcs5
906end
907note fcshit: one line "refs/heads/<b>:<path>:<line>:<text>"; skip the ref prefix (len 11 + branch + 1)
908fn fcshit i ulong p ulong e ulong to void
909a = add add p 12 get fabl i
910if ge a e
911ret
912end
913c1 = fcolon a e
914if ge c1 e
915ret
916end
917c2 = fcolon add c1 1 e
918if ge c2 e
919ret
920end
921put fhits 0 add get fhits 0 1
922fput tfcs6
923fputb
924fput tfowner
925fputc 47
926fputrn i
927fput tfcsblob
928fputbr i
929fputc 47
930fxesc a sub c1 a
931fput tfcsl
932fxesc add c1 1 sub sub c2 c1 1
933fput tfqgt
934fxesc a sub c1 a
935fputc 58
936fxesc add c1 1 sub sub c2 c1 1
937fput tfcs7
938m = sub sub e c2 1
939if gt m 300
940m = 300
941end
942fxesc add c2 1 m
943fput tfcs8
944end
945fn fcolon a ulong e ulong to ulong
946note the bound is the size of fxo: a path in a search hit can be longer than 100,000 bytes
947j = a
948while lt j e bound 16777216
949if eq get fxo j 58
950ret j
951end
952j = add j 1
953end
954ret e
955end