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/60json.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 / 60json.om`
223 lines ยท 3893 bytes Raw Blame History
1 note social/60json.om: the machine form (JSON, docs/API.md) of the public social pages:
2 note forge/stargazers/1, forge/watchers/1, forge/user/1 (account profiles, every tab) and forge/stars/1
3 note (the signed-in user's own lists). Same facts as the HTML handler in 55pages.om, same order, same
4 note validation before; never a session, key, IP or CSRF token. Strings go through fjtb/fjtc/fjstr.
5 note sojid: string id s from offset a as a JSON string
6 fn sojid s ulong a ulong to void
7 fjtb
8 o = get gsso s
9 l = get gssl s
10 if lt a l
11 for i ulong sub l a bound 4096
12 fjtc get gsstr add add o a i
13 end
14 end
15 fjstr
16 end
17 note sojsegb d: append the account's URL segment (display name, else z... key) to fjt (as sonmout)
18 fn sojsegb d ulong to void
19 s = get gsnm d
20 a = ulong 0
21 if eq s 0
22 s = d
23 a = len tsdidp
24 end
25 o = get gsso s
26 l = get gssl s
27 if ge a l
28 ret
29 end
30 for i ulong sub l a bound 4096
31 fjtc get gsstr add add o a i
32 end
33 end
34 fn sojseg d ulong to void
35 fjtb
36 sojsegb d
37 fjstr
38 end
39 note sojpath d: "", the href of the account's profile (souser, sonmout)
40 fn sojpath d ulong to void
41 fjtb
42 for i ulong get fbasel 0 bound 64
43 fjtc get fbase i
44 end
45 sojsegb d
46 fjstr
47 end
48 fn sojq t view uchar * to void
49 fputc 34
50 fput t
51 fputc 34
52 end
53 note sojuhd t d: {"schema":"","base":"","user":""
54 fn sojuhd t view uchar * d ulong to void
55 fjstart
56 fput tsjh1
57 fput t
58 fput tsjh2
59 fputb
60 fput tsjh3
61 sojseg d
62 end
63 note sojuser d: {"name":"","path":""}
64 fn sojuser d ulong to void
65 fputc 123
66 fyk0 tsjname
67 sojseg d
68 fyk tsjpath
69 sojpath d
70 fputc 125
71 end
72 note sojusers: the JSON array of sousers (same table walk, same order)
73 fn sojusers kind ulong x ulong side ulong to void
74 fputc 91
75 c = ulong 0
76 for s ulong 262144
77 k = get gsrk s
78 if and ne k 0 ne get gsrv s 0
79 if eq shr k 48 kind
80 a = and shr k 24 `16777215`
81 b = and k `16777215`
82 d = b
83 y = a
84 if eq side 1
85 d = a
86 y = b
87 end
88 if eq y x
89 if gt c 0
90 fputc 44
91 end
92 c = add c 1
93 sojuser d
94 end
95 end
96 end
97 end
98 fputc 93
99 end
100 note sojrepo i t: {"name":..,"rid":"rad:..","path":"/","stars":n} (sorepoli)
101 fn sojrepo i ulong t ulong to void
102 fput tsjr1
103 fjtname i
104 fjstr
105 fput tsjr2
106 fputid i
107 fput tsjr3
108 fjpath i
109 fput tsjr4
110 fnum get gscst t
111 fputc 125
112 end
113 note sojrepos: the JSON array of sorepol (same walk of the allow-list, same order)
114 fn sojrepos kind ulong a ulong to void
115 fputc 91
116 c = ulong 0
117 for i ulong get fan 0 bound 4096
118 t = sorepoid i
119 if and ne t 0 soron kind a t
120 if gt c 0
121 fputc 44
122 end
123 c = add c 1
124 sojrepo i t
125 end
126 end
127 fputc 93
128 end
129 note sojstars: the repos the user in fown starred, as a JSON array (sostarsof; the server's owner profile)
130 fn sojstars to void
131 d = soownid
132 if eq d 0
133 fputc 91
134 fputc 93
135 ret
136 end
137 sojrepos 1 d
138 end
139 note sojlist: ///stargazers (kind 1) and /watchers (kind 3) of repo id t (sorlist)
140 fn sojlist kind ulong t ulong to long
141 if eq kind 1
142 fyrhead tsjsg
143 else
144 fyrhead tsjwr
145 end
146 fyk tsjcnt
147 if eq kind 1
148 fnum get gscst t
149 else
150 fnum get gscwt t
151 end
152 fyk tsjusrs
153 if eq t 0
154 fputc 91
155 fputc 93
156 else
157 sojusers kind t 1
158 end
159 fyend
160 ret 200
161 end
162 note sojprof: forge/user/1 of account d (soprof); tab as soprof: 4 followers, 5 following, else stars
163 fn sojprof d ulong tab ulong to long
164 sojuhd tsjuser d
165 fyk tsjdid
166 sojid d 0
167 fyk tsqfls
168 fnum get gscfl d
169 fyk tsqflg
170 fnum get gscfg d
171 fyk tsqtab
172 if eq tab 4
173 sojq tsqfls
174 end
175 if eq tab 5
176 sojq tsqflg
177 end
178 if and ne tab 4 ne tab 5
179 sojq tsqstar
180 end
181 fyk tsjrepos
182 fynull
183 fyk tsjsrcv
184 fynull
185 fyk tsjfrcv
186 fynull
187 fyk tsjstrd
188 if and ne tab 4 ne tab 5
189 sojrepos 1 d
190 else
191 fynull
192 end
193 fyk tsjusrs
194 if eq tab 4
195 sojusers 4 d 1
196 end
197 if eq tab 5
198 sojusers 4 d 0
199 end
200 if and ne tab 4 ne tab 5
201 fynull
202 end
203 fyend
204 ret 200
205 end
206 note sojstarp: forge/stars/1 of the signed-in account u, list kind 1 stars, 2 favorites, 3 watching
207 fn sojstarp u ulong kind ulong to long
208 sojuhd tsjstar u
209 fyk tsqtab
210 if eq kind 1
211 sojq tsqstar
212 end
213 if eq kind 2
214 sojq tsqfav
215 end
216 if eq kind 3
217 sojq tsqwat
218 end
219 fyk tsjrepos
220 sojrepos kind u
221 fyend
222 ret 200
223 end