interplane-forge
INTERPLANE Forge
Brought by drakestapleton
interplane-forge / salvage / 20web.om
| 1 | text tlparent "View original source revision" |
| 2 | text tlhidden "This part is not publicly visible. It is a draft or its original source is unavailable." |
| 3 | text tlpriv "<p class=\"meta\">Your private revision</p>" |
| 4 | text tlgone "<p class=\"meta\">Withdrawn from public view</p>" |
| 5 | text tlph1 "The verifier could not prepare the pinned compiler or private scratch storage." |
| 6 | text tlph2 "The compiler refused the source or exceeded its resource budget." |
| 7 | text tlph3 "The program did not complete successfully inside the strict sandbox." |
| 8 | text tlph4 "The program output did not match the declared bytes. Check whitespace and the final newline." |
| 9 | text tlphx " Exit status: " |
| 10 | text tlphs "; signal status: " |
| 11 | text tlquota "Storage allocation reached. This instance holds at most 4096 immutable revisions and 64 per author, including drafts and withdrawn revisions. No new record was saved." |
| 12 | text tlempty2 "" |
| 13 | text tlquery "?before=" |
| 14 | text tlrootp "/salvage/" |
| 15 | text tlnewurl "new" |
| 16 | note Native, opt-in salvage surface. A signed session DID owns records, never its display name. |
| 17 | text tlenv "INTERPLANE_SALVAGE_DIR=" |
| 18 | text tlslash "/salvage" |
| 19 | text tlnewp "/salvage/new" |
| 20 | text tlslug "salvage/" |
| 21 | text tlact "action" |
| 22 | text tlsource "source" |
| 23 | text tlderive "derive" |
| 24 | text tlverify "verify" |
| 25 | text tlpub "publish" |
| 26 | text tlwith "withdraw" |
| 27 | text tltitle "title" |
| 28 | text tlorigin "origin" |
| 29 | text tllic "license" |
| 30 | text tldesc "description" |
| 31 | text tlcredit "credit" |
| 32 | text tllang "language" |
| 33 | text tlstdin "input" |
| 34 | text tlexpect "expected" |
| 35 | text tlcons "consent" |
| 36 | text tlyes "yes" |
| 37 | text tlmit "MIT" |
| 38 | text tlapache "Apache-2.0" |
| 39 | text tlbsd "BSD-3-Clause" |
| 40 | text tlcc0 "CC0-1.0" |
| 41 | text tlomega "Omega" |
| 42 | text tlver "salvage-v1" |
| 43 | text tldid "did:key:" |
| 44 | text tlplain "text/plain; charset=utf-8" |
| 45 | text tlbinary "application/octet-stream" |
| 46 | text tlattach "attachment" |
| 47 | text tlno "no-store" |
| 48 | text tlbase "<div class=\"sl\"><p class=\"eyebrow\">INTERPLANE / THE SALVAGE YARD</p>" |
| 49 | text tlclose "</div>" |
| 50 | text tlhref "<a href=\"" |
| 51 | text tlendh "\">" |
| 52 | text tlenda "</a>" |
| 53 | text tlh1 "<h1>" |
| 54 | text tlh1e "</h1>" |
| 55 | text tlp "<p>" |
| 56 | text tlpe "</p>" |
| 57 | text tlpre "<pre>" |
| 58 | text tlpree "</pre>" |
| 59 | text tlcard "<article class=\"sl-card\">" |
| 60 | text tlcarde "</article>" |
| 61 | text tlnewh "A rough build belongs here." |
| 62 | text tlliste "A small idea can become somebody else's starting point. Share unfinished source, make a useful native Omega part, and reproduce its declared example." |
| 63 | text tlnewln "Bring a build" |
| 64 | text tlback "Back to the yard" |
| 65 | text tlform1 "<form method=\"post\" action=\"" |
| 66 | text tlform2 "\"><input type=\"hidden\" name=\"csrf\" value=\"" |
| 67 | text tlform3 "\">" |
| 68 | text tlforme "</form>" |
| 69 | text tlbtn1 "<button name=\"action\" value=\"" |
| 70 | text tlbtn2 "\">" |
| 71 | text tlbtn3 "</button>" |
| 72 | text tlfields "<label>Give it a name<input name=\"title\" maxlength=\"160\" required></label><label>What works, and what doesn't?<textarea name=\"description\" maxlength=\"2048\" rows=\"3\" required></textarea></label>" |
| 73 | text tlmsg0 "<label>Original project or source URL<input name=\"origin\" maxlength=\"512\" required></label><label>Original author and attribution<input name=\"credit\" maxlength=\"512\" required></label><label>Source language<input name=\"language\" maxlength=\"128\" required></label><label>Permission to reuse<select name=\"license\"><option>MIT</option><option>Apache-2.0</option><option>BSD-3-Clause</option><option>CC0-1.0</option></select></label>" |
| 74 | text tlfcode "<label>Source text <small>Up to 16 KiB. UTF-8 text is stored with LF newlines.</small><textarea name=\"source\" rows=\"14\" maxlength=\"16384\" spellcheck=\"false\" required>" |
| 75 | text tlmsg1 "</textarea></label>" |
| 76 | text tlfex "<label>Example input<textarea name=\"input\" rows=\"3\" maxlength=\"4096\" spellcheck=\"false\"></textarea></label><label>Exact expected output <small>Include a final newline if the program writes one. Maximum 4 KiB.</small><textarea name=\"expected\" rows=\"3\" maxlength=\"4096\" spellcheck=\"false\"></textarea></label>" |
| 77 | text tlfcons "<label class=\"sl-check\"><input type=\"checkbox\" name=\"consent\" value=\"yes\" required> I have permission to share this publicly under the stated license. It contains no secrets or personal data. I understand public copies cannot be recalled.</label>" |
| 78 | text tlshared "Share this source" |
| 79 | text tlsavep "Save an Omega draft" |
| 80 | text tlmake "Make a useful part" |
| 81 | text tlmakep "Keep the useful idea and edit the source into a self-contained native Omega program. Credits and license carry forward. This is a human-assisted repair, not an automatic conversion." |
| 82 | text tldraft "Private draft. Only its author can view it until a passing example is explicitly published." |
| 83 | text tlpass "Declared example reproduced. This exact revision compiled with the pinned seeded compiler, ran under the strict sandbox, matched the expected output, and rejected an altered expected output. This is evidence for one example, not a proof of safety or general correctness." |
| 84 | text tlfail "Verification refused. Compilation, sandbox execution, exit status, time/output limits, or the declared output did not pass. Edit a new draft or retry this revision." |
| 85 | text tlmsg2 "No passing receipt yet. Start verification, then refresh this page to see the result." |
| 86 | text tlmsg3 "Verification is running. Refresh this page to check its receipt." |
| 87 | text tlcheckb "Verify the example" |
| 88 | text tlmsg4 "Publish this part" |
| 89 | text tlmsg5 "Withdraw from the yard" |
| 90 | text tlmsg6 "Withdrawn. This record is hidden from public routes. Copies already downloaded cannot be recalled." |
| 91 | text tlmeta "<dl><dt>Author DID</dt><dd>" |
| 92 | text tlmet2 "</dd><dt>Original source</dt><dd>" |
| 93 | text tlmet3 "</dd><dt>License</dt><dd>" |
| 94 | text tlmet4 "</dd><dt>Attribution</dt><dd>" |
| 95 | text tlmet5 "</dd><dt>Revision SHA-256</dt><dd class=\"mono\">" |
| 96 | text tlmet6 "</dd></dl>" |
| 97 | text tlcodeh "<h2>Source</h2>" |
| 98 | text tlexh "<h2>Declared example</h2><h3>Input</h3>" |
| 99 | text tlexeh "<h3>Expected output</h3>" |
| 100 | text tlproofh "<h2>Reproduction</h2><p>Download the exact record and receipt. The native replay tool validates the record hash, rebuilds from the pinned compiler, and checks this example in a fresh sandbox.</p>" |
| 101 | text tlrawr "/record" |
| 102 | text tlraws "/source.om" |
| 103 | text tlrawi "/stdin" |
| 104 | text tlrawe "/expected" |
| 105 | text tlrawc "/receipt" |
| 106 | text tlrecord "Exact source record" |
| 107 | text tlmsg7 "Collector receipt" |
| 108 | text tlmsg8 "Download source" |
| 109 | text tlnosess "Sign in with your key to bring a build or create a part." |
| 110 | text tlemptyy "The yard is waiting for its first public build. Unfinished is welcome." |
| 111 | text tlmsg9 "The form was refused. Check the byte limits, required text, permission checkbox, and license. Duplicate fields and malformed text are not accepted." |
| 112 | text tloff "The salvage workspace is not configured on this instance. No submission was saved." |
| 113 | text tlbusy "The verifier is busy. Your draft is saved; retry after the current job finishes." |
| 114 | text tlmsg10 "This action is not available for this revision. No publication was made." |
| 115 | text tlbefore "before=" |
| 116 | text tlnextpg "Older submissions" |
| 117 | text tlcss ".sl{max-width:950px;margin:auto}.sl h1{font-size:clamp(34px,5vw,60px);font-weight:450;letter-spacing:-.04em;line-height:1.1}.sl h2{font-weight:500;margin-top:36px}.sl .eyebrow{font:11px ui-monospace,monospace;letter-spacing:.15em;color:var(--mut)}.sl p{line-height:1.7;max-width:760px}.sl .sl-card{padding:24px;border:1px solid var(--line);border-radius:12px;margin:18px 0;background:var(--box)}.sl label{display:block;margin:20px 0;font-size:14px}.sl input:not([type=checkbox]),.sl select,.sl textarea{display:block;width:100%;max-width:100%;margin-top:8px;padding:12px;background:var(--bg);color:var(--fg);border:1px solid var(--line);border-radius:6px;font:inherit}.sl textarea{font:13px/1.65 ui-monospace,monospace}.sl small{display:block;color:var(--mut);font-weight:400}.sl button{padding:12px 18px;margin:10px 10px 10px 0}.sl button[value=source],.sl button[value=derive],.sl button[value=publish]{background:var(--acc);color:var(--bg)}.sl .sl-check{line-height:1.7}.sl .sl-check input{margin-right:10px}.sl dl{font-size:13px;overflow-wrap:anywhere}.sl dt{margin-top:12px;color:var(--mut)}.sl dd{margin:4px 0}.sl pre{max-width:100%;white-space:pre-wrap;overflow-wrap:anywhere}.sl a{display:inline-block;margin:6px 16px 6px 0}.sl :focus-visible{outline:3px solid var(--acc);outline-offset:4px}\n" |
| 118 | global glboot ulong 1 |
| 119 | fn slboot to bool |
| 120 | if ne get glboot 0 0 |
| 121 | ret eq get glok 0 1 |
| 122 | end |
| 123 | put glboot 0 1 |
| 124 | b = new uchar 1024 0 |
| 125 | for i ulong ulong envcnt bound 4096 |
| 126 | n = envread i b 0 1024 |
| 127 | if ge n long len tlenv |
| 128 | same = true |
| 129 | for j ulong len tlenv |
| 130 | if ne get b j get tlenv j |
| 131 | same = false |
| 132 | end |
| 133 | end |
| 134 | if same |
| 135 | if not slroot view part b len tlenv sub ulong n len tlenv |
| 136 | ret false |
| 137 | end |
| 138 | ret slinit |
| 139 | end |
| 140 | end |
| 141 | end |
| 142 | ret false |
| 143 | end |
| 144 | fn slprefix to bool |
| 145 | if lt get fpathl 0 8 |
| 146 | ret false |
| 147 | end |
| 148 | for i ulong 8 |
| 149 | if ne get fpath i get tlslash i |
| 150 | ret false |
| 151 | end |
| 152 | end |
| 153 | if eq get fpathl 0 8 |
| 154 | ret true |
| 155 | end |
| 156 | ret eq get fpath 8 47 |
| 157 | end |
| 158 | fn slesc fld ulong to void |
| 159 | for i ulong get gllen fld bound 16384 |
| 160 | fescc get glrec add get gloff fld i |
| 161 | end |
| 162 | end |
| 163 | fn slown to bool |
| 164 | who = get gscur 0 |
| 165 | if eq who 0 |
| 166 | ret false |
| 167 | end |
| 168 | n = get gssl who |
| 169 | if ne n get gllen 0 |
| 170 | ret false |
| 171 | end |
| 172 | a = get gsso who |
| 173 | b = get gloff 0 |
| 174 | for i ulong n bound 64 |
| 175 | if ne get gsstr add a i get glrec add b i |
| 176 | ret false |
| 177 | end |
| 178 | end |
| 179 | ret true |
| 180 | end |
| 181 | fn sladmin to bool |
| 182 | who = get gscur 0 |
| 183 | if eq who 0 |
| 184 | ret false |
| 185 | end |
| 186 | n = get gssl who |
| 187 | if ne n add len tldid len tfnid |
| 188 | ret false |
| 189 | end |
| 190 | o = get gsso who |
| 191 | for i ulong len tldid |
| 192 | if ne get gsstr add o i get tldid i |
| 193 | ret false |
| 194 | end |
| 195 | end |
| 196 | o = add o len tldid |
| 197 | for i ulong len tfnid |
| 198 | if ne get gsstr add o i get tfnid i |
| 199 | ret false |
| 200 | end |
| 201 | end |
| 202 | ret true |
| 203 | end |
| 204 | fn slparentok to bool |
| 205 | p = new uchar 64 0 |
| 206 | if ne get gllen 6 64 |
| 207 | ret false |
| 208 | end |
| 209 | n = slfield 6 p |
| 210 | if not slknown p |
| 211 | ret false |
| 212 | end |
| 213 | if ne slgetstate p 1 |
| 214 | ret false |
| 215 | end |
| 216 | if not slload p |
| 217 | ret false |
| 218 | end |
| 219 | ret eq get glrec 8 1 |
| 220 | end |
| 221 | fn slpubgate pubd bool receipt bool parent bool to bool |
| 222 | ret and and pubd receipt parent |
| 223 | end |
| 224 | fn slpublic id view uchar * to bool |
| 225 | if not slknown id |
| 226 | ret false |
| 227 | end |
| 228 | if not slload id |
| 229 | ret false |
| 230 | end |
| 231 | pubd = eq slgetstate id 1 |
| 232 | if eq get glrec 8 1 |
| 233 | ret pubd |
| 234 | end |
| 235 | if ne get glrec 8 2 |
| 236 | ret false |
| 237 | end |
| 238 | receipt = eq slreceiptget id 1 |
| 239 | ok = slparentok |
| 240 | loaded = slload id |
| 241 | ret slpubgate pubd receipt and ok loaded |
| 242 | end |
| 243 | fn slaccess id view uchar * to bool |
| 244 | if not slknown id |
| 245 | ret false |
| 246 | end |
| 247 | if not slload id |
| 248 | ret false |
| 249 | end |
| 250 | if slown |
| 251 | ret true |
| 252 | end |
| 253 | ret slpublic id |
| 254 | end |
| 255 | fn slhexbyte c uchar to bool |
| 256 | ret or and ge c 48 le c 57 or and ge c 65 le c 70 and ge c 97 le c 102 |
| 257 | end |
| 258 | fn slformvalid to bool |
| 259 | n = get fbodyl 0 |
| 260 | i = ulong 0 |
| 261 | while lt i n bound 65536 |
| 262 | if eq get fbody i 37 |
| 263 | if lt sub n i 3 |
| 264 | ret false |
| 265 | end |
| 266 | if not slhexbyte get fbody add i 1 |
| 267 | ret false |
| 268 | end |
| 269 | if not slhexbyte get fbody add i 2 |
| 270 | ret false |
| 271 | end |
| 272 | i = add i 3 |
| 273 | else |
| 274 | i = add i 1 |
| 275 | end |
| 276 | end |
| 277 | ret true |
| 278 | end |
| 279 | fn slgetform name view uchar * to long |
| 280 | count = ulong 0 |
| 281 | i = ulong 0 |
| 282 | n = get fbodyl 0 |
| 283 | while lt i n bound 70000 |
| 284 | if cobfmat name i n |
| 285 | count = add count 1 |
| 286 | end |
| 287 | i = cobfnxt i n |
| 288 | end |
| 289 | if ne count 1 |
| 290 | ret -1 |
| 291 | end |
| 292 | r = cobfld name |
| 293 | if lt r 0 |
| 294 | ret r |
| 295 | end |
| 296 | note HTML form newlines are canonicalized once, before the immutable record is hashed. |
| 297 | w = ulong 0 |
| 298 | skip = false |
| 299 | for j ulong ulong r bound 65536 |
| 300 | c = get gcfv j |
| 301 | if and skip eq c 10 |
| 302 | skip = false |
| 303 | else |
| 304 | skip = eq c 13 |
| 305 | if skip |
| 306 | c = uchar 10 |
| 307 | end |
| 308 | put gcfv w c |
| 309 | w = add w 1 |
| 310 | end |
| 311 | end |
| 312 | put gcfvl 0 w |
| 313 | if not cowutf8 w true |
| 314 | ret -1 |
| 315 | end |
| 316 | ret long w |
| 317 | end |
| 318 | fn slffeq name view uchar * want view uchar * to bool |
| 319 | n = slgetform name |
| 320 | if ne n long len want |
| 321 | ret false |
| 322 | end |
| 323 | for i ulong len want bound 128 |
| 324 | if ne get gcfv i get want i |
| 325 | ret false |
| 326 | end |
| 327 | end |
| 328 | ret true |
| 329 | end |
| 330 | fn slffput fld ulong name view uchar * required bool to bool |
| 331 | b = new uchar 16384 0 |
| 332 | n = slgetform name |
| 333 | if lt n 0 |
| 334 | ret false |
| 335 | end |
| 336 | if and required eq n 0 |
| 337 | ret false |
| 338 | end |
| 339 | if gt ulong n slcap fld |
| 340 | ret false |
| 341 | end |
| 342 | for i ulong ulong n bound 16384 |
| 343 | put b i get gcfv i |
| 344 | end |
| 345 | ret slput fld view part b 0 ulong n |
| 346 | end |
| 347 | fn slactor to bool |
| 348 | b = new uchar 64 0 |
| 349 | who = get gscur 0 |
| 350 | if eq who 0 |
| 351 | ret false |
| 352 | end |
| 353 | n = get gssl who |
| 354 | if gt n 64 |
| 355 | ret false |
| 356 | end |
| 357 | for i ulong n bound 64 |
| 358 | put b i get gsstr add get gsso who i |
| 359 | end |
| 360 | ret slput 0 view part b 0 n |
| 361 | end |
| 362 | fn sllicok to bool |
| 363 | if slfeq 3 tlmit |
| 364 | ret true |
| 365 | end |
| 366 | if slfeq 3 tlapache |
| 367 | ret true |
| 368 | end |
| 369 | if slfeq 3 tlbsd |
| 370 | ret true |
| 371 | end |
| 372 | ret slfeq 3 tlcc0 |
| 373 | end |
| 374 | fn slredirect id view uchar * to long |
| 375 | put fkind 0 2 |
| 376 | flocb |
| 377 | floct tlslug |
| 378 | floct id |
| 379 | ret 303 |
| 380 | end |
| 381 | fn slstore to long |
| 382 | id = new uchar 64 0 |
| 383 | if not slquota |
| 384 | ret soerr 507 tlquota |
| 385 | end |
| 386 | if ge get glidxn 0 4096 |
| 387 | ret soerr 507 tlquota |
| 388 | end |
| 389 | if not slsave |
| 390 | ret soerr 503 tloff |
| 391 | end |
| 392 | for i ulong 64 |
| 393 | put id i get glrid i |
| 394 | end |
| 395 | if eq get glrec 8 1 |
| 396 | previous = slgetstate id |
| 397 | if eq previous 2 |
| 398 | ret slredirect id |
| 399 | end |
| 400 | if eq previous 9 |
| 401 | ret soerr 503 tlmsg10 |
| 402 | end |
| 403 | if not slsetstate id 1 |
| 404 | ret soerr 503 tloff |
| 405 | end |
| 406 | end |
| 407 | ret slredirect id |
| 408 | end |
| 409 | fn slsubmit to long |
| 410 | if not slffeq tlcons tlyes |
| 411 | ret soerr 400 tlmsg9 |
| 412 | end |
| 413 | slbegin 1 |
| 414 | if not slactor |
| 415 | ret 403 |
| 416 | end |
| 417 | if not slffput 1 tltitle true |
| 418 | ret soerr 400 tlmsg9 |
| 419 | end |
| 420 | if not slffput 2 tlorigin true |
| 421 | ret soerr 400 tlmsg9 |
| 422 | end |
| 423 | if not slffput 3 tllic true |
| 424 | ret soerr 400 tlmsg9 |
| 425 | end |
| 426 | if not sllicok |
| 427 | ret soerr 400 tlmsg9 |
| 428 | end |
| 429 | if not slffput 4 tldesc true |
| 430 | ret soerr 400 tlmsg9 |
| 431 | end |
| 432 | if not slffput 5 tlsource true |
| 433 | ret soerr 400 tlmsg9 |
| 434 | end |
| 435 | for i ulong 3 |
| 436 | x = slput add i 6 tlempty |
| 437 | end |
| 438 | if not slffput 9 tlcredit true |
| 439 | ret soerr 400 tlmsg9 |
| 440 | end |
| 441 | if not slffput 10 tllang true |
| 442 | ret soerr 400 tlmsg9 |
| 443 | end |
| 444 | x = slput 11 tlver |
| 445 | ret slstore |
| 446 | end |
| 447 | fn slderive id view uchar * to long |
| 448 | origin = new uchar 512 0 |
| 449 | lic = new uchar 64 0 |
| 450 | cred = new uchar 512 0 |
| 451 | if not slpublic id |
| 452 | ret 404 |
| 453 | end |
| 454 | if ne get glrec 8 1 |
| 455 | ret 400 |
| 456 | end |
| 457 | if not slffeq tlcons tlyes |
| 458 | ret soerr 400 tlmsg9 |
| 459 | end |
| 460 | on = slfield 2 origin |
| 461 | ln = slfield 3 lic |
| 462 | cn = slfield 9 cred |
| 463 | slbegin 2 |
| 464 | if not slactor |
| 465 | ret 403 |
| 466 | end |
| 467 | if not slffput 1 tltitle true |
| 468 | ret soerr 400 tlmsg9 |
| 469 | end |
| 470 | x = slput 2 view part origin 0 on |
| 471 | x = slput 3 view part lic 0 ln |
| 472 | if not slffput 4 tldesc true |
| 473 | ret soerr 400 tlmsg9 |
| 474 | end |
| 475 | if not slffput 5 tlsource true |
| 476 | ret soerr 400 tlmsg9 |
| 477 | end |
| 478 | x = slput 6 id |
| 479 | if not slffput 7 tlstdin false |
| 480 | ret soerr 400 tlmsg9 |
| 481 | end |
| 482 | if not slffput 8 tlexpect false |
| 483 | ret soerr 400 tlmsg9 |
| 484 | end |
| 485 | x = slput 9 view part cred 0 cn |
| 486 | x = slput 10 tlomega |
| 487 | x = slput 11 tlver |
| 488 | ret slstore |
| 489 | end |
| 490 | fn slpost id view uchar * to long |
| 491 | r = sowpre |
| 492 | if ne r 0 |
| 493 | ret r |
| 494 | end |
| 495 | soratev get gscur 0 get gsnow 0 |
| 496 | if not slformvalid |
| 497 | ret soerr 400 tlmsg9 |
| 498 | end |
| 499 | if ne slgetform tsfcsrf 32 |
| 500 | ret soerr 400 tlmsg9 |
| 501 | end |
| 502 | if eq len id 0 |
| 503 | if not slffeq tlact tlsource |
| 504 | ret 400 |
| 505 | end |
| 506 | ret slsubmit |
| 507 | end |
| 508 | if slffeq tlact tlderive |
| 509 | ret slderive id |
| 510 | end |
| 511 | if not slaccess id |
| 512 | ret 404 |
| 513 | end |
| 514 | if slffeq tlact tlwith |
| 515 | if not or slown sladmin |
| 516 | ret 403 |
| 517 | end |
| 518 | if not slsetstate id 2 |
| 519 | ret 503 |
| 520 | end |
| 521 | ret slredirect id |
| 522 | end |
| 523 | if not slown |
| 524 | ret 403 |
| 525 | end |
| 526 | if eq slgetstate id 2 |
| 527 | ret soerr 409 tlmsg10 |
| 528 | end |
| 529 | if ne get glrec 8 2 |
| 530 | ret soerr 409 tlmsg10 |
| 531 | end |
| 532 | if slffeq tlact tlverify |
| 533 | if not sljobstart id |
| 534 | ret soerr 503 tlbusy |
| 535 | end |
| 536 | ret slredirect id |
| 537 | end |
| 538 | if slffeq tlact tlpub |
| 539 | if ne slreceiptget id 1 |
| 540 | ret soerr 409 tlmsg10 |
| 541 | end |
| 542 | if not slparentok |
| 543 | ret soerr 409 tlmsg10 |
| 544 | end |
| 545 | if not slsetstate id 1 |
| 546 | ret 503 |
| 547 | end |
| 548 | ret slredirect id |
| 549 | end |
| 550 | ret 400 |
| 551 | end |
| 552 | fn sllink id view uchar * suffix view uchar * label view uchar * to void |
| 553 | fput tlhref |
| 554 | fputb |
| 555 | fput tlslug |
| 556 | fesc id |
| 557 | fput suffix |
| 558 | fput tlendh |
| 559 | fput label |
| 560 | fput tlenda |
| 561 | end |
| 562 | fn slform id view uchar * to void |
| 563 | fput tlform1 |
| 564 | fputb |
| 565 | fput tlslug |
| 566 | fesc id |
| 567 | fput tlform2 |
| 568 | socsrfout |
| 569 | fput tlform3 |
| 570 | end |
| 571 | fn slbutton value view uchar * label view uchar * to void |
| 572 | fput tlbtn1 |
| 573 | fput value |
| 574 | fput tlbtn2 |
| 575 | fput label |
| 576 | fput tlbtn3 |
| 577 | end |
| 578 | fn slnewform id view uchar * derived bool to void |
| 579 | slform id |
| 580 | fput tlfields |
| 581 | if not derived |
| 582 | fput tlmsg0 |
| 583 | end |
| 584 | fput tlfcode |
| 585 | if derived |
| 586 | slesc 5 |
| 587 | end |
| 588 | fput tlmsg1 |
| 589 | if derived |
| 590 | fput tlfex |
| 591 | end |
| 592 | fput tlfcons |
| 593 | if derived |
| 594 | slbutton tlderive tlsavep |
| 595 | else |
| 596 | slbutton tlsource tlshared |
| 597 | end |
| 598 | fput tlforme |
| 599 | end |
| 600 | fn slnewpage to long |
| 601 | fput tlbase |
| 602 | fput tlh1 |
| 603 | fput tlnewh |
| 604 | fput tlh1e |
| 605 | if eq get gscur 0 0 |
| 606 | fput tlp |
| 607 | fput tlnosess |
| 608 | fput tlpe |
| 609 | else |
| 610 | slnewform tlempty false |
| 611 | end |
| 612 | fput tlclose |
| 613 | ret 200 |
| 614 | end |
| 615 | fn slbefore to ulong |
| 616 | n = get fqsl 0 |
| 617 | if eq n 0 |
| 618 | ret get glidxn 0 |
| 619 | end |
| 620 | if or lt n 8 gt n 12 |
| 621 | ret 5000 |
| 622 | end |
| 623 | for i ulong len tlbefore |
| 624 | if ne get fqs i get tlbefore i |
| 625 | ret 5000 |
| 626 | end |
| 627 | end |
| 628 | v = ulong 0 |
| 629 | for i ulong sub n 7 bound 5 |
| 630 | c = get fqs add i 7 |
| 631 | if or lt c 48 gt c 57 |
| 632 | ret 5000 |
| 633 | end |
| 634 | v = add mul v 10 ulong sub c 48 |
| 635 | end |
| 636 | if gt v get glidxn 0 |
| 637 | ret 5000 |
| 638 | end |
| 639 | ret v |
| 640 | end |
| 641 | fn slindex to long |
| 642 | id = new uchar 64 0 |
| 643 | pos = slbefore |
| 644 | if eq pos 5000 |
| 645 | ret 400 |
| 646 | end |
| 647 | fput tlbase |
| 648 | fput tlh1 |
| 649 | fput tlnewh |
| 650 | fput tlh1e |
| 651 | fput tlp |
| 652 | fput tlliste |
| 653 | fput tlpe |
| 654 | sllink tlempty tlnewurl tlnewln |
| 655 | shown = ulong 0 |
| 656 | for it ulong 32 |
| 657 | if eq pos 0 |
| 658 | break |
| 659 | end |
| 660 | pos = sub pos 1 |
| 661 | for i ulong 64 |
| 662 | put id i get glidx add mul pos 65 i |
| 663 | end |
| 664 | visible = slpublic id |
| 665 | mine = false |
| 666 | if not visible |
| 667 | if slload id |
| 668 | mine = slown |
| 669 | end |
| 670 | end |
| 671 | if or visible mine |
| 672 | fput tlcard |
| 673 | if not visible |
| 674 | if eq slgetstate id 2 |
| 675 | fput tlgone |
| 676 | else |
| 677 | fput tlpriv |
| 678 | end |
| 679 | end |
| 680 | fput tlhref |
| 681 | fputb |
| 682 | fput tlslug |
| 683 | fesc id |
| 684 | fput tlendh |
| 685 | slesc 1 |
| 686 | fput tlenda |
| 687 | fput tlp |
| 688 | slesc 4 |
| 689 | fput tlpe |
| 690 | fput tlcarde |
| 691 | shown = add shown 1 |
| 692 | end |
| 693 | end |
| 694 | if eq shown 0 |
| 695 | fput tlp |
| 696 | fput tlemptyy |
| 697 | fput tlpe |
| 698 | end |
| 699 | if gt pos 0 |
| 700 | fput tlhref |
| 701 | fputb |
| 702 | fput tlslug |
| 703 | fput tlquery |
| 704 | fnum pos |
| 705 | fput tlendh |
| 706 | fput tlnextpg |
| 707 | fput tlenda |
| 708 | end |
| 709 | fput tlclose |
| 710 | ret 200 |
| 711 | end |
| 712 | fn slitem id view uchar * to long |
| 713 | parentid = new uchar 64 0 |
| 714 | if not slaccess id |
| 715 | ret 404 |
| 716 | end |
| 717 | fput tlbase |
| 718 | sllink tlempty tlempty2 tlback |
| 719 | fput tlh1 |
| 720 | slesc 1 |
| 721 | fput tlh1e |
| 722 | fput tlp |
| 723 | slesc 4 |
| 724 | fput tlpe |
| 725 | fput tlmeta |
| 726 | slesc 0 |
| 727 | fput tlmet2 |
| 728 | slesc 2 |
| 729 | fput tlmet3 |
| 730 | slesc 3 |
| 731 | fput tlmet4 |
| 732 | slesc 9 |
| 733 | fput tlmet5 |
| 734 | fesc id |
| 735 | fput tlmet6 |
| 736 | state = slgetstate id |
| 737 | kind = get glrec 8 |
| 738 | if eq state 2 |
| 739 | fput tlp |
| 740 | fput tlmsg6 |
| 741 | fput tlpe |
| 742 | else |
| 743 | if eq kind 2 |
| 744 | if not slpublic id |
| 745 | fput tlp |
| 746 | fput tlhidden |
| 747 | fput tlpe |
| 748 | end |
| 749 | receipt = slreceiptget id |
| 750 | fput tlcard |
| 751 | if eq receipt 1 |
| 752 | fput tlpass |
| 753 | else |
| 754 | if eq receipt 2 |
| 755 | fput tlfail |
| 756 | fput tlp |
| 757 | slfailure |
| 758 | fput tlpe |
| 759 | else |
| 760 | if sljobis id |
| 761 | fput tlmsg3 |
| 762 | else |
| 763 | fput tlmsg2 |
| 764 | end |
| 765 | end |
| 766 | end |
| 767 | fput tlcarde |
| 768 | cm_partln id |
| 769 | if slown |
| 770 | slform id |
| 771 | slbutton tlverify tlcheckb |
| 772 | if eq receipt 1 |
| 773 | if ne state 1 |
| 774 | slbutton tlpub tlmsg4 |
| 775 | end |
| 776 | end |
| 777 | fput tlforme |
| 778 | end |
| 779 | end |
| 780 | if or slown sladmin |
| 781 | slform id |
| 782 | slbutton tlwith tlmsg5 |
| 783 | fput tlforme |
| 784 | end |
| 785 | end |
| 786 | fput tlcodeh |
| 787 | fput tlpre |
| 788 | slesc 5 |
| 789 | fput tlpree |
| 790 | sllink id tlraws tlmsg8 |
| 791 | if eq kind 2 |
| 792 | fput tlexh |
| 793 | fput tlpre |
| 794 | slesc 7 |
| 795 | fput tlpree |
| 796 | fput tlexeh |
| 797 | fput tlpre |
| 798 | slesc 8 |
| 799 | fput tlpree |
| 800 | fput tlproofh |
| 801 | pn = slfield 6 parentid |
| 802 | sllink view part parentid 0 pn tlempty tlparent |
| 803 | sllink id tltarurl tlbundle |
| 804 | sllink id tlrawr tlrecord |
| 805 | sllink id tlrawc tlmsg7 |
| 806 | else |
| 807 | if and eq state 1 ne get gscur 0 0 |
| 808 | fput tlh1 |
| 809 | fput tlmake |
| 810 | fput tlh1e |
| 811 | fput tlp |
| 812 | fput tlmakep |
| 813 | fput tlpe |
| 814 | slnewform id true |
| 815 | end |
| 816 | end |
| 817 | fput tlclose |
| 818 | ret 200 |
| 819 | end |
| 820 | fn slsuffix suffix view uchar * to bool |
| 821 | if ne get fpathl 0 add 73 len suffix |
| 822 | ret false |
| 823 | end |
| 824 | for i ulong len suffix bound 64 |
| 825 | if ne get fpath add i 73 get suffix i |
| 826 | ret false |
| 827 | end |
| 828 | end |
| 829 | ret true |
| 830 | end |
| 831 | fn slraw id view uchar * to long |
| 832 | if not slaccess id |
| 833 | ret 404 |
| 834 | end |
| 835 | fsetcc tlno |
| 836 | fsetcd tlattach |
| 837 | fsetct tlplain |
| 838 | put fkind 0 1 |
| 839 | fsetsbx |
| 840 | if slsuffix tltarurl |
| 841 | ret slbundle id |
| 842 | end |
| 843 | if slsuffix tlrawr |
| 844 | fsetct tlbinary |
| 845 | for i ulong get glrl 0 bound 32768 |
| 846 | fputc get glrec i |
| 847 | end |
| 848 | ret 200 |
| 849 | end |
| 850 | if slsuffix tlrawc |
| 851 | r = slreceiptget id |
| 852 | if or eq r 0 eq r 9 |
| 853 | ret 404 |
| 854 | end |
| 855 | fsetct tlbinary |
| 856 | for i ulong 353 |
| 857 | fputc get glrcpt i |
| 858 | end |
| 859 | ret 200 |
| 860 | end |
| 861 | fld = ulong 5 |
| 862 | if slsuffix tlrawi |
| 863 | fld = ulong 7 |
| 864 | else |
| 865 | if slsuffix tlrawe |
| 866 | fld = ulong 8 |
| 867 | else |
| 868 | if not slsuffix tlraws |
| 869 | ret 404 |
| 870 | end |
| 871 | end |
| 872 | end |
| 873 | for i ulong get gllen fld bound 16384 |
| 874 | fputc get glrec add get gloff fld i |
| 875 | end |
| 876 | ret 200 |
| 877 | end |
| 878 | text tlnavl "salvage/\">Bring your build</a>" |
| 879 | note slnav: the forge row entry (server/pages.om fhead), only while the store is switched on |
| 880 | fn slnav to void |
| 881 | if not slboot |
| 882 | ret |
| 883 | end |
| 884 | fput tlhref |
| 885 | fputb |
| 886 | fput tlnavl |
| 887 | end |
| 888 | fn slroute to long |
| 889 | id = new uchar 64 0 |
| 890 | if not slprefix |
| 891 | ret 0 |
| 892 | end |
| 893 | fsetcc tlno |
| 894 | sljobpoll |
| 895 | if not slboot |
| 896 | ret soerr 503 tloff |
| 897 | end |
| 898 | if or fpeq tlslash fpeq tlrootp |
| 899 | if eq get fmeth 0 3 |
| 900 | ret slpost tlempty |
| 901 | end |
| 902 | if not fget |
| 903 | ret 405 |
| 904 | end |
| 905 | ret slindex |
| 906 | end |
| 907 | if fpeq tlnewp |
| 908 | if not fget |
| 909 | ret 405 |
| 910 | end |
| 911 | ret slnewpage |
| 912 | end |
| 913 | if lt get fpathl 0 73 |
| 914 | ret 404 |
| 915 | end |
| 916 | for i ulong 64 |
| 917 | put id i get fpath add i 9 |
| 918 | end |
| 919 | if not slhex id |
| 920 | ret 404 |
| 921 | end |
| 922 | if eq get fpathl 0 73 |
| 923 | if eq get fmeth 0 3 |
| 924 | ret slpost id |
| 925 | end |
| 926 | if not fget |
| 927 | ret 405 |
| 928 | end |
| 929 | ret slitem id |
| 930 | end |
| 931 | if not fget |
| 932 | ret 405 |
| 933 | end |
| 934 | ret slraw id |
| 935 | end |
| 936 | fn slfailure to void |
| 937 | phase = get glrcpt 65 |
| 938 | if eq phase 1 |
| 939 | fput tlph1 |
| 940 | end |
| 941 | if eq phase 2 |
| 942 | fput tlph2 |
| 943 | end |
| 944 | if eq phase 3 |
| 945 | fput tlph3 |
| 946 | end |
| 947 | if eq phase 4 |
| 948 | fput tlph4 |
| 949 | end |
| 950 | if or eq phase 2 eq phase 3 |
| 951 | fput tlphx |
| 952 | fnum ulong get glrcpt 66 |
| 953 | fput tlphs |
| 954 | fnum ulong get glrcpt 67 |
| 955 | end |
| 956 | end |
| 957 | note sljobis: the queued verification job is this record |
| 958 | fn sljobis id view uchar * to bool |
| 959 | b = new uchar 64 0 |
| 960 | if not sljobid b |
| 961 | ret false |
| 962 | end |
| 963 | ret sleq id b |
| 964 | end |