mirror of
https://github.com/urbit/shrub.git
synced 2024-12-13 16:03:36 +03:00
Added discrimination per commanding twitter user
This commit is contained in:
parent
3431844d94
commit
83007d6c30
@ -4,7 +4,8 @@
|
||||
++ peer ,_`.
|
||||
++ poke--args
|
||||
%+ add-subs [[our /twit] our /post/(scot %uv eny)]
|
||||
%^ gate-mess . |=([a=cord ~] [/twit %twit-do !>([%post eny a])])
|
||||
%^ 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>}"]))
|
||||
|
@ -9,15 +9,15 @@
|
||||
::
|
||||
|%
|
||||
++ twit-path :: valid peer path
|
||||
$% [%home ~] :: home timeline
|
||||
$% :: [%home ~] :: home timeline
|
||||
[%user p=@t ~] :: user's tweets
|
||||
[%post p=@ta ~] :: status of status
|
||||
==
|
||||
::
|
||||
++ axle :: app state
|
||||
$: %0
|
||||
kes=(unit keys) :: auth
|
||||
out=(map ,@uvI (each cord stat)) :: sent tweets
|
||||
kes=(map span keys) :: 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
|
||||
==
|
||||
@ -50,7 +50,12 @@
|
||||
::::
|
||||
::
|
||||
|_ [hide axle]
|
||||
++ auth ~|(%no-auth ~(. twit (need kes) lat `@`eny)) :: build API door
|
||||
++ 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) lat `@`eny)
|
||||
::
|
||||
++ cull :: remove seen tweets
|
||||
|= [pax=path rep=(list stat)] ^+ rep
|
||||
=+ pev=(sa (turn (~(get ja fed) pax) |=(stat id)))
|
||||
@ -80,19 +85,19 @@
|
||||
++ poke-twit-do :: recieve request
|
||||
|= [ost=bone @ act=twit-do]
|
||||
^+ [*(list move) +>]
|
||||
?- -.act
|
||||
?- -.q.act
|
||||
%auth
|
||||
:: ~& twit-auth/p.act
|
||||
=. kes `p.act
|
||||
=. kes (~(put by kes) p.act p.q.act)
|
||||
:_(+>.$ [ost %give %nice ~]~) :: XX verify key
|
||||
%post
|
||||
=: out (~(put by out) p.act %& q.act)
|
||||
=: out (~(put by out) p.q.act %& p.act q.q.act)
|
||||
ran (~(del by ran) /peer/home)
|
||||
==
|
||||
%^ wait ost /peer/home
|
||||
:- [ost %give %nice ~]
|
||||
=+ mez=(stat-upda:auth [%status q.act]~ ~)
|
||||
[ost %pass /post/(scot %uv p.act) %e %them ~ mez]~
|
||||
=+ mez=(stat-upda:(auth p.act) [%status q.q.act]~ ~)
|
||||
[ost %pass /post/(scot %uv p.q.act) %e %them ~ mez]~
|
||||
==
|
||||
::
|
||||
++ pour :: recieve response
|
||||
@ -178,12 +183,11 @@
|
||||
?~ ole ~
|
||||
[ost %give %rush %twit-feed (flop ole)]~
|
||||
=- [ost %pass [%peer pax] %e %them ~ `hiss`-]
|
||||
=+ opt=?~(ole ~ ['since_id' (lutt:twit id.i.ole)]~)
|
||||
=+ aut=any-auth
|
||||
?- -.pax
|
||||
%user (stat-user:auth [(to-sd p.pax)]~ ~)
|
||||
%home
|
||||
?~ ole (stat-home:auth)
|
||||
=+ opt=['since_id' (lutt:twit id.i.ole)]~
|
||||
(stat-home:auth ~ opt)
|
||||
%user (stat-user:aut [(to-sd p.pax)]~ opt)
|
||||
:: %home (stat-home:auth ~ opt)
|
||||
==
|
||||
::
|
||||
++ to-sd :: parse user name/numb
|
||||
|
@ -3,24 +3,31 @@
|
||||
!:
|
||||
|_ [hide vat=wain]
|
||||
++ prompts
|
||||
`(list cord)`~['App token: ' 'App secret: ' 'User token: ' 'User secret: ' '']
|
||||
^- wain
|
||||
:~ 'User: '
|
||||
'App token: '
|
||||
'App secret: '
|
||||
'User token: '
|
||||
'User secret: '
|
||||
''
|
||||
==
|
||||
++ peek ,_prompt/[(snag (lent vat) prompts) %text '']
|
||||
++ posh-txt
|
||||
|= [@ * p=cord]
|
||||
=. vat [p vat]
|
||||
?. =(4 (lent vat)) `+>.$
|
||||
?. =(5 (lent vat)) `+>.$
|
||||
%.(+< (add-exit ,_`+>.$))
|
||||
::
|
||||
++ part
|
||||
=. vat (flop vat) :: put into order of entry
|
||||
?. ?=([@ @ @ @ ~] vat)
|
||||
?. ?=([@ @ @ @ @ ~] vat)
|
||||
~|([%keys-missing vat] !!)
|
||||
=+ =< aut=[[ctok csec] atok asec]
|
||||
`[ctok=cord csec=cord atok=cord asec=cord ~]`vat
|
||||
=+ =< aut=[acc %auth [ctok csec] atok asec]
|
||||
`[acc=span ctok=cord csec=cord atok=cord asec=cord ~]`vat
|
||||
|= ost=bone
|
||||
:_ ~
|
||||
:^ ost %pass /out
|
||||
[%g %mess serv our %twit-do !>([%auth aut])]
|
||||
[%g %mess serv our %twit-do !>(aut)]
|
||||
::
|
||||
++ poke--args (listen-in . (add-nice ,_`.))
|
||||
++ serv [our /twit]
|
||||
|
@ -1,3 +1,4 @@
|
||||
hoontap
|
||||
AP3G1t8ki6rPzeeAqdWCTw03F
|
||||
VV784LPwZSaAxtF16RWWTnST4F85BHN8VqQKNyv7MprCkA0xZD
|
||||
2821727326-RZGXSeTn7hCFQfJqR0ViivM3YYpu2O1M71gelBl
|
||||
|
@ -12,7 +12,10 @@
|
||||
++ rens
|
||||
|=(stat rose/[": " `~]^~[leaf/"{<now>} @{(trip who)}" leaf/(trip txt)])
|
||||
++ peer ,_`.
|
||||
++ poke--args (add-subs [[our /twit] our /home] ,_`.)
|
||||
++ 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]~))
|
||||
|
@ -1,5 +1,6 @@
|
||||
|%
|
||||
++ twit-do
|
||||
++ twit-do ,[p=span q=command] :: user and action
|
||||
++ command :: poke action
|
||||
$% [%auth p=keys] :: set API keys
|
||||
[%post p=@uvI q=cord] :: post a tweet
|
||||
==
|
||||
|
Loading…
Reference in New Issue
Block a user