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/dl/dljson.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 / dl / dljson.om` 331 lines ยท 5802 bytes Raw Blame History 1 note dl/dljson.om: the machine form (JSON) of the /releases pages (ForgeDownloads, docs/API.md). 2 note dlrelr calls dljrels / dljrtag when fjwant is true. Each runs the same checks as its HTML handler 3 note (dlrels / dlrtag) before it reads anything, and shows the same facts: the same records in the same 4 note order, the same archive and asset rows, size and SHA-256 only when the HTML shows them (the cached 5 note file and its sidecar exist). Links are the HTML hrefs with the base; tag and asset names passed 6 note dlrefok / dlasok, so they are URL- and JSON-safe bytes. /releases/latest is a redirect in both forms. 7 text tdjsrel "forge/releases/1" 8 text tdjsrl1 "forge/release/1" 9 text tdjrels "releases" 10 text tdjrel "release" 11 text tdjprev "prev" 12 text tdjnext "next" 13 text tdjhtml "html" 14 text tdjpre "prerelease" 15 text tdjlat "latest" 16 text tdjtime "time" 17 text tdjsha "sha" 18 text tdjpath "path" 19 text tdjsubj "subject" 20 text tdjnote "notes" 21 text tdjarch "archives" 22 text tdjtgz "tar_gz" 23 text tdjass "assets" 24 text tdjname "name" 25 text tdjsize "size" 26 text tdjsha2 "sha256" 27 text tdjpq "?page=" 28 text tdjskip "assets_not_offered" 29 note dljrels: GET /releases[?page=N] as forge/releases/1 (dlrels' checks and paging: 10 per page) 30 fn dljrels to long 31 if not dltags 32 ret 500 33 end 34 p = dlpageq 35 s = mul sub p 1 10 36 kn = get gdkn 0 37 if and gt p 1 ge s kn 38 ret 404 39 end 40 fyrhead tdjsrel 41 fyk tdpage 42 fnum p 43 fyk tdjrels 44 fputc 91 45 for i ulong 10 46 k = add s i 47 if ge k kn 48 break 49 end 50 if gt i 0 51 fputc 44 52 end 53 fputc 10 54 dljrel get gdkeep k false 55 end 56 fputc 93 57 dljpager p kn 58 fyend 59 ret 200 60 end 61 note dljpager: ,"prev":,"next": (dlpager's links) 62 fn dljpager p ulong kn ulong to void 63 fyk tdjprev 64 if gt p 1 65 dljpgl sub p 1 66 else 67 fynull 68 end 69 fyk tdjnext 70 if lt mul p 10 kn 71 dljpgl add p 1 72 else 73 fynull 74 end 75 end 76 fn dljpgl n ulong to void 77 fputc 34 78 fputrl 79 fput tdrel 80 fput tdjpq 81 fnum n 82 fputc 34 83 end 84 note dljrtag: GET /releases/tag/ as forge/release/1 (dlrtag's checks: 404 too long or unknown, 85 note 400 a refused tag name), with the release-assets/ files 86 fn dljrtag to long 87 if not dltags 88 ret 500 89 end 90 if not dlrcopy len tdrtag get frestl 0 91 ret 404 92 end 93 if not dlrefok 94 ret 400 95 end 96 r = dlrfind 97 if eq r DLNONE 98 ret 404 99 end 100 fyrhead tdjsrl1 101 fyk tdjrel 102 dljrel r true 103 fyend 104 ret 200 105 end 106 note dljrel: the release object of kept record r (dlrel1's facts); full adds the assets array, else null 107 fn dljrel r ulong full bool to void 108 dlsn2ref r 109 dlsetsha r 110 fputc 123 111 fyk0 tdtag 112 dljref 113 fyk tdjhtml 114 fputc 34 115 fputrl 116 fput tdrtag 117 dljrraw 118 fputc 34 119 fyk tdjpre 120 fybool dlpre 121 fyk tdjlat 122 fybool eq get gdlat 0 r 123 fyk tdjtime 124 dlfld r 6 125 fjiso dljnum 126 dljcmt 127 dljnotes r 128 dljarchs 129 fyk tdjass 130 if full 131 dljassets 132 else 133 fynull 134 end 135 fyk tdjskip 136 if full 137 fnum get gdaskip 0 138 else 139 fynull 140 end 141 fputc 125 142 end 143 note dljref: the tag name gdref as a JSON string; dljrraw: its bytes inside an open string (a link) 144 fn dljref to void 145 fjtb 146 for i ulong get gdrefl 0 147 fjtc get gdref i 148 end 149 fjstr 150 end 151 fn dljrraw to void 152 for i ulong get gdrefl 0 153 fputc get gdref i 154 end 155 end 156 note dljnum: the decimal field gdtl[gdfa, gdfa + gdfn) (creatordate:unix), 0 when empty or not digits 157 fn dljnum to ulong 158 a = get gdfa 0 159 v = ulong 0 160 for i ulong get gdfn 0 bound `1048576` 161 c = get gdtl add a i 162 if not dldig c 163 ret 0 164 end 165 v = add mul v 10 ulong sub c 48 166 end 167 ret v 168 end 169 note dljcmt: ,"commit":{"sha":"<40 hex>","path":"//commit/"} of gdsha 170 fn dljcmt to void 171 fyk tdcommit 172 fputc 123 173 fyk0 tdjsha 174 fputc 34 175 dljsha 176 fputc 34 177 fyk tdjpath 178 fputc 34 179 fputrl 180 fput tdcommp 181 dljsha 182 fputc 34 183 fputc 125 184 end 185 fn dljsha to void 186 for i ulong 40 187 fputc get gdsha i 188 end 189 end 190 note dljnotes: ,"subject":..,"notes":.. of an annotated tag (dlmsg, as dlnotes), null when the tag is 191 note lightweight or the part is empty (the HTML then shows no paragraph) 192 fn dljnotes r ulong to void 193 dlfld r 1 194 an = dlfeq tdtag 195 if an 196 an = dlmsg r 197 end 198 fyk tdjsubj 199 dljmsgf an get gdmsa 0 get gdmsn 0 200 fyk tdjnote 201 dljmsgf an get gdmba 0 get gdmbn 0 202 end 203 fn dljmsgf an bool a ulong n ulong to void 204 if and an gt n 0 205 fjtb 206 for i ulong n bound `16777216` 207 fjtc get fxo add a i 208 end 209 fjstr 210 ret 211 end 212 fynull 213 end 214 note dljarchs: ,"archives":{"zip":{..},"tar_gz":{..}} (dlarow 1 and 2) 215 fn dljarchs to void 216 fyk tdjarch 217 fputc 123 218 fyk0 tdezip 219 dljarow 1 220 fyk tdjtgz 221 dljarow 2 222 fputc 125 223 end 224 note dljarow: one source archive of the release in gdref / gdsha: name, path, size, sha256 225 fn dljarow fmt ulong to void 226 put gdfmt 0 fmt 227 dlprefix 228 if eq fmt 1 229 dlfinal tdezip 230 else 231 dlfinal tdetgz 232 end 233 fputc 123 234 fyk0 tdjname 235 fjtb 236 for i ulong get gdprel 0 237 fjtc get gdpre i 238 end 239 dljext fmt 240 fjstr 241 fyk tdjpath 242 fputc 34 243 fputrl 244 fput tdarht 245 dljrraw 246 if eq fmt 1 247 fput tdzip 248 else 249 fput tdtgz 250 end 251 fputc 34 252 dljsum 253 fputc 125 254 end 255 fn dljext fmt ulong to void 256 if eq fmt 1 257 for i ulong len tdzip 258 fjtc get tdzip i 259 end 260 ret 261 end 262 for i ulong len tdtgz 263 fjtc get tdtgz i 264 end 265 end 266 note dljsum: ,"size":,"sha256":"<64 hex>" of gdf when it is built with its sidecar (dlsumcells), 267 note else both null; never builds or hashes anything 268 fn dljsum to void 269 if dlexists 270 if dlsumrd 271 fyk tdjsize 272 fnum get gdsize 0 273 fyk tdjsha2 274 fputc 34 275 for i ulong 64 276 fputc get gdhex i 277 end 278 fputc 34 279 ret 280 end 281 end 282 fyk tdjsize 283 fynull 284 fyk tdjsha2 285 fynull 286 end 287 note dljassets: the release-assets/ files of the commit in gdsha as an array (dlassets' rows) 288 fn dljassets to void 289 dllsa 290 c = new uchar 40 0 291 for i ulong 40 292 put c i get gdsha i 293 end 294 fputc 91 295 for k ulong get gdan 0 bound 131072 296 if gt k 0 297 fputc 44 298 end 299 dljasrow k 300 end 301 fputc 93 302 for i ulong 40 303 put gdsha i get c i 304 end 305 end 306 note dljasrow: asset k: name, path (/releases/download//), size, sha256 307 fn dljasrow k ulong to void 308 fputc 123 309 fyk0 tdjname 310 n = get gdanl k 311 b = get gdano k 312 fjtb 313 for i ulong n 314 fjtc get fxo add b i 315 end 316 fjstr 317 fyk tdjpath 318 fputc 34 319 fputrl 320 fput tdrdl 321 dljrraw 322 fputc 47 323 for i ulong n 324 fputc get fxo add b i 325 end 326 fputc 34 327 dlabsha k 328 dlfblob 329 dljsum 330 fputc 125 331 end