mirror of
https://github.com/ilyakooo0/urbit.git
synced 2025-01-01 19:46:36 +03:00
151ization complete
Conflicts: Makefile
This commit is contained in:
parent
7268164eba
commit
d285cc5055
40
app/gh.hoon
40
app/gh.hoon
@ -18,6 +18,7 @@
|
||||
::
|
||||
// /%/split
|
||||
::
|
||||
!:
|
||||
=> |%
|
||||
++ move (pair bone card)
|
||||
++ sub-result
|
||||
@ -39,7 +40,7 @@
|
||||
--
|
||||
::
|
||||
|_ {hid/bowl cnt/@ hook/(map @t {id/@t listeners/(set bone)})}
|
||||
::++ prep ,_`.
|
||||
++ prep _`.
|
||||
::
|
||||
:: This core manages everything related to a particular request.
|
||||
::
|
||||
@ -79,8 +80,8 @@
|
||||
++ scry
|
||||
^+ .
|
||||
?+ style ~|(%invalid-style !!)
|
||||
%read read
|
||||
%listen listen
|
||||
$read read
|
||||
$listen listen
|
||||
==
|
||||
::
|
||||
++ read (send-hiss (endpoint-to-purl pax) %get ~ ~)
|
||||
@ -89,15 +90,16 @@
|
||||
::
|
||||
++ listen
|
||||
^+ .
|
||||
?> ?=({@ @ *} pax)
|
||||
=+ events=t.t.pax
|
||||
|- ^+ +>.$
|
||||
=+ paf=`path`(weld pax arg)
|
||||
?> ?=({@ @ *} paf)
|
||||
=+ events=t.t.paf
|
||||
|- ^+ +>+.$
|
||||
?~ events
|
||||
+>.$
|
||||
+>+.$
|
||||
?: (~(has by hook) i.events)
|
||||
=. +>.$ =>((update-hook i.events) ?>(?=({@ @ *} pax) .))
|
||||
=. +>+.$ (update-hook i.events)
|
||||
$(events t.events)
|
||||
=. +>.$ =>((create-hook i.events) ?>(?=({@ @ *} pax) .))
|
||||
=. +>+.$ (create-hook i.events)
|
||||
$(events t.events)
|
||||
::
|
||||
:: Set up a webhook.
|
||||
@ -105,7 +107,8 @@
|
||||
++ create-hook
|
||||
|= event/@t
|
||||
^+ +>
|
||||
?> ?=({@ @ *} pax)
|
||||
=+ paf=`path`(weld pax arg)
|
||||
?> ?=({@ @ *} paf)
|
||||
=+ clean-event=`tape`(turn (trip event) |=(a/@tD ?:(=('_' a) '-' a)))
|
||||
=. hook
|
||||
%+ ~(put by hook) (crip clean-event)
|
||||
@ -115,7 +118,7 @@
|
||||
[id (~(put in listeners) ost.hid)]
|
||||
%- send-hiss
|
||||
:* %+ scan
|
||||
=+ [(trip i.pax) (trip i.t.pax)]
|
||||
=+ [(trip i.paf) (trip i.t.paf)]
|
||||
"https://api.github.com/repos/{-<}/{->}/hooks"
|
||||
auri:epur
|
||||
%post ~ ~
|
||||
@ -138,7 +141,6 @@
|
||||
++ update-hook
|
||||
|= event/@t
|
||||
^+ +>
|
||||
?> ?=({@ @ @ *} pax)
|
||||
=+ hok=(~(got by hook) event)
|
||||
%_ +>.$
|
||||
hook
|
||||
@ -160,7 +162,7 @@
|
||||
?~ hook-data
|
||||
~& [%strange-hook hook response]
|
||||
[~ +>.$]
|
||||
~& response=response
|
||||
:: ~& response=response
|
||||
:_ +>.$
|
||||
%+ turn (~(tap in listeners.u.hook-data))
|
||||
|= ost/bone
|
||||
@ -200,12 +202,13 @@
|
||||
|= {way/wire res/httr}
|
||||
^- {(list move) _+>.$}
|
||||
?. ?=({care @ @ @ *} way)
|
||||
~& res=res
|
||||
[~ +>.$]
|
||||
=+ arg=(path (cue (slav %uv i.t.t.way)))
|
||||
:_ +>.$ :_ ~
|
||||
:+ ost.hid %diff
|
||||
?+ i.way null+~
|
||||
%x
|
||||
$x
|
||||
?~ r.res
|
||||
json+(jobe err+s+%empty-response code+(jone p.res) ~)
|
||||
=+ jon=(rush q.u.r.res apex:poja)
|
||||
@ -226,7 +229,7 @@
|
||||
=+ new-jon=(~(get by u.dir) i.arg)
|
||||
$(arg t.arg, u.jon ?~(new-jon ~ u.new-jon))
|
||||
::
|
||||
%y
|
||||
$y
|
||||
?~ r.res
|
||||
~& [err+s+%empty-response code+(jone p.res)]
|
||||
arch+*arch
|
||||
@ -246,11 +249,16 @@
|
||||
?~ dir
|
||||
[%arch `(shax (jam u.jon)) ~]
|
||||
?~ arg
|
||||
[%arch `(shax (jam u.jon)) (~(run by u.dir) ~)]
|
||||
[%arch `(shax (jam u.jon)) (~(run by u.dir) _~)]
|
||||
=+ new-jon=(~(get by u.dir) i.arg)
|
||||
$(arg t.arg, u.jon ?~(new-jon ~ u.new-jon))
|
||||
==
|
||||
::
|
||||
++ sigh-tang
|
||||
|= {way/wire tan/tang}
|
||||
^- {(list move) _+>.$}
|
||||
((slog >%gh-sigh-tang< tan) `+>.$)
|
||||
::
|
||||
:: We can't actually give the response to pretty much anything
|
||||
:: without blocking, so we just block unconditionally.
|
||||
::
|
||||
|
@ -38,6 +38,10 @@
|
||||
leaf+(trip body.comment)
|
||||
==
|
||||
[~ +>.$]
|
||||
++ diff-json
|
||||
|= {way/wire jon/json}
|
||||
~& jon
|
||||
[~ +>.$]
|
||||
++ peek
|
||||
|= {ren/@tas tyl/path}
|
||||
^- (unit (unit (pair mark *)))
|
||||
|
@ -885,7 +885,7 @@
|
||||
::
|
||||
++ back :: %ford bounce
|
||||
|= {tea/whir mar/mark cay/cage}
|
||||
(pass-note tea (ford-req -.top [%cast mar $+cay]))
|
||||
(pass-note tea (ford-req -.top [%dude |.(>[hen tea mar -.cay]<) [%cast mar $+cay]]))
|
||||
::
|
||||
++ cast-thou
|
||||
|= {mar/mark cay/cage}
|
||||
@ -1230,7 +1230,7 @@
|
||||
=+ ext=(fall p.pok %urb)
|
||||
=+ bem=?-(-.hem $beam p.hem, $spur [-.top (weld p.hem s.top)])
|
||||
~| bad-beam+q.bem
|
||||
?< =([~ 0] (sky %cw (tope bem(+ ~, r [%da now]))))
|
||||
?< =([~ 0] (sky [151 %noun] %cw (tope bem(+ ~, r [%da now]))))
|
||||
=+ wir=`whir`[%ha (tope -.bem ~)]
|
||||
=. wir ?+(mef !! $get wir, $head [%he wir])
|
||||
=. r.bem ?+(r.bem r.bem {$ud $0} da+now)
|
||||
@ -1674,7 +1674,7 @@
|
||||
:+ %$ %core
|
||||
%_ u.cor
|
||||
+12.q
|
||||
=+ ato=(sky %cx (tope root-beak [%atom (flop %_(dom . sec+dom))]))
|
||||
=+ ato=(sky [151 %noun] %cx (tope root-beak [%atom (flop %_(dom . sec+dom))]))
|
||||
=+ key=?~(ato '' ;;(@t u.ato)) :: XX jael
|
||||
`(bale)`[[our now (shas %bale eny) root-beak] [usr dom] key]
|
||||
==
|
||||
|
@ -1291,7 +1291,7 @@
|
||||
$plan (cope (abut:(meow p.kas q.kas) cof r.kas) faun)
|
||||
$reef (faun cof pit)
|
||||
$ride
|
||||
%+ cool |.(leaf+"ford: build failed")
|
||||
%+ cool |.(leaf+"ford: build failed {<hen>}")
|
||||
%+ cope $(kas q.kas)
|
||||
%- tabl-run
|
||||
|= {cof/cafe cay/cage}
|
||||
|
@ -810,7 +810,7 @@
|
||||
?. &(?=({p/* q/* r/@ s/^} q.vax) ((sane %tas) r.q.vax))
|
||||
=+ args="[%hiss wire (unit knot) mark cage]"
|
||||
:_(+>.$ [%| (ap-suck "hiss: bad hiss ask.{args}")])
|
||||
=^ gaw vel (~(slot wa vel) 7 vax)
|
||||
=^ gaw vel (~(slot wa vel) 15 vax)
|
||||
?. &(?=({p/@ q/^} q.gaw) ((sane %tas) p.q.gaw))
|
||||
:_(+>.$ [%| (ap-suck "hiss: malformed cage")])
|
||||
=+ usr=((soft (unit knot)) q.q.vax)
|
||||
|
@ -1,4 +1,6 @@
|
||||
=+ keys=,@t
|
||||
|= bal=(bale keys)
|
||||
=+ aut=authorization/(cat 3 'Basic ' key.bal)
|
||||
|=(a=hiss [%send %_(a q.q (~(add ja q.q.a) aut))])
|
||||
!:
|
||||
=+ keys=@t
|
||||
|= bal/(bale keys)
|
||||
=+ aut=authorization+(cat 3 'Basic ' key.bal)
|
||||
~& aut=`{@tas @t}`aut
|
||||
|=(a/hiss [%send %_(a q.q (~(add ja q.q.a) -.aut +.aut))])
|
||||
|
@ -1,11 +1,11 @@
|
||||
:: Converts the result of an 'issues' event into a issues:gh.
|
||||
/- gh
|
||||
/+ gh-parse
|
||||
|_ issue-comment=issue-comment:gh
|
||||
|_ issue-comment/issue-comment:gh
|
||||
++ grab
|
||||
|%
|
||||
++ json
|
||||
|= jon=^json
|
||||
|= jon/^json
|
||||
^- issue-comment:gh
|
||||
=+ top=(need ((om:jo some) jon))
|
||||
:* (need (repository:gh-parse (~(got by top) %repository)))
|
||||
|
@ -1,24 +1,24 @@
|
||||
:: Converts the result of an 'issues' event into a issues:gh.
|
||||
/- gh
|
||||
/+ gh-parse
|
||||
|_ issues=issues:gh
|
||||
|_ issues/issues:gh
|
||||
++ grab
|
||||
|%
|
||||
++ json
|
||||
|= jon=^json
|
||||
|= jon/^json
|
||||
^- issues:gh
|
||||
=+ top=(need ((om:jo some) jon))
|
||||
:* (need (repository:gh-parse (~(got by top) %repository)))
|
||||
(need (user:gh-parse (~(got by top) %sender)))
|
||||
=+ action=(need (so:jo (~(got by top) %action)))
|
||||
?+ action ~|([%bad-action action] !!)
|
||||
%assigned [action (need (user:gh-parse (~(got by top) %assignee)))]
|
||||
%unassigned [action (need (user:gh-parse (~(got by top) %assignee)))]
|
||||
%labeled [action (need (label:gh-parse (~(got by top) %label)))]
|
||||
%unlabeled [action (need (label:gh-parse (~(got by top) %label)))]
|
||||
%opened [action ~]
|
||||
%closed [action ~]
|
||||
%reopened [action ~]
|
||||
$assigned [action (need (user:gh-parse (~(got by top) %assignee)))]
|
||||
$unassigned [action (need (user:gh-parse (~(got by top) %assignee)))]
|
||||
$labeled [action (need (label:gh-parse (~(got by top) %label)))]
|
||||
$unlabeled [action (need (label:gh-parse (~(got by top) %label)))]
|
||||
$opened [action ~]
|
||||
$closed [action ~]
|
||||
$reopened [action ~]
|
||||
==
|
||||
(need (issue:gh-parse (~(got by top) %issue)))
|
||||
==
|
||||
|
@ -1,6 +1,6 @@
|
||||
|_ [method=meth endpoint=path jon=json]
|
||||
|_ {method/meth endpoint/path jon/json}
|
||||
++ grab
|
||||
|%
|
||||
++ noun ,[method=meth endpoint=path jon=json]
|
||||
++ noun {method/meth endpoint/path jon/json}
|
||||
--
|
||||
--
|
||||
|
@ -1,4 +1,4 @@
|
||||
|_ pax=path
|
||||
|_ pax/path
|
||||
++ grab
|
||||
|%
|
||||
++ noun path
|
||||
|
@ -1,4 +1,5 @@
|
||||
/+ basic-auth
|
||||
|_ [bal=(bale keys:basic-auth) ~]
|
||||
!:
|
||||
|_ {bal/(bale keys:basic-auth) $~}
|
||||
++ out (basic-auth bal)
|
||||
--
|
||||
|
Loading…
Reference in New Issue
Block a user