Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/interplane-forge/blob/main/social/55pages.om # interplane-forge INTERPLANE Forge Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `interplane-forge / social / 55pages.om` 784 lines ยท 11527 bytes Raw Blame History 1 note social/55pages.om: soroute, the social pages, POST actions, and the contract fragments. 2 note ---- router 3 fn soroute to long 4 if sopis tsplogin 5 ret sologin 6 end 7 if sopis tsplogo 8 ret sologout 9 end 10 if sopis tspset 11 ret sosettings 12 end 13 if sopis tspsetn 14 ret sosetname 15 end 16 if sopis tspstars 17 ret sostarsp 18 end 19 if sopis tspfol 20 ret sofollow true 21 end 22 if sopis tspunf 23 ret sofollow false 24 end 25 if ne get fridx 0 9999 26 ret sorepor 27 end 28 ret souserp 29 end 30 note ---- form and link pieces 31 fn socsrfout to void 32 for i ulong get fcsrfl 0 bound 64 33 fescc get fcsrf i 34 end 35 end 36 fn sopathout to void 37 for i ulong get fpathl 0 bound 4096 38 fescc get fpath i 39 end 40 end 41 note softail: close the action attribute, add csrf + back, the button, close the form 42 fn softail lbl view uchar * to void 43 fput tshf2 44 socsrfout 45 fput tshf3 46 sopathout 47 fput tshf4 48 fput lbl 49 fput tshf5 50 end 51 fn sorform act view uchar * lbl view uchar * to void 52 fput tshf1 53 fputb 54 fputrepo 55 fput act 56 softail lbl 57 end 58 fn sorcnt sp view uchar * n ulong w view uchar * to void 59 fput tsha1 60 fputb 61 fputrepo 62 fput sp 63 fput tsha2 64 fnum n 65 fput w 66 fput tsha3 67 end 68 note sorkeyt: the string id of allow-list repo i into sokb: "rad:" for a project with an old 69 note Radicle id (every target already in the log), "git:" for a store project without one 70 note (fhasal, server/radsrc.om or store/repos.om). An index past the list gives "rad:" alone, as the 71 note empty frid did before. 72 fn sorkeyt i ulong to void 73 sokclr 74 if ge i get fan 0 75 sokt tsradp 76 ret 77 end 78 if fhasal i 79 sokt tsradp 80 else 81 sokt tsgitp 82 end 83 n = fridlen i 84 for k ulong n bound 128 85 sokc fridbyte i k 86 end 87 end 88 note sorepoid: string id of allow-list index i (sorkeyt; 0 when nobody touched it) 89 fn sorepoid i ulong to ulong 90 sorkeyt i 91 ret sofind 92 end 93 note soownid: account DID id for the user name in fown (0 when none) 94 fn soownid to ulong 95 n = get fownl 0 96 if or eq n 0 gt n 39 97 ret 0 98 end 99 sokclr 100 for i ulong n bound 64 101 sokc get fown i 102 end 103 ret get gsnmo sofind 104 end 105 note sonmout: the account's URL segment: its display name, else the z... key of its DID 106 fn sonmout d ulong to void 107 n = get gsnm d 108 if ne n 0 109 sooutid n 0 110 ret 111 end 112 sooutid d len tsdidp 113 end 114 note sorsvk: gskb holds a display name or the z... key of a DID; the account id or 0 115 fn sorsvk to ulong 116 if sonameok 117 ret get gsnmo sofind 118 end 119 n = get gskbl 0 120 if or lt n 40 gt n 60 121 ret 0 122 end 123 z = new uchar 64 0 124 for i ulong n bound 64 125 put z i get gskb i 126 end 127 sokclr 128 sokt tsdidp 129 sokt part z 0 n 130 s = sofind 131 if eq get gsacc s 0 132 ret 0 133 end 134 ret s 135 end 136 note ---- contract fragments and counts 137 fn sostarn i ulong to ulong 138 ret get gscst sorepoid i 139 end 140 fn sofavn i ulong to ulong 141 ret get gscfv sorepoid i 142 end 143 fn sofolln to ulong 144 ret get gscfl soownid 145 end 146 fn sofollg to ulong 147 ret get gscfg soownid 148 end 149 note sobar: star / watch / favorite forms and counts for repo fridx 150 fn sobar to void 151 i = get fridx 0 152 if or eq i 9999 eq get gsok 0 0 153 ret 154 end 155 t = sorepoid i 156 u = get gscur 0 157 fput tshbar1 158 if eq u 0 159 sosignin tssinst 160 end 161 if ne u 0 162 if soron 1 u t 163 sorform tsrunst tsbunst 164 else 165 sorform tsrstar tsbstar 166 end 167 end 168 sorcnt tsrsg get gscst t tswstar 169 if ne u 0 170 if soron 3 u t 171 sorform tsrunwt tsbunwt 172 else 173 sorform tsrwat tsbwat 174 end 175 end 176 sorcnt tsrwr get gscwt t tswwat 177 if ne u 0 178 if soron 2 u t 179 sorform tsrunfv tsbunfv 180 else 181 sorform tsrfav tsbfav 182 end 183 end 184 fput tshbar2 185 end 186 fn sosignin lbl view uchar * to void 187 fput tsha1 188 flink tsplog2 189 fput tsha2 190 fput lbl 191 fput tsha3 192 end 193 fn sofolbar to void 194 soflbar soownid 195 end 196 note soflbar: follower/following counts and the follow form for account d 197 fn soflbar d ulong to void 198 if or eq d 0 eq get gsok 0 0 199 ret 200 end 201 fput tshbar1 202 souln d tsqfls get gscfl d tswfls 203 souln d tsqflg get gscfg d tswflg 204 u = get gscur 0 205 if eq u 0 206 sosignin tssinfl 207 end 208 if and ne u 0 ne u d 209 fput tshf1 210 fputb 211 if soron 4 u d 212 fput tspunf2 213 sofolf d tsbunfl 214 else 215 fput tspfol2 216 sofolf d tsbfol 217 end 218 end 219 fput tshbar2 220 end 221 fn sofolf d ulong lbl view uchar * to void 222 fput tshfu 223 sonmout d 224 softail lbl 225 end 226 fn souln d ulong q view uchar * n ulong w view uchar * to void 227 fput tsha1 228 fputb 229 sonmout d 230 fput tsqtabe 231 fput q 232 fput tsha2 233 fnum n 234 fput w 235 fput tsha3 236 end 237 fn sostarsof to void 238 d = soownid 239 if eq d 0 240 fput tsnone 241 ret 242 end 243 sorepol 1 d 244 end 245 note sorepol: allow-listed repos with relation kind by actor a (private repos never appear) 246 fn sorepol kind ulong a ulong to void 247 c = ulong 0 248 n = get fan 0 249 fput tsul1 250 for i ulong n bound 4096 251 t = sorepoid i 252 if and ne t 0 soron kind a t 253 c = add c 1 254 sorepoli i t 255 end 256 end 257 fput tsul2 258 if eq c 0 259 fput tsnone 260 end 261 end 262 fn sorepoli i ulong t ulong to void 263 fput tsli1 264 fput tsrepo1 265 fputb 266 fput tfowner 267 fput tsslash 268 fputrn i 269 fput tsha2 270 fput tfowner 271 fput tsslash 272 fputrn i 273 fput tsha3 274 fput tsmut1 275 fnum get gscst t 276 fput tswstar 277 fput tsmut2 278 fput tsli2 279 end 280 note sousers: side 1 lists actors a of (kind, a, x); side 0 lists targets b of (kind, x, b) 281 fn sousers kind ulong x ulong side ulong to void 282 fput tsul1 283 c = ulong 0 284 for s ulong 262144 285 k = get gsrk s 286 if and ne k 0 ne get gsrv s 0 287 if eq shr k 48 kind 288 a = and shr k 24 `16777215` 289 b = and k `16777215` 290 if and eq side 1 eq b x 291 c = add c 1 292 soli a 293 end 294 if and eq side 0 eq a x 295 c = add c 1 296 soli b 297 end 298 end 299 end 300 end 301 fput tsul2 302 if eq c 0 303 fput tsnone 304 end 305 end 306 fn soli d ulong to void 307 fput tsli1 308 souser d 309 fput tsli2 310 end 311 note ---- query tabs 312 fn sotab to ulong 313 n = fqget tsqtab 314 if lt n 1 315 ret 0 316 end 317 m = ulong n 318 if sofvis tsqfav m 319 ret 1 320 end 321 if sofvis tsqwat m 322 ret 3 323 end 324 if sofvis tsqfls m 325 ret 4 326 end 327 if sofvis tsqflg m 328 ret 5 329 end 330 if sofvis tsqstar m 331 ret 6 332 end 333 ret 9 334 end 335 fn sofvis t view uchar * n ulong to bool 336 if ne n len t 337 ret false 338 end 339 for i ulong n bound 64 340 if ne get fval i get t i 341 ret false 342 end 343 end 344 ret true 345 end 346 note ---- repo actions and lists 347 fn sorepor to long 348 a = soracode 349 if eq a 0 350 ret 0 351 end 352 if ge a 20 353 if gt get fmeth 0 2 354 ret 405 355 end 356 ret sorlist a 357 end 358 if ne get fmeth 0 3 359 ret 405 360 end 361 r = sowpre 362 if ne r 0 363 ret r 364 end 365 ret soract2 a 366 end 367 fn soracode to ulong 368 if sorestis tsrstar 369 ret 1 370 end 371 if sorestis tsrunst 372 ret 2 373 end 374 if sorestis tsrfav 375 ret 3 376 end 377 if sorestis tsrunfv 378 ret 4 379 end 380 if sorestis tsrwat 381 ret 5 382 end 383 if sorestis tsrunwt 384 ret 6 385 end 386 if sorestis tsrsg 387 ret 20 388 end 389 if sorestis tsrwr 390 ret 21 391 end 392 ret 0 393 end 394 note soract2: idempotent; an event is logged only when the state changes 395 fn soract2 a ulong to long 396 u = get gscur 0 397 sorkeyt get fridx 0 398 t = sofind 399 on = eq rem a 2 1 400 kind = add div sub a 1 2 1 401 cur = false 402 if ne t 0 403 cur = soron kind u t 404 end 405 if ne cur on 406 if not soemit a u 407 ret soerr 500 tsmwrite 408 end 409 end 410 d = new uchar 256 0 411 k = ulong 0 412 for i ulong get fownl 0 bound 64 413 put d k get fown i 414 k = add k 1 415 end 416 put d k 47 417 k = add k 1 418 for i ulong get frepol 0 bound 128 419 put d k get frepo i 420 k = add k 1 421 end 422 ret sobackto part d 0 k 423 end 424 fn sorlist a ulong to long 425 t = sorepoid get fridx 0 426 if fjwant 427 if eq a 20 428 ret sojlist 1 t 429 end 430 ret sojlist 3 t 431 end 432 fyalt 433 kind = ulong 1 434 if eq a 20 435 fsetti tstsg 436 else 437 fsetti tstwr 438 kind = ulong 3 439 end 440 frepohd 99 441 fput tsh2a 442 if eq kind 1 443 fput tstsg 444 else 445 fput tstwr 446 end 447 fput tsh2b 448 if eq t 0 449 fput tsnone 450 ret 200 451 end 452 sousers kind t 1 453 ret 200 454 end 455 note sobackto: 303 to base + back (validated body field) or else base + def 456 fn sobackto def view uchar * to long 457 put fkind 0 2 458 flocb 459 b = new uchar 512 0 460 n = sobval tsbk b 461 if gt n 0 462 if sobackok part b 0 ulong n 463 for i ulong sub ulong n 1 bound 512 464 flocc get b add i 1 465 end 466 ret 303 467 end 468 end 469 floct def 470 ret 303 471 end 472 note sobackok: "/" then [A-Za-z0-9._~/-] with no "//" and no "/." (no traversal, no other host) 473 fn sobackok s view uchar * to bool 474 if ne get s 0 47 475 ret false 476 end 477 for i ulong len s bound 512 478 c = get s i 479 if not sourlc c 480 ret false 481 end 482 if gt i 0 483 p = get s sub i 1 484 if and eq p 47 or eq c 47 eq c 46 485 ret false 486 end 487 end 488 end 489 ret true 490 end 491 fn sourlc c uchar to bool 492 if and ge c 65 le c 90 493 ret true 494 end 495 if and ge c 97 le c 122 496 ret true 497 end 498 if and ge c 48 le c 57 499 ret true 500 end 501 ret or or eq c 45 eq c 46 or or eq c 95 eq c 126 eq c 47 502 end 503 note ---- follow 504 fn sofollow on bool to long 505 if ne get fmeth 0 3 506 ret 405 507 end 508 r = sowpre 509 if ne r 0 510 ret r 511 end 512 raw = new uchar 64 0 513 n = sobval tsfuser raw 514 if lt n 1 515 ret soerr 400 tsmnous 516 end 517 sokclr 518 for i ulong ulong n 519 sokc get raw i 520 end 521 d = sorsvk 522 if eq d 0 523 ret soerr 404 tsmnous 524 end 525 u = get gscur 0 526 if eq d u 527 ret soerr 400 tsmself 528 end 529 if ne soron 4 u d on 530 sokclr 531 sokid d 532 a = ulong 8 533 if on 534 a = ulong 7 535 end 536 if not soemit a u 537 ret soerr 500 tsmwrite 538 end 539 end 540 ret sobackto part raw 0 ulong n 541 end 542 note ---- pages 543 fn sopgin to long 544 fput tsin1 545 for i ulong get fuserl 0 bound 64 546 fescc get fuser i 547 end 548 fput tsin2 549 fput tsrepo1 550 flink tspset2 551 fput tsha2 552 fput tsin3 553 fput tsha3 554 sologf 555 ret 200 556 end 557 fn sologf to void 558 fput tshf1 559 flink tsplo2 560 softail tsbout 561 end 562 fn sopglog nh view uchar * ts ulong mac view uchar * to long 563 fput tslg1 564 c = new uchar 96 0 565 l = sochal nh ts c 566 fesc part c 0 l 567 fput tslg2 568 flink tsplog2 569 fput tslg3 570 fput mac 571 fput tslg4 572 fput nh 573 fput tslg5 574 d = new uchar 20 0 575 k = sodec ts d 576 fput part d 0 k 577 fput tslg6 578 ret 200 579 end 580 fn sosettings to long 581 if gt get fmeth 0 2 582 ret 405 583 end 584 u = get gscur 0 585 if eq u 0 586 ret soback tsplog2 587 end 588 fsetti tstset 589 fput tsst1 590 sooutid u 0 591 n = get gsnm u 592 if eq n 0 593 fput tsst2n 594 else 595 fput tsst2 596 sooutid n 0 597 fput tsst3 598 end 599 fput tsst4 600 if ne u get gsown 0 601 fput tsst5 602 flink tspsn2 603 fput tsst6 604 socsrfout 605 fput tsst7 606 end 607 fput tsst8 608 sologf 609 ret 200 610 end 611 fn sostarsp to long 612 if gt get fmeth 0 2 613 ret 405 614 end 615 u = get gscur 0 616 if eq u 0 617 ret soback tsplog2 618 end 619 fsetti tststar 620 tab = sotab 621 kind = ulong 1 622 if eq tab 1 623 kind = ulong 2 624 end 625 if eq tab 3 626 kind = ulong 3 627 end 628 if fjwant 629 ret sojstarp u kind 630 end 631 fyalt 632 fput tsh1a 633 fput tststar 634 fput tsh1b 635 fput tstab1 636 sostabl 1 kind tslstar tsqstar 637 sostabl 2 kind tslfav tsqfav 638 sostabl 3 kind tslwat tsqwat 639 fput tstab2 640 if eq kind 2 641 fput tsfavp 642 end 643 sorepol kind u 644 ret 200 645 end 646 fn sostabl code ulong cur ulong lbl view uchar * q view uchar * to void 647 if eq code cur 648 fput tstabon 649 else 650 fput tsrepo1 651 end 652 fputb 653 fput tspstr2 654 if ne code 1 655 fput tsqtabe 656 fput q 657 end 658 fput tsha2 659 fput lbl 660 fput tsha3 661 end 662 note souserp: /, //followers, //following for accounts; is the display 663 note name or the z... key. The owner's plain profile stays the server's. 664 fn souserp to long 665 n = get fpathl 0 666 if or lt n 2 gt n 80 667 ret 0 668 end 669 j = ulong 1 670 for it ulong 80 671 if or ge j n eq get fpath j 47 672 break 673 end 674 j = add j 1 675 end 676 tab = sotab 677 if lt j n 678 tab = sosegtab j 679 if eq tab 0 680 ret 0 681 end 682 end 683 sokclr 684 for i ulong sub j 1 bound 80 685 sokc get fpath add i 1 686 end 687 d = sorsvk 688 if eq d 0 689 ret 0 690 end 691 if and eq d get gsown 0 and ne tab 4 ne tab 5 692 ret 0 693 end 694 if gt get fmeth 0 2 695 ret 405 696 end 697 tn = new uchar 80 0 698 l = sub j 1 699 for i ulong l bound 80 700 put tn i get fpath add i 1 701 end 702 fsetti part tn 0 l 703 if fjwant 704 ret sojprof d tab 705 end 706 fyalt 707 ret soprof d tab 708 end 709 note sosegtab: the rest of fpath from j is "/followers" (4) or "/following" (5); else 0 710 fn sosegtab j ulong to ulong 711 if sopsub j tspfls 712 ret 4 713 end 714 if sopsub j tspflg 715 ret 5 716 end 717 ret 0 718 end 719 fn sopsub j ulong t view uchar * to bool 720 if ne sub get fpathl 0 j len t 721 ret false 722 end 723 for i ulong len t bound 64 724 if ne get fpath add j i get t i 725 ret false 726 end 727 end 728 ret true 729 end 730 fn soprof d ulong tab ulong to long 731 fput tsh1a 732 sonmout d 733 fput tsh1b 734 fput tsdid1 735 sooutid d 0 736 fput tsdid2 737 soflbar d 738 fput tstab1 739 k = tab 740 if or eq tab 0 eq tab 9 741 k = ulong 6 742 end 743 sotabl d 6 k 744 sotabl d 4 k 745 sotabl d 5 k 746 fput tstab2 747 if eq k 4 748 sousers 4 d 1 749 ret 200 750 end 751 if eq k 5 752 sousers 4 d 0 753 ret 200 754 end 755 sorepol 1 d 756 ret 200 757 end 758 note sotabl: profile tab code (6 stars, 4 followers, 5 following) for account d; cur is marked 759 fn sotabl d ulong code ulong cur ulong to void 760 if eq code cur 761 fput tstabon 762 else 763 fput tsrepo1 764 end 765 fputb 766 sonmout d 767 fput tsqtabe 768 if eq code 6 769 fput tsqstar 770 fput tsha2 771 fput tslstar 772 end 773 if eq code 4 774 fput tsqfls 775 fput tsha2 776 fput tslfls 777 end 778 if eq code 5 779 fput tsqflg 780 fput tsha2 781 fput tslflg 782 end 783 fput tsha3 784 end