mirror of
https://github.com/urbit/shrub.git
synced 2025-01-03 10:02:32 +03:00
Merge branch 'twit-app' into dot-plan
Pull in working :twit and various fixes it depends on, to add write-plan-account logic to it
This commit is contained in:
commit
a3781a4777
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
/sec/**/*.atom
|
@ -32,7 +32,7 @@
|
||||
{$pill p/path} :: noun to unix pill
|
||||
:: {$tree p/path} :: noun to unix tree
|
||||
{$file p/beam} :: save to clay
|
||||
{$http p/?($post $put) q/iden r/purl} :: http outbound
|
||||
{$http p/?($post $put) q/(unit iden) r/purl} :: http outbound
|
||||
{$poke p/goal} :: poke app
|
||||
{$show p/?($0 $1 $2 $3)} :: print val+span+twig
|
||||
{$verb p/term} :: store variable
|
||||
@ -42,7 +42,7 @@
|
||||
q/dojo-build :: general build
|
||||
== ::
|
||||
++ dojo-build :: one arvo step
|
||||
$% {$ur p/iden q/purl} :: http GET request
|
||||
$% {$ur p/(unit iden) q/purl} :: http GET request
|
||||
{$ge p/dojo-model} :: generator
|
||||
{$dv p/path} :: core from source
|
||||
{$ex p/twig} :: hoon expression
|
||||
@ -87,7 +87,7 @@
|
||||
++ card :: general card
|
||||
$% {$diff $sole-effect sole-effect} ::
|
||||
{$send wire {ship term} clap} ::
|
||||
{$hiss wire {$~ iden} mark {$hiss hiss}} ::
|
||||
{$hiss wire (unit iden) mark {$hiss hiss}} ::
|
||||
{$exec wire @p (unit {beak silk})} ::
|
||||
{$deal wire sock term club} ::
|
||||
{$info wire @p toro} ::
|
||||
@ -167,8 +167,8 @@
|
||||
;~(plug (cold %file tar) dp-beam)
|
||||
;~(plug (cold %flat pat) (most fas qut))
|
||||
;~(plug (cold %pill dot) (most fas sym))
|
||||
;~(plug (cold %http lus) (easy %post) dp-iden-url)
|
||||
;~(plug (cold %http hep) (easy %put) dp-iden-url)
|
||||
;~(plug (cold %http lus) (stag %post dp-iden-url))
|
||||
;~(plug (cold %http hep) (stag %put dp-iden-url))
|
||||
(stag %show (cook $?($1 $2 $3) (cook lent (stun [1 3] wut))))
|
||||
==
|
||||
++ dp-hooves :: hoof list
|
||||
@ -221,7 +221,7 @@
|
||||
(sear plex:vez (stag %conl poor:vez))
|
||||
::
|
||||
++ dp-iden-url
|
||||
(cook |=({a/(unit iden) b/purl} [(fall a *iden) b]) auru:epur)
|
||||
(cook |=({a/(unit iden) b/purl} [`(fall a *iden) b]) auru:epur)
|
||||
::
|
||||
++ dp-model ;~(plug dp-server dp-config) :: ++dojo-model
|
||||
++ dp-path (tope he-beam) :: ++path
|
||||
@ -269,10 +269,10 @@
|
||||
(he-card(poy `+>+<(pux `way)) %exec way our.hid `[he-beak kas])
|
||||
::
|
||||
++ dy-eyre :: send work to eyre
|
||||
|= {way/wire usr/iden req/hiss}
|
||||
|= {way/wire usr/(unit iden) req/hiss}
|
||||
^+ +>+>
|
||||
?> ?=($~ pux)
|
||||
(he-card(poy `+>+<(pux `way)) %hiss way `usr %httr %hiss req)
|
||||
(he-card(poy `+>+<(pux `way)) %hiss way usr %httr %hiss req)
|
||||
::
|
||||
++ dy-stop :: stop work
|
||||
^+ +>
|
||||
@ -415,6 +415,7 @@
|
||||
++ dy-cast
|
||||
|* {typ/_* bun/vase}
|
||||
|= a/vase ^- typ
|
||||
~| [p.bun p.a]
|
||||
?> (~(nest ut p.bun) & p.a)
|
||||
;;(typ q.a)
|
||||
::
|
||||
@ -537,7 +538,7 @@
|
||||
++ dy-shown
|
||||
$? twig
|
||||
$^ {dy-shown dy-shown}
|
||||
$% {$ur iden purl}
|
||||
$% {$ur (unit iden) purl}
|
||||
{$dv path}
|
||||
{$as mark dy-shown}
|
||||
{$do twig dy-shown}
|
||||
@ -676,9 +677,11 @@
|
||||
(dy-meal (slot 7 vax))
|
||||
::
|
||||
$|
|
||||
=+ hiz=;;(hiss +<.q.vax)
|
||||
=> .(vax (slap vax !,(*twig ?>(?=($| -) .)))) :: XX working spec #72
|
||||
=+ typ={$| (unit iden) hiss *}
|
||||
=+ [~ usr hiz ~]=((dy-cast typ !>(*typ)) vax)
|
||||
=. ..dy (he-diff %tan leaf+"< {(earn p.hiz)}" ~)
|
||||
(dy-eyre(pro `(slap (slot 7 vax) limb+%q)) /scar ~. hiz)
|
||||
(dy-eyre(pro `(slap (slot 15 vax) limb+%r)) /scar usr hiz)
|
||||
==
|
||||
::
|
||||
++ dy-sigh-scar :: scraper result
|
||||
|
318
app/twit.hoon
318
app/twit.hoon
@ -8,66 +8,69 @@
|
||||
::
|
||||
|%
|
||||
++ twit-path :: valid peer path
|
||||
$% :: [%home ~] :: home timeline
|
||||
[%user p=@t ~] :: user's tweets
|
||||
[%post p=span:,@uv ~] :: status of status
|
||||
$% {$home p/@t $~} :: home timeline
|
||||
{$user p/@t $~} :: user's tweets
|
||||
{$post p/@taxuv $~} :: status of status
|
||||
==
|
||||
::
|
||||
++ axle :: app state
|
||||
$: %0
|
||||
kes=(map span keys:twittter) :: auth
|
||||
out=(map ,@uvI (each ,[span cord] stat)) :: sent tweets
|
||||
ran=(map path ,[p=@ud q=@da]) :: polls active
|
||||
fed=(jar path stat) :: feed cache
|
||||
$: $0
|
||||
out/(map @uvI (each {knot cord} stat)) :: sent tweets
|
||||
ran/(map path {p/@ud q/@da}) :: polls active
|
||||
fed/(jar path stat) :: feed cache
|
||||
==
|
||||
::
|
||||
++ gift :: subscription action
|
||||
$% [%quit ~] :: terminate
|
||||
[%diff gilt] :: send data
|
||||
$% {$quit $~} :: terminate
|
||||
{$diff gilt} :: send data
|
||||
==
|
||||
++ gilt
|
||||
$% [%twit-feed p=(list stat)] :: posts in feed
|
||||
[%twit-stat p=stat] :: tweet accepted
|
||||
[%ares term (list tank)]
|
||||
$% {$twit-feed p/(list stat)} :: posts in feed
|
||||
{$twit-post p/stat} :: tweet accepted
|
||||
{$ares term (list tank)}
|
||||
==
|
||||
::
|
||||
++ move ,[bone card]
|
||||
++ move {bone card}
|
||||
++ card :: arvo request
|
||||
$? gift
|
||||
$% [%them path ~ u=hiss] :: HTTP request
|
||||
[%poke wire dock %talk-command command:talk] ::
|
||||
[%wait path p=@da] :: timeout
|
||||
$% {$hiss wire (unit iden) api-call} :: api request
|
||||
{$poke wire dock $talk-command command:talk} ::
|
||||
{$wait wire p/@da} :: timeout
|
||||
== ==
|
||||
::
|
||||
++ api-call {response-mark $twit-req {endpoint quay}} :: full hiss payload
|
||||
++ response-mark ?($twit-post $twit-feed) :: sigh options
|
||||
++ sign :: arvo response
|
||||
$% [%e %thou p=httr] :: HTTP result
|
||||
[%t %wake ~] :: timeout ping
|
||||
$% {$e $thou p/httr} :: HTTP result
|
||||
{$t $wake $~} :: timeout ping
|
||||
==
|
||||
::
|
||||
++ stat stat:twitter :: recieved tweet
|
||||
++ twit main:twitter :: api interface
|
||||
++ twir parse:twitter :: reparsers
|
||||
++ twip render:twitter :: printers
|
||||
:: XX =*
|
||||
++ stat post:twitter :: recieved tweet
|
||||
++ command command:twitter :: incoming command
|
||||
++ endpoint endpoint:reqs:twitter :: outgoing target
|
||||
++ param param:reqs:twitter :: twit-req paramters
|
||||
++ print print:twitter :: their serialization
|
||||
++ parse parse:twitter :: and deserialization
|
||||
::
|
||||
:: ++ twit args:reqs:twitter :: arugment types
|
||||
:: ++ twir parse:twitter :: reparsers
|
||||
:: ++ twip print:twitter :: printers
|
||||
--
|
||||
!:
|
||||
::::
|
||||
::
|
||||
|_ [bowl axle]
|
||||
++ any-auth ?~(kes (auth) (auth p.n.kes)) :: use any keys
|
||||
++ auth :: build API door
|
||||
|= a=span
|
||||
~| [%no-auth a]
|
||||
~(. twit (~(got by kes) a) now `@`eny)
|
||||
|_ {bowl axle}
|
||||
::
|
||||
++ cull :: remove seen tweets
|
||||
|= [pax=path rep=(list stat)] ^+ rep
|
||||
=+ pev=(sa (turn (~(get ja fed) pax) |=(stat id)))
|
||||
|= {pax/path rep/(list stat)} ^+ rep
|
||||
=+ pev=(silt (turn (~(get ja fed) pax) |=(stat id)))
|
||||
(skip rep |=(stat (~(has in pev) id)))
|
||||
::
|
||||
++ done [*(list move) .]
|
||||
++ dely :: next polling timeout
|
||||
|= pax=path
|
||||
^- [(unit time) _ran]
|
||||
|= pax/path
|
||||
^- {(unit time) _ran}
|
||||
=+ cur=(~(get by ran) pax)
|
||||
=+ tym=(add now (mul ~s8 (bex ?~(cur 0 p.u.cur))))
|
||||
:: ~& dely/`@dr`(sub tym now)
|
||||
@ -75,8 +78,12 @@
|
||||
[~ ran]
|
||||
[`tym (~(put by ran) pax ?~(cur 0 (min 5 +(p.u.cur))) tym)]
|
||||
::
|
||||
++ wait-new :: poll with min delay
|
||||
|= {pax/path mof/(list move)}
|
||||
(wait(ran (~(del by ran) pax)) pax mof)
|
||||
::
|
||||
++ wait :: ensure poll by path
|
||||
|= [pax=path mof=(list move)]
|
||||
|= {pax/path mof/(list move)} ^+ done
|
||||
=^ tym ran (dely pax)
|
||||
:_ +>.$
|
||||
?~ tym
|
||||
@ -87,117 +94,175 @@
|
||||
mof
|
||||
::
|
||||
++ poke-twit-do :: recieve request
|
||||
|= [usr=span act=command:twitter]
|
||||
^+ [*(list move) +>]
|
||||
|= {usr/iden act/command} ^+ done
|
||||
?- -.act
|
||||
%auth
|
||||
:- [(print "authed @{(trip usr)}")]~
|
||||
+>.$(kes (~(put by kes) usr p.act)) :: XX verify key
|
||||
%post
|
||||
=: out (~(put by out) p.act %& usr q.act)
|
||||
ran (~(del by ran) /peer/home)
|
||||
==
|
||||
%+ wait /peer/home
|
||||
=+ mez=(stat-upda:(auth usr) [%status q.act]~ ~)
|
||||
[ost %them /post/(scot %uv p.act) ~ mez]~
|
||||
$post
|
||||
=. out (~(put by out) p.act %& usr q.act)
|
||||
%+ wait-new /peer/home/[usr]
|
||||
=+ req=[%twit-req `endpoint`update+[%status q.act]~ ~]
|
||||
[ost %hiss post+(dray ~[%uv] p.act) `usr %twit-post req]~
|
||||
==
|
||||
::
|
||||
++ wake-peer
|
||||
|= [pax=path ~] ^+ done
|
||||
~& twit-wake/peer/pax
|
||||
|= {pax/path $~} ^+ done
|
||||
~& twit-wake+peer+pax
|
||||
:_ +>.$
|
||||
?. (~(has by ran) peer/pax) :: ignore if retracted
|
||||
?. (~(has by ran) peer+pax) :: ignore if retracted
|
||||
~
|
||||
=+ => |=([a=bone @ b=path] [b a])
|
||||
=+ => |=({a/bone @ b/path} [b a])
|
||||
pus=(~(gas ju *(jug path bone)) (turn (~(tap by sup)) .))
|
||||
?~ (~(get ju pus) pax)
|
||||
~
|
||||
~& peer-again/[pax ran]
|
||||
(pear | our pax)
|
||||
~& peer-again+[pax ran]
|
||||
(pear | `~. pax) ::(user-from-path pax))
|
||||
::
|
||||
++ thou
|
||||
|= [pax=path hit=httr] ^+ done
|
||||
?+ p.hit ~|([%unknown-code p.hit] !!)
|
||||
429 :: Rate-limit
|
||||
=. ran (~(put by ran) pax 6 now)
|
||||
=+ lim=%.(%x-rate-limit-reset ;~(biff ~(get by (mo q.hit)) poja ni:jo))
|
||||
=+ tym=?~(lim (add ~m7.s30 now) (add ~1970.1.1 (mul ~s1 u.lim)))
|
||||
~& retrying-in/`@dr`(sub tym now)
|
||||
:_(+>.$ [ost %wait pax tym]~)
|
||||
::
|
||||
200 :: OK
|
||||
=+ jon=(need (poja q:(need r.hit)))
|
||||
:: ~& twit-resp/%.(jon ?+(-.jon !! %o stat:twir, %a (ar:jo stat:twir)))
|
||||
?+ pax ~|([%http-missed pax] !!)
|
||||
[%post @ ~] :: post acknowledged
|
||||
=+ ^= rep
|
||||
~| [%bad-post jon]
|
||||
(need %.(jon stat:twir))
|
||||
=. out (~(put by out) (slav %uv i.t.pax) %| rep)
|
||||
:_ +>.$
|
||||
=+ pax=/[who.rep]/status/(rsh 3 2 (scot %ui id.rep))
|
||||
:- (print (earn [& ~ `/com/twitter] `pax ~))
|
||||
(spam pax (tweet-good rep))
|
||||
[%peer *] :: feed data
|
||||
=+ ^= rep
|
||||
~| [%bad-feed jon]
|
||||
(need %.(jon (ar:jo stat:twir)))
|
||||
:: ~& got-feed/[(scag 5 (turn rep |=(stat id))) fed]
|
||||
=+ ren=(cull t.pax rep) :: new messages
|
||||
?~ ren
|
||||
(wait pax ~) :: pump polling
|
||||
:: ~& spam-feed/ren
|
||||
=: ran (~(del by ran) pax) :: clear poll delay
|
||||
fed (~(put by fed) t.pax rep) :: saw last message
|
||||
==
|
||||
(wait pax (spam t.pax [%diff twit-feed/(flop ren)] ~))
|
||||
==
|
||||
::
|
||||
?(400 401 403 404) :: Err
|
||||
=+ ^- git=gift
|
||||
=+ err=%.(q:(need r.hit) ;~(biff poja mean:twir))
|
||||
:^ %diff %ares %bad-http
|
||||
[leaf/"HTTP Code {<p.hit>}" (turn (need err) mean:twip)]
|
||||
?+ pax [[ost git]~ +>.$]
|
||||
[%post @ ~]
|
||||
[(spam pax git ~) +>.$]
|
||||
==
|
||||
++ sigh-recoverable-error :: Rate-limit
|
||||
|= {pax/path $429 $rate-limit lim/(unit @da)}
|
||||
=. ran (~(put by ran) pax 6 now)
|
||||
=+ tym=?~(lim (add ~m7.s30 now) (add ~1970.1.1 (mul ~s1 u.lim)))
|
||||
~& retrying-in+`@dr`(sub tym now)
|
||||
:_(+>.$ [ost %wait pax tym]~)
|
||||
::
|
||||
++ sigh-twit-post-post :: status acknowledged
|
||||
|= {wir/wire rep/stat} ^+ done
|
||||
=+ (raid wir mez=%uv ~)
|
||||
=. out (~(put by out) mez %| rep)
|
||||
:_ +>.$
|
||||
=+ pax=/[who.rep]/status/(rsh 3 2 (scot %ui id.rep))
|
||||
:- (show-url [& ~ &+/com/twitter] `pax ~)
|
||||
=+ mof=~[[%diff %twit-post rep] [%quit ~]]
|
||||
(weld (spam post+wir mof) (spam scry+x+post+wir mof))
|
||||
::
|
||||
++ sigh-twit-feed :: feed data
|
||||
|= {wir/wire rep/(list stat)} ^+ done
|
||||
?> ?=({?($peer $scry) *} wir)
|
||||
=* pax t.wir
|
||||
:: ~& got-feed+[(scag 5 (turn rep |=(stat id))) fed]
|
||||
=+ ren=(cull pax rep) :: new messages
|
||||
=. rep (weld ren (~(get ja fed) pax))
|
||||
=. fed (~(put by fed) pax rep) :: save full list
|
||||
?: ?=($scry -.wir)
|
||||
[(spam scry+x+pax [%diff twit-feed+(flop rep)] [%quit ~] ~) +>.$]
|
||||
?~ ren
|
||||
(wait wir ~) :: pump polling
|
||||
:: ~& spam-feed+ren
|
||||
(wait-new wir (spam pax [%diff twit-feed+(flop ren)] ~))
|
||||
::
|
||||
++ sigh-tang :: Err
|
||||
|= {pax/path tan/tang} ^+ done
|
||||
~& sigh-tang+pax
|
||||
%- (slog (flop tan))
|
||||
=+ ^- git/gift
|
||||
=+ err='' ::%.(q:(need r.hit) ;~(biff poja mean:twir)) :: XX parse?
|
||||
:^ %diff %ares %bad-http
|
||||
tan
|
||||
:: [leaf/"HTTP Code {<p.hit>}" (turn (need err) mean:render:twit)]
|
||||
?+ pax [[ost git]~ +>.$]
|
||||
{$post @ $~}
|
||||
[(spam pax git ~) +>.$]
|
||||
==
|
||||
++ tweet-good |=(rep=stat `(list gift)`~[[%diff %twit-stat rep] [%quit ~]])
|
||||
++ peer |=(pax=path :_(+> (pear & src pax))) :: accept subscription
|
||||
::
|
||||
:: ++ user-to-path |=(a/(unit iden) ?~(a '~' (scot %ta u.a)))
|
||||
:: ++ user-from-path
|
||||
:: |= pax/path ^- {(unit iden) path}
|
||||
:: ~| %bad-user
|
||||
:: ?~ pax ~|(%empty-path !!)
|
||||
:: ~| i.pax
|
||||
:: ?: =('~' i.pax) [~ t.pax]
|
||||
:: [`(slav %ta i.pax) t.pax]
|
||||
::
|
||||
::
|
||||
++ compat |=({usr/(unit iden) req/(unit iden)} ?~(req & =(usr req)))
|
||||
::
|
||||
:: .^(twit-feed %gx /=twit=/~/home/urbit_test)
|
||||
:: .^(twit-stat %gx /=twit=/~./post/0vv0old.0post.hash0.0000)
|
||||
++ peek
|
||||
|= {ren/care pax/path} ^- (unit (unit gilt))
|
||||
?> ?=($x ren) :: others unsupported
|
||||
=+ usr=`~. :: =^ usr pax (user-from-path pax)
|
||||
?. ?=(twit-path pax)
|
||||
~|([%missed-path pax] !!)
|
||||
=+ gil=(pear-scry pax)
|
||||
?- -.gil
|
||||
$none ~
|
||||
$part ~ :: stale data
|
||||
$full ``p.gil
|
||||
==
|
||||
::
|
||||
++ peer-scry-x
|
||||
|= pax/path ^+ done
|
||||
:_ +>
|
||||
=+ pek=(peek %x pax)
|
||||
?^ pek
|
||||
?~ u.pek ~|(bad-scry+x+pax !!)
|
||||
~[[ost %diff u.u.pek] [ost %quit ~]]
|
||||
=+ usr=`~. :: =^ usr pax (user-from-path pax)
|
||||
?. ?=(twit-path pax)
|
||||
~|([%missed-path pax] !!)
|
||||
=+ hiz=(pear-hiss pax)
|
||||
?~ hiz ~ :: already in flight
|
||||
::?> (compat usr -.u.hiz) :: XX better auth
|
||||
[ost %hiss scry+pax usr +.u.hiz]~
|
||||
::
|
||||
++ peer |=(pax/path :_(+> (pear & `~. pax))) :: accept subscription
|
||||
++ pear :: poll, possibly returning current data
|
||||
|= [ver=? @ pax=path]
|
||||
|= {ver/? usr/(unit iden) pax/path}
|
||||
^- (list move)
|
||||
?. ?=(twit-path pax)
|
||||
~|([%missed-path pax] !!)
|
||||
=> .(pax `twit-path`pax)
|
||||
?: ?=(%post -.pax)
|
||||
?. ver ~
|
||||
=+ sta=(~(get by out) (slav %uv p.pax))
|
||||
?. ?=([~ %| ^] sta) :: post not received
|
||||
~
|
||||
~[[ost %diff %twit-stat p.u.sta] [ost %quit ~]]
|
||||
=+ ole=(~(get ja fed) pax)
|
||||
:_ ^- (list move)
|
||||
?. ver ~
|
||||
?~ ole ~
|
||||
[ost %diff %twit-feed (flop ole)]~
|
||||
=- `move`[ost %them peer/pax ~ `hiss`-]
|
||||
=+ opt=?~(ole ~ ['since_id' (lutt:twit id.i.ole)]~)
|
||||
=+ aut=any-auth
|
||||
=+ gil=(pear-scry pax)
|
||||
%+ welp
|
||||
^- (list move)
|
||||
?: ?=($full -.gil) ~ :: permanent result
|
||||
=+ hiz=(pear-hiss pax)
|
||||
?~ hiz ~
|
||||
::?> (compat usr -.u.hiz) :: XX better auth
|
||||
[ost %hiss peer+pax usr +.u.hiz]~
|
||||
^- (list move)
|
||||
?. ver ~
|
||||
?- -.gil
|
||||
$none ~
|
||||
$part [ost %diff p.gil]~
|
||||
$full ~[[ost %diff p.gil] [ost %quit ~]]
|
||||
==
|
||||
::
|
||||
++ pear-scry
|
||||
|= pax/twit-path ^- $%({$none $~} {$part p/gilt} {$full p/gilt})
|
||||
?- -.pax
|
||||
%user (stat-user:aut [(to-sd p.pax)]~ opt)
|
||||
:: %home (stat-home:auth ~ opt)
|
||||
$post
|
||||
=+ (raid +.pax mez=%uv ~)
|
||||
=+ sta=(~(get by out) mez)
|
||||
?. ?=({$~ $| *} sta)
|
||||
[%none ~]
|
||||
[%full twit-post+p.u.sta]
|
||||
::
|
||||
?($user $home)
|
||||
[%part twit-feed+(flop (~(get ja fed) pax))]
|
||||
==
|
||||
::
|
||||
++ pear-hiss
|
||||
|= pax/twit-path ^- (unit {(unit iden) api-call})
|
||||
?- -.pax
|
||||
$post ~ :: future/unacked
|
||||
$user
|
||||
=+ ole=(~(get ja fed) pax)
|
||||
=+ opt=?~(ole ~ ['since_id' (tid:print id.i.ole)]~)
|
||||
`[`~. [%twit-feed twit-req+[posts-by+[(to-sd p.pax)]~ opt]]]
|
||||
::
|
||||
$home
|
||||
=+ ole=(~(get ja fed) pax)
|
||||
=+ opt=?~(ole ~ ['since_id' (tid:print id.i.ole)]~)
|
||||
`[`p.pax [%twit-feed twit-req+[timeline+~ opt]]]
|
||||
==
|
||||
::
|
||||
++ to-sd :: parse user name/numb
|
||||
|= a=span ^- sd:twit
|
||||
|= a/knot ^- sd:param
|
||||
~| [%not-user a]
|
||||
%+ rash a
|
||||
;~(pose (stag %user-id dem) (stag %screen-name user:twir))
|
||||
;~(pose (stag %user-id dem) (stag %screen-name user:parse))
|
||||
::
|
||||
:: ++ pull :: release subscription
|
||||
:: |= ost=bone
|
||||
:: |= ost/bone
|
||||
:: ?. (~(has by sup) ost) `+>.$ :: XX should not occur
|
||||
:: =+ [his pax]=(~(got by sup) ost)
|
||||
:: ?: (lth 1 ~(wyt in (~(get ju pus) pax)))
|
||||
@ -208,13 +273,12 @@
|
||||
:: `+>.$
|
||||
::
|
||||
++ spam :: send by path
|
||||
|= [a=path b=(list gift)] ^- (list move)
|
||||
|= {a/path b/(list gift)} ^- (list move)
|
||||
%- zing ^- (list (list move))
|
||||
%+ turn (~(tap by sup))
|
||||
|= [ost=bone @ pax=path]
|
||||
|= {ost/bone @ pax/path}
|
||||
?. =(pax a) ~
|
||||
(turn b |=(c=gift [ost c]))
|
||||
(turn b |=(c/gift [ost c]))
|
||||
::
|
||||
++ print
|
||||
|=(mes=tape [ost %poke / [our %talk] (said our %twit now eny leaf/mes ~)])
|
||||
++ show-url ~(said-url talk `bowl`+<-)
|
||||
--
|
||||
|
@ -849,9 +849,8 @@
|
||||
=+ url=((hard quri) q.q.cay)
|
||||
(give-thou 307 [location+(crip (apex:earn url))]~ ~)
|
||||
?. ?=($mime p.cay)
|
||||
=+ bek=-:(need (tome p.tee))
|
||||
=+ bik=?+(r.bek bek {$ud $0} bek(r da+now))
|
||||
(exec-live tee bik [%flag [p.sih `~] %cast %mime [%$ p.q.sih]])
|
||||
=+ bek=(norm-beak -:(need (tome p.tee)))
|
||||
(exec-live tee bek [%flag [p.sih `~] %cast %mime [%$ p.q.sih]])
|
||||
~| q.q.cay
|
||||
=+ ((hard {mit/mite rez/octs}) q.q.cay)
|
||||
=+ dep=(crip "W/{(pojo %s (scot %uv p.sih))}")
|
||||
@ -859,6 +858,7 @@
|
||||
==
|
||||
==
|
||||
::
|
||||
++ norm-beak |=(bek/beak ?+(r.bek bek {$ud $0} bek(r da+now)))
|
||||
++ emule
|
||||
|= a/_|?(..emule) ^+ ..emule
|
||||
=+ mul=(mule a)
|
||||
@ -891,13 +891,13 @@
|
||||
::
|
||||
++ back :: %ford bounce
|
||||
|= {tea/whir mar/mark cay/cage}
|
||||
=+ bek=?+(r.top -.top {$ud $0} -.top(r da+now))
|
||||
(execute tea bek [%cast mar $+cay])
|
||||
(execute tea (norm-beak -.top) [%cast mar $+cay])
|
||||
::
|
||||
++ cast-thou
|
||||
|= {mar/mark cay/cage}
|
||||
?: ?=($httr mar) (give-sigh %& cay)
|
||||
(back si+~ mar cay)
|
||||
%^ execute si+~ (norm-beak -.top)
|
||||
[%alts [%cast mar $+cay] [%cast %recoverable-error $+cay] ~]
|
||||
::
|
||||
++ del-deps
|
||||
|= {a/@uvH b/(each duct ixor)} ^+ +>.$
|
||||
@ -1750,7 +1750,8 @@
|
||||
:: XX formal dill-blit %url via hood
|
||||
++ auth-print |=({$show a/purl} (slog auth-tank leaf+(earn a) ~))
|
||||
++ auth-tank
|
||||
=> rose+["." `~]^(turn (flop dom) |=(a/cord leaf+(trip a)))
|
||||
=> =- ?~(usr - rose+["@" `~]^~[leaf+(trip usr) -])
|
||||
rose+["." `~]^(turn (flop dom) |=(a/cord leaf+(trip a)))
|
||||
rose+[" " `~]^~[leaf+"To authenticate" . leaf+"visit:"]
|
||||
::
|
||||
++ do-give (with !>(|=({$give a/httr} a)) fin-httr)
|
||||
|
123
arvo/ford.hoon
123
arvo/ford.hoon
@ -78,7 +78,7 @@
|
||||
$: nah/duct :: cause
|
||||
{bek/beak kas/silk} :: problem
|
||||
keg/(map (pair term beam) cage) :: block results
|
||||
kig/{p/@ud q/(map @ud {van/vane ren/care bem/beam})} :: blocks
|
||||
kig/(set (trel vane care beam)) :: blocks
|
||||
== ::
|
||||
++ gagl (list (pair gage gage)) ::
|
||||
++ vane ?($a $b $c $d $e $f $g) ::
|
||||
@ -192,26 +192,22 @@
|
||||
=: p.tad.bay +(p.tad.bay)
|
||||
dym.bay (~(put by dym.bay) hen num)
|
||||
==
|
||||
~(exec zo [num `task`[hen kub ~ 0 ~]])
|
||||
~(exec zo [num `task`[hen kub ~ ~]])
|
||||
::
|
||||
++ axon :: take
|
||||
|= {num/@ud tik/@ud sih/sign}
|
||||
|= {num/@ud {van/vane ren/care bem/beam} sih/sign}
|
||||
^+ +>
|
||||
?: ?=({$unto $quit *} +.sih)
|
||||
+>.$
|
||||
=+ tus=(~(get by q.tad.bay) num)
|
||||
?~ tus
|
||||
~& [%ford-lost van num]
|
||||
+>.$
|
||||
?- -.+.sih
|
||||
$writ
|
||||
=+ tus=(~(get by q.tad.bay) num)
|
||||
?~ tus
|
||||
~& [%ford-lost num]
|
||||
+>.$
|
||||
(~(resp zo [num u.tus]) tik p.+.sih)
|
||||
::
|
||||
$writ (~(resp zo [num u.tus]) [van ren bem] p.+.sih)
|
||||
$unto
|
||||
=+ tus=(~(get by q.tad.bay) num)
|
||||
?~ tus
|
||||
~& [%ford-lost num]
|
||||
+>.$
|
||||
?+ -.p.+.sih ~|(%ford-strange-unto !!)
|
||||
$diff (~(resd zo [num u.tus]) tik p.p.+.sih)
|
||||
?+ -.p.+.sih ~|(ford-strange-unto+-.p.+.sih !!)
|
||||
$diff (~(resd zo [num u.tus]) [van ren bem] p.p.+.sih)
|
||||
$reap ?~ p.p.+.sih +>.$
|
||||
((slog leaf+"ford-reap-fail" u.p.p.+.sih) +>.$)
|
||||
==
|
||||
@ -292,49 +288,40 @@
|
||||
==
|
||||
++ camo :: stop requests
|
||||
^+ .
|
||||
=+ kiz=(~(tap by q.kig) *(list {p/@ud q/{van/vane ren/care bem/beam}}))
|
||||
=+ kiz=(~(tap in kig))
|
||||
|- ^+ +>
|
||||
?~ kiz +>
|
||||
?. ?=($c van.q.i.kiz) +>
|
||||
%= $
|
||||
kiz t.kiz
|
||||
mow
|
||||
:_ mow
|
||||
:- hen
|
||||
:^ %pass
|
||||
[(scot %p our) (scot %ud num) (scot %ud p.i.kiz) ~]
|
||||
%c
|
||||
[%warp [our p.bem.q.i.kiz] q.bem.q.i.kiz ~]
|
||||
$(kiz t.kiz, mow :_(mow [hen (cancel i.kiz)]))
|
||||
::
|
||||
++ cancel :: stop a request
|
||||
|= {van/vane ren/care bem/beam} ^- (wind note gift)
|
||||
?+ van ~|(stub-cancel+van !!)
|
||||
$c [%pass (camp-wire +<) van [%warp [our p.bem] q.bem ~]]
|
||||
$g [%pass (camp-wire +<) van [%deal [our p.bem] q.bem [%pull ~]]]
|
||||
==
|
||||
++ camp-wire :: encode block
|
||||
|= {van/vane ren/care bem/beam} ^- wire
|
||||
[(scot %p our) (scot %ud num) van ren (tope bem)]
|
||||
::
|
||||
++ camp :: request a file
|
||||
|= {van/vane ren/care bem/beam}
|
||||
^+ +>
|
||||
?: ?=($g van)
|
||||
%= +>.$
|
||||
kig [+(p.kig) (~(put by q.kig) p.kig [%g ren bem])]
|
||||
mow
|
||||
:_ mow
|
||||
:- hen
|
||||
:^ %pass
|
||||
[(scot %p our) (scot %ud num) (scot %ud p.kig) ~]
|
||||
%g
|
||||
~& >> [%camping van ren bem]
|
||||
[%deal [our p.bem] q.bem [%peer %scry ren (flop s.bem)]]
|
||||
~& >> [%camping van ren bem]
|
||||
%_ +>.$
|
||||
kig (~(put in kig) +<)
|
||||
mow
|
||||
:_ mow
|
||||
:- hen
|
||||
?+ van ~&(%camp-stub !!)
|
||||
$g
|
||||
:+ %pass (camp-wire +<)
|
||||
[%g [%deal [our p.bem] q.bem [%peer %scry ren (flop s.bem)]]]
|
||||
::
|
||||
$c
|
||||
:+ %pass (camp-wire +<)
|
||||
[%c [%warp [our p.bem] q.bem [~ %sing ren r.bem (flop s.bem)]]]
|
||||
==
|
||||
?: ?=($c van)
|
||||
%= +>.$
|
||||
kig [+(p.kig) (~(put by q.kig) p.kig [%c ren bem])]
|
||||
mow
|
||||
:_ mow
|
||||
:- hen
|
||||
:^ %pass
|
||||
[(scot %p our) (scot %ud num) (scot %ud p.kig) ~]
|
||||
%c
|
||||
~& >> [%camping van ren bem]
|
||||
[%warp [our p.bem] q.bem [~ %sing ren r.bem (flop s.bem)]]
|
||||
==
|
||||
+>.$
|
||||
==
|
||||
::
|
||||
++ clad :: hash dependencies
|
||||
|* hoc/(bolt) ^+ [*@uvH hoc]
|
||||
@ -580,7 +567,7 @@
|
||||
::
|
||||
++ exec :: execute app
|
||||
^+ ..zo
|
||||
?: !=(~ q.kig) ..zo
|
||||
?: !=(~ kig) ..zo
|
||||
=+ bot=(make-norm-bek [~ jav.bay deh.bay] kas)
|
||||
=^ dep bot (clad bot)
|
||||
=. ..exec (dash p.bot)
|
||||
@ -1762,23 +1749,24 @@
|
||||
==
|
||||
::
|
||||
++ resp
|
||||
|= {tik/@ud rot/riot}
|
||||
|= {{van/vane ren/care bem/beam} rot/riot}
|
||||
^+ ..zo
|
||||
?> (~(has by q.kig) tik)
|
||||
=+ `{van/vane ren/care bem/beam}`(~(got by q.kig) tik)
|
||||
?> ?=($c van)
|
||||
=. kig (~(del in kig) +<-.$)
|
||||
?~ rot
|
||||
=^ dep deh.bay (daze ~ deh.bay) :: dependencies?
|
||||
amok:(expo [%made dep %| (smyt ren (tope bem)) ~])
|
||||
=+ (cat 3 'c' ren)
|
||||
exec(q.kig (~(del by q.kig) tik), keg (~(put by keg) [- bem] r.u.rot))
|
||||
=+ (cat 3 van ren)
|
||||
exec(keg (~(put by keg) [- bem] r.u.rot))
|
||||
::
|
||||
++ resd
|
||||
|= {tik/@ud cag/cage}
|
||||
|= {{van/vane ren/care bem/beam} cag/cage}
|
||||
^+ ..zo
|
||||
?> (~(has by q.kig) tik)
|
||||
=+ `{van/vane ren/care bem/beam}`(~(got by q.kig) tik)
|
||||
=+ (cat 3 'g' ren)
|
||||
exec(q.kig (~(del by q.kig) tik), keg (~(put by keg) [- bem] cag))
|
||||
?> ?=($g van)
|
||||
=. kig (~(del in kig) +<-.$)
|
||||
=. mow :_(mow [hen (cancel van ren bem)])
|
||||
=+ (cat 3 van ren)
|
||||
exec(keg (~(put by keg) [- bem] cag))
|
||||
::
|
||||
++ syve
|
||||
^- sley
|
||||
@ -1789,6 +1777,9 @@
|
||||
%+ biff +<
|
||||
|= cay/cage ^- (unit cage)
|
||||
?. -:(nets:wa +.ref `span`p.q.cay) :: error if bad type
|
||||
~& :^ %ford-syve-lost `path`[tem (tope bem)]
|
||||
want=;;(span +.ref)
|
||||
have=p.q.cay
|
||||
~
|
||||
`cay
|
||||
^- (unit (unit cage))
|
||||
@ -1897,10 +1888,12 @@
|
||||
?^ dep
|
||||
=+ bem=(need (tome t.t.tea))
|
||||
abet:(~(axun za [our hen [now eny ski] ~] bay) tea u.dep bem q.hin)
|
||||
?> ?=({@ $~} t.t.tea)
|
||||
?> ?=({@ @ ^} t.t.tea)
|
||||
=+ :* num=(slav %ud i.t.tea)
|
||||
tik=(slav %ud i.t.t.tea)
|
||||
van=((hard vane) i.t.t.tea)
|
||||
ren=((hard care) i.t.t.t.tea)
|
||||
bem=(need (tome t.t.t.t.tea))
|
||||
==
|
||||
abet:(~(axon za [our hen [now eny ski] ~] bay) num tik q.hin)
|
||||
abet:(~(axon za [our hen [now eny ski] ~] bay) num [van ren bem] q.hin)
|
||||
[mos ..^$(pol (~(put by pol) our bay))]
|
||||
--
|
||||
|
@ -647,7 +647,11 @@
|
||||
?+ q.p.zem ((slog leaf+"peek bad result" ~) [~ ~])
|
||||
$~ ~
|
||||
{$~ $~} [~ ~]
|
||||
{$~ $~ term *} ``[+14.q.p.zem (slot 15 p.zem)]
|
||||
{$~ $~ ^}
|
||||
=+ caz=(spec (slot 7 p.zem))
|
||||
?. &(?=({p/@ *} q.caz) ((sane %tas) p.q.caz))
|
||||
((slog leaf+"scry: malformed cage" ~) [~ ~])
|
||||
``[p.q.caz (slot 3 caz)]
|
||||
==
|
||||
::
|
||||
++ ap-club :: apply effect
|
||||
|
@ -1194,6 +1194,8 @@
|
||||
(cold 63 (just '/'))
|
||||
==
|
||||
::
|
||||
:: .= ~[p=~.ack q=~.~sarnel r=~..y]
|
||||
:: (dray ~[p=%tas q=%p r=%f] %ack ~sarnel &)
|
||||
++ dray :: load tuple into path
|
||||
=- |* {a/{@tas (pole @tas)} b/*} ^- (paf a)
|
||||
=> .(b `(tup -.a +.a)`b)
|
||||
@ -1211,7 +1213,7 @@
|
||||
^= odo
|
||||
|* a/@tas
|
||||
|= b/*
|
||||
=< a(. (. b)) :: preserve face
|
||||
=< a(, (. b)) :: preserve face
|
||||
?+ a @
|
||||
$c @c $da @da $dr @dr $f @f $if @if $is @is $p @p
|
||||
$u @u $uc @uc $ub @ub $ui @ui $ux @ux $uv @uv $uw @uw
|
||||
|
@ -4,11 +4,11 @@
|
||||
/? 310
|
||||
/- sole
|
||||
[sole]
|
||||
:- %get |= {^ {a/hiss $~} $~}
|
||||
:- %get |= {^ {a/hiss $~} usr/iden}
|
||||
^- (sole-request (cask httr))
|
||||
?. ?=($get p.q.a)
|
||||
~| %only-get-requests-supported-in-generators :: XX enforced?
|
||||
!!
|
||||
:- *tang
|
||||
:+ %| `hiss`a
|
||||
:^ %| `usr `hiss`a
|
||||
|=(hit/httr (sole-so %httr hit))
|
||||
|
@ -5,6 +5,7 @@
|
||||
/- sole
|
||||
[sole]
|
||||
:- %get |= {^ {a/tape $~} $~}
|
||||
^- (sole-request (cask httr))
|
||||
%+ sole-at (scan a auri:epur)
|
||||
|= hit/httr
|
||||
(sole-so %httr hit)
|
||||
|
@ -4,7 +4,7 @@
|
||||
::
|
||||
[twitter .]
|
||||
:- %say
|
||||
|= $: [now=@da eny=@uvI bec=beak]
|
||||
[[who=span msg=cord ~] ~]
|
||||
|= $: {now/@da eny/@uvI bec/beak}
|
||||
{{who/knot msg/cord $~} $~}
|
||||
==
|
||||
[%twit-do [who %post eny msg]]
|
||||
|
@ -1,23 +0,0 @@
|
||||
:: Input twitter keys
|
||||
/- sole, twitter
|
||||
!:
|
||||
[sole twitter .]
|
||||
|%
|
||||
++ baz64 (cook crip (star alp))
|
||||
--
|
||||
!:
|
||||
:- %ask
|
||||
|= $: [now=@da eny=@uvI bec=beak]
|
||||
[~ ~]
|
||||
==
|
||||
^- (sole-result (cask twit-do))
|
||||
%+ sole-lo [%& %$ "User: "] %+ sole-go urs:ab |= acc=span
|
||||
%+ sole-lo [%& %$ "App token: "] %+ sole-go baz64 |= ctok=cord
|
||||
%+ sole-lo [%& %$ "App secret: "] %+ sole-go baz64 |= csec=cord
|
||||
%+ sole-lo [%& %$ "User token: "] %+ sole-go baz64 |= atok=cord
|
||||
%+ sole-lo [%& %$ "User secret: "] %+ sole-go baz64 |= asec=cord
|
||||
(sole-so %twit-do [acc %auth [ctok csec] atok asec])
|
||||
|
||||
|
||||
|
||||
|
@ -1,5 +0,0 @@
|
||||
hoontap
|
||||
AP3G1t8ki6rPzeeAqdWCTw03F
|
||||
VV784LPwZSaAxtF16RWWTnST4F85BHN8VqQKNyv7MprCkA0xZD
|
||||
2821727326-BAABHUpwCuoeVjINTHTVvfPlJlGHmigqKywlLcE
|
||||
o6TCNfQhhUkzx6fKIC3CGi2cWn3YbEoQVCVgg210YYTtV
|
17
gen/twit/feed.hoon
Normal file
17
gen/twit/feed.hoon
Normal file
@ -0,0 +1,17 @@
|
||||
:: Display twitter feed
|
||||
::
|
||||
:::: /hoon/feed/twit/gen
|
||||
::
|
||||
/- twitter
|
||||
!:
|
||||
:::: ~fyr
|
||||
::
|
||||
:- %say
|
||||
|= $: {now/@da eny/@uvI bek/beak}
|
||||
{{who/iden $~} typ/?($home $user)}
|
||||
==
|
||||
=+ pax=/(scot %p p.bek)/twit/(scot %da now)/[typ]/[who]
|
||||
:- %tang
|
||||
%+ turn (flop .^((list post:twitter) %gx pax))
|
||||
|= post:twitter ^- tank
|
||||
rose+[": " `~]^~[leaf+"{<now>} @{(trip who)}" leaf+(trip txt)]
|
@ -1,13 +0,0 @@
|
||||
/+ sh-utils
|
||||
!:
|
||||
|_ [hide ~]
|
||||
++ peer ,_`.
|
||||
++ poke--args
|
||||
%+ add-subs [[our /twit] our /post/(scot %uv eny)]
|
||||
%^ gate-mess .
|
||||
|=([a=span b=cord ~] [/twit %twit-do !>([a %post eny b])])
|
||||
,_`.
|
||||
++ posh-twit-stat
|
||||
(args-into-gate . |=([@ @ a=@da @] tang/~[leaf/"Tweet recieved {<a>}"]))
|
||||
++ pour |*([ost=@ * sih=[@ ^]] :_(+>.$ [ost %give +.sih]~))
|
||||
--
|
@ -1,23 +0,0 @@
|
||||
:: Display twitter feed
|
||||
::
|
||||
:::: /hook/core/twitter-feed/app
|
||||
::
|
||||
/+ sh-utils
|
||||
!:
|
||||
::
|
||||
:::: ~fyr
|
||||
::
|
||||
|_ [hide ~]
|
||||
++ stat ,[id=@u who=@ta now=@da txt=@t]
|
||||
++ rens
|
||||
:- %say
|
||||
|=(stat rose/[": " `~]^~[leaf/"{<now>} @{(trip who)}" leaf/(trip txt)])
|
||||
++ peer ,_`.
|
||||
++ poke--args
|
||||
|= [ost=bone his=ship who=span ~]
|
||||
%.(+< (add-subs [[our /twit] our /user/[who]] ,_`+>.$))
|
||||
::
|
||||
++ posh-twit-feed
|
||||
(args-into-gate . |=(a=(list stat) tang/(turn a rens)))
|
||||
:: ++ pour |*([ost=@ * sih=[@ ^]] :_(+>.$ [ost %give +.sih]~))
|
||||
--
|
@ -150,6 +150,10 @@
|
||||
::
|
||||
++ token-exchange (post-quay exchange-url ~)
|
||||
++ token-request (post-quay token-reqs-url oauth-callback+oauth-callback ~)
|
||||
++ identity
|
||||
%+ weld
|
||||
?~(usr "default identity for " "{(trip usr)}@")
|
||||
(trip (join '.' (flop dom)))
|
||||
::
|
||||
:: use token to sign authorization header. requires:
|
||||
:: ++ res (res-handle-reqt handle-token) :: take request token
|
||||
@ -169,7 +173,10 @@
|
||||
?. ?=({{$'oauth_token' oauth-token/@t} {$'oauth_verifier' @t} $~} a)
|
||||
~|(no-token+a !!)
|
||||
?~ tok
|
||||
~|(%no-secret-for-token !!)
|
||||
%+ mean-wall %no-secret-for-token
|
||||
"""
|
||||
Attempting to authorize {identity}
|
||||
"""
|
||||
?. =(oauth-token.tok oauth-token.q.i.a)
|
||||
~| wrong-token+[id=usr q.i.a]
|
||||
~|(%multiple-tokens-unsupported !!)
|
||||
@ -178,8 +185,12 @@
|
||||
++ token-response ['oauth_token' 'oauth_token_secret']
|
||||
+- bak-save-access
|
||||
|= handle/$-(token _done)
|
||||
%- (res-parse token-response)
|
||||
|= access-token/{tok/@t sec/@t} ^- core-move
|
||||
%- (res-parse token-response 'screen_name')
|
||||
|= {access-token/{tok/@t sec/@t} nam/knot} ^- core-move
|
||||
?. ?~(usr & =(usr nam))
|
||||
%- %- %*(. slog pri 1)
|
||||
(flop p:(mule |.(~|(wrong-user+[req=usr got=nam] !!))))
|
||||
[[%redo ~] (handle `token`~)]
|
||||
[[%redo ~] (handle `token`[%access-token access-token])]
|
||||
::
|
||||
+- res-parse
|
||||
|
@ -9,7 +9,7 @@
|
||||
::::
|
||||
::
|
||||
[. ^talk]
|
||||
|%
|
||||
|_ bol/bowl
|
||||
++ main :: main story
|
||||
|= our/ship ^- cord
|
||||
=+ can=(clan our)
|
||||
@ -18,6 +18,18 @@
|
||||
$king %floor
|
||||
==
|
||||
::
|
||||
++ said-url :: app url
|
||||
|= url/purl
|
||||
:^ ost.bol %poke /said-url
|
||||
:+ [our.bol %talk] %talk-command
|
||||
^- command
|
||||
:- %publish
|
||||
:_ ~
|
||||
^- thought
|
||||
:+ (shaf %thot eny.bol)
|
||||
[[[%& our.bol (main our.bol)] [*envelope %pending]] ~ ~]
|
||||
[now.bol *bouquet [%app dap.bol (crip (earn url))]] :: XX
|
||||
::
|
||||
++ said :: app message
|
||||
|= {our/@p dap/term now/@da eny/@uvI mes/(list tank)}
|
||||
:- %talk-command
|
||||
|
@ -58,7 +58,7 @@
|
||||
$get [url med *math ~]
|
||||
$post
|
||||
=+ hed=(my content-type+['application/x-www-form-urlencoded']~ ~)
|
||||
[url(r ~) med hed (some (tact +:(tail:earn r.url)))]
|
||||
[url(r ~) med hed ?~(r.url ~ (some (tact +:(tail:earn r.url))))]
|
||||
==
|
||||
::
|
||||
++ find-req
|
||||
@ -85,14 +85,14 @@
|
||||
++ fasp |*(a/{@tas *} [(gsub '-' '_' -.a) +.a]) :: XX usable electroplating
|
||||
++ user (cook crip (plus ;~(pose aln cab)))
|
||||
++ mean (ot errors+(ar (ot message+so code+ni ~)) ~):jo
|
||||
++ stat
|
||||
++ post
|
||||
=+ jo
|
||||
%+ ce stat:sur-twit
|
||||
%+ ce post:sur-twit
|
||||
%- ot
|
||||
:~ id+ni
|
||||
user+(ot (fasp screen-name+(su user)) ~)
|
||||
(fasp created-at+da)
|
||||
text+so
|
||||
text+(cu crip (su (star escp:poxa))) :: parse html escapes
|
||||
==
|
||||
++ usel
|
||||
=+ jo
|
||||
@ -109,10 +109,6 @@
|
||||
|= a/$@(^scr ^lsc) ^- @t
|
||||
?@(a `@t`a (join ',' a))
|
||||
::
|
||||
++ lst
|
||||
|= a/$@(@t ^lst) ^- @t
|
||||
?@(a `@t`a (join ',' a))
|
||||
::
|
||||
++ lid
|
||||
|= a/$@(^tid (list ^tid)) ^- @t
|
||||
?~ a ~|(%nil-id !!)
|
||||
@ -123,7 +119,7 @@
|
||||
=+ args:reqs
|
||||
|%
|
||||
++ apex
|
||||
|= {a/endpoint b/quay}
|
||||
|= {a/endpoint b/quay} ^- hiss
|
||||
=+ [med pax]=(find-req -.a)
|
||||
(valve med (cowl pax +.a b))
|
||||
::
|
||||
@ -157,8 +153,7 @@
|
||||
:- (gsub '-' '_' -.p)
|
||||
?+ -.p p.p :: usually plain text
|
||||
?($source-id $target-id) (tid:print p.p)
|
||||
?($follow $id $name $user-id) (lid:print p.p)
|
||||
$track (lst:print p.p)
|
||||
?($id $name $user-id) (lid:print p.p)
|
||||
$screen-name (lsc:print p.p)
|
||||
==
|
||||
--
|
||||
|
22
mar/recoverable-error.hoon
Normal file
22
mar/recoverable-error.hoon
Normal file
@ -0,0 +1,22 @@
|
||||
:: Possibly non-fatal http error
|
||||
::
|
||||
:::: /hoon/recoverable-error/mar
|
||||
::
|
||||
/- recoverable-error
|
||||
!:
|
||||
:::: ~fyr
|
||||
::
|
||||
|_ recoverable-error
|
||||
++ grab
|
||||
|%
|
||||
++ noun recoverable-error
|
||||
++ httr
|
||||
|= a/^httr ^- recoverable-error
|
||||
~! a
|
||||
?+ p.a ~|(non-recoverable+p.a !!)
|
||||
$429 :+ p.a %rate-limit
|
||||
%.(%x-rate-limit-reset ;~(biff ~(get by (malt q.a)) poja ni:jo))
|
||||
==
|
||||
--
|
||||
++ grow |% ++ tank >[+<]< --
|
||||
--
|
@ -3,11 +3,11 @@
|
||||
:::: /hoon/feed/twit/mar
|
||||
::
|
||||
/+ twitter, httr-to-json
|
||||
|_ (list stat:twitter)
|
||||
|_ (list post:twitter)
|
||||
++ grab
|
||||
|%
|
||||
++ noun (list stat:twitter)
|
||||
++ json (corl need (ar:jo stat:parse:twitter))
|
||||
++ noun (list post:twitter)
|
||||
++ json (corl need (ar:jo post:parse:twitter))
|
||||
++ httr (cork httr-to-json json) :: XX mark translation
|
||||
--
|
||||
++ grow
|
||||
|
@ -1,13 +1,13 @@
|
||||
:: Twitter status
|
||||
::
|
||||
:::: /hoon/stat/twit/mar
|
||||
:::: /hoon/post/twit/mar
|
||||
::
|
||||
/+ twitter, httr-to-json
|
||||
|_ stat:twitter
|
||||
|_ post:twitter
|
||||
++ grab
|
||||
|%
|
||||
++ noun stat:twitter
|
||||
++ json (corl need stat:parse:twitter)
|
||||
++ noun post:twitter
|
||||
++ json (corl need post:parse:twitter)
|
||||
++ httr (cork httr-to-json json) :: XX mark translation
|
||||
--
|
||||
++ grow
|
8
sur/recoverable-error.hoon
Normal file
8
sur/recoverable-error.hoon
Normal file
@ -0,0 +1,8 @@
|
||||
:: Possibly non-fatal http error
|
||||
::
|
||||
:::: /hoon/recoverable-error/sur
|
||||
::
|
||||
!:
|
||||
$% :: more later, {@u (cask)}
|
||||
{$429 p/{$rate-limit p/(unit @da)}}
|
||||
==
|
@ -73,7 +73,7 @@
|
||||
|* out/$-(* *) :: output structure
|
||||
%+ pair (list tank) ::
|
||||
%+ each (unit out) :: ~ is abort
|
||||
(pair hiss $-(httr (sole-request out))) :: fetch and continue
|
||||
(trel (unit iden) hiss $-(httr (sole-request out))) :: fetch and continue
|
||||
:: ::
|
||||
++ sole-gen :: XX virtual type
|
||||
$% {$say $-((sole-args) (cask))} :: direct noun
|
||||
@ -99,8 +99,10 @@
|
||||
[p=*(list tank) q=[%| p=pom q=mor]] ::
|
||||
:: ::
|
||||
++ sole-at :: fetch url
|
||||
|* {pul/_purl fun/$-(httr *)} ::
|
||||
[p=*(list tank) q=[%| p=[pul %get ~ ~] q=fun]] ::
|
||||
=| usr/iden ::
|
||||
|* {pul/_purl fun/$-(httr *)} ::
|
||||
:- p=*(list tank) ::
|
||||
q=[%| p=`usr q=[pul %get ~ ~] r=fun] ::
|
||||
:: ::
|
||||
++ sole-no :: empty result
|
||||
[p=*(list tank) q=[%& ~]] ::
|
||||
|
215
sur/twitter.hoon
215
sur/twitter.hoon
@ -1,16 +1,15 @@
|
||||
|%
|
||||
++ stat {id/@u who/@ta now/@da txt/@t} :: recieved tweet
|
||||
++ post {id/@u who/@ta now/@da txt/@t} :: recieved tweet
|
||||
++ keys :: twitter-key type
|
||||
$: con/{tok/@t sec/@t} :: user key pair
|
||||
acc/{tok/@t sec/@t} :: app key pair
|
||||
==
|
||||
::
|
||||
++ command :: poke action
|
||||
$% {$auth p/keys} :: set API keys
|
||||
{$post p/@uvI q/cord} :: post a tweet
|
||||
$% {$post p/@uvI q/cord} :: post a tweet
|
||||
==
|
||||
++ sur-twit . :: XX
|
||||
::
|
||||
::
|
||||
++ reqs
|
||||
|%
|
||||
++ args
|
||||
@ -21,7 +20,6 @@
|
||||
++ lid (list tid) :: screen names
|
||||
++ lon @t :: longitude
|
||||
++ lsc (list scr) ::
|
||||
++ lst (list @t)
|
||||
++ nam @t :: location name
|
||||
++ pla @t :: place-id
|
||||
++ scr @t :: screen name
|
||||
@ -32,12 +30,11 @@
|
||||
--
|
||||
++ param
|
||||
=> args
|
||||
=< $? de fo gr id is la lo na os pl qq sc
|
||||
sd ss sl si st te ti ts tr ur ui us
|
||||
=< $? de gr id is la lo na os pl qq sc
|
||||
sd ss sl si st te ti ts ur ui us
|
||||
==
|
||||
|%
|
||||
++ de {$device p/dev}
|
||||
++ fo {$follow p/lid}
|
||||
++ gr {$grant-type p/gat}
|
||||
++ id {$id p/tid}
|
||||
++ is {$id p/lid}
|
||||
@ -56,7 +53,6 @@
|
||||
++ te {$text p/@t}
|
||||
++ ti {$target-id p/tid}
|
||||
++ ts {$target-screen-name p/scr}
|
||||
++ tr {$track p/lst}
|
||||
++ ur {$url p/url}
|
||||
++ ui {$user-id p/tid}
|
||||
++ us {$user-id p/lid}
|
||||
@ -85,112 +81,115 @@
|
||||
:: ^- (pole {_{term _(pole *param)} ?($get $post) path})
|
||||
=> param
|
||||
:~
|
||||
[ {$stat-ment $~} %get /statuses/mentions-timeline ]
|
||||
[ {$stat-user sd $~} %get /statuses/user-timeline ]
|
||||
[ {$stat-home $~} %get /statuses/home-timeline ]
|
||||
[ {$stat-retw $~} %get /statuses/retweets-of-me ]
|
||||
[ {$stat-rets-iddd id $~} %get /statuses/retweets/':id' ]
|
||||
[ {$stat-show id $~} %get /statuses/show ]
|
||||
[ {$stat-dest-iddd id $~} %post /statuses/destroy/':id' ]
|
||||
[ {$stat-upda st $~} %post /statuses/update ]
|
||||
[ {$stat-retw-iddd id $~} %post /statuses/retweet/':id' ]
|
||||
[ {$stat-oemb-iddd id $~} %get /statuses/oembed ]
|
||||
[ {$stat-oemb-urll ur $~} %get /statuses/oembed ]
|
||||
[ {$stat-retw-idss id $~} %get /statuses/retweeters/ids ]
|
||||
[ {$sear-twee qq $~} %get /search/tweets ]
|
||||
:- {$stat-filt-foll ?(fo tr) $~}
|
||||
[%post /statuses/filter]
|
||||
[ {$mentions $~} %get /statuses/mentions-timeline ]
|
||||
[ {$posts-by sd $~} %get /statuses/user-timeline ]
|
||||
[ {$timeline $~} %get /statuses/home-timeline ]
|
||||
[ {$retweets-mine $~} %get /statuses/retweets-of-me ]
|
||||
[ {$retweets-of id $~} %get /statuses/retweets/':id' ]
|
||||
[ {$show-status id $~} %get /statuses/show ]
|
||||
[ {$del-status id $~} %post /statuses/destroy/':id' ]
|
||||
[ {$full-status id $~} %post /statuses/looup ]
|
||||
[ {$update st $~} %post /statuses/update ]
|
||||
[ {$retweet id $~} %post /statuses/retweet/':id' ]
|
||||
[ {$unretweet id $~} %post /statuses/unretweet/':id' ]
|
||||
::
|
||||
[ {$stat-samp $~} %get /statuses/sample ]
|
||||
[ {$stat-fire $~} %get /statuses/firehose ]
|
||||
[ {$dire $~} %get /direct-messages ]
|
||||
[ {$dire-sent $~} %get /direct-messages/sent ]
|
||||
[ {$dire-show id $~} %get /direct-messages/show ]
|
||||
[ {$dire-dest id $~} %post /direct-messages/destroy ]
|
||||
[ {$dire-neww sd te $~} %post /direct-messages/new ]
|
||||
[ {$frie-nore-idss $~} %get /friendships/no-retweets/ids ]
|
||||
[ {$frie-idss sd $~} %get /friends/ids ]
|
||||
[ {$foll-idss sd $~} %get /followers/ids ]
|
||||
[ {$frie-inco $~} %get /friendships/incoming ]
|
||||
[ {$frie-outg $~} %get /friendships/outgoing ]
|
||||
[ {$frie-crea sd $~} %post /friendships/create ]
|
||||
[ {$frie-dest sd $~} %post /friendships/destroy ]
|
||||
[ {$frie-upda sd $~} %post /friendships/update ]
|
||||
:- {$frie-show ?(si os) ?(ti ts) $~}
|
||||
[ {$oembed-from-id id $~} %get /statuses/oembed ]
|
||||
[ {$oembed-from-url ur $~} %get /statuses/oembed ]
|
||||
[ {$retweeters id $~} %get /statuses/retweeters/ids ]
|
||||
[ {$search qq $~} %get /search/tweets ]
|
||||
[ {$all-dms $~} %get /direct-messages ]
|
||||
[ {$all-dms-sent $~} %get /direct-messages/sent ]
|
||||
[ {$show-dm id $~} %get /direct-messages/show ]
|
||||
[ {$del-dm id $~} %post /direct-messages/destroy ]
|
||||
[ {$dm sd te $~} %post /direct-messages/new ]
|
||||
::
|
||||
[ {$blocked-retweeters $~} %get /friendships/no-retweets/ids ]
|
||||
[ {$followers sd $~} %get /followers/list ]
|
||||
[ {$follower-ids sd $~} %get /followers/ids ]
|
||||
[ {$friends sd $~} %get /friends/list ]
|
||||
[ {$friend-ids sd $~} %get /friends/ids ]
|
||||
[ {$friend-requests $~} %get /friendships/incoming ]
|
||||
[ {$friend-requesting $~} %get /friendships/outgoing ]
|
||||
[ {$follow sd $~} %post /friendships/create ]
|
||||
[ {$unfollow sd $~} %post /friendships/destroy ]
|
||||
[ {$set-friendship sd $~} %post /friendships/update ]
|
||||
[ {$relationships ?(us ss) $~} %get /friendships/lookup ]
|
||||
:- {$relationship ?(si os) ?(ti ts) $~}
|
||||
[%get /friendships/show]
|
||||
::
|
||||
[ {$frie-list sd $~} %get /friends/list ]
|
||||
[ {$foll-list sd $~} %get /followers/list ]
|
||||
[ {$frie-look ?(us ss) $~} %get /friendships/lookup ]
|
||||
[ {$acco-sett-gett $~} %get /account/settings ]
|
||||
[ {$acco-veri $~} %get /account/verify-credentials ]
|
||||
[ {$acco-sett-post $~} %post /account/settings ]
|
||||
[ {$acco-upda-deli de $~} %post /account/update-delivery-device ]
|
||||
[ {$acco-upda-prof $~} %post /account/update-profile ]
|
||||
:- {$acco-upda-prof-back $~}
|
||||
[ {$show-settings $~} %get /account/settings ]
|
||||
[ {$test-login $~} %get /account/verify-credentials ]
|
||||
[ {$set-settings $~} %post /account/settings ]
|
||||
[ {$set-sms-target de $~} %post /account/update-delivery-device ]
|
||||
[ {$set-profile $~} %post /account/update-profile ]
|
||||
[ {$set-colors $~} %post /account/update-profile-colors ]
|
||||
[ {$del-background $~} %post /account/remove-profile-banner ]
|
||||
:- {$set-background $~}
|
||||
[%post /account/update-profile-background-image]
|
||||
::
|
||||
[ {$acco-upda-prof-colo $~} %post /account/update-profile-colors ]
|
||||
[ {$bloc-list $~} %get /blocks/list ]
|
||||
[ {$bloc-idss $~} %get /blocks/ids ]
|
||||
[ {$bloc-crea sd $~} %post /blocks/create ]
|
||||
[ {$bloc-dest sd $~} %post /blocks/destroy ]
|
||||
[ {$user-look ?(us ss) $~} %get /users/lookup ]
|
||||
[ {$user-show sd $~} %get /users/show ]
|
||||
[ {$user-sear qq $~} %get /users/search ]
|
||||
[ {$user-cont-tees sd $~} %get /users/contributees ]
|
||||
[ {$user-cont-tors sd $~} %get /users/contributors ]
|
||||
[ {$acco-remo $~} %post /account/remove-profile-banner ]
|
||||
[ {$user-prof sd $~} %get /users/profile-banner ]
|
||||
[ {$mute-user-crea sd $~} %post /mutes/users/create ]
|
||||
[ {$mute-user-dest sd $~} %post /mutes/users/destroy ]
|
||||
[ {$mute-user-idss $~} %get /mutes/users/ids ]
|
||||
[ {$mute-user-list $~} %get /mutes/users/list ]
|
||||
[ {$user-sugg-slug sl $~} %get /users/suggestions ]
|
||||
[ {$user-sugg $~} %get /users/suggestions ]
|
||||
[ {$favo-list $~} %get /favorites/list ]
|
||||
[ {$favo-dest id $~} %post /favorites/destroy ]
|
||||
[ {$favo-crea id $~} %post /favorites/create ]
|
||||
[ {$list-list $~} %get /lists/list ]
|
||||
[ {$list-stat $~} %get /lists/statuses ]
|
||||
[ {$list-memb-dest $~} %post /lists/members/destroy ]
|
||||
[ {$list-memb-hips sd $~} %get /lists/memberships ]
|
||||
[ {$list-subs-bers $~} %get /lists/subscribers ]
|
||||
[ {$list-subs-crea $~} %post /lists/subscribers/create ]
|
||||
[ {$list-subs-show sd $~} %get /lists/subscribers/show ]
|
||||
[ {$list-subs-dest $~} %post /lists/subscribers/destroy ]
|
||||
:- {$list-memb-crea-alll ?(us ss) $~}
|
||||
[%post /lists/members/create-all]
|
||||
[ {$blocks $~} %get /blocks/list ]
|
||||
[ {$blocks-ids $~} %get /blocks/ids ]
|
||||
[ {$block sd $~} %post /blocks/create ]
|
||||
[ {$unblock sd $~} %post /blocks/destroy ]
|
||||
::
|
||||
[ {$list-memb-show sd $~} %get /lists/members/show ]
|
||||
[ {$list-memb-bers $~} %get /lists/members ]
|
||||
[ {$list-memb-crea sd $~} %post /lists/members/create ]
|
||||
[ {$list-dest $~} %post /lists/destroy ]
|
||||
[ {$list-upda $~} %post /lists/update ]
|
||||
[ {$list-crea na $~} %post /lists/create ]
|
||||
[ {$list-show $~} %get /lists/show ]
|
||||
[ {$list-subs-ions sd $~} %get /lists/subscriptions ]
|
||||
:- {$list-memb-dest-alll ?(us ss) $~}
|
||||
[%post /lists/members/destroy-all]
|
||||
[ {$full-users ?(us ss) $~} %get /users/lookup ]
|
||||
[ {$user sd $~} %get /users/show ]
|
||||
[ {$search-users qq $~} %get /users/search ]
|
||||
[ {$user-contributees sd $~} %get /users/contributees ] :: undoc'd
|
||||
[ {$user-contributors sd $~} %get /users/contributors ] :: undoc'd
|
||||
[ {$user-prof sd $~} %get /users/profile-banner ]
|
||||
::
|
||||
[ {$list-owne sd $~} %get /lists/ownerships ]
|
||||
[ {$save-list $~} %get /saved-searches/list ]
|
||||
[ {$save-show-iddd id $~} %get /saved-searches/show/':id' ]
|
||||
[ {$save-crea qq $~} %post /saved-searches/create ]
|
||||
[ {$save-dest-iddd id $~} %post /saved-searches/destroy/':id' ]
|
||||
[ {$geoo-iddd-plac id $~} %get /geo/id/':id' ]
|
||||
[ {$geoo-reve la lo $~} %get /geo/reverse-geocode ]
|
||||
[ {$geoo-sear $~} %get /geo/search ]
|
||||
[ {$geoo-simi la lo na $~} %get /geo/similar-places ]
|
||||
[ {$tren-plac id $~} %get /trends/place ]
|
||||
[ {$tren-avai $~} %get /trends/available ]
|
||||
[ {$tren-clos la lo $~} %get /trends/closest ]
|
||||
[ {$user-repo sd $~} %post /users/report-spam ]
|
||||
[ {$help-conf $~} %get /help/configuration ]
|
||||
[ {$help-lang $~} %get /help/languages ]
|
||||
[ {$help-priv $~} %get /help/privacy ]
|
||||
[ {$help-toss $~} %get /help/tos ]
|
||||
[ {$appl-rate $~} %get /application/rate-limit-status ]
|
||||
[ {$mute-user sd $~} %post /mutes/users/create ]
|
||||
[ {$unmute-user sd $~} %post /mutes/users/destroy ]
|
||||
[ {$muted $~} %get /mutes/users/list ]
|
||||
[ {$muted-ids $~} %get /mutes/users/ids ]
|
||||
::
|
||||
[ {$suggested $~} %get /users/suggestions ]
|
||||
[ {$suggestion sl $~} %get /users/suggestions/':slug' ]
|
||||
:- {$suggestion-posts sl $~}
|
||||
[%get /users/suggestions/':slug'/members]
|
||||
::
|
||||
[ {$favorites $~} %get /favorites/list ]
|
||||
[ {$del-favorite id $~} %post /favorites/destroy ]
|
||||
[ {$favorite id $~} %post /favorites/create ]
|
||||
::
|
||||
[ {$lists $~} %get /lists/list ]
|
||||
[ {$lists-of sd $~} %get /lists/memberships ]
|
||||
[ {$lists-by sd $~} %get /lists/ownerships ]
|
||||
[ {$lists-subscribed sd $~} %get /lists/subscriptions ]
|
||||
[ {$list $~} %get /lists/show ]
|
||||
[ {$list-posts $~} %get /lists/statuses ]
|
||||
[ {$list-remove ?(us ss) $~} %post /lists/members/destroy-all ]
|
||||
[ {$list-subscribers $~} %get /lists/subscribers ]
|
||||
[ {$list-subscribe $~} %post /lists/subscribers/create ]
|
||||
[ {$list-unsubscribe $~} %post /lists/subscribers/destroy ]
|
||||
[ {$list-is-subscribed sd $~} %get /lists/subscribers/show ]
|
||||
[ {$list-add ?(us ss) $~} %post /lists/members/create-all ]
|
||||
[ {$list-is-in sd $~} %get /lists/members/show ]
|
||||
[ {$list-members $~} %get /lists/members ]
|
||||
[ {$del-list $~} %post /lists/destroy ]
|
||||
[ {$config-list $~} %post /lists/update ]
|
||||
[ {$new-list na $~} %post /lists/create ]
|
||||
::
|
||||
[ {$saved-searches $~} %get /saved-searches/list ]
|
||||
[ {$full-saved-search id $~} %get /saved-searches/show/':id' ]
|
||||
[ {$save-search qq $~} %post /saved-searches/create ]
|
||||
[ {$del-saved-search id $~} %post /saved-searches/destroy/':id' ]
|
||||
::
|
||||
[ {$full-geo id $~} %get /geo/id/':id' ]
|
||||
[ {$geo-reverse la lo $~} %get /geo/reverse-geocode ]
|
||||
[ {$search-geo $~} %get /geo/search ]
|
||||
[ {$geo-similar la lo na $~} %get /geo/similar-places ]
|
||||
[ {$trend-locations $~} %get /trends/available ]
|
||||
[ {$trends-at id $~} %get /trends/place ]
|
||||
[ {$trends-near la lo $~} %get /trends/closest ]
|
||||
::
|
||||
[ {$user-report sd $~} %post /users/report-spam ]
|
||||
[ {$help-config $~} %get /help/configuration ]
|
||||
[ {$help-langs $~} %get /help/languages ]
|
||||
[ {$help-privacy $~} %get /help/privacy ]
|
||||
[ {$help-tos $~} %get /help/tos ]
|
||||
[ {$rate-limit-info $~} %get /application/rate-limit-status ]
|
||||
==
|
||||
--
|
||||
--
|
||||
|
Loading…
Reference in New Issue
Block a user