urbit/main/app/twitter-auth/core.hook
2015-01-26 19:43:38 -08:00

35 lines
774 B
Plaintext

:: Input twitter keys
/+ sh-utils
!:
|_ [hide vat=wain]
++ prompts
^- wain
:~ 'User: '
'App token: '
'App secret: '
'User token: '
'User secret: '
''
==
++ peek ,_prompt/[(snag (lent vat) prompts) %text '']
++ posh-txt
|= [@ * p=cord]
=. vat [p vat]
?. =(5 (lent vat)) `+>.$
%.(+< (add-exit ,_`+>.$))
::
++ part
=. vat (flop vat) :: put into order of entry
?. ?=([@ @ @ @ @ ~] vat)
~|([%keys-missing 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 !>(aut)]
::
++ poke--args (listen-in . (add-nice ,_`.))
++ serv [our /twit]
--