urbit/main/app/twitter-auth/core.hook
2015-01-21 19:31:40 -08:00

28 lines
721 B
Plaintext

:: Input twitter keys
/+ sh-utils
!:
|_ [hide vat=wain]
++ prompts
`(list cord)`~['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)) `+>.$
%.(+< (add-exit ,_`+>.$))
::
++ part
=. vat (flop vat) :: put into order of entry
?. ?=([@ @ @ @ ~] vat)
~|([%keys-missing vat] !!)
=+ =< aut=[[utok usec] atok asec]
`[atok=cord asec=cord utok=cord usec=cord ~]`vat
|= ost=bone
:_ ~
:^ ost %pass /out
[%g %mess serv our %twit-do !>([%auth aut])]
::
++ poke--args (listen-in . (add-nice ,_`.))
++ serv [our /twit]
--