interplane.Get Omega
Read in your language

interplane-forge

INTERPLANE Forge

Brought by drakestapleton

branch main Branches Tags History

interplane-forge / patch / p7route.om

133 lines · 2680 bytes Raw Blame History
1note patch/p7route.om: paroute, the slice's entry point (server/route.om fslices asks it before collab).
2note GET /<o>/<r>/patches[?page=N] the list (HTML, or forge/patch-list/1)
3note GET /<o>/<r>/patches/new how to open a patch
4note POST /<o>/<r>/patches/new the upload (patch/p4take.om)
5note GET /<o>/<r>/patches/<id> one item, signed or imported (HTML, or forge/patch/1); <id> is
6note 16 lowercase hex
7note GET /<o>/<r>/patches/<id>.patch the stored mbox bytes
8note GET /<o>/<r>/patches/<id>.diff the stored diff, or the bundle diff of an imported item
9note GET /<o>/<r>/patches/<id>.bundle the stored head.bundle of an imported item
10note GET /<o>/<r>/pulls 302 to .../patches; /pulls/<id> and /pull/<id> 302 to
11note .../patches/<id> (the names other forges use)
12note Returns 0 when the path is not one of these.
13note paseg t: frest starts with the segment t, followed by its end or a slash
14fn paseg t view uchar * to bool
15if not frstpre t
16ret false
17end
18n = len t
19if eq n get frestl 0
20ret true
21end
22ret eq get frest n 47
23end
24note paidrq a: frest[a, a+16) is 16 lowercase hex; copied into gpid
25fn paidrq a ulong to bool
26for i ulong 16
27c = get frest add a i
28if lt sohexv c 0
29ret false
30end
31put gpid i c
32end
33ret true
34end
35note pasfx a t: frest from a to its end equals t
36fn pasfx a ulong t view uchar * to bool
37if ne sub get frestl 0 a len t
38ret false
39end
40for i ulong len t bound 16
41if ne get frest add a i get t i
42ret false
43end
44end
45ret true
46end
47note paalias o: /pulls or /pull (o its length): the same pages under the names other forges use
48fn paalias o ulong to long
49if ne get fmeth 0 1
50ret 405
51end
52n = get frestl 0
53id = false
54if and ne n o ne n add o 1
55if ne sub n add o 1 16
56ret 404
57end
58if not paidrq add o 1
59ret 404
60end
61id = true
62else
63if eq o len tppull
64ret 404
65end
66end
67put fkind 0 2
68flocrepo
69floct tppats
70if id
71flocc 47
72for i ulong 16
73flocc get gpid i
74end
75end
76ret 302
77end
78fn paroute to long
79if ge get fridx 0 get fan 0
80ret 0
81end
82if paseg tppulls
83ret paalias len tppulls
84end
85if paseg tppull
86ret paalias len tppull
87end
88if not paseg tppats
89ret 0
90end
91m = get fmeth 0
92n = get frestl 0
93o = len tppats
94if or eq n o eq n add o 1
95if ne m 1
96ret 405
97end
98ret palist
99end
100if frsteq tppnew
101if eq m 3
102ret patake
103end
104if ne m 1
105ret 405
106end
107ret panewpg
108end
109if ne m 1
110ret 405
111end
112a = add o 1
113l = sub n a
114if lt l 16
115ret 404
116end
117if not paidrq a
118ret 404
119end
120if eq l 16
121ret pashow
122end
123if pasfx add a 16 tpsfxp
124ret paraws 0
125end
126if pasfx add a 16 tpsfxd
127ret paraws 1
128end
129if pasfx add a 16 tpsfxb
130ret paraws 2
131end
132ret 404
133end