mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-11-28 19:55:53 +03:00
Stripdown part 2.
This commit is contained in:
parent
f6d54ae941
commit
a74d5219fc
57
ape/ask.hoon
57
ape/ask.hoon
@ -1,57 +0,0 @@
|
||||
::
|
||||
:::: /hoon+ask+ape
|
||||
::
|
||||
/? 314
|
||||
/+ sole
|
||||
[. sole]
|
||||
|%
|
||||
++ card
|
||||
$% {$diff $sole-effect sole-effect}
|
||||
==
|
||||
--
|
||||
!:
|
||||
|_ {bow/bowl adr/(set cord) sos/(map bone sole-share)}
|
||||
++ peer-sole
|
||||
|= path
|
||||
^- (quip {bone card} +>)
|
||||
~| [%not-in-whitelist src.bow]
|
||||
?> (~(has in (sa (limo ~zod our.bow ~talsur-todres ~))) src.bow)
|
||||
:_ +>.$(sos (~(put by sos) ost.bow *sole-share))
|
||||
=- [(effect %mor pro+[& %$ "<listening>"] -)]~
|
||||
=+ all=adrs
|
||||
[tan+(turn all message) (turn all put-mail)]
|
||||
::
|
||||
++ adrs (sort (~(tap by adr)) aor)
|
||||
++ effect |=(fec/sole-effect [ost.bow %diff %sole-effect fec])
|
||||
++ message |=(ask/@t leaf+"ask: {(trip ask)}")
|
||||
++ put-mail |=(ask/@t =+(pax=(rash ask unix-path) [%sav pax '']))
|
||||
++ unix-path :: split into path of "name" and "extension"
|
||||
;~ (glue dot)
|
||||
(cook crip (star ;~(less dot next)))
|
||||
;~(plug (cook crip (star next)) (easy ~))
|
||||
==
|
||||
::
|
||||
++ poke-ask-mail
|
||||
|= ask/@t
|
||||
^- (quip {bone card} +>)
|
||||
~| have-mail+ask
|
||||
?< (~(has in adr) ask)
|
||||
:_ +>.$(adr (~(put in adr) ask))
|
||||
=+ [mez=[(message ask)]~ sav=(put-mail ask)]
|
||||
%+ turn (prey /sole bow)
|
||||
|=({ost/bone ^} (effect(ost.bow ost) %mor tan+mez sav ~))
|
||||
::
|
||||
++ poke-sole-action
|
||||
|= act/sole-action
|
||||
^- (quip {bone card} +>)
|
||||
?- -.act
|
||||
$clr `+>.$
|
||||
$ret [[(effect tan+(turn adrs message))]~ +>.$] :: re-print list
|
||||
$det :: reject all input
|
||||
=+ som=(~(got by sos) ost.bow) :: XX this code belongs in a library
|
||||
=^ inv som (~(transceive sole som) +.act)
|
||||
=^ det som (~(transmit sole som) inv)
|
||||
=. sos (~(put by sos) ost.bow som)
|
||||
[[(effect det+det)]~ +>.$]
|
||||
==
|
||||
--
|
220
ape/bit.hoon
220
ape/bit.hoon
@ -1,220 +0,0 @@
|
||||
::
|
||||
::
|
||||
::::
|
||||
::
|
||||
/? 314
|
||||
/- talk, bit-api
|
||||
/+ talk, sole, http
|
||||
!:
|
||||
:::: sivtyv-barnel
|
||||
:: be sure to have oauth2-code markk
|
||||
[talk bit-api .]
|
||||
|%
|
||||
++ axle
|
||||
$: cred/(unit {app-secret/@t client-id/@t})
|
||||
oauth-code/(unit @t)
|
||||
auth/(unit {access/@t refresh/@t})
|
||||
contacts/(map @t @t)
|
||||
outgoing/(map ship @t) incoming/(map @t ship)
|
||||
==
|
||||
++ move {bone note}
|
||||
++ hapt {ship path}
|
||||
++ note
|
||||
$% {$send wire {ship term} $poke mesa}
|
||||
{$them wire (unit hiss)}
|
||||
{$hiss wire mark bit-any}
|
||||
==
|
||||
++ gift
|
||||
$% {$nice $~}
|
||||
{$mean ares}
|
||||
==
|
||||
++ sign
|
||||
$% {$thou p/httr}
|
||||
{$unto $coup p/(unit tang)}
|
||||
==
|
||||
++ mesa
|
||||
$% {$bit-addr-request $~}
|
||||
{$bit-addr-made @t}
|
||||
{$talk-command command}
|
||||
==
|
||||
--
|
||||
::
|
||||
!:
|
||||
|_ {hid/bowl vat/axle}
|
||||
:: ++ prep ~&(%bit-prep-wipe ,_`.)
|
||||
++ return [*(list move) .]
|
||||
++ redirect-uri [hostname `/~~/home+pub+bit+fab ~]
|
||||
++ hostname ^- hart
|
||||
?+ (clan our.hid) !!
|
||||
$czar [| ?+(our.hid `8.443 $~fyr `8.444) `/localhost]
|
||||
$duke [| `8.444 `/org+urbit+(crip +:<our.hid>)]
|
||||
==
|
||||
++ auth-url
|
||||
%+ weld "https://sandbox.coinbase.com+oauth+authorize"
|
||||
%- tail:earn :~
|
||||
'response_type'^%code
|
||||
'client_id'^client-id:(need cred.vat)
|
||||
'redirect_uri'^(crip (earn redirect-uri))
|
||||
'scope'^'user balance buy sell send transactions addresses'
|
||||
'meta[send_limit_amount]'^'1'
|
||||
'meta[send_limit_curency]'^'BTC'
|
||||
'meta[send_limit_period]'^'day'
|
||||
==
|
||||
++ old-api
|
||||
|= {pour-path/wire end-point/path req/$@($get {$post p/json})}
|
||||
^- move
|
||||
%^ send:http ost.hid pour-path
|
||||
[/com+coinbase+api v1/end-point req ~ ['access_token' access:(need auth.vat)]~]
|
||||
::
|
||||
++ api-call
|
||||
|= {res/mark req/bit-api-call} ^+ return
|
||||
~| %missing-access-token
|
||||
[[ost.hid %hiss / res bit-api-call+[access:(need auth.vat) req]]~ +>.$]
|
||||
::
|
||||
++ print |=(msg/tape [[(publish [%lin & (crip msg)]~)]~ +>.$])
|
||||
++ callback-uri [hostname [`%json /~/to+[dap.hid]/json] ~[anon+'' wire+'/']]
|
||||
++ poke-auth
|
||||
|= arg/{secr/cord id/cord}
|
||||
=. cred.vat `arg
|
||||
=+ prl=`purl`(need (epur (crip auth-url)))
|
||||
:_ +>.$
|
||||
:- %- publish
|
||||
:~ [%lin & 'secret and client id saved successfully']
|
||||
[%lin & 'please click on the url below to continue authentication']
|
||||
[%url prl ~]
|
||||
==
|
||||
~
|
||||
::
|
||||
++ sigh-tang |=({* err/tang} (mean err))
|
||||
++ send-friend :: inter-app interface
|
||||
|= {way/wire his/ship mez/$%({$bit-addr-request $~} {$bit-addr-made @t})}
|
||||
^- move
|
||||
[ost.hid %send way [his dap.hid] %poke mez]
|
||||
::
|
||||
++ poke-bit-send |=(req/bit-send (api-call %bit-transaction send+req))
|
||||
++ sigh-bit-transaction
|
||||
|=({* trid/@t} (print "transaction success {(trip trid)}"))
|
||||
::
|
||||
++ poke-bit-ship-send :: send to ship
|
||||
|= {to/ship amount/@t}
|
||||
=. outgoing.vat (~(put by outgoing.vat) to amount)
|
||||
:_ +>.$
|
||||
:_ ~
|
||||
(send-friend /sent to %bit-addr-request ~)
|
||||
::
|
||||
++ poke-bit-addr-request :: give your address to receive bit
|
||||
|= $~ :: gen new address with callback
|
||||
:_ +>.$
|
||||
:_ ~
|
||||
%+ old-api /addr-request+(scot %p src.hid)
|
||||
:+ /addresses %post
|
||||
%+ joba %address
|
||||
%- jobe :~
|
||||
label+(jape "address for {<src.hid>}")
|
||||
'callback_url'^(jape (earn callback-uri))
|
||||
==
|
||||
::
|
||||
++ pour-addr-request :: send new address to sender
|
||||
|= {pax/path rez/json}
|
||||
=+ adr=(need ((ot address+so ~):jo rez))
|
||||
=+ his=(slav %p +<.pax)
|
||||
~! incoming.vat
|
||||
=. incoming.vat
|
||||
(~(put by incoming.vat) adr his)
|
||||
:_ +>.$
|
||||
:_ ~
|
||||
(send-friend [%message ~] his %bit-addr-made adr)
|
||||
::
|
||||
++ poke-bit-addr-made :: receive address for sending
|
||||
|= addr/@t
|
||||
=+ amount=(~(got by outgoing.vat) src.hid) :: get amount to send
|
||||
(api-call %bit-transaction txt-send+[addr amount])
|
||||
::
|
||||
++ poke-oauth2-code
|
||||
|= code/cord
|
||||
=. oauth-code.vat
|
||||
[~ code]
|
||||
?< ?=($~ cred.vat)
|
||||
=+ req=[code [client-id app-secret]:u.cred.vat redirect-uri]
|
||||
[[ost.hid %hiss / %oauth-tokens bit-get-token+req]~ +>.$]
|
||||
::
|
||||
++ sigh-oauth-tokens
|
||||
|= {wire toke/{access/@t refresh/@t}}
|
||||
=.(auth.vat `toke (print "authenticated."))
|
||||
::
|
||||
++ poke-buy
|
||||
|=(arg/{amount/@t currency/@t} ?<(=(amount.arg ~) (api-call %json %buy arg)))
|
||||
::
|
||||
++ poke-sell
|
||||
|=(arg/{amount/@t currency/@t} ?<(=(amount.arg ~) (api-call %json %sell arg)))
|
||||
++ sigh-json |=({* a/json} ~&(a return))
|
||||
++ poke-list |=($~ (api-call %bit-accounts %list ~))
|
||||
++ sigh-bit-accounts |=({* acc/bit-accounts} ~&(accounts=acc return))
|
||||
++ poke-send-raw
|
||||
|= arg/{to/@t amone/(unit @t) cur/(unit @t) amtwo/(unit @t) nt/(unit @t)}
|
||||
=+ ^= adr
|
||||
?~ (~(get by contacts.vat) to.arg) to
|
||||
~&('contact-exists' (~(get by contacts.vat) to.arg))
|
||||
=+ ^= info
|
||||
?~ cur.arg
|
||||
[to+s+to.arg amount+s+(need amone.arg) ~]
|
||||
?~ nt.arg
|
||||
:* to+s+to.arg
|
||||
'amount_currency_iso'^s+(need cur.arg)
|
||||
'amount_string'^s+(need amtwo.arg)
|
||||
~
|
||||
==
|
||||
:* to+s+to.arg
|
||||
amount+s+(need amtwo.arg)
|
||||
'amount_string'^s+(need amtwo.arg)
|
||||
~
|
||||
==
|
||||
=+ ^= pst
|
||||
(jobe transaction+(jobe info) ~)
|
||||
[[(old-api /send /transactions+'send_money' %post pst) ~] +>.$]
|
||||
::
|
||||
++ poke-json
|
||||
|= arg/json
|
||||
~& arg
|
||||
=+ [adr amo]=(need %.(arg (ot address+so amount+no ~):jo))
|
||||
=+ frm=(~(get by incoming.vat) adr)
|
||||
(print "just received {(trip amo)} BTC from {<frm>}")
|
||||
::(old-api /get-id /transactions+[transaction-id] %get)
|
||||
::
|
||||
++ pour-get-id :: display transaction info
|
||||
|= {pax/path rez/json}
|
||||
:_ +>.$
|
||||
:_ ~
|
||||
!!
|
||||
::
|
||||
++ thou
|
||||
|= {way/wire res/httr}
|
||||
?+ -.way !!
|
||||
$message `+>.$
|
||||
?($addr-request $get-id)
|
||||
~| 'must receive a 200'
|
||||
~| res
|
||||
?> =(200 p.res)
|
||||
%- ?-(-.way $addr-request pour-addr-request, $get-id pour-get-id)
|
||||
[way (rash q:(need r.res) apex:poja)]
|
||||
==
|
||||
::
|
||||
++ publish
|
||||
|= act/(list speech)
|
||||
^- move
|
||||
=+ ^= thotz
|
||||
%+ turn act
|
||||
|= sp/speech ^- thought
|
||||
=+ ^= tail
|
||||
:- ^- audience
|
||||
:+ :- ^- partner
|
||||
[%& our.hid ?+((clan our.hid) !! $czar %court, $duke %porch)]
|
||||
^- (pair envelope delivery)
|
||||
[`envelope`[& ~] %pending]
|
||||
~
|
||||
~
|
||||
`statement`[now.hid ~ sp]
|
||||
:- `@`(sham eny.hid tail)
|
||||
tail
|
||||
[ost.hid %send /auth [our.hid %talk] %poke [%talk-command %publish thotz]]
|
||||
--
|
691
ape/cloud.hoon
691
ape/cloud.hoon
@ -1,691 +0,0 @@
|
||||
:: digital ocean fleet management
|
||||
::
|
||||
::::
|
||||
::
|
||||
/? 314
|
||||
/- talk
|
||||
::
|
||||
::
|
||||
:::: sivtyv-barnel
|
||||
::
|
||||
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
:: data structures ::
|
||||
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
!:
|
||||
[talk .]
|
||||
|%
|
||||
++ instance
|
||||
$: plat/?($do $gce)
|
||||
name/@t
|
||||
id/@t
|
||||
status/@t
|
||||
created/@da
|
||||
snapshot/name/@t
|
||||
==
|
||||
++ image
|
||||
$: plat/?($do $gce)
|
||||
name/@t
|
||||
id/@t
|
||||
==
|
||||
++ create-req-do
|
||||
$: name/@t
|
||||
size/@t
|
||||
image/@t
|
||||
ssh/(list cord)
|
||||
backups/(unit ?)
|
||||
ipv6+(unit ?)
|
||||
private-networking/(unit ?)
|
||||
user-data/(unit @t)
|
||||
==
|
||||
++ create-req-gce {project/@t zone/@t name/@t machine-type/@t}
|
||||
++ axle
|
||||
$: auth/{do/keys gce/keys}
|
||||
toke/{do/tokens gce/tokens}
|
||||
insts/(map @t instance)
|
||||
images/(map {@t @t} image)
|
||||
==
|
||||
++ keys {authc/(unit @t) client-secret/(unit @t)}
|
||||
++ tokens {access/@t refresh/@t}
|
||||
++ move {bone card}
|
||||
++ card
|
||||
$% {$diff $json json}
|
||||
{$wait wire @da}
|
||||
{$send wire {ship term} $poke $talk-command command}
|
||||
{$them wire (unit hiss)}
|
||||
==
|
||||
++ droplet-action
|
||||
$% {$start $~}
|
||||
{$stop $~}
|
||||
{$reboot $~}
|
||||
{$delete $~}
|
||||
{$snapshot p/@t}
|
||||
==
|
||||
++ cloud-command
|
||||
$% {$action id/@t name/@t act/droplet-action}
|
||||
{$create-do p/json}
|
||||
{$create-gce p/json}
|
||||
==
|
||||
--
|
||||
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
:: miscellaneous functions ::
|
||||
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
!:
|
||||
|%
|
||||
++ auth-queries
|
||||
|= code/cord
|
||||
:~ 'grant_type'^'authorization_code'
|
||||
'code'^code
|
||||
:- 'client_id'
|
||||
'd8f46b95af38c1ab3d78ad34c2157a6959c23eb0eb5d8e393f650f08e6a75c6f'
|
||||
'redirect_uri'^'http://localhost:8443/home+pub+cloud+fab'
|
||||
==
|
||||
::
|
||||
++ parse-iso8601
|
||||
=< (cook to-time (parsf ;"{parse-day}T{parse-seconds}{parse-zone}"))
|
||||
|%
|
||||
++ to-time
|
||||
|= {{y/@u m/@u d/@u} t/{h/@u m/@u s/@u ms/@u} {syn/? zh/@u zm/@u}}
|
||||
^- @da
|
||||
%- year
|
||||
^- date
|
||||
=: h.t ?:(syn (sub h.t zh) (add h.t zh))
|
||||
m.t ?:(syn (sub m.t zm) (add m.t zm))
|
||||
==
|
||||
[[& y] m d h.t m.t s.t (div (mul ms.t 0x1.0000) 1.000) ~]
|
||||
++ parse-day (parsf ;"{dem}\-{dem}\-{dem}")
|
||||
++ parse-seconds (parsf ;"{dem}:{dem}:{dem}{(optional ;~(pfix dot dem))}")
|
||||
++ optional |*(fel/rule ;~(pose fel (easy 0)))
|
||||
++ parse-zone
|
||||
;~ pose
|
||||
(cold [& 0 0] (jest 'Z'))
|
||||
(parsf ;"{parse-zone-sign}{dem}:{dem}")
|
||||
==
|
||||
++ parse-zone-sign ;~(plug ;~(pose (cold & lus) (cold | hep)))
|
||||
--
|
||||
++ parse-cloud-command
|
||||
=+ jo
|
||||
%- of :~
|
||||
[%create-gce some]
|
||||
[%create-do some]
|
||||
::[%create-gce some]
|
||||
:- %action
|
||||
(ot id+so name+so act+parse-droplet-action ~)
|
||||
==
|
||||
++ parse-droplet-action
|
||||
=> jo
|
||||
%- of :~
|
||||
[%start ul]
|
||||
[%stop ul]
|
||||
[%reboot ul]
|
||||
[%delete ul]
|
||||
[%snapshot so]
|
||||
==
|
||||
++ key-do
|
||||
(mo [%start 'power_on'] [%stop 'shutdown'] [%reboot 'power_cycle'] ~)
|
||||
::
|
||||
++ adapter-do
|
||||
|= a/cord
|
||||
(~(got by key-do) a)
|
||||
::
|
||||
++ parse-ip-do
|
||||
=> jo
|
||||
%- ot
|
||||
:_ ~ v4/(ar (ot 'ip_address'^(su lip:ag) ~))
|
||||
::
|
||||
++ parse-ip-gce
|
||||
=> jo
|
||||
%+ cu |=(a/(list (list @if)) `(list @if)`(zing a))
|
||||
(ar (ot 'accessConfigs'^(ar (ot 'natIP'^(su lip:ag) ~)) ~))
|
||||
::
|
||||
++ tail-url
|
||||
|= a/cord
|
||||
-:(flop q.q:(need (epur a)))
|
||||
::
|
||||
++ parse-region
|
||||
=> jo
|
||||
(ot name+so ~)
|
||||
::
|
||||
++ parse-id-text
|
||||
|= jon/json
|
||||
?.(?=({?($n $s) *} jon) ~ (some p.jon))
|
||||
::
|
||||
++ create-do-body
|
||||
|= $: name/@t
|
||||
size/@t
|
||||
image/@t
|
||||
ssh-keys/(list cord)
|
||||
backups/(unit ?)
|
||||
ipv6+(unit ?)
|
||||
private-networking/(unit ?)
|
||||
user-data/(unit @t)
|
||||
==
|
||||
%- jobe
|
||||
:~ name+s+name
|
||||
size+s+size
|
||||
image+s+image
|
||||
backups+?~(backups ~ b+u.backups)
|
||||
ipv6/?~(ipv6 ~ b+u.ipv6)
|
||||
'user_data'^?~(user-data ~ s+u.user-data)
|
||||
'private_networking'^?~(private-networking ~ b+u.private-networking)
|
||||
==
|
||||
::
|
||||
++ convert-do
|
||||
|= a/?($start $stop $reboot $snapshot)
|
||||
?- a
|
||||
$start
|
||||
'power_on'
|
||||
$stop
|
||||
'shutdown'
|
||||
$reboot
|
||||
'power_cycle'
|
||||
$snapshot
|
||||
'snapshot'
|
||||
==
|
||||
::
|
||||
++ instance-to-json
|
||||
|= a/(list instance)
|
||||
^- json
|
||||
%+ joba 'instances'
|
||||
:- %a
|
||||
%+ turn a
|
||||
|= instance
|
||||
^- json
|
||||
%- jobe
|
||||
:~ name+`json`s+name
|
||||
id+s+id
|
||||
status+s+status
|
||||
created+s+(crip (dust (yore created)))
|
||||
snapshot+s+snapshot
|
||||
==
|
||||
++ map-to-list
|
||||
|= a/(map {@t @t} image)
|
||||
^- liz/(list image)
|
||||
%+ turn (~(tap by a) *(list {{@t @t} image}))
|
||||
|=(a/{{@t @t} image} `image`+.a)
|
||||
::
|
||||
++ image-to-json
|
||||
|= a/(list image)
|
||||
%+ joba 'images'
|
||||
:- %a
|
||||
%+ turn a
|
||||
|= image
|
||||
^- json
|
||||
%- jobe
|
||||
:~ name+s+name id+s+id ==
|
||||
--
|
||||
::::::::::::::::
|
||||
:: main door ::
|
||||
::::::::::::::::
|
||||
!:
|
||||
|_ {bowl vat/axle}
|
||||
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
:: miscellaneous arms that have to be in main door for scope reasons ::
|
||||
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
::
|
||||
++ thou
|
||||
|= {pour-path/path resp/?(httr *)}
|
||||
^- {(list move) _+>.$}
|
||||
~& unhandled-pour-path+resp
|
||||
:_ +>.$ ~
|
||||
::
|
||||
++ httpreq
|
||||
|= $: pour-path/wire :: must be in main door because of scope
|
||||
domain/(list cord)
|
||||
end-point/path
|
||||
req-type/$?($get $delt {$post json})
|
||||
headers/math
|
||||
queries/quay
|
||||
==
|
||||
^- move
|
||||
=+ ^- parsed-url/purl
|
||||
:+ ^= host-port :: ++hart
|
||||
:+ security=%.y
|
||||
port=~
|
||||
host=[%.y [path=[%com domain]]]
|
||||
endpoint=[extensions=~ point=end-point] :: ++pork,
|
||||
q-strings=queries :: ++quay
|
||||
=+ ^- request/hiss :: cast to hiss
|
||||
:- parsed-url
|
||||
?@ req-type
|
||||
[req-type headers ~]
|
||||
[%post headers ~ (tact (pojo +.req-type))]
|
||||
:^ ost %them pour-path
|
||||
`(unit hiss)`[~ request]
|
||||
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
:: manage supscriptions and publish to talk ::
|
||||
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
++ peer
|
||||
|= pax/path
|
||||
^- {(list move) _+>.$}
|
||||
:_ +>.$
|
||||
=+ lis=(~(tap by insts.vat))
|
||||
[ost %diff %json (instance-to-json (turn lis |=(a/{@t instance} +.a)))]~
|
||||
::
|
||||
++ spam
|
||||
|= jon/json
|
||||
%+ turn (~(tap by sup))
|
||||
|= {sub/bone @ pax/path}
|
||||
^- move
|
||||
[sub %diff %json jon]
|
||||
::
|
||||
++ publish
|
||||
|= {act/(list speech)}
|
||||
^- move
|
||||
=+ ^= spchz
|
||||
%+ turn act
|
||||
|= sp/speech
|
||||
=+ ^= tail
|
||||
:- ^- audience
|
||||
:+ :- `partner`[%& our ?+((clan our) !! $czar %court, $duke %porch)]
|
||||
^- (pair envelope delivery)
|
||||
[`envelope`[& ~] %pending]
|
||||
~
|
||||
~
|
||||
`statement`[now ~ sp]
|
||||
^- thought
|
||||
:- `@`(sham eny tail)
|
||||
tail
|
||||
=+ mez=[%talk-command [%publish `(list thought)`spchz]]
|
||||
[ost %send /pub [our %talk] %poke mez]
|
||||
++ thou-pub |=($~ :_(+>.$ ~))
|
||||
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
:: authentication ::
|
||||
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
++ poke-cloud-auth
|
||||
|= {cde/cord typ/cord}
|
||||
^- {(list move) _+>.$}
|
||||
?: =(%do typ)
|
||||
=. authc.do.auth.vat
|
||||
[~ cde]
|
||||
:_ +>.$ ~
|
||||
=. access.gce.toke.vat
|
||||
cde
|
||||
:_ +>.$
|
||||
:_ list-gce
|
||||
(publish [%lin & 'successfully authenticated to gce']~)
|
||||
::
|
||||
++ poke-cloud-secret
|
||||
|= {secret/cord typ/cord}
|
||||
^- {(list move) _+>.$}
|
||||
?+ typ ~|(missing-platform=typ !!)
|
||||
$do
|
||||
=. client-secret.do.auth.vat
|
||||
[~ secret]
|
||||
:_ +>.$
|
||||
:_ ~
|
||||
%+ httpreq /do/auth
|
||||
:^ ~[%digitalocean %cloud] `path`/v1/oauth/token
|
||||
[%post ~]
|
||||
:- ~ `quay`['client_secret'^secret (auth-queries (need authc.do.auth.vat))]
|
||||
==
|
||||
::
|
||||
++ thou-do-auth
|
||||
|= {$~ resp/httr}
|
||||
^- {(list move) _+>.$}
|
||||
~| resp
|
||||
=+ body=(rash q:(need r.resp) apex:poja)
|
||||
~| receive-auth+resp(r body)
|
||||
=+ [ac re]=(need ((ot 'access_token'^so 'refresh_token'^so ~):jo body))
|
||||
=: access.do.toke.vat ac
|
||||
refresh.do.toke.vat re
|
||||
==
|
||||
:_ +>.$
|
||||
:- (publish [%lin & 'successfully authenticated']~)
|
||||
list-do
|
||||
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
:: create digital ocean droplets ::
|
||||
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
++ create-do
|
||||
|= act/json
|
||||
=+ ^- deets/create-req-do
|
||||
%- need
|
||||
%. act
|
||||
=> jo
|
||||
%- ot
|
||||
:~ name+so
|
||||
size+so
|
||||
image+so
|
||||
ssh+(ar so)
|
||||
backups+(mu bo)
|
||||
'ipv6'^(mu bo)
|
||||
'priv_networking'^(mu bo)
|
||||
'user_data'^(mu so)
|
||||
==
|
||||
=+ ^- body/json
|
||||
%- create-do-body
|
||||
:* name.deets
|
||||
size.deets
|
||||
image.deets
|
||||
ssh.deets
|
||||
backups.deets
|
||||
ipv6.deets
|
||||
private-networking.deets
|
||||
user-data.deets
|
||||
==
|
||||
%- httpreq :*
|
||||
/create-do
|
||||
~[%digitalocean %api] /v2/droplets
|
||||
[%post body]
|
||||
%^ mo ['Content-Type' 'application+json; charset=utf-8' ~]
|
||||
['Authorization' (cat 3 'Bearer ' access.do.toke.vat) ~]
|
||||
~
|
||||
~
|
||||
==
|
||||
::
|
||||
++ thou-create-do |=({path resp/httr} ~&(resp :_(+>.$ ~)))
|
||||
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
:: create google instances ::
|
||||
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
++ reserve-ip
|
||||
|= name/json
|
||||
=+ nam=(need ((ot name+so ~):jo name))
|
||||
%- httpreq
|
||||
:* /reserve-ip/[nam]
|
||||
~['googleapis' 'www']
|
||||
/compute/v1/projects/urbcloud/regions/us-central1/addresses
|
||||
[%post (joba name+s+nam)]
|
||||
%^ mo ['Content-Type' 'application+json' ~]
|
||||
['Authorization' (cat 3 'Bearer ' access.gce.toke.vat) ~]
|
||||
~
|
||||
*quay
|
||||
==
|
||||
::
|
||||
++ thou-reserve-ip
|
||||
|= {pax/path resp/httr}
|
||||
~& resp
|
||||
~| r.resp
|
||||
=+ parsed=(rash q:(need r.resp) apex:poja)
|
||||
=+ ur=(need ((ot 'targetLink'^so ~):jo parsed))
|
||||
~& initial-response+parsed
|
||||
=+ name=-:(flop q.q:(need (epur ur)))
|
||||
=+ buf=`@da`(add ~s10 now)
|
||||
:_(+>.$ [ost %wait `path`/check-ip-status/[name] buf]~)
|
||||
::
|
||||
++ wake-check-ip-status
|
||||
|= {name/path $~}
|
||||
~& this-is-the-name+name
|
||||
=+ nam=?~(name !! -.name)
|
||||
:_ +>.$
|
||||
:_ ~
|
||||
%- httpreq
|
||||
:* `path`/check-ip-status/[nam]
|
||||
~['googleapis' 'www']
|
||||
`path`/compute/v1/projects/urbcloud/regions/us-central1/addresses/[nam]
|
||||
%get
|
||||
%^ mo ['Content-Type' 'application+json' ~]
|
||||
['Authorization' (cat 3 'Bearer ' access.gce.toke.vat) ~]
|
||||
~
|
||||
*quay
|
||||
==
|
||||
++ thou-check-ip-status
|
||||
|= {name/path resp/httr}
|
||||
~& api-resp+resp
|
||||
=+ parsed=(rash q:(need r.resp) apex:poja)
|
||||
!!
|
||||
::?. =('RESERVED' (need ((ot status+so ~):jo parsed)))
|
||||
::
|
||||
++ create-gce
|
||||
|= jon/json
|
||||
=+ ^- {name/@t image/@t number/@ud}
|
||||
(need ((ot name+so 'instance_img'^so number+ni ~):jo jon))
|
||||
|- ^- (list move)
|
||||
?~ number ~
|
||||
:_ $(number (dec number))
|
||||
=+ nam=(cat 3 name (scot %ud number))
|
||||
=+ ^- body/json
|
||||
%- jobe
|
||||
:~ name+s+nam
|
||||
'machineType'^s+'zones+us-central1-a+machineTypes+n1-standard-1'
|
||||
:- %disks :- %a :_ ~
|
||||
%- jobe
|
||||
:+ 'initializeParams'^`json`(joba 'sourceImage'^s+image)
|
||||
boot+b+%.y
|
||||
~
|
||||
:- 'networkInterfaces' :- %a :_ ~
|
||||
(joba 'network' `json`[%s 'global+networks+default'])
|
||||
==
|
||||
^- move
|
||||
%- httpreq
|
||||
:* `path`/create-gce
|
||||
`(list cord)`~['googleapis' 'www']
|
||||
`path`/compute/v1/projects/urbcloud/zones/us-central1-a/'instances'
|
||||
[%post `json`body]
|
||||
%^ mo ['Content-Type' 'application+json' ~]
|
||||
['Authorization' (cat 3 'Bearer ' access.gce.toke.vat) ~]
|
||||
~
|
||||
`quay`[%key access.gce.toke.vat]~
|
||||
==
|
||||
::
|
||||
++ thou-create-gce |=({path resp/httr} ~&(resp :_(+>.$ ~)))
|
||||
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
:: perform actions on instances (both kinds) ::
|
||||
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
++ poke-json :: receive action from client
|
||||
|= jon/json
|
||||
^- {(list move) _+>.$}
|
||||
=+ action=`cloud-command`(need (parse-cloud-command jon))
|
||||
:_ +>.$
|
||||
?- -.action
|
||||
$create-gce [(reserve-ip p.action)]~
|
||||
$create-do [(create-do p.action)]~
|
||||
::$create-gce [(create-gce p.action)]
|
||||
$action [(instance-action [id name act]:action)]~
|
||||
==
|
||||
++ instance-action
|
||||
|= {id/@t name/@t action/droplet-action}
|
||||
=+ d=(~(got by insts.vat) id)
|
||||
~| 'can\'t find id'
|
||||
=+ typ=?~(d !! -.d)
|
||||
?- typ
|
||||
$do
|
||||
=+ ^= meth
|
||||
?: ?=($delete -.action)
|
||||
%delt
|
||||
:- %post
|
||||
%+ jobe type+s+(convert-do -.action)
|
||||
?.(?=($snapshot -.action) ~ [name+s+p.action ~])
|
||||
^- move
|
||||
=+ ^= req
|
||||
%- httpreq :*
|
||||
/do/[-.action]
|
||||
~[%digitalocean %api]
|
||||
?:(?=($delt meth) /v2/droplets/[id] /v2/droplets/[id]/actions)
|
||||
meth
|
||||
%^ mo ['Content-Type' 'application+json' ~]
|
||||
['Authorization' (cat 3 'Bearer ' access.do.toke.vat) ~] ~
|
||||
*quay
|
||||
==
|
||||
req
|
||||
::
|
||||
$gce
|
||||
=+ ^= head-query
|
||||
:- %^ mo ['Content-Type' 'application+json' ~]
|
||||
['Authorization' (cat 3 'Bearer ' access.gce.toke.vat) ~] ~
|
||||
*quay
|
||||
?- -.action
|
||||
?($start $stop $reboot $'snapshot')
|
||||
=+ end=/compute/v1/projects/urbcloud/zones/us-central1-a/instances/[name]
|
||||
%- httpreq
|
||||
:* /gce-act/[-.action] ~['googleapis' 'www']
|
||||
(welp end [?:(?=($reboot -.action) 'reset' -.action) ~])
|
||||
[%post ~]
|
||||
head-query
|
||||
==
|
||||
::
|
||||
$delete
|
||||
=+ end=/compute/v1/projects/urbcloud/zones/us-central1-a/instances/[name]
|
||||
%- httpreq
|
||||
:* /gce-act/[-.action] ~['googleapis' 'www']
|
||||
end
|
||||
%delt
|
||||
head-query
|
||||
==
|
||||
==
|
||||
==
|
||||
++ thou-do-act
|
||||
|= {pax/path resp/httr}
|
||||
~& [resp act+pax]
|
||||
:_ +>.$ ~
|
||||
::
|
||||
++ thou-gce-act
|
||||
|= {pax/path resp/httr}
|
||||
~& [resp act+pax]
|
||||
:_ +>.$ ~
|
||||
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
:: retrieve google instances and images ::
|
||||
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
++ list-gce
|
||||
^- (list move)
|
||||
:+ (list-something-gce /zones/['us-central1-a']/instances)
|
||||
(list-something-gce /global/snapshots)
|
||||
~
|
||||
::
|
||||
++ list-something-gce
|
||||
|= endpoint/path
|
||||
=+ ^= lis
|
||||
:*
|
||||
/list-gce/[-.endpoint]
|
||||
~[%googleapis %www] (welp /compute/v1/projects/urbcloud endpoint)
|
||||
%get ~
|
||||
^- quay
|
||||
[%'access_token' access.gce.toke.vat]~
|
||||
==
|
||||
~! lis
|
||||
~! +<:httpreq
|
||||
(httpreq lis)
|
||||
::
|
||||
++ thou-list-gce-zones :: instances
|
||||
|= {pax/path resp/httr}
|
||||
^- {(list move) _+>.$}
|
||||
=+ parsed=(rash q:(need r.resp) apex:poja) :: body httr to json
|
||||
~| 'no list received or bad json'
|
||||
=+ items=(need ((ot items+(ar some) ~):jo parsed))
|
||||
=+ ^- ins/(list {@t instance})
|
||||
~| 'bad-json'^items
|
||||
%+ turn items
|
||||
|= in/json
|
||||
=< [id .]
|
||||
^- instance
|
||||
:- %gce
|
||||
%- need
|
||||
%. in =+ jo
|
||||
%- ot
|
||||
:~ name+so
|
||||
id+so
|
||||
status+so
|
||||
'creationTimestamp'^(su parse-iso8601) ::zone+so
|
||||
'machineType'^(cu tail-url so)
|
||||
:: 'networkInterfaces'^parse-ip-gce
|
||||
==
|
||||
=. insts.vat
|
||||
%- mo
|
||||
%+ weld ins
|
||||
%+ skip (~(tap by insts.vat)) :: keep non-gce
|
||||
|=(a/{@t instance} ?=($gce +<.a))
|
||||
=+ buf=`@da`(add ~s10 now)
|
||||
=+ liz=(~(tap by insts.vat))
|
||||
=+ tail=(turn liz |=(a/{@t instance} +.a))
|
||||
:_ +>.$ ::
|
||||
:- [ost %wait /refresh-gce buf]
|
||||
(spam (instance-to-json tail))
|
||||
::
|
||||
++ thou-list-gce-global :: imgs
|
||||
|= {pax/path resp/httr}
|
||||
^- {(list move) _+>.$}
|
||||
=+ parsed=(rash q:(need r.resp) apex:poja)
|
||||
=+ imgz=(need ((ot items+(ar some) ~):jo parsed))
|
||||
=. images.vat
|
||||
%- mo
|
||||
%+ weld
|
||||
%+ skip (~(tap by images.vat) *(list {{@t @t} image}))
|
||||
|=(a/{{@t @t} image} ?=($gce ->.a))
|
||||
%+ turn imgz
|
||||
|= a/json
|
||||
=< [[name %gce] .]
|
||||
^- image
|
||||
:- %gce
|
||||
%- need
|
||||
%. a =+ jo
|
||||
%- ot
|
||||
[name+so id+so ~]
|
||||
:_ +>.$ [(spam `json`(image-to-json `(list image)`(map-to-list images.vat)))]
|
||||
::
|
||||
++ wake-refresh-gce |=({path $~} [list-gce +>.$])
|
||||
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
:: list digital ocean droplets and images ::
|
||||
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
++ list-do
|
||||
:+((list-something-do %droplets) (list-something-do %images) ~)
|
||||
++ list-something-do
|
||||
|= som/@tas
|
||||
=+ ^= lis
|
||||
:~ /list-do/[som]
|
||||
~[%digitalocean %api]
|
||||
/v2/[som]
|
||||
%get
|
||||
%- mo
|
||||
:~ ['Content-Type' 'application+json' ~]
|
||||
['Authorization' (cat 3 'Bearer ' access.do.toke.vat) ~]
|
||||
==
|
||||
==
|
||||
(httpreq lis)
|
||||
::
|
||||
++ thou-list-do-droplets
|
||||
|= {pax/path resp/httr}
|
||||
^- {(list move) _+>.$}
|
||||
=+ parsed=(rash q:(need r.resp) apex:poja) :: parse httr to json
|
||||
~| receive-list+parsed
|
||||
=+ dar=(need ((ot droplets+(ar some) ~):jo parsed)) :: reparse ar of insts
|
||||
=+ ^- dropz/(list {@t instance})
|
||||
~| bad-json+-.dar
|
||||
%+ turn dar
|
||||
|= drp/json ^- {@t instance}
|
||||
=- ~! - -
|
||||
=< [id .]
|
||||
^- instance
|
||||
:- %do
|
||||
%- need
|
||||
%. drp
|
||||
=+ jo
|
||||
%- ot
|
||||
:~ name+so
|
||||
id+parse-id-text
|
||||
status+so
|
||||
'created_at'^(su parse-iso8601)
|
||||
image+(ot name+so ~)
|
||||
==
|
||||
=. insts.vat
|
||||
%- mo
|
||||
%+ weld dropz
|
||||
%+ skip (~(tap by insts.vat) *(list {@t instance}))
|
||||
|=(a/{@t instance} ?=($do +>.$))
|
||||
=+ buf=`@da`(add ~s10 now)
|
||||
:_ +>.$
|
||||
:- [ost %wait /refresh-do buf]
|
||||
%- spam
|
||||
%- instance-to-json
|
||||
%+ turn (~(tap by insts.vat) *(list {@t instance}))
|
||||
|=(a/{@t instance} +.a)
|
||||
::
|
||||
++ thou-list-do-images
|
||||
|= {pax/path resp/httr}
|
||||
=+ parsed=(rash q:(need r.resp) apex:poja)
|
||||
~| crashed-do-images+parsed
|
||||
=+ ^= imgz
|
||||
%- need
|
||||
((ot images+(ar (ot [name+so distribution+so id+no ~])) ~):jo parsed)
|
||||
=+ ^- images/(list {{@t @t} image})
|
||||
%+ turn imgz
|
||||
|= {name/@t dist/@t id/@t}
|
||||
=+ nom=(cat 3 name dist)
|
||||
[[%do nom] `image`[%do nom id]]
|
||||
=. images.vat
|
||||
%- mo
|
||||
%+ weld images
|
||||
%+ skip (~(tap by images.vat) *(list {{@t @t} image}))
|
||||
|=(a/{{@t @t} image} ?=($do ->.a))
|
||||
:_ +>.$
|
||||
~[(spam `json`(image-to-json `(list image)`(map-to-list images.vat)))]
|
||||
::
|
||||
++ wake-refresh-do |=({path $~} [list-do +>.$])
|
||||
--
|
@ -1,85 +0,0 @@
|
||||
:: :: ::
|
||||
:::: /hoon+oct1/ape :::::: dependencies
|
||||
:: :: ::
|
||||
/? 310 :: arvo version
|
||||
/- sole, oct1 :: structures
|
||||
/+ sole, oct1 :: libraries
|
||||
[. sole oct1] :: ::
|
||||
:: :: ::
|
||||
:::: :::::: interfaces
|
||||
!: :: ::
|
||||
=> |% ::
|
||||
++ axon {$0 eye/face gam/game} :: agent state
|
||||
++ card {$diff $sole-effect sole-effect} :: update
|
||||
++ face (map bone sole-share) :: console state
|
||||
++ move (pair bone card) :: cause and action
|
||||
-- ::
|
||||
:: :: ::
|
||||
:::: :::::: parsers
|
||||
:: :: ::
|
||||
=> |% ::
|
||||
++ colm (cook |=(a/@ (sub a '1')) (shim '1' '3')) :: row or column
|
||||
++ come ;~(plug colm ;~(pfix fas colm)) :: coordinate
|
||||
-- ::
|
||||
:: :: ::
|
||||
:::: :::::: process core
|
||||
:: :: ::
|
||||
|_ $: bowl :: system state
|
||||
moz/(list move) :: pending actions
|
||||
axon :: server state, v0
|
||||
== ::
|
||||
:: :: ::
|
||||
:::: :::::: process tools
|
||||
:: :: ::
|
||||
++ abet [(flop moz) .(moz ~)] :: resolve
|
||||
++ bike $+(_. _+>) :: self-transformer
|
||||
++ dish |=(cad/card %_(+> moz [[ost cad] moz])) :: request
|
||||
++ eels (~(tap by sup)) :: all clients
|
||||
++ echo |= {all/(list sink) fun/bike} =+ old=+>+<- ::
|
||||
|- ^+ +>.^$ ?~ all +>.^$(+<- old) ::
|
||||
=. ost p.i.all ::
|
||||
$(all t.all, +>.^$ (fun +>.^$)) ::
|
||||
++ flap |=(con/bike (echo eels con)) :: update all clients
|
||||
++ here ~(. go gam) :: game core
|
||||
:: :: ::
|
||||
:::: :::::: process logic
|
||||
:: :: ::
|
||||
++ fail (fect %bel ~) :: user error
|
||||
++ fect |=(sole-effect (dish %diff %sole-effect +<)) :: update console
|
||||
++ kick |= point =^ dud gam ~(m at:here +<) ::
|
||||
?.(dud fail wild:kind) ::
|
||||
++ kind =+(res:here ?~(- + (word(gam new:here) ->))) :: move result
|
||||
++ prom (fect %pro %& %oct1 voy:here) :: update prompt
|
||||
++ rend (turn `wall`tab:here |=(tape txt++<)) :: table print
|
||||
++ sawn .(eye (~(del by eye) ost)) :: console unsubscribe
|
||||
++ seen .(eye (~(put by eye) ost *sole-share)) :: console subscribe
|
||||
++ show prom:(fect %mor rend) :: update console
|
||||
++ tame (flap |=(_. prom:+<)) :: light update
|
||||
++ wild (flap |=(_. show:+<)) :: full update
|
||||
++ word |=(tape (flap |=(_+> (fect:+< txt++>+<)))) ::
|
||||
:: :: ::
|
||||
:::: :::::: process UI
|
||||
:: :: ::
|
||||
++ work :: console action
|
||||
|= act/sole-action ::
|
||||
=+ say=(~(got by eye) ost) ::
|
||||
|^ ?+(-.act abet $det (delt +.act), $ret dive) ::
|
||||
++ abet ..work(eye (~(put by eye) ost say)) :: resolve
|
||||
++ delt |= cal/sole-change :: edit command line
|
||||
=^ cul say (~(remit sole say) cal good) ::
|
||||
?~(cul abet fail:(fect:abet det+u.cul)) ::
|
||||
++ dive =+ (rust (tufa buf.say) (punt come)) :: apply command line
|
||||
?~(- fail ?~(-> show (kick:wipe ->+))) ::
|
||||
++ good |=((list @c) -:(rose (tufa +<) come)) :: validate input
|
||||
++ wipe =^ cal say (~(transmit sole say) set+~) :: clear line
|
||||
(fect:abet %det cal) ::
|
||||
-- ::
|
||||
:: :: ::
|
||||
:::: :::::: arvo handlers
|
||||
:: :: ::
|
||||
++ peer-sole |=(* abet:show:seen) :: console subscribe
|
||||
++ prep |= (unit (pair (list move) axon)) :: update self
|
||||
abet:?~(+< +> wild(+<+ +<+)) ::
|
||||
++ poke-sole-action |=(sole-action abet:(work +<)) :: console input
|
||||
++ pull-sole |=(* abet:sawn) :: console unsubscribe
|
||||
--
|
103
ape/oct2.hoon
103
ape/oct2.hoon
@ -1,103 +0,0 @@
|
||||
:: :: ::
|
||||
:::: /hoon+oct2/ape :::::: dependencies
|
||||
:: :: ::
|
||||
/? 310 :: arvo version
|
||||
/- sole, oct2 :: structures
|
||||
/+ sole, oct2 :: libraries
|
||||
[. sole oct2] :: ::
|
||||
:: :: ::
|
||||
:::: :::::: interfaces
|
||||
!: :: ::
|
||||
=> |% ::
|
||||
++ axle {eye/face gam/game} :: agent state
|
||||
++ card $% {$diff lime} :: update
|
||||
{$quit $~} :: cancel
|
||||
== ::
|
||||
++ face (map bone sole-share) :: console state
|
||||
++ lime {$sole-effect sole-effect} :: :sole update
|
||||
++ move (pair bone card) :: cause and action
|
||||
-- ::
|
||||
:: :: ::
|
||||
:::: :::::: past state
|
||||
:: :: ::
|
||||
=> |% ::
|
||||
++ axon $%({$1 axle} {$0 axle-0}) :: all states
|
||||
++ axle-0 {eye/face gam/game-0} :: old axle
|
||||
++ game-0 {who/? box/board boo/board} :: old game
|
||||
++ wake |= axon :- %1 ?- +<- $1 +<+ :: rough upgrade
|
||||
$0 [eye [who ~^~ ~ box boo]:gam]:+<+ ::
|
||||
== -- ::
|
||||
:: :: ::
|
||||
:::: :::::: parsers
|
||||
:: :: ::
|
||||
=> |% ::
|
||||
++ colm (cook |=(a/@ (sub a '1')) (shim '1' '3')) :: row or column
|
||||
++ come ;~(plug colm ;~(pfix fas colm)) :: coordinate
|
||||
++ cope |=(? ?:(+< (stag %| (cold ~ sig)) come)) :: with wait mode
|
||||
-- ::
|
||||
:: :: ::
|
||||
:::: :::::: process core
|
||||
:: :: ::
|
||||
|_ $: bowl ::
|
||||
moz/(list move) :: pending actions
|
||||
{$1 axle} :: process state v1
|
||||
== ::
|
||||
:: :: ::
|
||||
:::: :::::: process tools
|
||||
:: :: ::
|
||||
++ abet [(flop moz) .(moz ~)] :: resolve
|
||||
++ bike $+(_. _+>) :: self-transformer
|
||||
++ dish |=(cad/card %_(+> moz [[ost cad] moz])) :: request
|
||||
++ echo |= {all/(list sink) fun/bike} =+ old=+>+<- :: publish to all
|
||||
|- ^+ +>.^$ ?~ all +>.^$(+<- old) ::
|
||||
=> .(ost p.i.all, src q.i.all) ::
|
||||
$(all t.all, +>.^$ (fun +>.^$)) ::
|
||||
++ flap |=(con/bike (echo (~(tap by sup)) con)) :: update all clients
|
||||
++ here ~(. go src gam) :: game core
|
||||
:: :: ::
|
||||
:::: :::::: server logic
|
||||
:: :: ::
|
||||
++ fail (fect %bel ~) :: user error
|
||||
++ fect |=(sole-effect (dish %diff %sole-effect +<)) :: update console
|
||||
++ heal |= old/axon =. +>+<+> (wake old) :: complete update
|
||||
=- +>.$(gam -) ?. !=(1 +<-) gam ::
|
||||
(muy:here (turn (~(tap by sup)) |=(sink q))) ::
|
||||
++ kick |= point =^ dud gam ~(m at:here +<) ::
|
||||
?.(dud fail wild:kind) ::
|
||||
++ kind =+(res:here ?~(- + (word(gam new:here) ->))) :: move result
|
||||
++ hail |=(? tame(gam (hey:here +<))) :: toggle subscriber
|
||||
++ prom (fect %pro %& %oct2 voy:here) :: update prompt
|
||||
++ rend (turn `wall`tab:here |=(tape txt++<)) :: table print
|
||||
++ sawn (hail(eye (~(del by eye) ost)) |) :: console unsubscribe
|
||||
++ seen (hail(eye (~(put by eye) ost *sole-share)) &) :: console subscribe
|
||||
++ show prom:(fect %mor rend) :: update console
|
||||
++ tame (flap |=(_. prom:+<)) :: light update
|
||||
++ wild (flap |=(_. show:+<)) :: full update
|
||||
++ word |=(tape (flap |=(_+> (fect:+< txt++>+<)))) ::
|
||||
:: :: ::
|
||||
:::: :::::: console UI
|
||||
:: :: ::
|
||||
++ work :: console action
|
||||
|= act/sole-action ::
|
||||
=+ say=(~(got by eye) ost) ::
|
||||
|^ ?+(-.act abet $det (delt +.act), $ret dive) ::
|
||||
++ abet ..work(eye (~(put by eye) ost say)) :: resolve
|
||||
++ cusp (cope !ept:here) :: parsing rule
|
||||
++ delt |= cal/sole-change :: edit command line
|
||||
=^ cul say (~(remit sole say) cal good) ::
|
||||
?~(cul abet fail:(fect:abet det+u.cul)) ::
|
||||
++ dive =+ (rust (tufa buf.say) (punt come)) :: apply command line
|
||||
?~(- fail ?~(-> show (kick:wipe ->+))) ::
|
||||
++ good |=((list @c) -:(rose (tufa +<) cusp)) :: validate input
|
||||
++ wipe =^ cal say (~(transmit sole say) set+~) :: clear line
|
||||
(fect:abet %det cal) ::
|
||||
-- ::
|
||||
:: :: ::
|
||||
:::: :::::: arvo handlers
|
||||
:: :: ::
|
||||
++ peer-sole |=(* abet:show:seen) :: console subscribe
|
||||
++ poke-sole-action |=(sole-action abet:(work +<)) :: console input
|
||||
++ prep |= (unit (pair (list move) axon)) :: update self
|
||||
abet:?~(+< +> wild:(heal +<+>)) ::
|
||||
++ pull-sole |=(* abet:sawn) :: console unsubscribe
|
||||
--
|
116
ape/oct3.hoon
116
ape/oct3.hoon
@ -1,116 +0,0 @@
|
||||
:: :: ::
|
||||
:::: /hoon+oct3/ape :::::: dependencies
|
||||
:: :: ::
|
||||
/? 310 :: arvo version
|
||||
/- sole, oct3 :: structures
|
||||
/+ sole, oct3 :: libraries
|
||||
[. sole oct3] :: ::
|
||||
:: :: ::
|
||||
:::: :::::: interfaces
|
||||
!: :: ::
|
||||
=> |% ::
|
||||
++ axle {eye/face gam/game} :: agent state
|
||||
++ card $% {$diff lime} :: update
|
||||
{$quit $~} :: cancel
|
||||
== ::
|
||||
++ face (map bone sole-share) :: console state
|
||||
++ lime $% {$sole-effect sole-effect} :: :sole update
|
||||
{$oct3-update play} :: :oct3 update
|
||||
== ::
|
||||
++ move (pair bone card) :: cause and action
|
||||
-- ::
|
||||
:: :: ::
|
||||
:::: :::::: past state
|
||||
:: :: ::
|
||||
=> |% ::
|
||||
++ axon $%({$1 axle} {$0 axle-0}) :: all states
|
||||
++ axle-0 {eye/face gam/game-0} :: old axle
|
||||
++ game-0 {who/? box/board boo/board} :: old game
|
||||
++ wake |= axon :- %1 ?- +<- $1 +<+ :: coarse upgrade
|
||||
$0 [eye [who ~^~ ~ box boo]:gam]:+<+ ::
|
||||
== -- ::
|
||||
:: :: ::
|
||||
:::: :::::: parsers
|
||||
:: :: ::
|
||||
=> |% ::
|
||||
++ colm (cook |=(a/@ (sub a '1')) (shim '1' '3')) :: row or column
|
||||
++ come ;~(plug colm ;~(pfix fas colm)) :: coordinate
|
||||
++ cope |=(? ?:(+< (stag %| (cold ~ sig)) come)) :: with wait mode
|
||||
-- ::
|
||||
:: :: ::
|
||||
:::: :::::: process core
|
||||
:: :: ::
|
||||
|_ $: bowl ::
|
||||
moz/(list move) :: pending actions
|
||||
{$1 axle} :: process state v1
|
||||
== ::
|
||||
:: :: ::
|
||||
:::: :::::: process tools
|
||||
:: :: ::
|
||||
++ abet [(flop moz) .(moz ~)] :: resolve
|
||||
++ bike $+(_. _+>) :: self-transformer
|
||||
++ dish |=(cad/card %_(+> moz [[ost cad] moz])) :: request
|
||||
++ echo |= {all/(list sink) fun/bike} =+ old=+>+<- :: publish to all
|
||||
|- ^+ +>.^$ ?~ all +>.^$(+<- old) ::
|
||||
=> .(ost p.i.all, src q.i.all) ::
|
||||
$(all t.all, +>.^$ (fun +>.^$)) ::
|
||||
++ eels (~(tap by sup)) :: all clients
|
||||
++ elfs (prey /oct3 +<-) :: network clients
|
||||
++ elks (prey /sole +<-) :: console clients
|
||||
++ flap |= {net/bike con/bike} :: update all clients
|
||||
(echo:(echo elks con) elfs net) ::
|
||||
++ here ~(. go src gam) :: game core
|
||||
:: :: ::
|
||||
:::: :::::: server logic
|
||||
:: :: ::
|
||||
++ fail ?:(soul (fect %bel ~) ~|(%invalid-move !!)) :: user error
|
||||
++ fect |=(sole-effect (dish %diff %sole-effect +<)) :: update console
|
||||
++ fact |=(play (dish %diff %oct3-update +<)) :: update partner
|
||||
++ hail |=(? tame(gam (hey:here +<))) :: toggle subscriber
|
||||
++ heal |= old/axon =. +>+<+> (wake old) :: complete update
|
||||
=- +>.$(gam -) ?. !=(1 +<-) gam ::
|
||||
(muy:here (turn eels |=(sink q))) ::
|
||||
++ kick |= point =^ dud gam ~(m at:here +<) ::
|
||||
?.(dud fail wild:kind) ::
|
||||
++ kind =+(res:here ?~(- + (word(gam new:here) ->))) :: move result
|
||||
++ prom (fect %pro %& %oct3 voy:here) :: update prompt
|
||||
++ rend (turn `wall`tab:here |=(tape txt++<)) :: table print
|
||||
++ sawn (hail(eye (~(del by eye) ost)) |) :: console unsubscribe
|
||||
++ seen (hail(eye (~(put by eye) ost *sole-share)) &) :: console subscribe
|
||||
++ show prom:(fect %mor rend) :: update console
|
||||
++ soul =+((~(get by sup) ost) ?=([~ * %sole *] -)) :: is console
|
||||
++ tame (flap |=(_. (fact:+< &/gam)) |=(_. prom:+<)) :: light update
|
||||
++ wild (flap |=(_. (fact:+< &/gam)) |=(_. show:+<)) :: full update
|
||||
++ word |= txt/tape %+ flap :: game message
|
||||
|=(_+> (fact:+< |/txt)) ::
|
||||
|=(_+> (fect:+< txt+txt)) ::
|
||||
:: :: ::
|
||||
:::: :::::: console UI
|
||||
:: :: ::
|
||||
++ work :: console action
|
||||
|= act/sole-action ::
|
||||
=+ say=(~(got by eye) ost) ::
|
||||
|^ ?+(-.act abet $det (delt +.act), $ret dive) ::
|
||||
++ abet ..work(eye (~(put by eye) ost say)) :: resolve
|
||||
++ cusp (cope !ept:here) :: parsing rule
|
||||
++ delt |= cal/sole-change :: edit command line
|
||||
=^ cul say (~(remit sole say) cal good) ::
|
||||
?~(cul abet fail:(fect:abet det+u.cul)) ::
|
||||
++ dive =+ (rust (tufa buf.say) (punt come)) :: apply command line
|
||||
?~(- fail ?~(-> show (kick:wipe ->+))) ::
|
||||
++ good |=((list @c) -:(rose (tufa +<) cusp)) :: validate input
|
||||
++ wipe =^ cal say (~(transmit sole say) set+~) :: clear line
|
||||
(fect:abet %det cal) ::
|
||||
-- ::
|
||||
:: :: ::
|
||||
:::: :::::: arvo handlers
|
||||
:: :: ::
|
||||
++ peer-oct3 |=(* abet:tame:(hail &)) :: urbit subscribe
|
||||
++ peer-sole |=(* abet:show:seen) :: console subscribe
|
||||
++ poke-sole-action |=(sole-action abet:(work +<)) :: console input
|
||||
++ poke-oct3-move |=(point abet:wild:(kick +<)) :: urbit move
|
||||
++ prep |= (unit (pair (list move) axon)) :: update self
|
||||
abet:?~(+< +> wild:(heal +<+>)) ::
|
||||
++ pull-oct3 |=(* abet:(hail |)) :: urbit unsubscribe
|
||||
++ pull-sole |=(* abet:sawn) :: console unsubscribe
|
||||
--
|
139
ape/oct4.hoon
139
ape/oct4.hoon
@ -1,139 +0,0 @@
|
||||
:: :: ::
|
||||
:::: /hoon+oct4/ape :::::: dependencies
|
||||
:: :: ::
|
||||
/? 310 :: arvo version
|
||||
/- sole, oct4 :: structures
|
||||
/+ sole, oct4 :: libraries
|
||||
[. sole oct4] :: ::
|
||||
:: :: ::
|
||||
:::: :::::: interfaces
|
||||
!: :: ::
|
||||
=> |% ::
|
||||
++ axle {eye/face rem/(unit ship) gam/game} :: agent state
|
||||
++ card $% {$diff lime} :: update
|
||||
{$quit $~} :: cancel
|
||||
{$peer wire dock path} :: subscribe
|
||||
{$poke wire dock pear} :: send move
|
||||
{$pull wire dock $~} :: unsubscribe
|
||||
== ::
|
||||
++ face (map bone sole-share) :: console state
|
||||
++ lime $% {$sole-effect sole-effect} :: :sole update
|
||||
{$oct4-update play} :: :oct4 update
|
||||
== ::
|
||||
++ move (pair bone card) :: cause and action
|
||||
++ pear {$oct4-move point} :: outgoing move
|
||||
-- ::
|
||||
:: :: ::
|
||||
:::: :::::: past state
|
||||
:: :: ::
|
||||
=> |% ::
|
||||
++ agon (unit {(list move) axon}) :: boot argument
|
||||
++ axon $%({$1 axle} {$0 axle-0}) :: all states
|
||||
++ axle-0 {eye/face gam/game-0} :: old axle
|
||||
++ game-0 {who/? box/board boo/board} :: old game
|
||||
++ wake |= axon :- %1 ?- +<- $1 +<+ :: coarse upgrade
|
||||
$0 [eye ~ [who ~^~ ~ box boo]:gam]:+<+ ::
|
||||
== -- ::
|
||||
:: :: ::
|
||||
:::: :::::: parsers
|
||||
:: :: ::
|
||||
=> |% ::
|
||||
++ colm (cook |=(a/@ (sub a '1')) (shim '1' '3')) :: row or column
|
||||
++ come ;~(plug colm ;~(pfix fas colm)) :: coordinate
|
||||
++ comb (pick come ;~(pfix sig (punt fed:ag))) :: all command input
|
||||
++ cope |=(? ?:(+< (stag %| (cold ~ sig)) comb)) :: with wait mode
|
||||
-- ::
|
||||
:: :: ::
|
||||
:::: :::::: process core
|
||||
:: :: ::
|
||||
|_ $: bowl ::
|
||||
moz/(list move) :: pending actions
|
||||
{$1 axle} :: process state v1
|
||||
== ::
|
||||
:: :: ::
|
||||
:::: :::::: process tools
|
||||
:: :: ::
|
||||
++ abet [(flop moz) .(moz ~)] :: resolve
|
||||
++ bike $+(_. _+>) :: self-transformer
|
||||
++ dish |=(cad/card %_(+> moz [[ost cad] moz])) :: request
|
||||
++ done (echo eels |=(_. (dish:+< %quit ~))) :: cancel everyone
|
||||
++ echo |= {all/(list sink) fun/bike} =+ old=+>+<- :: publish to all
|
||||
|- ^+ +>.^$ ?~ all +>.^$(+<- old) ::
|
||||
=> .(ost p.i.all, src q.i.all) ::
|
||||
$(all t.all, +>.^$ (fun +>.^$)) ::
|
||||
++ eels (~(tap by sup)) :: all clients
|
||||
++ elfs (prey /oct4 +<-) :: network clients
|
||||
++ elks (prey /sole +<-) :: console clients
|
||||
++ emit |=(lime (dish %diff +<)) :: publish
|
||||
++ flap |= {net/bike con/bike} :: update all clients
|
||||
(echo:(echo elks con) elfs net) ::
|
||||
++ here ~(. go src gam) :: game core
|
||||
:: :: ::
|
||||
:::: :::::: server logic
|
||||
:: :: ::
|
||||
++ fail ?:(soul (fect %bel ~) ~|(%invalid-move !!)) :: user error
|
||||
++ fect |=(sole-effect (emit %sole-effect +<)) :: update console
|
||||
++ fact |=(play (emit %oct4-update +<)) :: update partner
|
||||
++ hail |=(? ?^(rem +> tame(gam (hey:here +<)))) :: toggle subscriber
|
||||
++ harp |=(game ?:(=(gam +<) +> wild(gam +<))) :: update game
|
||||
++ heal |= old/axon =. +>+<+> (wake old) :: complete update
|
||||
=- +>.$(gam -) ?. !=(1 +<-) gam ::
|
||||
(muy:here (turn eels |=(sink q))) ::
|
||||
++ hear |=(play ?-(+<- $| (word +<+), $& (harp +<+))) :: network update
|
||||
++ kick |= point =^ dud gam ~(m at:here +<) ::
|
||||
?.(dud fail wild:?~(rem kind (send +>-))) ::
|
||||
++ kind =+(res:here ?~(- + (word(gam new:here) ->))) :: move result
|
||||
++ plan |= (unit ship) ?~ +< stop(gam new:here) :: link+unlink
|
||||
?^(rem fail link(rem +<)) ::
|
||||
++ plot |= (each point (unit ship)) :: apply command
|
||||
?-(+<- $& (kick +<+), $| (plan +<+)) ::
|
||||
++ like |*(* [/oct4 [+.rem dap] +<]) :: friend message
|
||||
++ link (dish peer+(like /oct4)) :: subscribe to friend
|
||||
++ prom (fect %pro %& %oct4 stat) :: update prompt
|
||||
++ rend (turn `wall`tab:here |=(tape txt++<)) :: table print
|
||||
++ sawn (hail(eye (~(del by eye) ost)) |) :: console unsubscribe
|
||||
++ seen (hail(eye (~(put by eye) ost *sole-share)) &) :: console subscribe
|
||||
++ send |=(point (dish poke+(like %oct4-move +<))) :: send move
|
||||
++ show prom:(fect %mor rend) :: update console
|
||||
++ soul =+((~(get by sup) ost) ?=([~ * %sole *] -)) :: is console
|
||||
++ stat (weld ?~(rem ~ "@{(scow p+u.rem)}") voy:here) :: prompt line
|
||||
++ stop ?~(rem done wild:(dish pull+(like ~))) :: unsubscribe
|
||||
++ tame (flap |=(_. (fact:+< &/gam)) |=(_. prom:+<)) :: light update
|
||||
++ wild (flap |=(_. (fact:+< &/gam)) |=(_. show:+<)) :: full update
|
||||
++ with |=(? (word(rem ?:(+< rem ~)) "{<[+< src]>}")) ::
|
||||
++ word |= txt/tape %+ flap :: game message
|
||||
|=(_+> (fact:+< |/txt)) ::
|
||||
|=(_+> (fect:+< txt+txt)) ::
|
||||
:: :: ::
|
||||
:::: :::::: console UI
|
||||
:: :: ::
|
||||
++ work :: console action
|
||||
|= act/sole-action ::
|
||||
=+ say=(~(got by eye) ost) ::
|
||||
|^ ?+(-.act abet $det (delt +.act), $ret dive) ::
|
||||
++ abet ..work(eye (~(put by eye) ost say)) :: resolve
|
||||
++ cusp (cope !ept:here) :: parsing rule
|
||||
++ delt |= cal/sole-change :: edit command line
|
||||
=^ cul say (~(remit sole say) cal good) ::
|
||||
?~(cul abet fail:(fect:abet det+u.cul)) ::
|
||||
++ dive =+ (rust (tufa buf.say) (punt comb)) :: apply command line
|
||||
?~(- fail ?~(-> show (plot:wipe ->+))) ::
|
||||
++ good |=((list @c) -:(rose (tufa +<) cusp)) :: validate input
|
||||
++ wipe =^ cal say (~(transmit sole say) set+~) :: clear line
|
||||
(fect:abet %det cal) ::
|
||||
-- ::
|
||||
:: :: ::
|
||||
:::: :::::: arvo handlers
|
||||
:: :: ::
|
||||
++ reap-oct4 |=({* (unit)} abet:(with =(~ +<+))) :: linked to friend
|
||||
++ coup-oct4 |=({* (unit)} abet:?~(+<+ +> fail)) :: move acknowledge
|
||||
++ diff-oct4-update |=({* play} abet:(hear +<+)) :: network update
|
||||
++ peer-oct4 |=(* abet:tame:(hail &)) :: urbit subscribe
|
||||
++ peer-sole |=(* abet:show:seen) :: console subscribe
|
||||
++ poke-sole-action |=(sole-action abet:(work +<)) :: console input
|
||||
++ poke-oct4-move |=(point abet:wild:(kick +<)) :: urbit move
|
||||
++ prep |=(agon abet:?~(+< +> (heal +<+>))) :: load state
|
||||
++ pull-oct4 |=(* abet:(hail |)) :: urbit unsubscribe
|
||||
++ pull-sole |=(* abet:sawn) :: console unsubscribe
|
||||
++ quit-oct4 |=(* abet:?~(rem +> wild(rem ~))) :: unlinked by friend
|
||||
--
|
@ -1,8 +0,0 @@
|
||||
/- twitter
|
||||
!:
|
||||
[twitter .]
|
||||
|_ [bowl ~]
|
||||
++ poke-noun |=(span (onwards [%peer / [our %twit] /user+[+<]]))
|
||||
++ onwards |*({mark *} [[ost +<]~ +>.$])
|
||||
++ diff-twit-feed |=({* a/(list twit-stat)} ?~(a `+>.$ ~&(i.a $(a t.a))))
|
||||
--
|
221
ape/twit.hoon
221
ape/twit.hoon
@ -1,221 +0,0 @@
|
||||
:: Twitter daemon
|
||||
::
|
||||
:::: /hook+core+twit+app
|
||||
::
|
||||
/- twitter
|
||||
/+ twitter, talk
|
||||
::
|
||||
:::: ~fyr
|
||||
::
|
||||
[twitter .]
|
||||
|%
|
||||
++ twit-path :: valid peer path
|
||||
$% :: [%home $~] :: home timeline
|
||||
{$user p/@t $~} :: user's tweets
|
||||
{$post p/span $~} :: status of status
|
||||
==
|
||||
::
|
||||
++ axle :: app state
|
||||
$: $0
|
||||
kes/(map span keys:twit-do) :: 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
|
||||
==
|
||||
::
|
||||
++ gift :: subscription action
|
||||
$% {$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)}
|
||||
==
|
||||
::
|
||||
++ 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
|
||||
== ==
|
||||
::
|
||||
++ sign :: arvo response
|
||||
$% {$e $thou p/httr} :: HTTP result
|
||||
{$t $wake $~} :: timeout ping
|
||||
==
|
||||
::
|
||||
++ stat twit-stat :: recieved tweet
|
||||
--
|
||||
!:
|
||||
::::
|
||||
::
|
||||
|_ {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)
|
||||
::
|
||||
++ cull :: remove seen tweets
|
||||
|= {pax/path rep/(list stat)} ^+ rep
|
||||
=+ pev=(sa (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}
|
||||
=+ cur=(~(get by ran) pax)
|
||||
=+ tym=(add now (mul ~s8 (bex ?~(cur 0 p.u.cur))))
|
||||
:: ~& dely+`@dr`(sub tym now)
|
||||
?: &(?=(^ cur) (gte tym q.u.cur) (gth q.u.cur now))
|
||||
[~ ran]
|
||||
[`tym (~(put by ran) pax ?~(cur 0 (min 5 +(p.u.cur))) tym)]
|
||||
::
|
||||
++ wait :: ensure poll by path
|
||||
|= {pax/path mof/(list move)}
|
||||
=^ tym ran (dely pax)
|
||||
:_ +>.$
|
||||
?~ tym
|
||||
:: ~& no-wait+ran
|
||||
mof
|
||||
:: ~& will-wait+u.tym
|
||||
:- [ost %wait pax u.tym]
|
||||
mof
|
||||
::
|
||||
++ poke-twit-do :: recieve request
|
||||
|= act/twit-do
|
||||
^+ [*(list move) +>]
|
||||
?- -.q.act
|
||||
$auth
|
||||
:- [(print "authed @{(trip p.act)}")]~
|
||||
+>.$(kes (~(put by kes) p.act p.q.act)) :: XX verify key
|
||||
$post
|
||||
=: out (~(put by out) p.q.act %& p.act q.q.act)
|
||||
ran (~(del by ran) /peer+home)
|
||||
==
|
||||
%+ wait /peer+home
|
||||
=+ mez=(stat-upda:(auth p.act) [%status q.q.act]~ ~)
|
||||
[ost %them /post+(scot %uv p.q.act) ~ mez]~
|
||||
==
|
||||
::
|
||||
++ wake-peer
|
||||
|= {pax/path ~} ^+ done
|
||||
~& twit-wake+peer+pax
|
||||
:_ +>.$
|
||||
?. (~(has by ran) peer+pax) :: ignore if retracted
|
||||
~
|
||||
=+ => |=({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)
|
||||
::
|
||||
++ 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 ~) +>.$]
|
||||
==
|
||||
==
|
||||
++ tweet-good |=(rep/stat `(list gift)`~[[%diff %twit-stat rep] [%quit ~]])
|
||||
++ peer |=(pax/path :_(+> (pear & src pax))) :: accept subscription
|
||||
++ pear :: poll, possibly returning current data
|
||||
|= {ver/? @ 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
|
||||
?- -.pax
|
||||
$user (stat-user:aut [(to-sd p.pax)]~ opt)
|
||||
:: $home (stat-home:auth ~ opt)
|
||||
==
|
||||
::
|
||||
++ to-sd :: parse user name+numb
|
||||
|= a/span ^- sd:twit
|
||||
~| [%not-user a]
|
||||
%+ rash a
|
||||
;~(pose (stag %user-id dem) (stag %screen-name user:twir))
|
||||
::
|
||||
:: ++ pull :: release subscription
|
||||
:: |= ost/bone
|
||||
:: ?. (~(has by sup) ost) `+>.$ :: XX should not occur
|
||||
:: =+ [his pax]=(~(got by sup) ost)
|
||||
:: ?: (lth 1 ~(wyt in (~(get ju pus) pax)))
|
||||
:: `+>.$
|
||||
:: =: ran (~(del by ran) [%peer pax])
|
||||
:: fed (~(del by fed) pax)
|
||||
:: ==
|
||||
:: `+>.$
|
||||
::
|
||||
++ spam :: send by path
|
||||
|= {a/path b/(list gift)} ^- (list move)
|
||||
%- zing ^- (list (list move))
|
||||
%+ turn (~(tap by sup))
|
||||
|= {ost/bone @ pax/path}
|
||||
?. =(pax a) ~
|
||||
(turn b |=(c/gift [ost c]))
|
||||
::
|
||||
++ print
|
||||
|= mes/tape
|
||||
[ost %poke / [our %talk] (said:^talk our %twit now eny leaf+mes ~)]
|
||||
--
|
337
ape/work.hoon
337
ape/work.hoon
@ -1,337 +0,0 @@
|
||||
::
|
||||
::::
|
||||
::
|
||||
/? 314
|
||||
/- work
|
||||
/+ talk
|
||||
!:
|
||||
::::
|
||||
::
|
||||
[. work]
|
||||
|%
|
||||
++ move (pair bone card) :: all actions
|
||||
++ card :: general card
|
||||
$% {$diff $work-report client} ::
|
||||
{$peer wire dock path} ::
|
||||
{$poke wire dock pear} ::
|
||||
== ::
|
||||
++ pear :: poke fruit
|
||||
$% {$talk-command command:talk} ::
|
||||
== ::
|
||||
--
|
||||
!:
|
||||
::::
|
||||
::
|
||||
|_ $: bowl
|
||||
client
|
||||
connected/? :: subscribed to talk
|
||||
count/@ud :: / messages from talk
|
||||
unordered/(map {@uvH @u} (pair ship flesh:work-stuff:talk))
|
||||
==
|
||||
++ at
|
||||
|= client-task
|
||||
=| moves/(list move)
|
||||
|%
|
||||
++ abet
|
||||
^- {(list move) _+>.$}
|
||||
[(flop moves) +>.$(tasks (~(put by tasks) id.tax +<.$))]
|
||||
::
|
||||
++ abut
|
||||
^- {(list move) _+>.$}
|
||||
[(flop moves) +>.$]
|
||||
::
|
||||
++ send-audience
|
||||
|= {to/(set station:talk) action/duty:work-stuff:talk}
|
||||
%_ +>.$
|
||||
eny (sham eny action)
|
||||
moves
|
||||
:_ moves
|
||||
^- move
|
||||
:* ost %poke
|
||||
/sending+(scot %uv id.tax)/(scot %ud version.tax)
|
||||
[our %talk]
|
||||
%talk-command
|
||||
=> [. talk] ^- command:talk
|
||||
:- %publish
|
||||
|- ^- (list thought)
|
||||
:_ ~
|
||||
:+ (shaf %task eny)
|
||||
%- mo ^- (list {partner envelope delivery})
|
||||
%+ turn (~(tap in to))
|
||||
|=(sat/station [[%& sat] [*envelope %pending]])
|
||||
[now *bouquet [%tax action]]
|
||||
==
|
||||
==
|
||||
::
|
||||
++ send
|
||||
|= action/duty:work-stuff:talk
|
||||
(send-audience audience action)
|
||||
::
|
||||
++ send-archive
|
||||
|= to/(set station:talk)
|
||||
(send-audience to %archive id.tax)
|
||||
::
|
||||
++ send-create (send %create tax)
|
||||
++ send-change |* *
|
||||
?: =(our creator.tax)
|
||||
(send-update +(version.tax) our +<)
|
||||
%+ send-audience
|
||||
[[creator.tax (main:talk creator.tax)] ~ ~]
|
||||
[%change id.tax +<]
|
||||
++ send-update |*(* (send %update id.tax +<))
|
||||
++ process-update
|
||||
|= up/update
|
||||
^+ +>
|
||||
?- -.up
|
||||
$add ?>(?=($comment +<.up) (send-change %add-comment our +>.up))
|
||||
$doer
|
||||
?- +<.up
|
||||
$release (send-change %set-doer ~)
|
||||
$claim (send-change %set-doer `our)
|
||||
==
|
||||
::
|
||||
$set
|
||||
?- +<.up
|
||||
$audience (process-audience to.up)
|
||||
$date-due (send-change %set-date-due +>.up)
|
||||
$title (send-change %set-title +>.up)
|
||||
$description (send-change %set-description +>.up)
|
||||
$tags (send-change %set-tags +>.up)
|
||||
$done (send-change %set-done +>.up)
|
||||
==
|
||||
==
|
||||
++ process-audience
|
||||
|= to/(set station:talk)
|
||||
^+ +>
|
||||
=. +>.$ (send-archive (~(dif in audience) to))
|
||||
=. +>.$ (send-audience (~(dif in to) audience) %create tax)
|
||||
+>.$(audience to)
|
||||
--
|
||||
::
|
||||
++ prep
|
||||
|= $= old
|
||||
$_
|
||||
=< $
|
||||
%- unit
|
||||
$: client
|
||||
?
|
||||
@ud
|
||||
(map {@uvH @u} (pair ship flesh:work-stuff:talk))
|
||||
==
|
||||
^- {(list move) _+>.$}
|
||||
initialize(+<+ ?~(old +<+.+>.$ u.old))
|
||||
::
|
||||
++ initialize
|
||||
^- {(list move) _.}
|
||||
?: connected
|
||||
[~ .]
|
||||
:_ .(connected %&) :_ ~
|
||||
[ost %peer /peering [our %talk] /f+(main:talk our)/(scot %ud count)]
|
||||
::
|
||||
++ process-duty
|
||||
|= {when/@da her/ship from/(set station:talk) action/duty:work-stuff:talk}
|
||||
^- {(list move) _+>.$}
|
||||
=- =^ mof con mirror-to-web:con
|
||||
[(welp mof mos) con]
|
||||
^- {mos/(list move) con/_+>.$}
|
||||
?- -.action
|
||||
$create
|
||||
=+ existing-task=(~(get by tasks) id.tax.action)
|
||||
?: ?& ?=(^ existing-task)
|
||||
!=(tax.action tax.u.existing-task)
|
||||
!archived.u.existing-task
|
||||
==
|
||||
~& :* %new-task-with-old-id
|
||||
her=her
|
||||
from=from
|
||||
new-task=tax.action
|
||||
existing-task=u.existing-task
|
||||
==
|
||||
[~ +>.$]
|
||||
?. =(her creator.tax.action)
|
||||
~& :* %created-with-bad-creator
|
||||
her=her
|
||||
from=from
|
||||
new-task=tax.action
|
||||
existing-task=existing-task
|
||||
==
|
||||
[~ +>.$]
|
||||
=. tasks
|
||||
%^ ~(put by tasks) id.tax.action |
|
||||
:_ tax.action
|
||||
?~ existing-task from
|
||||
(~(uni in audience.u.existing-task) from)
|
||||
=. sort ?^(existing-task sort [id.tax.action sort])
|
||||
[~ +>.$]
|
||||
::
|
||||
$archive
|
||||
=+ tax=(~(get by tasks) id.action)
|
||||
?~ tax
|
||||
~& :* %archive-for-nonexistent-task
|
||||
her=her
|
||||
from=from
|
||||
action=action
|
||||
==
|
||||
[~ +>.$]
|
||||
?: !=(her creator.tax.u.tax)
|
||||
~& :* %archiver-not-creator
|
||||
her=her
|
||||
from=from
|
||||
action=action
|
||||
tax=tax
|
||||
==
|
||||
[~ +>.$]
|
||||
=. tasks
|
||||
%+ ~(put by tasks) id.action
|
||||
:* =(~ (~(dif in audience.u.tax) from))
|
||||
(~(dif in audience.u.tax) from)
|
||||
tax.u.tax
|
||||
==
|
||||
[~ +>.$]
|
||||
::
|
||||
$change
|
||||
=+ tax=(~(get by tasks) id.action)
|
||||
?~ tax
|
||||
~& :* %change-for-nonexistent-task
|
||||
her=her
|
||||
from=from
|
||||
action=action
|
||||
==
|
||||
[~ +>.$]
|
||||
?: !=(our creator.tax.u.tax)
|
||||
~& :* %me-not-creator
|
||||
her=her
|
||||
from=from
|
||||
action=action
|
||||
tax=tax
|
||||
==
|
||||
[~ +>.$]
|
||||
abet:(send-update:(at u.tax) +(version.tax.u.tax) her meat.action)
|
||||
::
|
||||
$update
|
||||
=+ tax=(~(get by tasks) id.action)
|
||||
?~ tax
|
||||
~& :* %update-for-nonexistent-task
|
||||
her=her
|
||||
from=from
|
||||
action=action
|
||||
==
|
||||
[~ +>.$]
|
||||
?: !=(her creator.tax.u.tax)
|
||||
~& :* %her-not-creator
|
||||
her=her
|
||||
from=from
|
||||
action=action
|
||||
tax=tax
|
||||
==
|
||||
[~ +>.$]
|
||||
?. =(version.action +(version.tax.u.tax))
|
||||
~& :* %update-bad-version
|
||||
her
|
||||
from=from
|
||||
action=action
|
||||
tax=tax
|
||||
==
|
||||
?: (lte version.action version.tax.u.tax)
|
||||
~& %really-bad-version
|
||||
[~ +>.$]
|
||||
:- ~
|
||||
%_ +>.$
|
||||
unordered
|
||||
%+ ~(put by unordered)
|
||||
[id.action version.action]
|
||||
[her.action meat.action]
|
||||
==
|
||||
|-
|
||||
=. tasks
|
||||
%+ ~(put by tasks) id.action
|
||||
:+ archived.u.tax
|
||||
(~(uni in audience.u.tax) from)
|
||||
=. version.tax.u.tax version.action
|
||||
=. date-modified.tax.u.tax when
|
||||
?- -.meat.action
|
||||
$set-doer tax.u.tax(doer her.meat.action)
|
||||
$set-date-due tax.u.tax(date-due wen.meat.action)
|
||||
$set-tags tax.u.tax(tags tag.meat.action)
|
||||
$set-title tax.u.tax(title til.meat.action)
|
||||
$set-description tax.u.tax(description des.meat.action)
|
||||
$set-done tax.u.tax(done ?.(don.meat.action ~ `when))
|
||||
$add-comment
|
||||
%= tax.u.tax
|
||||
discussion [[when [who com]:meat.action] discussion.tax.u.tax]
|
||||
==
|
||||
==
|
||||
=+ ooo=(~(get by unordered) id.action +(version.action))
|
||||
?~ ooo
|
||||
[~ +>.^$]
|
||||
%= $
|
||||
version.action +(version.action)
|
||||
her.action p.u.ooo
|
||||
meat.action q.u.ooo
|
||||
==
|
||||
==
|
||||
::
|
||||
++ mirror-to-web
|
||||
^- {(list move) _.}
|
||||
~& [%mirroring sort=(turn sort |=(a/@uv `@uv`(rsh 2 25 a)))]
|
||||
:_ .
|
||||
%+ murn (~(tap by sup))
|
||||
|= {ust/bone her/ship pax/path}
|
||||
^- (unit move)
|
||||
?:(?=({$sole *} pax) ~ `[ust full-report])
|
||||
::
|
||||
++ full-report [%diff %work-report tasks sort]
|
||||
++ peer-repo |=(path [[ost full-report]~ +>.$])
|
||||
++ coup
|
||||
|= {way/wire saw/(unit tang)}
|
||||
^- {(list move) _+>.$}
|
||||
?> ?=($~ saw)
|
||||
[~ +>.$]
|
||||
::
|
||||
++ quit-peering |=(way/wire ?>(?=($~ way) initialize(connected |)))
|
||||
++ reap-peering
|
||||
|= {way/wire saw/(unit tang)}
|
||||
^- {(list move) _+>.$}
|
||||
?> ?=({$~ $~} +<)
|
||||
[~ +>.$]
|
||||
::
|
||||
++ poke-work-command
|
||||
|= cod/command
|
||||
?. =(our src)
|
||||
~|([%wrong-user our=our src=src] !!)
|
||||
?- -.cod
|
||||
$sort mirror-to-web(sort p.cod)
|
||||
$old
|
||||
=^ mow +>.$
|
||||
=+ (at (~(got by tasks) id.cod))
|
||||
abet:(process-update:- dif.cod)
|
||||
=^ mov +>.$ mirror-to-web
|
||||
[(welp mov mow) +>.$]
|
||||
$new
|
||||
=. +>.cod +>.cod(date-created now, version 0, date-modified now)
|
||||
abut:send-create:(at | +.cod)
|
||||
==
|
||||
::
|
||||
:: XX test the disconnection case
|
||||
++ diff-talk-report
|
||||
|= {way/wire rep/report:talk}
|
||||
^- {(list move) _+>.$}
|
||||
?> ?=($grams -.rep)
|
||||
|- ^- {(list move) _+>.^$}
|
||||
?~ q.rep [~ +>.^$]
|
||||
=. count +(count)
|
||||
=* her p.i.q.rep
|
||||
=* when p.r.q.i.q.rep
|
||||
=* said r.r.q.i.q.rep
|
||||
?. ?=($tax -.said)
|
||||
$(p.rep +(p.rep), q.rep t.q.rep)
|
||||
=+ ^- from/(set station:talk)
|
||||
%- sa ^- (list station:talk)
|
||||
%+ murn (~(tap by q.q.i.q.rep))
|
||||
=> talk
|
||||
|= {par/partner *}
|
||||
`(unit station)`?.(?=($& -.par) ~ `p.par)
|
||||
=^ mos +>.^$ (process-duty when her from +.said)
|
||||
=^ mof +>.^$ $(p.rep +(p.rep), q.rep t.q.rep)
|
||||
[(weld mos mof) +>.^$]
|
||||
--
|
@ -1,36 +0,0 @@
|
||||
:: File writer
|
||||
::
|
||||
:::: /hoon+write+app
|
||||
::
|
||||
|_ {bowl $~}
|
||||
++ beak-now byk(r [%da now])
|
||||
++ poke-json
|
||||
|= jon/json
|
||||
=- (poke--data (need (- jon.+)))
|
||||
=> jo
|
||||
%- ot :~
|
||||
pax+(cu deft (su fel:stab))
|
||||
dat+(of json+some mime+(pe / (cu taco so)) ~) :: XX mite
|
||||
==
|
||||
::
|
||||
++ poke-write-paste
|
||||
|= {typ/?($hoon $md $txt) txt/@t}
|
||||
(poke--data [`typ /pub+paste+(scot %da now)] %mime / (taco txt))
|
||||
::
|
||||
++ poke--data
|
||||
|= {{ext/(unit @t) pax/path} dat/$$({$json json} {$mime mime})}
|
||||
?~ ext $(ext [~ -.dat])
|
||||
=+ cay=?-(-.dat %json [-.dat !>(+.dat)], %mime [-.dat !>(+.dat)])
|
||||
?: =(u.ext -.dat) (made pax ~ `cay)
|
||||
[[ost %exec pax our ~ beak-now %cast u.ext `cay]~ +>.$] :: XX defer %nice
|
||||
::
|
||||
++ made
|
||||
|= {pax/wire @ res/gage}
|
||||
?. =(our src)
|
||||
~|(foreign-write+[our=our src=src] !!)
|
||||
?+ -.res ~|(gage+-.res !!)
|
||||
$| (mean p.res)
|
||||
$& =- [[ost %info / our -]~ +>.$]
|
||||
(foal :(welp (tope beak-now ~) pax /[-.p.res]) p.res)
|
||||
==
|
||||
--
|
146
arvo/jael.hoon
146
arvo/jael.hoon
@ -1,146 +0,0 @@
|
||||
:: %jael, secret storage
|
||||
::
|
||||
:::: /hoon+jael
|
||||
::
|
||||
!? 164
|
||||
::::
|
||||
:: %jael is logically homogeneous, but please follow these conventions:
|
||||
::
|
||||
:: /cap :: foreign app keys
|
||||
:: /service :: service name, eg %face for FB
|
||||
:: /appid :: your ship's app-id
|
||||
:: /@uvH :: by hash
|
||||
:: /@ud :: by number
|
||||
:: /@tas :: by name
|
||||
::
|
||||
:: /key :: foreign user secrets
|
||||
:: /service :: service name, eg %face
|
||||
:: /userid :: user identity
|
||||
::
|
||||
:: /urb :: urbit secrets
|
||||
:: /tok+hash
|
||||
|
||||
|= pit=vase
|
||||
=> =~
|
||||
:: structures
|
||||
|%
|
||||
++ axle :: %jael state
|
||||
$: %0 :: %jael version
|
||||
ent=@ :: entropy
|
||||
sef=safe :: secret tree
|
||||
red=(map duct (set path)) :: reverse subscribers
|
||||
== ::
|
||||
++ gift :: out result <-$
|
||||
$% [%dead p=path] :: key expired
|
||||
[%live p=path q=@] :: key created
|
||||
== ::
|
||||
++ kiss :: in request ->$
|
||||
$% [%kill p=path] :: discard secret
|
||||
[%make p=@uw q=(unit ,@da) r=@ud s=path] :: generate random
|
||||
[%nuke ~] :: erase subscriber
|
||||
[%tell p=@uw q=(unit ,@da) r=path] :: save secret
|
||||
== ::
|
||||
++ move ,[p=duct q=(mold note gift)] :: typed move
|
||||
++ note :: out request $->
|
||||
$% $: %b :: to %behn
|
||||
$% [%wait p=@da] ::
|
||||
[%rest p=@da] ::
|
||||
== == == ::
|
||||
++ perm (pair ,@ud (list ,@ud)) :: prime definition
|
||||
++ safe ::
|
||||
$: nub=(unit ,@uw) :: secret
|
||||
dex=(unit ,@da) :: expiration
|
||||
sud=(set duct) :: subscribers
|
||||
kin=(map term safe) :: children
|
||||
== ::
|
||||
-- ::
|
||||
:: programs
|
||||
|%
|
||||
++ bu
|
||||
|_ $: xap=path
|
||||
fes=(list safe)
|
||||
moz=(list move)
|
||||
==
|
||||
axle
|
||||
::
|
||||
++ bu-abet :: resolve
|
||||
^- axle
|
||||
?~ xap +<+
|
||||
%= bu-abet
|
||||
xap t.xap
|
||||
fes t.fes
|
||||
sef %= i.fes
|
||||
kin
|
||||
?: =(*safe sef)
|
||||
(~(del by kin.i.fes) i.xap)
|
||||
(~(put by kin.i.fes) i.xap sef)
|
||||
==
|
||||
==
|
||||
::
|
||||
++ bu-kill :: destroy
|
||||
^+ .
|
||||
=+ dus=(~(tap by
|
||||
|
||||
::
|
||||
++ bu-ajar :: descend
|
||||
|= pax=path
|
||||
^+ +>
|
||||
?~ pax +>.$
|
||||
%= $
|
||||
pax t.pax
|
||||
xap [i.pax xap]
|
||||
fes [sef fes]
|
||||
sef (fall (~(get by kin.sef) i.pax) *safe)
|
||||
==
|
||||
--
|
||||
++ bury
|
||||
|= [pax=path lex=axle]
|
||||
(~(bu-ajar bu [~ ~ ~] tof.lex lex) pax)
|
||||
--
|
||||
. ==
|
||||
=| axle
|
||||
|= [now=@da eny=@ ski=sled] :: activate
|
||||
^? :: opaque core
|
||||
|% ::
|
||||
++ call :: request
|
||||
|= [hen=duct hic=(hypo (hobo kiss))]
|
||||
^- [p=(list move) q=_..^$]
|
||||
=> .(q.hic ?.(?=(%soft -.q.hic) q.hic ((hard kiss) p.q.hic)))
|
||||
=^ moz +>+>-
|
||||
=< bu-abet
|
||||
?- -.p.q.hic
|
||||
%kill
|
||||
kill:(bury p.p.q.hic +>+>-)
|
||||
::
|
||||
%make
|
||||
%nuke
|
||||
%tell
|
||||
==
|
||||
::
|
||||
++ doze
|
||||
|= [now=@da hen=duct]
|
||||
^- (unit ,@da)
|
||||
~
|
||||
::
|
||||
++ load :: highly forgiving
|
||||
|= old=*
|
||||
=+ lox=((soft axle) old)
|
||||
^+ ..^$
|
||||
?~ lox
|
||||
~& %jael-reset
|
||||
..^$
|
||||
..^$(+>- u.lox)
|
||||
::
|
||||
++ scry
|
||||
|= [fur=(unit (set monk)) ren=@tas who=ship syd=desk lot=coin tyl=path]
|
||||
^- (unit (unit (pair mark ,*)))
|
||||
:: actually scry
|
||||
~
|
||||
::
|
||||
++ stay :: save w+o cache
|
||||
`axle`+>-.$(pol (~(run by pol) |=(a=baby [tad.a dym.a ~])))
|
||||
::
|
||||
++ take :: response
|
||||
|= [tea=wire hen=duct hin=(hypo noun)]
|
||||
!!
|
||||
--
|
103
arvo/kahn.hoon
103
arvo/kahn.hoon
@ -1,103 +0,0 @@
|
||||
:: %kahn, social state
|
||||
::
|
||||
:::: /hoon+kahn
|
||||
::
|
||||
!? 164
|
||||
::::
|
||||
|= pit=vase
|
||||
=> =~
|
||||
:: structures
|
||||
|%
|
||||
++ axle :: %kahn state
|
||||
$: %0 ::
|
||||
soc=(map monk node) :: social graph
|
||||
red=(map duct (set monk)) :: reverse subscribers
|
||||
== ::
|
||||
++ cert (each will ,*) :: urbit or other
|
||||
++ gift :: out result <-$
|
||||
$: [%then p=node] :: propagate change
|
||||
== ::
|
||||
++ node :: social identity
|
||||
$: tin=(map monk link) :: inbound links
|
||||
oud=(map monk link) :: outbound links
|
||||
cet=cert :: certificate
|
||||
sud=(set duct) :: subscribers
|
||||
== ::
|
||||
++ khan ,[p=@tas q=@ta] :: foreign identity
|
||||
++ kiss :: social update
|
||||
$: [%cert p=monk q=cert] :: set certificate
|
||||
[%hear p=monk] :: watch identity
|
||||
[%know p=monk q=(map monk link)] :: set forward links
|
||||
[%nuke ~] :: erase subscriber
|
||||
== ::
|
||||
++ link (pair rank ,@da) :: trust+expiration
|
||||
++ monk (each ship khan) :: general identity
|
||||
++ rank :: privilege ring
|
||||
$? %0 :: complete trust
|
||||
%1 :: structural trust
|
||||
%2 :: social trust
|
||||
%3 :: neutral trust
|
||||
%4 :: negative trust
|
||||
== ::
|
||||
-- ::
|
||||
. ==
|
||||
=| axle
|
||||
=* lex -
|
||||
|= [now=@da eny=@ ski=sled] :: activate
|
||||
^? :: opaque core
|
||||
|% ::
|
||||
++ call :: request
|
||||
|= [hen=duct hic=(hypo (hobo kiss))]
|
||||
^- [p=(list move) q=_..^$]
|
||||
=> .(q.hic ?.(?=(%soft -.q.hic) q.hic ((hard kiss) p.q.hic)))
|
||||
!!
|
||||
::
|
||||
++ doze
|
||||
|= [now=@da hen=duct]
|
||||
^- (unit ,@da)
|
||||
~
|
||||
::
|
||||
++ load :: highly forgiving
|
||||
|= old=*
|
||||
=+ lox=((soft axle) old)
|
||||
^+ ..^$
|
||||
?~ lox
|
||||
~& %khan-reset
|
||||
..^$
|
||||
..^$(+>- u.lox)
|
||||
::
|
||||
++ scry
|
||||
|= [fur=(unit (set monk)) ren=@tas who=ship syd=desk lot=coin tyl=path]
|
||||
^- (unit (unit (pair mark ,*)))
|
||||
?. =(big [~ who]) ~
|
||||
=+ ^= yub ^- [(unit monk)
|
||||
?: =(%urb syd)
|
||||
?. ?=([* ~] tyl) ~
|
||||
=+ goy=(slaw %p
|
||||
|
||||
?+ ?=([%$ %da @]
|
||||
?+ lot ~
|
||||
[%$ %ud @]
|
||||
%+ bind
|
||||
(perm who u.hun q.p.lot [syd t.tyl])
|
||||
|=(a=* [%noun a])
|
||||
::
|
||||
?. =(now q.p.lot) ~
|
||||
%+ bind
|
||||
(temp who u.hun [syd t.tyl])
|
||||
|=(a=* [%noun a])
|
||||
==
|
||||
?. ?=([%da
|
||||
=+ mok ^- (unit monk)
|
||||
?: =(%urb face)
|
||||
(
|
||||
|
||||
::
|
||||
++ stay :: save w+o cache
|
||||
`axle`+>-.$
|
||||
::
|
||||
++ take :: response
|
||||
|= [tea=wire hen=duct hin=(hypo noun)]
|
||||
!!
|
||||
--
|
||||
|
104
arvo/lunt.hoon
104
arvo/lunt.hoon
@ -1,104 +0,0 @@
|
||||
:: %lunt, fleet job control
|
||||
::
|
||||
:::: /hoon+lunt
|
||||
::
|
||||
!? 164
|
||||
::::
|
||||
|= pit=vase
|
||||
=> =~
|
||||
:: structures
|
||||
|%
|
||||
++ axle :: %lunt state
|
||||
$: %0 ::
|
||||
all=(map ship axil) :: state by owner
|
||||
== ::
|
||||
++ born ,[p=brat q=(unit ship)] :: task identity
|
||||
++ brat ,@ud :: task number
|
||||
++ bulb ::
|
||||
$: p=@p :: ship identity
|
||||
q=home :: server data
|
||||
== ::
|
||||
++ home :: storage access
|
||||
$: pad=@uvH :: passcode
|
||||
huc=husk :: log server
|
||||
sog=hulk :: storage server
|
||||
== ::
|
||||
++ hulk :: checkpoint service
|
||||
$% [%astr p=@ud q=@ud] :: S3
|
||||
== ::
|
||||
++ husk :: log server
|
||||
$: pro=@tas :: protocol
|
||||
cap=@uvH :: access code
|
||||
srv=(list (pair ,@ud clip)) :: server cluster
|
||||
== ::
|
||||
++ gift :: result
|
||||
$: [%die p=brat] :: kill
|
||||
[%int p=brat] :: interrupt
|
||||
[%run p=brat q=@p r=home] :: load
|
||||
[%say p=brat q=(list ovum)] :: send events
|
||||
[%new p=brat q=@p r=home s=(list ovum)] :: create
|
||||
== ::
|
||||
++ kiss :: request
|
||||
$: [%com p=@p] :: toggle compute svr
|
||||
[%end p=brat] :: local end
|
||||
[%fan p=@ud] :: set local fanout
|
||||
[%kil ~] :: terminate ship
|
||||
[%int ~] :: interrupt ship
|
||||
[%new p=@p q=(set ,@p) q=home r=@uvI] :: create ship
|
||||
[%run p=@p q=home] :: run existing ship
|
||||
[%say p=(list ovum)] :: remote events
|
||||
[%sto p=husk] :: toggle logger
|
||||
== ::
|
||||
++ axil ::
|
||||
$: bus=(unit ,@p) :: master
|
||||
loc=@ud :: local resources
|
||||
hen=(unit duct) :: effect duct
|
||||
ent=@ :: entropy
|
||||
seq=@ :: brat sequence
|
||||
why=(map duct born) :: hosted ships
|
||||
how=(map born duct) :: reverse why
|
||||
hut=(map born home) :: storage control
|
||||
ham=(set hulk) :: block stores
|
||||
sto=(set husk) :: log stores
|
||||
com=(set ship) :: compute resources
|
||||
== ::
|
||||
-- ::
|
||||
. ==
|
||||
=| axle
|
||||
=* lex -
|
||||
|= [now=@da eny=@ ski=sled] :: activate
|
||||
^? :: opaque core
|
||||
|% ::
|
||||
++ call :: request
|
||||
|= [hen=duct hic=(hypo (hobo kiss))]
|
||||
^- [p=(list move) q=_..^$]
|
||||
=> .(q.hic ?.(?=(%soft -.q.hic) q.hic ((hard kiss) p.q.hic)))
|
||||
!!
|
||||
::
|
||||
++ doze
|
||||
|= [now=@da hen=duct]
|
||||
^- (unit ,@da)
|
||||
~
|
||||
::
|
||||
++ load :: highly forgiving
|
||||
|= old=*
|
||||
=+ lox=((soft axle) old)
|
||||
^+ ..^$
|
||||
?~ lox
|
||||
~& %lunt-reset
|
||||
..^$
|
||||
..^$(+>- u.lox)
|
||||
::
|
||||
++ scry
|
||||
|= [fur=(unit (set monk)) ren=@tas who=ship syd=desk lot=coin tyl=path]
|
||||
^- (unit (unit (pair mark ,*)))
|
||||
~
|
||||
::
|
||||
++ stay :: save w+o cache
|
||||
`axle`+>-.$
|
||||
::
|
||||
++ take :: response
|
||||
|= [tea=wire hen=duct hin=(hypo noun)]
|
||||
!!
|
||||
--
|
||||
|
@ -1,94 +0,0 @@
|
||||
:: %musk, realm management
|
||||
::
|
||||
:::: /hoon+musk
|
||||
::
|
||||
!? 164
|
||||
::::
|
||||
|= pit=vase
|
||||
=> =~
|
||||
:: structures
|
||||
|%
|
||||
++ axle :: %musk state
|
||||
$: %0 ::
|
||||
all=(map ship axil) :: state by owner
|
||||
== ::
|
||||
++ axil ::
|
||||
$: kid=(map ship girl) :: daughters
|
||||
deq=(map narc ship) :: reverse address
|
||||
siq=(map ship (list clan)) :: ship to clans
|
||||
kes=(map clan (list ship)) :: clan to ships
|
||||
== ::
|
||||
++ clan ,@tas :: group identity
|
||||
++ narc :: contact address
|
||||
$: [%$ p=ship] :: urbit
|
||||
[%m p=@t q=@t] :: email p@q
|
||||
[%f p=@t] :: facebook
|
||||
[%g p=@t] :: google
|
||||
[%p p=@t] :: phone message
|
||||
[%t p=@t] :: twitter
|
||||
== ::
|
||||
++ pony :: daughter status
|
||||
$% [%cold ~] :: virginal
|
||||
[%dead ~] :: written off
|
||||
[%fake ~] :: virtual
|
||||
[%free ~] :: downloaded
|
||||
[%here ~] :: hosted
|
||||
[%left p=(unit ship)] :: run away to
|
||||
== ::
|
||||
++ rank :: relative privilege
|
||||
$? %0 :: enemy
|
||||
%1 :: neighbor
|
||||
%2 :: guest+customer
|
||||
%3 :: friend+employee
|
||||
%4 :: officer+family
|
||||
%5 :: self+admin
|
||||
== ::
|
||||
++ girl ::
|
||||
$: hop=pony :: status
|
||||
tag=(unit ,@tas) :: petname
|
||||
tip=rank :: rank
|
||||
fig=(set narc) :: identities
|
||||
loc=(unit ,[p=@da q=@ud r=clip]) :: last position
|
||||
sym=(set ,[p=@ q=@uvH]) :: symmetric keys?
|
||||
wyl=will :: crypto will
|
||||
== ::
|
||||
-- ::
|
||||
. ==
|
||||
=| axle
|
||||
=* lex -
|
||||
|= [now=@da eny=@ ski=sled] :: activate
|
||||
^? :: opaque core
|
||||
|% ::
|
||||
++ call :: request
|
||||
|= [hen=duct hic=(hypo (hobo kiss))]
|
||||
^- [p=(list move) q=_..^$]
|
||||
=> .(q.hic ?.(?=(%soft -.q.hic) q.hic ((hard kiss) p.q.hic)))
|
||||
!!
|
||||
::
|
||||
++ doze
|
||||
|= [now=@da hen=duct]
|
||||
^- (unit ,@da)
|
||||
~
|
||||
::
|
||||
++ load :: highly forgiving
|
||||
|= old=*
|
||||
=+ lox=((soft axle) old)
|
||||
^+ ..^$
|
||||
?~ lox
|
||||
~& %lunt-reset
|
||||
..^$
|
||||
..^$(+>- u.lox)
|
||||
::
|
||||
++ scry
|
||||
|= [fur=(unit (set monk)) ren=@tas who=ship syd=desk lot=coin tyl=path]
|
||||
^- (unit (unit (pair mark ,*)))
|
||||
~
|
||||
::
|
||||
++ stay :: save w+o cache
|
||||
`axle`+>-.$
|
||||
::
|
||||
++ take :: response
|
||||
|= [tea=wire hen=duct hin=(hypo noun)]
|
||||
!!
|
||||
--
|
||||
|
2341
arvo/zuse.hoon
2341
arvo/zuse.hoon
File diff suppressed because it is too large
Load Diff
@ -1,14 +0,0 @@
|
||||
|
||||
::
|
||||
::::
|
||||
::
|
||||
/? 310
|
||||
::
|
||||
:::::::
|
||||
!:
|
||||
:- %say
|
||||
|= {^ arg/{address/@t contact/@t $~} $~}
|
||||
:- %address-contact
|
||||
[address.arg contact.arg]
|
||||
|
||||
|
@ -1,11 +0,0 @@
|
||||
::
|
||||
::::
|
||||
::
|
||||
/? 310
|
||||
::
|
||||
:::::
|
||||
!:
|
||||
:- %say
|
||||
|= {^ {arg1+cord arg2+cord $~} $~}
|
||||
:- %auth
|
||||
[arg1 arg2]
|
@ -1,11 +0,0 @@
|
||||
::
|
||||
::::
|
||||
::
|
||||
/? 310
|
||||
::
|
||||
:::::::
|
||||
!:
|
||||
:- %say
|
||||
|= {^ {amount/@t currency/@t $~} $~}
|
||||
:- %buy
|
||||
[amount currency]
|
@ -1,14 +0,0 @@
|
||||
|
||||
::
|
||||
::::
|
||||
::
|
||||
/? 310
|
||||
::
|
||||
:::::::
|
||||
!:
|
||||
:- %say
|
||||
|= {^ arg/{contact/@t address/@t $~} $~}
|
||||
:- %bit-contact
|
||||
[contact.arg address.arg]
|
||||
|
||||
|
@ -1,12 +0,0 @@
|
||||
::
|
||||
::::
|
||||
::
|
||||
/? 310
|
||||
::
|
||||
:::::::
|
||||
!:
|
||||
:- %say
|
||||
|= {^ $~ $~}
|
||||
:- %list
|
||||
~
|
||||
|
@ -1,12 +0,0 @@
|
||||
::
|
||||
::::
|
||||
::
|
||||
/? 310
|
||||
::
|
||||
:::::::
|
||||
!:
|
||||
:- %say
|
||||
|= {^ {amount/@t currency/@t $~} $~}
|
||||
:- %sell
|
||||
[amount currency]
|
||||
|
@ -1,12 +0,0 @@
|
||||
::
|
||||
::::
|
||||
::
|
||||
/? 310
|
||||
::
|
||||
:::::::
|
||||
!:
|
||||
:- %say
|
||||
|= {^ {to/@uc amo/@t $~} $~}
|
||||
[%bit-send to amo]
|
||||
|
||||
|
33
gen/cat.hoon
33
gen/cat.hoon
@ -1,33 +0,0 @@
|
||||
:: ConCATenate file listings
|
||||
::
|
||||
:::: /hoon+gen+cat
|
||||
::
|
||||
// /%%/ls+subdir
|
||||
// /%/pretty
|
||||
!:
|
||||
::::
|
||||
::
|
||||
:- %say
|
||||
|= {^ {arg/(list path)} $~}
|
||||
=- tang+(flop `tang`(zing -))
|
||||
%+ turn arg
|
||||
|= pax/path
|
||||
^- tang
|
||||
=+ ark=;;(arch .^(%cy pax))
|
||||
?^ fil.ark
|
||||
?: =(%sched -:(flop pax))
|
||||
[>;;((map ,@da cord) .^(%cx pax))<]~
|
||||
[leaf+(spud pax) (pretty-file .^(%cx pax))]
|
||||
?- dir.ark :: handle ambiguity
|
||||
$~
|
||||
[rose+[" " `~]^~[leaf+"~" (smyt pax)]]~
|
||||
::
|
||||
{{@t $~} $~ $~}
|
||||
$(pax (welp pax /[p.n.dir.ark]))
|
||||
::
|
||||
*
|
||||
=- [palm+[": " ``~]^-]~
|
||||
:~ rose+[" " `~]^~[leaf+"*" (smyt pax)]
|
||||
`tank`(subdir pax dir.ark)
|
||||
==
|
||||
==
|
@ -1,25 +0,0 @@
|
||||
!:
|
||||
|%
|
||||
++ pretty-noun
|
||||
|= pri=* ^- tank
|
||||
?~ pri
|
||||
leaf+"~"
|
||||
?@ pri
|
||||
leaf+?:(((sane %tas) pri) <`@tas`pri> <pri>)
|
||||
=< rose+[" " ?:(- "~[" "[") "]"]^+
|
||||
|- ^- [? (list tank)]
|
||||
?~ +.pri
|
||||
[& ^$(pri -.pri) ~]
|
||||
?@ +.pri
|
||||
[| ^$(pri -.pri) ^$(pri +.pri) ~]
|
||||
[+< - +>]:[^$(pri -.pri) $(pri +.pri)]
|
||||
::
|
||||
++ vale-cord |=(a=cord `?`(levy (trip a) |=(b=@ |((gte b 32) =(10 b)))))
|
||||
::
|
||||
++ pretty-file
|
||||
=+ wain-to-tang=|=(a=wain (turn a |=(b=cord leaf+(trip b))))
|
||||
|= fyl=* ^- tang
|
||||
=+ `(unit wain)`?@(fyl `(lore fyl) ((soft wain) fyl))
|
||||
?^ - (wain-to-tang u)
|
||||
[(pretty-noun fyl)]~
|
||||
--
|
@ -1,11 +0,0 @@
|
||||
::
|
||||
::::
|
||||
::
|
||||
/? 310
|
||||
::
|
||||
::::
|
||||
!:
|
||||
:- %say
|
||||
|= [^ [arg=(list cord) ~]]
|
||||
:- %keys
|
||||
arg
|
@ -1,6 +0,0 @@
|
||||
/- sole
|
||||
[sole]
|
||||
:- %get |= {^ {a/tape $~} $~}
|
||||
%+ sole-at (scan a auri:epur)
|
||||
|= hit/httr
|
||||
(sole-so %httr hit)
|
@ -1,10 +0,0 @@
|
||||
::
|
||||
::::
|
||||
::
|
||||
/? 310
|
||||
::
|
||||
:::::
|
||||
!:
|
||||
:- %say
|
||||
|= {^ {arg/tape $~} $~}
|
||||
purl+(scan arg auri:epur)
|
@ -1,11 +0,0 @@
|
||||
::
|
||||
:::: /hoon+hello+gen
|
||||
::
|
||||
/? 314
|
||||
::
|
||||
::::
|
||||
!:
|
||||
:- %say
|
||||
|= {^ {{txt/@tas $~} $~}}
|
||||
:- %noun
|
||||
(crip (weld "hello, " (flop (trip txt))))
|
@ -1,6 +0,0 @@
|
||||
:- %say
|
||||
|= {^ {mel/cord $~} $~}
|
||||
=+ adr=(star ;~(less (mask "\"\\()[],:;<>@") prn))
|
||||
=+ dom=[;~(plug dlab dot (most dot dlab))]:urlp
|
||||
=+ ~|(bad-email+mel (rash mel ;~((glue pat) adr dom)))
|
||||
helm-send-ask+mel
|
@ -1,58 +0,0 @@
|
||||
::
|
||||
:::: /hoon+begin+hood+gun
|
||||
::
|
||||
/? 314
|
||||
/- sole
|
||||
::
|
||||
::::
|
||||
!:
|
||||
=> |%
|
||||
++ begs {his/@p tic/@p yen/@t ges/gens}
|
||||
++ scug |*({a/@ b/(pole)} ?~(b ~ ?~(a ~ [-.b $(b +.b, a (dec a))])))
|
||||
--
|
||||
[sole .]
|
||||
:- %ask
|
||||
|= $: {now/@da eny/@uvI bec/beak}
|
||||
{arg/_(scug *@ ~{his/*@p tic/*@p})}
|
||||
safety/?($on $off)
|
||||
==
|
||||
^- (sole-result (cask begs))
|
||||
?. =(safety %off)
|
||||
%+ sole-yo
|
||||
:- %leaf
|
||||
"|begin is deprecated, please invoke urbit with -w [name] -t [ticket]"
|
||||
sole-no
|
||||
=- ?~ arg -
|
||||
=+ (fun.q.q his.arg)
|
||||
?~ +.arg -
|
||||
(fun.q.q tic.arg)
|
||||
%+ sole-lo
|
||||
[%& %helm-begin "your urbit: ~"]
|
||||
%+ sole-go fed:ag
|
||||
|= his/@p
|
||||
%+ sole-lo
|
||||
[%& %helm-ticket "your ticket: ~"]
|
||||
%+ sole-go fed:ag
|
||||
|= tic/@p
|
||||
%+ sole-lo
|
||||
[%& %helm-entropy "some entropy: "]
|
||||
%+ sole-go (boss 256 (more gon qit))
|
||||
|= yen/@t
|
||||
=+ ney=(shax yen)
|
||||
%+ sole-yo `tank`[%leaf "entropy check: {(scow %p `@p`(mug ney))}"]
|
||||
%+ sole-so %helm-begin
|
||||
:* his
|
||||
tic
|
||||
ney
|
||||
::
|
||||
^- gens
|
||||
:- %en
|
||||
=+ can=(clan his)
|
||||
?- can
|
||||
$czar [%czar ~]
|
||||
$duke [%duke %anon ~]
|
||||
$earl [%earl (scot %p his)]
|
||||
$king [%king ?:(=(~doznec his) 'Urban Republic' (scot %p his))]
|
||||
$pawn [%pawn ~]
|
||||
==
|
||||
==
|
@ -1,13 +0,0 @@
|
||||
::
|
||||
:::: /hoon+reload+hood+gen
|
||||
::
|
||||
/? 314
|
||||
::
|
||||
::::
|
||||
!:
|
||||
:- %say
|
||||
|= $: {now/@da eny/@uvI bec/beak}
|
||||
{arg/(list term) $~}
|
||||
==
|
||||
:+ %helm-reload-desk %base
|
||||
arg
|
@ -1,13 +0,0 @@
|
||||
::
|
||||
:::: /hoon+cancel+hood+gen
|
||||
::
|
||||
/? 314
|
||||
::
|
||||
::::
|
||||
!:
|
||||
:- %say
|
||||
|= $: {now/@da eny/@uvI bec/beak}
|
||||
{{syd/@tas $~} $~}
|
||||
==
|
||||
:- %kiln-cancel
|
||||
syd
|
@ -1,2 +0,0 @@
|
||||
:- %say
|
||||
|=({^ {input/path output/path $~} $~} kiln-cp+[input output])
|
@ -1,12 +0,0 @@
|
||||
::
|
||||
:::: /hoon+deset+hood+gen
|
||||
::
|
||||
/? 314
|
||||
::
|
||||
::::
|
||||
!:
|
||||
:- %say
|
||||
|= $: {now/@da eny/@uvI bec/beak}
|
||||
{arg/$~ $~}
|
||||
==
|
||||
[%helm-deset ~]
|
@ -1,2 +0,0 @@
|
||||
:- %say
|
||||
|=({^ {who/ship mez/$@($~ {a/tape $~})} $~} helm-send-hi+[who ?~(mez ~ `a.mez)])
|
@ -1,13 +0,0 @@
|
||||
::
|
||||
:::: /hoon+reload+hood+gen
|
||||
::
|
||||
/? 314
|
||||
::
|
||||
::::
|
||||
!:
|
||||
:- %say
|
||||
|= $: {now/@da eny/@uvI bec/beak}
|
||||
{$~ $~}
|
||||
==
|
||||
:- %hood-init
|
||||
p.bec
|
@ -1,12 +0,0 @@
|
||||
::
|
||||
:::: /hoon+invite+hood+gen
|
||||
::
|
||||
/? 314
|
||||
::
|
||||
::::
|
||||
!:
|
||||
:- %say
|
||||
|= $: {now/@da eny/@uvI bec/beak}
|
||||
{{who/@p myl/@t $~} $~}
|
||||
==
|
||||
[%helm-invite who myl]
|
@ -1,13 +0,0 @@
|
||||
::
|
||||
:::: /hoon+label+hood+gen
|
||||
::
|
||||
/? 314
|
||||
::
|
||||
::::
|
||||
!:
|
||||
:- %say
|
||||
|= $: {now/@da eny/@uvI bec/beak}
|
||||
{arg/{syd/desk lab/@tas $~} $~}
|
||||
==
|
||||
:- %kiln-label
|
||||
[syd lab]:arg
|
@ -1,15 +0,0 @@
|
||||
::
|
||||
:::: /hoon+link+hood+gen
|
||||
::
|
||||
/? 314
|
||||
::
|
||||
::::
|
||||
!:
|
||||
:- %say
|
||||
|= $: {now/@da eny/@uvI byk/beak}
|
||||
{arg/$?({dap/term $~} {who/ship dap/term $~}) $~}
|
||||
==
|
||||
:- %drum-link
|
||||
?~ +.arg
|
||||
[p.byk dap.arg]
|
||||
[who.arg dap.arg]
|
@ -1,12 +0,0 @@
|
||||
::
|
||||
:::: /hoon+mass+hood+gen
|
||||
::
|
||||
/? 314
|
||||
::
|
||||
::::
|
||||
!:
|
||||
:- %say
|
||||
|= $: {now/@da eny/@uvI bec/beak}
|
||||
{arg/$~ $~}
|
||||
==
|
||||
[%helm-mass ~]
|
@ -1,33 +0,0 @@
|
||||
::
|
||||
:::: /hoon+merge+hood+gen
|
||||
::
|
||||
/? 314
|
||||
!:
|
||||
|%
|
||||
++ beaky {span span span $~}
|
||||
++ sorc ?({bek/beaky $~} {her/@p sud/@tas $~})
|
||||
--
|
||||
::
|
||||
::::
|
||||
!:
|
||||
:- %say
|
||||
|= $: {now/@da eny/@uvI bek/beak}
|
||||
{arg/{?(sorc {syd/$@(desk beaky) sorc})} gem/?($auto germ)}
|
||||
==
|
||||
=* our p.bek
|
||||
|^ :- %kiln-merge
|
||||
^- {syd/desk her/ship sud/desk gem/?($auto germ)}
|
||||
?- arg
|
||||
{@ @ $~} =+(arg [sud ?.(=(our her) her (sein her)) sud gem])
|
||||
{^ $~} =+((pars bek.arg) [dez ?.(=(our who) who (sein who)) dez gem])
|
||||
{* @ @ $~} [(pars-src syd.arg) =+(arg [her sud gem])]
|
||||
{* ^ $~} [(pars-src syd.arg) =+((pars bek.arg) [who dez gem])]
|
||||
==
|
||||
++ pars |=(a/beaky =+((need (tome a)) `{who/ship dez/desk}`{p q}))
|
||||
++ pars-src
|
||||
|= syd=$@(desk beaky)
|
||||
?@ syd syd
|
||||
=+ (pars syd)
|
||||
~| [%into-foreign who `path`syd]
|
||||
?>(=(our who) dez)
|
||||
--
|
@ -1,2 +0,0 @@
|
||||
:- %say
|
||||
|=({^ {input/path output/path $~} $~} kiln-mv+[input output])
|
@ -1,13 +0,0 @@
|
||||
::
|
||||
:::: /hoon+overload+hood+gen
|
||||
::
|
||||
/? 314
|
||||
::
|
||||
::::
|
||||
!:
|
||||
:- %say
|
||||
|= $: {now/@da eny/@uvI bec/beak}
|
||||
{{arg/term $~} $~}
|
||||
==
|
||||
:- %kiln-overload
|
||||
arg
|
@ -1,12 +0,0 @@
|
||||
::
|
||||
:::: /hoon+reload+hood+gen
|
||||
::
|
||||
/? 314
|
||||
::
|
||||
::::
|
||||
!:
|
||||
:- %say
|
||||
|= $: {now/@da eny/@uvI bec/beak}
|
||||
{arg/$~ $~}
|
||||
==
|
||||
[%helm-reload ~[%c]]
|
@ -1,12 +0,0 @@
|
||||
::
|
||||
:::: /hoon+reload+hood+gen
|
||||
::
|
||||
/? 314
|
||||
::
|
||||
::::
|
||||
!:
|
||||
:- %say
|
||||
|= $: {now/@da eny/@uvI bec/beak}
|
||||
{arg/$~ $~}
|
||||
==
|
||||
[%helm-reload ~[%z %a %b %c %d %e %f %g]]
|
@ -1,13 +0,0 @@
|
||||
::
|
||||
:::: /hoon+reload+hood+gen
|
||||
::
|
||||
/? 314
|
||||
::
|
||||
::::
|
||||
!:
|
||||
:- %say
|
||||
|= $: {now/@da eny/@uvI bec/beak}
|
||||
{arg/{desk (list term)} $~}
|
||||
==
|
||||
:- %helm-reload-desk
|
||||
arg
|
@ -1,12 +0,0 @@
|
||||
::
|
||||
:::: /hoon+reload+hood+gen
|
||||
::
|
||||
/? 314
|
||||
::
|
||||
::::
|
||||
!:
|
||||
:- %say
|
||||
|= $: {now/@da eny/@uvI bec/beak}
|
||||
{arg/$~ $~}
|
||||
==
|
||||
[%helm-reload ~[%f]]
|
@ -1,2 +0,0 @@
|
||||
:- %say
|
||||
|=({^ {input/path $~} $~} kiln-rm+input)
|
@ -1,2 +0,0 @@
|
||||
:- %say
|
||||
|=({^ {where/path tym/@da eve/@t $~} $~} kiln-schedule+[where tym eve])
|
@ -1,13 +0,0 @@
|
||||
::
|
||||
:::: /hoon+sync+hood+gen
|
||||
::
|
||||
/? 314
|
||||
::
|
||||
::::
|
||||
!:
|
||||
:- %say
|
||||
|= $: {now/@da eny/@uvI bec/beak}
|
||||
{arg/{syd/@tas her/@p sud/@tas $~} $~}
|
||||
==
|
||||
:- %kiln-sync
|
||||
[syd her sud]:arg
|
@ -1,16 +0,0 @@
|
||||
::
|
||||
:::: /hoon+unix+hood+gen
|
||||
::
|
||||
/? 314
|
||||
::
|
||||
::::
|
||||
!:
|
||||
:- %say
|
||||
|= $: {now/@da eny/@uvI bec/beak}
|
||||
{{syd/@tas syn/?($~ {? $~})} $~}
|
||||
==
|
||||
:+ %hood-unix
|
||||
syd
|
||||
?~ syn
|
||||
~
|
||||
`-.syn
|
@ -1,15 +0,0 @@
|
||||
::
|
||||
:::: /hoon+link+hood+gen
|
||||
::
|
||||
/? 314
|
||||
::
|
||||
::::
|
||||
!:
|
||||
:- %say
|
||||
|= $: {now/@da eny/@uvI byk/beak}
|
||||
{arg/$?({dap/term $~} {who/ship dap/term $~}) $~}
|
||||
==
|
||||
:- %drum-unlink
|
||||
?~ +.arg
|
||||
[p.byk dap.arg]
|
||||
[who.arg dap.arg]
|
@ -1,13 +0,0 @@
|
||||
::
|
||||
:::: /hoon+mount+hood+gen
|
||||
::
|
||||
/? 314
|
||||
::
|
||||
::::
|
||||
!:
|
||||
:- %say
|
||||
|= $: {now/@da eny/@uvI bec/beak}
|
||||
{{mon/$@(term {span path}) $~} $~}
|
||||
==
|
||||
:- %kiln-unmount
|
||||
mon
|
@ -1,13 +0,0 @@
|
||||
::
|
||||
:::: /hoon+unsync+hood+gen
|
||||
::
|
||||
/? 314
|
||||
::
|
||||
::::
|
||||
!:
|
||||
:- %say
|
||||
|= $: {now/@da eny/@uvI bec/beak}
|
||||
{arg/{syd/@tas her/@p sud/@tas $~} $~}
|
||||
==
|
||||
:- %kiln-unsync
|
||||
[syd her sud]:arg
|
12
gen/ls.hoon
12
gen/ls.hoon
@ -1,12 +0,0 @@
|
||||
:: LiSt directory subnodes
|
||||
::
|
||||
:::: /hoon+ls+gen
|
||||
::
|
||||
// /%/subdir
|
||||
!:
|
||||
::::
|
||||
::
|
||||
:- %say
|
||||
|= {^ {arg/path $~} $~}
|
||||
=+ lon=((hard arch) .^(%cy arg))
|
||||
tang+[?~(dir.lon leaf+"~" (subdir arg dir.lon))]~
|
@ -1,20 +0,0 @@
|
||||
|%
|
||||
++ subdir
|
||||
|= {pax/path des/(map @t $~)}
|
||||
^- tank
|
||||
:+ %rose [" " `~]
|
||||
%+ turn (sort (~(tap by des)) aor)
|
||||
|= {kid/@ta $~}
|
||||
=+ paf=`path`/[kid]
|
||||
=- :+ %rose ["/" ~ ?:(dir "/" ~)]
|
||||
(turn paf |=(a/span leaf+(trip a)))
|
||||
|- ^- {dir/? paf/path}
|
||||
=+ arf=;;(arch .^(%cy (weld pax paf)))
|
||||
?^ fil.arf
|
||||
[| paf]
|
||||
?~ dir.arf
|
||||
[& paf] :: !!
|
||||
?. ?+({^ $~ $~} dir.arf)
|
||||
[& paf]
|
||||
$(paf (welp paf /[p.n.dir.arf]))
|
||||
--
|
@ -1,2 +0,0 @@
|
||||
:- %say
|
||||
|=({^ arg/(list @) foo/_`@`1 bar/_`@`2} noun+[arg foo bar])
|
@ -1,16 +0,0 @@
|
||||
::
|
||||
:::: /hoon+ticket+gen
|
||||
::
|
||||
/? 314
|
||||
::
|
||||
::::
|
||||
!:
|
||||
:- %say
|
||||
|= $: {now/@da eny/@uvI bec/beak}
|
||||
[$~ $~]
|
||||
==
|
||||
:- %noun
|
||||
?> =(1 (met 5 p.bec))
|
||||
=+ mon=(mix (lsh 5 1 (end 5 1 eny)) p.bec)
|
||||
=+ tic=((hard @p) .^(/a+(scot %p p.bec)/tick+(scot %da now)/(scot %p mon)))
|
||||
"moon: {<`@p`mon>}; ticket: {<tic>}"
|
@ -1,24 +0,0 @@
|
||||
:: Input twitter keys
|
||||
/- sole
|
||||
!:
|
||||
=+ cryp=bruw :: XX change to ec2 ++brew eventually
|
||||
=+ [sole]
|
||||
:- %ask
|
||||
|= $: {now/@da eny/@uvI bec/beak}
|
||||
{{who/ship $~} $~}
|
||||
==
|
||||
^- (sole-result (cask tang))
|
||||
%+ sole-yo leaf+"generating carrier {(scow %p who)} (#{(scow %ud who)})"
|
||||
%+ sole-lo [%| %pope-pass "passphrase: "]
|
||||
%+ sole-go (boss 256 (star prn))
|
||||
|= fra/@t
|
||||
%+ sole-lo [%| %pope-none "[press enter to compute]"] :: XX oy
|
||||
%+ sole-go (easy ~)
|
||||
|= $~
|
||||
=+ bur=(shax (add who (shax fra)))
|
||||
~& %computing-fingerprint
|
||||
=+ arc=(cryp 2.048 bur)
|
||||
%+ sole-so %tang
|
||||
:~ leaf+"generator: {(scow %uw bur)}"
|
||||
leaf+"fingerprint: {(scow %uw fig:ex:arc)}"
|
||||
==
|
@ -1,21 +0,0 @@
|
||||
:: Tree view recursive directory contents
|
||||
::
|
||||
:::: /hoon+tree+gen
|
||||
::
|
||||
!:
|
||||
::::
|
||||
::
|
||||
:- %say
|
||||
|= {^ {pax/path fla/$@($~ {$full $~})} $~}
|
||||
=+ len=(lent pax)
|
||||
=+ rend=?^(fla smyt |=(a/path (smyt (slag len a))))
|
||||
:- %tang %- flop
|
||||
|- ^- tang
|
||||
=+ ark=;;(arch .^(cy+pax))
|
||||
=- ?~ fil.ark -
|
||||
[(rend pax) -]
|
||||
%- zing
|
||||
%+ turn
|
||||
(sort (~(tap by dir.ark)) aor)
|
||||
|= {a/@t $~}
|
||||
^$(pax (welp pax /[a]))
|
@ -1,10 +0,0 @@
|
||||
/- twitter
|
||||
::
|
||||
::::
|
||||
::
|
||||
[twitter .]
|
||||
:- %say
|
||||
|= $: {now/@da eny/@uvI bec/beak}
|
||||
{{who/span msg/cord $~} $~}
|
||||
==
|
||||
[%twit-do [who %post eny msg]]
|
@ -1,20 +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,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 received {<a>}"]))
|
||||
++ pour |*({ost/@ * sih/{@ ^}} :_(+>.$ [ost %give +.sih]~))
|
||||
--
|
@ -1,22 +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)))
|
||||
--
|
@ -1,19 +0,0 @@
|
||||
::
|
||||
:::: /hoon+down-jet+lib
|
||||
::
|
||||
/- markdown
|
||||
::
|
||||
::::
|
||||
::
|
||||
[markdown .]
|
||||
// /%/parse :: inli donp parse
|
||||
// /%/rend :: sing sung sang flat into-inner
|
||||
~% %down ..is ~
|
||||
|%
|
||||
++ mark
|
||||
~/ %mark
|
||||
|= p/@t
|
||||
(normalize (rash p parse))
|
||||
::
|
||||
++ print sing
|
||||
--
|
File diff suppressed because it is too large
Load Diff
@ -1,239 +0,0 @@
|
||||
:: ++down rendering arms
|
||||
!:
|
||||
::::
|
||||
::
|
||||
|%
|
||||
++ into-inner
|
||||
|= {a/marl b/manx}
|
||||
?~ c.b b(c a)
|
||||
$(b i.c.b)
|
||||
::
|
||||
++ flat
|
||||
|= a/marl
|
||||
^- tape
|
||||
?~ a ~
|
||||
%- weld :_ $(a t.a)
|
||||
^- tape
|
||||
?~ n.g.i.a
|
||||
?>(?=(_:/(**) i.a) v.i.a.g.i.a)
|
||||
?+ n.g.i.a $(a c.i.a)
|
||||
$img
|
||||
%- zing ^- wall
|
||||
%+ murn a.g.i.a |= {a/mane b/tape}
|
||||
^- (unit tape)
|
||||
?+ a ~
|
||||
$alt [~ b]
|
||||
==
|
||||
==
|
||||
++ sanitize
|
||||
|= a/marl ^- tape
|
||||
=- (zing `wall`(scan (flat a) fel))
|
||||
=< fel=;~(sfix (star ;~(plug (cold '-' -) (plus +))) (star next))
|
||||
[(star ;~(less aln prn)) ;~(pose nud low (cook |=(a/@ (add a ' ')) hig))]
|
||||
::
|
||||
++ sang :: tight item children
|
||||
|= a/(list elem)
|
||||
^- marl
|
||||
?~ a ~
|
||||
%- weld :_ $(a t.a)
|
||||
?. ?=($para -.i.a)
|
||||
(sing i.a ~)
|
||||
(sung p.i.a)
|
||||
::
|
||||
++ sing :: elem to manx
|
||||
=> |%
|
||||
++ first-word
|
||||
|= a/tape
|
||||
=. a (trip (crip a)) :: XX valid tapes
|
||||
^- (unit tape)
|
||||
=. a q.q:(need q:((star ace) [1 1] a))
|
||||
=+ vex=((plus ;~(less ace prn)) [1 1] a)
|
||||
?~ q.vex ~
|
||||
(some (wonk vex))
|
||||
--
|
||||
=+ [tig=| had=*(unit mane)]
|
||||
|= lum/(list elem)
|
||||
|^ ^- marl
|
||||
=+ a=apex
|
||||
?~ q.a
|
||||
p.a
|
||||
(weld p.a $(lum q.a))
|
||||
::
|
||||
++ apex
|
||||
^- {p/marl q/_lum}
|
||||
?~ lum
|
||||
?~ had [~ ~]
|
||||
(lose "unclosed {<u.had>}")
|
||||
=> [ele=i.lum .(lum t.lum)]
|
||||
?. ?=($html -.ele)
|
||||
(push (reso ele) ~)
|
||||
:: begin reparsing of html that the spec jankily lets through ::
|
||||
=+ tex=(trip (role p.ele))
|
||||
=^ mar lum (chomp tex (sear |=(a/marl ?~(a ~ (some a))) many:poxa))
|
||||
?^ mar
|
||||
(push u.mar)
|
||||
=^ hed lum (chomp tex head:poxa)
|
||||
?^ hed
|
||||
=+ max=`marx`u.hed
|
||||
(push(lum q) [max p] ~):[apex(had `n.max) .]
|
||||
=^ tal lum (chomp tex tail:poxa)
|
||||
?~ tal
|
||||
=^ cha lum (chomp tex prn)
|
||||
?^ cha
|
||||
(push :/([u.cha]~) ~)
|
||||
(push ;lost:"{tex}" ~)
|
||||
?: =(had tal)
|
||||
[~ lum]
|
||||
?^ had
|
||||
=. lum [ele lum]
|
||||
(lose "unclosed {<u.had>}")
|
||||
(lose "close {<u.tal>}")
|
||||
:: end reparsing of html that the spec jankily lets through ::
|
||||
::
|
||||
++ lose |=(a/tape [[;lost:"{a}"]~ lum])
|
||||
++ chomp
|
||||
|* {tap/tape fel/rule}
|
||||
^- {(unit _(wonk *fel)) _lum}
|
||||
=+ vex=(fel 1^1 tap)
|
||||
?~ q.vex [~ lum]
|
||||
:- [~ (wonk vex)]
|
||||
?~(q.q.u.q.vex lum [[%html (lore (crip q.q.u.q.vex))] lum])
|
||||
::
|
||||
++ push
|
||||
|= a/marl
|
||||
^+ apex
|
||||
?~ a apex
|
||||
[[b p] q]:[b=i.a (push t.a)]
|
||||
::
|
||||
++ reso
|
||||
|= a/elem
|
||||
?^ -.a
|
||||
=. tig ?.(?=($list -.p.a) tig p.p.a)
|
||||
?: &(tig ?=($item -.p.a))
|
||||
[/li (sang q.a)]
|
||||
%+ into-inner ^$(lum q.a)
|
||||
?- -.p.a
|
||||
$bloq ;blockquote;
|
||||
$item ;li;
|
||||
$list ?@ q.p.a ;ul;
|
||||
?: =(1 p.q.p.a) ;ol;
|
||||
=+ num=(pojo (jone p.q.p.a))
|
||||
;ol(start num);
|
||||
==
|
||||
?- -.a :: :/("unimplemented {<p.a>}")
|
||||
$html !! :: handled earlier XX do type stuff
|
||||
$para [/p (sung p.a)]
|
||||
$head
|
||||
=+ [hed=(add %h0 (lsh 3 1 p.a)) kid=(sung q.a)]
|
||||
[[hed id+(sanitize kid) ~] kid]
|
||||
::
|
||||
$hrul ;hr;
|
||||
$meta =+ jon=`json`o+(~(run by p.a) |=(cord s++<))
|
||||
;meta(value "{(pojo jon)}", name "frontmatter", urb_front "");
|
||||
:: %html
|
||||
::=+ tex=(role (turn p.a crip))
|
||||
::=+ (poxa tex)
|
||||
::?^ - u.-
|
||||
::=+ (rush tex (star ;~(pose gah comt:poxa)))
|
||||
::?^ - :/(~)
|
||||
::;lost: {<p.a>}
|
||||
:: :/([(role (turn p.a crip))]~) :: XX haaaaaaack
|
||||
$defn :/(~)
|
||||
$code =+ lan=?~(p.a ~ (first-word r.u.p.a))
|
||||
=+ tex=(trip (role q.a))
|
||||
?~ lan ;pre:code:"{tex}"
|
||||
;pre:code(class "language-{u.lan}"):"{tex}"
|
||||
|
||||
==
|
||||
--
|
||||
::
|
||||
++ sung
|
||||
|= lim/kids
|
||||
=+ had=*(unit mane)
|
||||
|^ ^- marl
|
||||
=+ a=apex
|
||||
?~ q.a
|
||||
p.a
|
||||
(weld p.a $(lim q.a))
|
||||
::
|
||||
++ apex
|
||||
^- {p/marl q/_lim}
|
||||
?~ lim
|
||||
?~ had [~ ~]
|
||||
(lose "unclosed {<u.had>}")
|
||||
=> [ele=i.lim .(lim t.lim)]
|
||||
?. ?=($htmt -.ele)
|
||||
?: &(?=($$ -.ele) ?=({{$$ *} *} lim))
|
||||
apex(p.i.lim (weld p.ele p.i.lim))
|
||||
(push (reso ele) ~)
|
||||
=+ tex=(trip p.ele)
|
||||
=^ emo lim (chomp tex empt:poxa)
|
||||
?^ emo
|
||||
=+ man=`manx`u.emo
|
||||
(push man ~)
|
||||
=^ hed lim (chomp tex head:poxa)
|
||||
?^ hed
|
||||
=+ max=`marx`u.hed
|
||||
(push(lim q) [max p] ~):[apex(had `n.max) .]
|
||||
=^ tal lim (chomp tex tail:poxa)
|
||||
?~ tal
|
||||
(push ;lost:"{tex}" ~)
|
||||
?: =(had tal)
|
||||
[~ lim]
|
||||
?^ had
|
||||
=. lim [ele lim]
|
||||
(lose "unclosed {<u.had>}")
|
||||
(lose "unopened {<u.tal>}")
|
||||
::
|
||||
++ lose |=(a/tape [[;lost:"{a}"]~ lim])
|
||||
++ chomp
|
||||
|* {tap/tape fel/rule}
|
||||
^- {(unit _(wonk *fel)) _lim}
|
||||
=+ vex=(fel 1^1 tap)
|
||||
?~ q.vex [~ lim]
|
||||
:- [~ (wonk vex)]
|
||||
?~(q.q.u.q.vex lim [[%htmt (crip q.q.u.q.vex)] lim])
|
||||
::
|
||||
++ push
|
||||
|= a/marl
|
||||
^+ apex
|
||||
?~ a apex
|
||||
[[b p] q]:[b=i.a (push t.a)]
|
||||
::
|
||||
++ urly
|
||||
|= a/tape ^- tape
|
||||
?~ a ~
|
||||
:: ?: (gth i.a 0xff) "XX" :: XX
|
||||
?: ?| [?=(^ q)]:(alp 1^1 a)
|
||||
(~(has in (sa "!*'();:@&=+$,/?/%.~_")) i.a) :: XX reparse
|
||||
==
|
||||
[i.a $(a t.a)]
|
||||
(weld (urle (trip i.a)) $(a t.a))
|
||||
::
|
||||
++ reso
|
||||
|= b/inline
|
||||
^- manx
|
||||
?@ -.b
|
||||
?- -.b
|
||||
$$ :/(p.b)
|
||||
$line ;br;
|
||||
$code ;code:"{p.b}"
|
||||
$htmt !! ::p.b :: handled earlier :: XX do type stuff
|
||||
==
|
||||
?: ?=($blot -.p.b)
|
||||
=+ res=`manx`;img(src (urly p.p.b), alt (flat (turn q.b ..$)));
|
||||
:: ;img@"{p.p.b}";
|
||||
?~ q.p.b res
|
||||
res(a.g (welp a.g.res title+u.q.p.b ~))
|
||||
=+ kid=(sung q.b)
|
||||
%+ into-inner kid
|
||||
?- p.b
|
||||
{$emph ?} ?.(p.p.b ;em; ;strong;)
|
||||
{$delt $~} ;del;
|
||||
{$link ^} =+ url=(urly p.p.b)
|
||||
=. url ?^(url url "#{(sanitize kid)}")
|
||||
?~ q.p.b ;a/"{url}";
|
||||
;a/"{url}"(title u.q.p.b);
|
||||
==
|
||||
--
|
||||
--
|
@ -1,34 +0,0 @@
|
||||
::
|
||||
:::: /hoon+frontmatter+lib
|
||||
::
|
||||
/? 314
|
||||
!:
|
||||
|%
|
||||
++ atr-lines
|
||||
|= atr/(map cord cord)
|
||||
%+ turn (sort (~(tap by atr)) |=({{a/@ @} {b/@ @}} (aor a b)))
|
||||
|= {k/cord v/cord}
|
||||
(rap 3 k ': ' v ~)
|
||||
::
|
||||
++ atr-key ;~(sfix (star ;~(less col prn)) col ace)
|
||||
++ print
|
||||
|= {atr/(map cord cord) src/wain}
|
||||
?~ atr src
|
||||
['---' (welp (atr-lines atr) '---' src)]
|
||||
++ parse
|
||||
=| atr/(map cord cord)
|
||||
|= wan/wain ^+ [atr mud='']
|
||||
?~ wan [~ '']
|
||||
?^ (rush i.wan (star ace))
|
||||
$(wan t.wan)
|
||||
?. =('---' i.wan) [~ (role wan)]
|
||||
|- ^+ [atr mud='']
|
||||
?~ t.wan ~|(%unclosed-metadata !!)
|
||||
?: =('---' i.t.wan) [atr (role t.t.wan)]
|
||||
?^ (rush i.t.wan (star ace))
|
||||
$(wan t.wan)
|
||||
=- $(wan t.wan, atr (~(put by atr) (crip key) (crip val)))
|
||||
~| malformed-attribute+i.t.wan
|
||||
^- {key/tape ^ val/tape}
|
||||
+>:(atr-key 1^1 (trip i.t.wan))
|
||||
--
|
@ -1,43 +0,0 @@
|
||||
:: :: ::
|
||||
:::: /hoon+oct1/lib :::::: dependencies
|
||||
:: :: ::
|
||||
/? 310 :: arvo version
|
||||
/- oct1 :: structures
|
||||
=> ^oct1 :: namespace
|
||||
:: :: ::
|
||||
:::: :::::: semantics
|
||||
!: :: ::
|
||||
|% ::
|
||||
++ icon |=(? ?:(+< 'X' 'O')) :: display at
|
||||
++ bo :: per board
|
||||
|_ bud/board ::
|
||||
++ bit |=(@ =(1 (cut 0 [+< 1] bud))) :: moved at address
|
||||
++ get |=(point (bit (off +<))) :: get point
|
||||
++ off |=(point (add x (mul 3 y))) :: bitfield address
|
||||
++ set |=(point (con bud (bex (off +<)))) :: set point
|
||||
++ win %- lien :_ |=(a/@ =(a (dis a bud))) :: test for win
|
||||
(rip 4 0wl04h0.4A0Aw.4A00s.0e070) :: with bitmasks
|
||||
-- ::
|
||||
++ go :: play from
|
||||
|_ game:oct1 ::
|
||||
++ at |_ point :: per point
|
||||
++ g +>+< :: game
|
||||
++ k !|(x o) :: legal move
|
||||
++ m ?.(k [| g] [& g:t:?:(who y p)]) :: move
|
||||
++ o (~(get bo boo) +<) :: old at o
|
||||
++ p .(boo (~(set bo boo) +<)) :: play at o
|
||||
++ t .(who !who) :: take turn
|
||||
++ v ?:(x (icon &) ?:(o (icon |) '.')) :: view
|
||||
++ x (~(get bo box) +<) :: old at x
|
||||
++ y .(box (~(set bo box) +<)) :: play at x
|
||||
-- ::
|
||||
++ new +<(boo 0, box 0, who &) :: reset game
|
||||
++ res ?. |(~(win bo box) ~(win bo boo)) :: possible result
|
||||
?: =(511 (con boo box)) ::
|
||||
`"tie :-(" ~ `"{<~[(icon who)]>} wins" ::
|
||||
++ row |= y/@ :- (add y '1') %- zing :: print row
|
||||
(turn (gulf 0 3) |=(@ ~[' ' ~(v at y +<)])) ::
|
||||
++ tab ~["+ 1 2 3" (row 0) (row 1) (row 2)] :: print table
|
||||
++ voy ": {<~[(icon who)]>} (row+col): " :: print prompt
|
||||
--
|
||||
--
|
@ -1,59 +0,0 @@
|
||||
:: :: ::
|
||||
:::: /hoon+oct2/lib :::::: dependencies
|
||||
:: :: ::
|
||||
/? 310 :: arvo version
|
||||
/- oct2 :: structures
|
||||
=> ^oct2 :: namespace
|
||||
:: :: ::
|
||||
:::: :::::: semantics
|
||||
!: :: ::
|
||||
|% ::
|
||||
++ icon |=(? ?:(+< 'X' 'O')) :: display at
|
||||
++ bo :: per board
|
||||
|_ bud/board ::
|
||||
++ bit |=(@ =(1 (cut 0 [+< 1] bud))) :: moved at address
|
||||
++ get |=(point (bit (off +<))) :: get point
|
||||
++ off |=(point (add x (mul 3 y))) :: bitfield address
|
||||
++ set |=(point (con bud (bex (off +<)))) :: set point
|
||||
++ win %- lien :_ |=(a/@ =(a (dis a bud))) :: test for win
|
||||
(rip 4 0wl04h0.4A0Aw.4A00s.0e070) :: with bitmasks
|
||||
-- ::
|
||||
++ go :: play from
|
||||
|_ {src/ship game} ::
|
||||
++ at |_ point :: per point
|
||||
++ g `game`+>+<+ :: game
|
||||
++ k &(!|(x o) ept) :: legal move
|
||||
++ m ?.(k [| g] [& g:t:?:(who y p)]) :: move
|
||||
++ o (~(get bo boo) +<) :: old at o
|
||||
++ p .(boo (~(set bo boo) +<), q.sag `src) :: play at o
|
||||
++ t .(who !who) :: take turn
|
||||
++ v ?:(x (icon &) ?:(o (icon |) '.')) :: view
|
||||
++ x (~(get bo box) +<) :: old at x
|
||||
++ y .(box (~(set bo box) +<), p.sag `src) :: play at x
|
||||
-- ::
|
||||
++ ept =+(own |(&(=(~ -) !=(oth `src)) =(`src -))) :: we can play
|
||||
++ hey |=(? +>+<+(aud ((stat ship) +< src aud))) :: enter+leave
|
||||
++ muy |= (list ship) ?~ +< +>+<+ :: many in audience
|
||||
$(+< t.+<, aud ((stat ship) & i.+< aud)) ::
|
||||
++ nam =+ ?: =(p.sag `src) ['=' (icon &) ~] :: print name
|
||||
?: =(q.sag `src) ['=' (icon |) ~] ::
|
||||
"" (welp (scow %p src) `tape`-) ::
|
||||
++ new +<+(boo 0, box 0, who &, sag [~ ~]) :: reset game
|
||||
++ oth own(who !who) :: who owns other turn
|
||||
++ own ?:(who p.sag q.sag) :: who owns this turn
|
||||
++ res ?. |(~(win bo box) ~(win bo boo)) :: possible result
|
||||
?: =(511 (con boo box)) ::
|
||||
`"tie :-(" ~ `"{<nam>} wins" ::
|
||||
++ row |= y/@ :- (add y '1') %- zing :: print row
|
||||
(turn (gulf 0 3) |=(@ ~[' ' ~(v at y +<)])) ::
|
||||
++ str =+ [own ~[(icon who)]] ^- tape :: print player
|
||||
?~(-< -> (scow %p u.-<)) ::
|
||||
++ tab ~["+ 1 2 3" (row 0) (row 1) (row 2)] :: print table
|
||||
++ vew =- ?: =(~ -) ~ :(weld "[" - "]") :: print watchers
|
||||
=+ dow=(~(tap by aud)) |- ^- tape ::
|
||||
?~ dow ~ =+ mor=$(dow t.dow) ::
|
||||
:(weld nam(src p.i.dow) ?~(mor "" ", ") mor) ::
|
||||
++ voy =+ ~[(icon who)] %+ weld vew :: print prompt
|
||||
?.(ept " ({-}'s turn) " ": {-} (row+col): ")::
|
||||
--
|
||||
--
|
@ -1,60 +0,0 @@
|
||||
:: :: ::
|
||||
:::: /hoon+oct3/lib :::::: dependencies
|
||||
:: :: ::
|
||||
/? 310 :: arvo version
|
||||
/- oct3 :: structures
|
||||
:: :: ::
|
||||
:::: :::::: semantics
|
||||
!: :: ::
|
||||
[. ^oct3]
|
||||
|% ::
|
||||
++ icon |=(? ?:(+< 'X' 'O')) :: display at
|
||||
++ bo :: per board
|
||||
|_ bud/board ::
|
||||
++ bit |=(@ =(1 (cut 0 [+< 1] bud))) :: moved at address
|
||||
++ get |=(point (bit (off +<))) :: get point
|
||||
++ jon a+(turn (gulf 0 9) |=(@ b+(bit +<))) :: to json
|
||||
++ off |=(point (add x (mul 3 y))) :: bitfield address
|
||||
++ set |=(point (con bud (bex (off +<)))) :: set point
|
||||
++ win %- lien :_ |=(a/@ =(a (dis a bud))) :: test for win
|
||||
(rip 4 0wl04h0.4A0Aw.4A00s.0e070) :: with bitmasks
|
||||
-- ::
|
||||
++ go :: play from
|
||||
|_ {src/ship game} ::
|
||||
++ at |_ point :: per point
|
||||
++ g `game`+>+<+ :: game
|
||||
++ k &(!|(x o) ept) :: legal move
|
||||
++ m ?.(k [| g] [& g:t:?:(who y p)]) :: move
|
||||
++ o (~(get bo boo) +<) :: old at o
|
||||
++ p .(boo (~(set bo boo) +<), q.sag `src) :: play at o
|
||||
++ t .(who !who) :: take turn
|
||||
++ v ?:(x (icon &) ?:(o (icon |) '.')) :: view
|
||||
++ x (~(get bo box) +<) :: old at x
|
||||
++ y .(box (~(set bo box) +<), p.sag `src) :: play at x
|
||||
-- ::
|
||||
++ ept =+(own |(&(=(~ -) !=(oth `src)) =(`src -))) :: we can play
|
||||
++ hey |=(? +>+<+(aud ((stat ship) +< src aud))) :: enter+leave
|
||||
++ muy |= (list ship) ?~ +< +>+<+ :: many in audience
|
||||
$(+< t.+<, aud ((stat ship) & i.+< aud)) ::
|
||||
++ nam =+ ?: =(p.sag `src) ['=' (icon &) ~] :: print name
|
||||
?: =(q.sag `src) ['=' (icon |) ~] ::
|
||||
"" (welp (scow %p src) `tape`-) ::
|
||||
++ new +<+(boo 0, box 0, who &, sag [~ ~]) :: reset game
|
||||
++ oth own(who !who) :: who owns other turn
|
||||
++ own ?:(who p.sag q.sag) :: who owns this turn
|
||||
++ res ?. |(~(win bo box) ~(win bo boo)) :: possible result
|
||||
?: =(511 (con boo box)) ::
|
||||
`"tie :-(" ~ `"{<nam>} wins" ::
|
||||
++ row |= y/@ :- (add y '1') %- zing :: print row
|
||||
(turn (gulf 0 3) |=(@ ~[' ' ~(v at y +<)])) ::
|
||||
++ str =+ [own ~[(icon who)]] ^- tape :: print player
|
||||
?~(-< -> (scow %p u.-<)) ::
|
||||
++ tab ~["+ 1 2 3" (row 0) (row 1) (row 2)] :: print table
|
||||
++ vew =- ?: =(~ -) ~ :(weld "[" - "]") :: print watchers
|
||||
=+ dow=(~(tap by aud)) |- ^- tape ::
|
||||
?~ dow ~ =+ mor=$(dow t.dow) ::
|
||||
:(weld nam(src p.i.dow) ?~(mor "" ", ") mor) ::
|
||||
++ voy =+ ~[(icon who)] %+ weld vew :: print prompt
|
||||
?.(ept " ({-}'s turn) " ": {-} (row+col): ")::
|
||||
--
|
||||
--
|
@ -1,60 +0,0 @@
|
||||
:: :: ::
|
||||
:::: /hoon+oct4/lib :: :: dependencies
|
||||
:: :: ::
|
||||
/? 310 :: arvo version
|
||||
/- oct4 :: structures
|
||||
:: :: ::
|
||||
:::: :: :: semantics
|
||||
!: :: ::
|
||||
[. ^oct4]
|
||||
|%
|
||||
++ icon |=(? ?:(+< 'X' 'O')) :: display at
|
||||
++ bo :: per board
|
||||
|_ bud/board ::
|
||||
++ bit |=(@ =(1 (cut 0 [+< 1] bud))) :: moved at address
|
||||
++ get |=(point (bit (off +<))) :: get point
|
||||
++ jon a+(turn (gulf 0 9) |=(@ b+(bit +<))) :: to json
|
||||
++ off |=(point (add x (mul 3 y))) :: bitfield address
|
||||
++ set |=(point (con bud (bex (off +<)))) :: set point
|
||||
++ win %- lien :_ |=(a/@ =(a (dis a bud))) :: test for win
|
||||
(rip 4 0wl04h0.4A0Aw.4A00s.0e070) :: with bitmasks
|
||||
-- ::
|
||||
++ go :: play from
|
||||
|_ {src/ship game} ::
|
||||
++ at |_ point :: per point
|
||||
++ g `game`+>+<+ :: game
|
||||
++ k &(!|(x o) ept) :: legal move
|
||||
++ m ?.(k [| g] [& g:t:?:(who y p)]) :: move
|
||||
++ o (~(get bo boo) +<) :: old at o
|
||||
++ p .(boo (~(set bo boo) +<), q.sag `src) :: play at o
|
||||
++ t .(who !who) :: take turn
|
||||
++ v ?:(x (icon &) ?:(o (icon |) '.')) :: view
|
||||
++ x (~(get bo box) +<) :: old at x
|
||||
++ y .(box (~(set bo box) +<), p.sag `src) :: play at x
|
||||
-- ::
|
||||
++ ept =+(own |(&(=(~ -) !=(oth `src)) =(`src -))) :: we can play
|
||||
++ hey |=(? +>+<+(aud ((stat ship) +< src aud))) :: enter+leave
|
||||
++ muy |= (list ship) ?~ +< +>+<+ :: many in audience
|
||||
$(+< t.+<, aud ((stat ship) & i.+< aud)) ::
|
||||
++ nam =+ ?: =(p.sag `src) ['=' (icon &) ~] :: print name
|
||||
?: =(q.sag `src) ['=' (icon |) ~] ::
|
||||
"" (welp (scow %p src) `tape`-) ::
|
||||
++ new +<+(boo 0, box 0, who &, sag [~ ~]) :: reset game
|
||||
++ oth own(who !who) :: who owns other turn
|
||||
++ own ?:(who p.sag q.sag) :: who owns this turn
|
||||
++ res ?. |(~(win bo box) ~(win bo boo)) :: possible result
|
||||
?: =(511 (con boo box)) ::
|
||||
`"tie :-(" ~ `"{<nam>} wins" ::
|
||||
++ row |= y/@ :- (add y '1') %- zing :: print row
|
||||
(turn (gulf 0 3) |=(@ ~[' ' ~(v at y +<)])) ::
|
||||
++ str =+ [own ~[(icon who)]] ^- tape :: print player
|
||||
?~(-< -> (scow %p u.-<)) ::
|
||||
++ tab ~["+ 1 2 3" (row 0) (row 1) (row 2)] :: print table
|
||||
++ vew =- ?: =(~ -) ~ :(weld "[" - "]") :: print watchers
|
||||
=+ dow=(~(tap by aud)) |- ^- tape ::
|
||||
?~ dow ~ =+ mor=$(dow t.dow) ::
|
||||
:(weld nam(src p.i.dow) ?~(mor "" ", ") mor) ::
|
||||
++ voy =+ ~[(icon who)] %+ weld vew :: print prompt
|
||||
?.(ept " ({-}'s turn) " ": {-} (row+col): ")::
|
||||
--
|
||||
--
|
132
lib/react.hoon
132
lib/react.hoon
@ -1,132 +0,0 @@
|
||||
!:
|
||||
|%
|
||||
++ react-elems :: XX /~
|
||||
~+ %- sa ^- (list term)
|
||||
:~ %a %abbr %address %area %article %aside %audio %b %base
|
||||
%bdi %bdo %big %blockquote %body %br %button %canvas %caption
|
||||
%cite %code %col %colgroup %data %datalist %dd %del %details
|
||||
%dfn %dialog %div %dl %dt %em %embed %fieldset %figcaption
|
||||
%figure %footer %form %h1 %h2 %h3 %h4 %h5 %h6 %head %header
|
||||
%hr %html %i %iframe %img %input %ins %kbd %keygen %label
|
||||
%legend %li %link %main %map %mark %menu %menuitem %meta
|
||||
%meter %nav %noscript %object %ol %optgroup %option %output %p
|
||||
%param %picture %pre %progress %q %rp %rt %ruby %s %samp
|
||||
%script %section %select %small %source %span %strong %style
|
||||
%sub %summary %sup %table %tbody %td %textarea %tfoot %th
|
||||
%thead %time %title %tr %track %u %ul %var %video %wbr
|
||||
%circle %defs %ellipse %g %line %linear-gradient %mask %path
|
||||
%pattern %polygon %polyline %radial-gradient %rect %stop %svg
|
||||
%text %tspan
|
||||
==
|
||||
++ react-attrs
|
||||
~+ ^- (map term cord)
|
||||
%- mo ^- (list {term cord})
|
||||
:- [%class 'className']
|
||||
=- (rash - (more next (cook |=(a/tape [(cass a) (crip a)]) (star alf))))
|
||||
'''
|
||||
accept acceptCharset accessKey action allowFullScreen allowTransparency alt
|
||||
async autoComplete autoFocus autoPlay cellPadding cellSpacing charSet checked
|
||||
classID className colSpan cols content contentEditable contextMenu controls
|
||||
coords crossOrigin data dateTime defer dir disabled download draggable encType
|
||||
form formAction formEncType formMethod formNoValidate formTarget frameBorder
|
||||
headers height hidden high href hrefLang htmlFor httpEquiv icon id label lang
|
||||
list loop low manifest marginHeight marginWidth max maxLength media mediaGroup
|
||||
method min multiple muted name noValidate open optimum pattern placeholder
|
||||
poster preload radioGroup readOnly rel required role rowSpan rows sandbox scope
|
||||
scoped scrolling seamless selected shape size sizes span spellCheck src srcDoc
|
||||
srcSet start step style tabIndex target title type useMap value width wmode
|
||||
'''
|
||||
++ react-vale
|
||||
~(has in react-elems)
|
||||
::
|
||||
++ react-to-json
|
||||
|= src/manx ^- json
|
||||
?: ?=(_:/(**) src)
|
||||
(jape v.i.a.g.src)
|
||||
=+ atr=(mo a.g.src)
|
||||
?: (~(has by atr) [%urb %codemirror])
|
||||
?> ?=({{$pre *} _:/(**) $~} src)
|
||||
$(src ;codemirror(value "{v.i.a.g.i.c.src}");)
|
||||
?: (~(has by atr) [%urb %exec]) :: runnable code attribute tag
|
||||
?> ?=({{$pre *} _:/(**) $~} src) :: verify its only a text node
|
||||
=* code v.i.a.g.i.c.src
|
||||
%_ $
|
||||
src
|
||||
=+ =< result=(mule .)
|
||||
!.(|.((slap !>(.) (ream (crip code))))) :: compile and run safely
|
||||
=+ claz=?:(-.result "rancode" "failedcode")
|
||||
;div(class "{claz}")
|
||||
;pre:"{code}"
|
||||
;+ ?: ?=($& -.result)
|
||||
;code:"{~(ram re (sell p.result))}"
|
||||
;pre
|
||||
;div:"error"
|
||||
;* %+ turn p.result
|
||||
|= a/tank
|
||||
^- manx
|
||||
;div:"{~(ram re a)}"
|
||||
== ==
|
||||
==
|
||||
%- jobe :~
|
||||
c+a+(turn c.src ..$)
|
||||
gn+s+(mane-to-cord n.g.src)
|
||||
=< ga+(jobe (turn a.g.src .))
|
||||
|= {a/mane b/tape} ^- {cord json}
|
||||
:_ (jape b)
|
||||
?^ a (mane-to-cord a)
|
||||
(fall (~(get by react-attrs) a) a)
|
||||
==
|
||||
::
|
||||
++ mane-to-cord |=(a/mane `cord`?@(a a (rap 3 -.a ':' +.a ~)))
|
||||
:: generates React javascript XX deprecated
|
||||
++ react-to-tape
|
||||
|= src/manx ^- tape
|
||||
?: (~(has by (mo a.g.src)) [%urb %codemirror])
|
||||
?> ?=({{$pre *} _:/(**) $~} src)
|
||||
$(src ;codemirror(value "{v.i.a.g.i.c.src}");)
|
||||
?: (~(has by (mo a.g.src)) [%urb %exec]) :: runnable code attribute tag
|
||||
?> ?=({{$pre *} _:/(**) $~} src) :: verify its only a text node
|
||||
=* code v.i.a.g.i.c.src
|
||||
=+ ^= result
|
||||
(mule |.((slap !>(.) (ream (crip code))))) :: compile and run safely
|
||||
?: ?=($.y -.result) :: it was ok
|
||||
=+ ^= new
|
||||
;div(class "rancode")
|
||||
;pre:"{code}"
|
||||
;code:"{~(ram re (sell p.result))}"
|
||||
==
|
||||
$(src new)
|
||||
=+ ^= error
|
||||
;div(class "failedcode")
|
||||
;pre:"{code}"
|
||||
;pre
|
||||
;div:"error"
|
||||
;* %+ turn
|
||||
(scag (dec (lent p.result)) p.result) :: hide react trace
|
||||
|= a/tank
|
||||
^- manx
|
||||
;div:"{~(ram re a)}"
|
||||
==
|
||||
==
|
||||
$(src error)
|
||||
;: weld
|
||||
"React.createElement("
|
||||
=* tan n.g.src
|
||||
?^ tan !! :: namespaces unsupported
|
||||
?: (react-vale tan)
|
||||
"'{(trip tan)}'"
|
||||
(trip tan)
|
||||
", "
|
||||
=- (pojo (jobe (turn a.g.src -)))
|
||||
|= {a/mane b/tape}
|
||||
=. a ?+(a a $class 'className')
|
||||
?^(a !! [a (jape b)])
|
||||
", "
|
||||
=< ~(ram re %rose [", " "[" "]"] (turn c.src .))
|
||||
|= a/manx
|
||||
?: ?=(_:/(**) a)
|
||||
leaf+(pojo (jape v.i.a.g.a))
|
||||
leaf+^$(src a)
|
||||
")"
|
||||
==
|
||||
--
|
@ -1,65 +0,0 @@
|
||||
/- tree-include
|
||||
!:
|
||||
|%
|
||||
++ extract
|
||||
|= a/marl ^- tape
|
||||
?~ a ~
|
||||
%- weld :_ $(a t.a)
|
||||
?. ?=(_:/(**) i.a)
|
||||
$(a c.i.a)
|
||||
v.i.a.g.i.a
|
||||
::
|
||||
++ getall
|
||||
|= tag/(list mane)
|
||||
|= ele/manx ^- marl
|
||||
?: (lien tag |=(a/mane =(a n.g.ele)))
|
||||
~[ele]
|
||||
(zing (turn c.ele ..$))
|
||||
::
|
||||
++ baff |*({a/(unit) b/(trap)} ?^(a a *b))
|
||||
++ find-in-tree
|
||||
|* {paz/fist:jo fun/$+(* (unit))}
|
||||
|= jon/json
|
||||
=+ a=`(list json)`~[jon]
|
||||
|^ (try)
|
||||
++ try
|
||||
|. ^+ *fun
|
||||
?~ a ~
|
||||
%+ biff (paz i.a)
|
||||
|* {b/(list json) c/*} ^+ *fun
|
||||
(baff (baff (fun c) try(a b)) try(a t.a))
|
||||
--
|
||||
::
|
||||
++ map-to-json
|
||||
|* {a/$+(* cord) b/$+(* json)}
|
||||
|* c/(map) ^- json
|
||||
~! c
|
||||
(jobe (turn (~(tap by c)) |*({k/* v/*} [(a k) (b v)])))
|
||||
::
|
||||
++ json-front
|
||||
|= a/json ^- json
|
||||
=- (fall `(unit json)`- ~)
|
||||
%. a
|
||||
%+ find-in-tree (ot c+(ar some) gn+so ga+(om so) ~):jo
|
||||
|= {nom/span atr/(map span cord)} ^- (unit json)
|
||||
?. (~(has by atr) 'urb:front') ~
|
||||
?> ?=($meta nom)
|
||||
(biff (~(get by atr) %value) poja)
|
||||
::
|
||||
++ read-schem
|
||||
=< (cook to-noun (cook to-tree apex))
|
||||
|%
|
||||
++ noun $@(term [noun noun]) :: shadow
|
||||
++ data $@(term {n/@ l/noun r/data})
|
||||
++ apex ;~(plug sym (star ;~(plug delim sym)))
|
||||
++ delim ;~(pose (cold 0 dot) (cook lent (plus cab)))
|
||||
++ to-noun |=(a/data ?@(a a [l.a $(a r.a)]))
|
||||
++ to-tree
|
||||
|= {acc/data a/(list {p/@u q/term})}
|
||||
%+ roll a =< .(acc ^acc)
|
||||
|= {{n/@u v/term} acc/data}
|
||||
?@ acc [n acc v]
|
||||
?: (gth n n.acc) [n (to-noun acc) v]
|
||||
acc(r $(acc r.acc))
|
||||
--
|
||||
--
|
544
lib/twitter.hoon
544
lib/twitter.hoon
@ -1,544 +0,0 @@
|
||||
:: A Twitter API library.
|
||||
::
|
||||
:::: /hoon+twitter+lib
|
||||
::
|
||||
/? 314
|
||||
/- twitter
|
||||
=+ twit:^twitter
|
||||
!:
|
||||
:::: functions
|
||||
::
|
||||
|%
|
||||
++ fass :: rewrite path
|
||||
|= a/path
|
||||
%- trip
|
||||
%^ gsub '-' '_'
|
||||
%+ reel a
|
||||
|= {p/@t q/@t}
|
||||
(cat 3 '/' (cat 3 p q))
|
||||
::
|
||||
++ gsub :: replace chars
|
||||
|= {a/@t b/@t t/@t}
|
||||
^- @t
|
||||
?~ t t
|
||||
%+ add (lsh 3 1 $(t (rsh 3 1 t)))
|
||||
=+ c=(mod t (bex 8))
|
||||
?:(=(a c) b c)
|
||||
::
|
||||
++ oauth :: OAuth 1.0 header
|
||||
|= $: med/meth
|
||||
url/tape
|
||||
pas/(list tape)
|
||||
key/keys
|
||||
zet/@
|
||||
ken/@
|
||||
==
|
||||
^- @t
|
||||
=+ non=(turn (rip 2 (shaw zet 128 ken)) |=(a/@ ~(x ne a)))
|
||||
=+ tim=(slag 2 (scow %ui (unt zet)))
|
||||
=+ sky=(crip :(weld (urle (trip sec.con.key)) "&" (urle (trip sec.acc.key))))
|
||||
=+ ^= bas
|
||||
^- tape
|
||||
=+ ^= hds
|
||||
%- reel :_ |=({p/tape q/tape} :(weld p "&" q))
|
||||
%- sort :_ aor
|
||||
%- weld :- pas
|
||||
^- (list tape)
|
||||
:~ :(weld "oauth_consumer_key=" (trip tok.con.key))
|
||||
:(weld "oauth_nonce=" non)
|
||||
:(weld "oauth_signature_method=HMAC-SHA1")
|
||||
:(weld "oauth_timestamp=" tim)
|
||||
:(weld "oauth_token=" (trip tok.acc.key))
|
||||
:(weld "oauth_version=1.0")
|
||||
==
|
||||
;: weld
|
||||
(trip (cuss (trip `@t`med))) "&"
|
||||
(urle url) "&"
|
||||
(urle (scag (dec (lent hds)) `tape`hds))
|
||||
==
|
||||
=+ sig=`tape`(sifo (swap 3 (hmac (swap 3 sky) (crip bas))))
|
||||
%- crip
|
||||
;: weld "OAuth "
|
||||
"oauth_consumer_key=" "\"" (trip tok.con.key) "\", "
|
||||
"oauth_nonce=" "\"" non "\", "
|
||||
"oauth_signature=" "\"" (urle sig) "\", "
|
||||
"oauth_signature_method=\"HMAC-SHA1\", "
|
||||
"oauth_timestamp=" "\"" tim "\", "
|
||||
"oauth_token=" "\"" (trip tok.acc.key) "\", "
|
||||
"oauth_version=1.0"
|
||||
==
|
||||
::
|
||||
++ valve :: produce request
|
||||
|= $: med/meth
|
||||
{rus/tape quy/quay}
|
||||
key/keys
|
||||
est/time
|
||||
eny/@
|
||||
==
|
||||
^- hiss
|
||||
=+ url="https://api.twitter.com+1.1{rus}.json"
|
||||
=+ req=|=(a/tape (scan a auri:epur))
|
||||
=+ ^= help
|
||||
|= quy/(list {tape tape})
|
||||
^- (list tape)
|
||||
%+ turn quy
|
||||
|= a/{p/tape q/tape}
|
||||
:(weld (urle p.a) "=" (urle q.a))
|
||||
=+ tan=(turn quy |=({p/@t q/@t} [(trip p) (trip q)]))
|
||||
=+ har=(help (turn tan |=(p/{p/tape q/tape} [p.p (urle q.p)])))
|
||||
=+ hab=(help tan)
|
||||
=+ lav=(reel har |=({p/tape q/tape} :(weld p "&" q)))
|
||||
=+ voy=?:(=(0 (lent lav)) ~ (scag (dec (lent lav)) `tape`lav))
|
||||
=+ vab=(reel hab |=({p/tape q/tape} :(weld p "&" q)))
|
||||
=+ vur=(crip ?:(=(0 (lent vab)) ~ (scag (dec (lent vab)) `tape`vab)))
|
||||
=+ ^= head
|
||||
%- ~(gas by *math)
|
||||
:~ ['authorization' [(oauth med url hab key est eny) ~]]
|
||||
['content-type' ['application+x-www-form-urlencoded' ~]]
|
||||
==
|
||||
?: =(%get med)
|
||||
?~ voy
|
||||
[(req url) med head ~]
|
||||
[(req :(weld url "?" voy)) med head ~]
|
||||
[(req url) med head (some [(met 3 vur) vur])]
|
||||
--
|
||||
!:
|
||||
:::: library
|
||||
::
|
||||
|%
|
||||
++ twip :: response printers
|
||||
|%
|
||||
++ mean
|
||||
|= {msg/@t num/@ud} ^- tank
|
||||
rose+[": " `~]^~[leaf+"Error {<num>}" leaf+(trip msg)]
|
||||
--
|
||||
++ twir :: response parsers
|
||||
|%
|
||||
++ fasp |*({a/@tas b/*} [(gsub '-' '_' a) b])
|
||||
++ user (cook crip (plus ;~(pose aln cab)))
|
||||
++ mean (ot errors+(ar (ot message+so code+ni ~)) ~):jo
|
||||
++ stat
|
||||
=+ jo
|
||||
^- $+(json (unit {id/@u who/@ta now/@da txt/@t}))
|
||||
%- ot
|
||||
:~ id+ni
|
||||
user+(ot (fasp screen-name+(su user)) ~)
|
||||
(fasp created-at+da)
|
||||
text+so
|
||||
==
|
||||
++ usel
|
||||
=+ jo
|
||||
^- $+(json (unit (list who/@ta)))
|
||||
=- (ot users+(ar -) ~)
|
||||
(ot (fasp screen-name+(su user)) ~)
|
||||
--
|
||||
++ twit
|
||||
=> |% :: request structures
|
||||
++ dev @t :: device name
|
||||
++ gat @t :: grant type
|
||||
++ lat @t :: latitude
|
||||
++ lid (list tid)
|
||||
++ lon @t :: longitude
|
||||
++ lsc (list scr)
|
||||
++ lst (list @t)
|
||||
++ nam @t :: location name
|
||||
++ pla @t :: place-id
|
||||
++ scr @t :: screen name
|
||||
++ slu @t :: category name
|
||||
++ tid @u
|
||||
++ tok @t :: oauth token
|
||||
++ url @t :: callback url
|
||||
::
|
||||
++ at {$access-token p/tok}
|
||||
++ de {$device p/dev}
|
||||
++ fo {$follow p/lid}
|
||||
++ gr {$grant-type p/gat}
|
||||
++ id {$id p/tid}
|
||||
++ ii {$'!inline' p/@t}
|
||||
++ is {$id p/lid}
|
||||
++ la {$lat p/lat}
|
||||
++ lo {$long p/lon}
|
||||
++ na {$name p/lid}
|
||||
++ oa {$oauth-callback p/url}
|
||||
++ os {$source-screen-name p/scr}
|
||||
++ pl {$place-id p/pla}
|
||||
++ qq {$q p/@t}
|
||||
++ sc {$screen-name p/scr}
|
||||
++ sd ?(ui sc)
|
||||
++ ss {$screen-name p/lsc}
|
||||
++ sl {$slug p/slu}
|
||||
++ si {$source-id p/tid}
|
||||
++ st {$status p/@t}
|
||||
++ 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}
|
||||
--
|
||||
|_ {key/keys est/time eny/@uw}
|
||||
++ lutt |=(@ `@t`(rsh 3 2 (scot %ui +<)))
|
||||
++ llsc
|
||||
|= (list scr)
|
||||
(roll +< |=({p/scr q/@t} (cat 3 (cat 3 q ',') p)))
|
||||
::
|
||||
++ llst
|
||||
|= (list @t)
|
||||
(roll +< |=({p/@t q/@t} (cat 3 (cat 3 q ',') p)))
|
||||
::
|
||||
++ llid
|
||||
|= (list tid)
|
||||
(roll +< |=({p/tid q/@t} (cat 3 (cat 3 q ',') (lutt p))))
|
||||
::
|
||||
++ mold :: construct request
|
||||
|* {med/meth pax/path a/$+(* *)}
|
||||
|= {args/a quy/quay}
|
||||
(valve med (cowl pax args quy) key est eny)
|
||||
::
|
||||
++ cowl :: handle parameters
|
||||
|= $: pax/path
|
||||
ban/(list {p/@t q/?(@ (list @))})
|
||||
quy/quay
|
||||
==
|
||||
^- {path quay}
|
||||
?~ ban
|
||||
[(fass pax) quy]
|
||||
?: =('!inline' p.i.ban)
|
||||
?@ q.i.ban
|
||||
[(fass (welp pax /[`@t`q.i.ban])) quy]
|
||||
!!
|
||||
:- (fass pax)
|
||||
%+ welp quy
|
||||
%+ turn `(list {p/@t q/?(@ (list @))})`ban
|
||||
|= {p/@t q/?(@ (list @))}
|
||||
^- {@t @t}
|
||||
:- (gsub '-' '_' p)
|
||||
?@ q
|
||||
?- p
|
||||
?($id $source-id $target-id $user-id) (lutt q)
|
||||
@ `@t`q
|
||||
==
|
||||
?- p
|
||||
?($follow $id $name $user-id) (llid q)
|
||||
$track (llst q)
|
||||
$screen-name (llsc q)
|
||||
* !!
|
||||
==
|
||||
::
|
||||
++ stat-ment
|
||||
(mold %get /statuses+mentions-timeline $~)
|
||||
::
|
||||
++ stat-user
|
||||
(mold %get /statuses+user-timeline {sd $~})
|
||||
::
|
||||
++ stat-home
|
||||
(mold %get /statuses+home-timeline $~)
|
||||
::
|
||||
++ stat-retw
|
||||
(mold %get /statuses+retweets-of-me $~)
|
||||
::
|
||||
++ stat-rets-iddd
|
||||
(mold %get /statuses+retweets {ii $~})
|
||||
::
|
||||
++ stat-show
|
||||
(mold %get /statuses+show {id $~})
|
||||
::
|
||||
++ stat-dest-iddd
|
||||
(mold %post /statuses+destroy {ii $~})
|
||||
::
|
||||
++ stat-upda
|
||||
(mold %post /statuses+update {st $~})
|
||||
::
|
||||
++ stat-retw-iddd
|
||||
(mold %post /statuses+retweet {ii $~})
|
||||
::
|
||||
++ stat-oemb-iddd
|
||||
(mold %get /statuses+oembed {id $~})
|
||||
::
|
||||
++ stat-oemb-urll
|
||||
(mold %get /statuses+oembed {ur $~})
|
||||
::
|
||||
++ stat-retw-idss
|
||||
(mold %get /statuses+retweeters+ids {id $~})
|
||||
::
|
||||
++ sear-twee
|
||||
(mold %get /search+tweets {qq $~})
|
||||
::
|
||||
++ stat-filt-foll
|
||||
(mold %post /statuses+filter {?(fo tr) $~})
|
||||
::
|
||||
++ stat-samp
|
||||
(mold %get /statuses+sample $~)
|
||||
::
|
||||
++ stat-fire
|
||||
(mold %get /statuses+firehose $~)
|
||||
::
|
||||
++ user
|
||||
(mold %get /user $~)
|
||||
::
|
||||
++ site
|
||||
(mold %get /site {fo $~})
|
||||
::
|
||||
++ dire
|
||||
(mold %get /direct-messages $~)
|
||||
::
|
||||
++ dire-sent
|
||||
(mold %get /direct-messages+sent $~)
|
||||
::
|
||||
++ dire-show
|
||||
(mold %get /direct-messages+show {id $~})
|
||||
::
|
||||
++ dire-dest
|
||||
(mold %post /direct-messages+destroy {id $~})
|
||||
::
|
||||
++ dire-neww
|
||||
(mold %post /direct-messages+new {sd te $~})
|
||||
::
|
||||
++ frie-nore-idss
|
||||
(mold %get /friendships+no-retweets+ids $~)
|
||||
::
|
||||
++ frie-idss
|
||||
(mold %get /friends+ids {sd $~})
|
||||
::
|
||||
++ foll-idss
|
||||
(mold %get /followers+ids {sd $~})
|
||||
::
|
||||
++ frie-inco
|
||||
(mold %get /friendships+incoming $~)
|
||||
::
|
||||
++ frie-outg
|
||||
(mold %get /friendships+outgoing $~)
|
||||
::
|
||||
++ frie-crea
|
||||
(mold %post /friendships+create {sd $~})
|
||||
::
|
||||
++ frie-dest
|
||||
(mold %post /friendships+destroy {sd $~})
|
||||
::
|
||||
++ frie-upda
|
||||
(mold %post /friendships+update {sd $~})
|
||||
::
|
||||
++ frie-show
|
||||
(mold %get /friendships+show {?(si os) ?(ti ts) $~})
|
||||
::
|
||||
++ frie-list
|
||||
(mold %get /friends+list {sd $~})
|
||||
::
|
||||
++ foll-list
|
||||
(mold %get /followers+list {sd $~})
|
||||
::
|
||||
++ frie-look
|
||||
(mold %get /friendships+lookup {?(us ss) $~})
|
||||
::
|
||||
++ acco-sett-gett
|
||||
(mold %get /account+settings $~)
|
||||
::
|
||||
++ acco-veri
|
||||
(mold %get /account+verify-credentials $~)
|
||||
::
|
||||
++ acco-sett-post
|
||||
(mold %post /account+settings $~)
|
||||
::
|
||||
++ acco-upda-deli
|
||||
(mold %post /account+update-delivery-device {de $~})
|
||||
::
|
||||
++ acco-upda-prof
|
||||
(mold %post /account+update-profile $~)
|
||||
::
|
||||
++ acco-upda-prof-back
|
||||
(mold %post /account+update-profile-background-image $~)
|
||||
::
|
||||
++ acco-upda-prof-colo
|
||||
(mold %post /account+update-profile-colors $~)
|
||||
::
|
||||
++ bloc-list
|
||||
(mold %get /blocks+list $~)
|
||||
::
|
||||
++ bloc-idss
|
||||
(mold %get /blocks+ids $~)
|
||||
::
|
||||
++ bloc-crea
|
||||
(mold %post /blocks+create {sd $~})
|
||||
::
|
||||
++ bloc-dest
|
||||
(mold %post /blocks+destroy {sd $~})
|
||||
::
|
||||
++ user-look
|
||||
(mold %get /users+lookup {?(us ss) $~})
|
||||
::
|
||||
++ user-show
|
||||
(mold %get /users+show {sd $~})
|
||||
::
|
||||
++ user-sear
|
||||
(mold %get /users+search {qq $~})
|
||||
::
|
||||
++ user-cont-tees
|
||||
(mold %get /users+contributees {sd $~})
|
||||
::
|
||||
++ user-cont-tors
|
||||
(mold %get /users+contributors {sd $~})
|
||||
::
|
||||
++ acco-remo
|
||||
(mold %post /account+remove-profile-banner $~)
|
||||
::
|
||||
++ user-prof
|
||||
(mold %get /users+profile-banner {sd $~})
|
||||
::
|
||||
++ mute-user-crea
|
||||
(mold %post /mutes+users+create {sd $~})
|
||||
::
|
||||
++ mute-user-dest
|
||||
(mold %post /mutes+users+destroy {sd $~})
|
||||
::
|
||||
++ mute-user-idss
|
||||
(mold %get /mutes+users+ids $~)
|
||||
::
|
||||
++ mute-user-list
|
||||
(mold %get /mutes+users+list $~)
|
||||
::
|
||||
++ user-sugg-slug
|
||||
(mold %get /users+suggestions {sl $~})
|
||||
::
|
||||
++ user-sugg
|
||||
(mold %get /users+suggestions $~)
|
||||
::
|
||||
++ favo-list
|
||||
(mold %get /favorites+list $~)
|
||||
::
|
||||
++ favo-dest
|
||||
(mold %post /favorites+destroy {id $~})
|
||||
::
|
||||
++ favo-crea
|
||||
(mold %post /favorites+create {id $~})
|
||||
::
|
||||
++ list-list
|
||||
(mold %get /lists+list $~)
|
||||
::
|
||||
++ list-stat
|
||||
(mold %get /lists+statuses $~)
|
||||
::
|
||||
++ list-memb-dest
|
||||
(mold %post /lists+members+destroy $~)
|
||||
::
|
||||
++ list-memb-hips
|
||||
(mold %get /lists+memberships {sd $~})
|
||||
::
|
||||
++ list-subs-bers
|
||||
(mold %get /lists+subscribers $~)
|
||||
::
|
||||
++ list-subs-crea
|
||||
(mold %post /lists+subscribers+create $~)
|
||||
::
|
||||
++ list-subs-show
|
||||
(mold %get /lists+subscribers+show {sd $~})
|
||||
::
|
||||
++ list-subs-dest
|
||||
(mold %post /lists+subscribers+destroy $~)
|
||||
::
|
||||
++ list-memb-crea-alll
|
||||
(mold %post /lists+members+create-all {?(us ss) $~})
|
||||
::
|
||||
++ list-memb-show
|
||||
(mold %get /lists+members+show {sd $~})
|
||||
::
|
||||
++ list-memb-bers
|
||||
(mold %get /lists+members $~)
|
||||
::
|
||||
++ list-memb-crea
|
||||
(mold %post /lists+members+create {sd $~})
|
||||
::
|
||||
++ list-dest
|
||||
(mold %post /lists+destroy $~)
|
||||
::
|
||||
++ list-upda
|
||||
(mold %post /lists+update $~)
|
||||
::
|
||||
++ list-crea
|
||||
(mold %post /lists+create {na $~})
|
||||
::
|
||||
++ list-show
|
||||
(mold %get /lists+show $~)
|
||||
::
|
||||
++ list-subs-ions
|
||||
(mold %get /lists+subscriptions {sd $~})
|
||||
::
|
||||
++ list-memb-dest-alll
|
||||
(mold %post /lists+members+destroy-all {?(us ss) $~})
|
||||
::
|
||||
++ list-owne
|
||||
(mold %get /lists+ownerships {sd $~})
|
||||
::
|
||||
++ save-list
|
||||
(mold %get /saved-searches+list $~)
|
||||
::
|
||||
++ save-show-iddd
|
||||
(mold %get /saved-searches+show {ii $~})
|
||||
::
|
||||
++ save-crea
|
||||
(mold %post /saved-searches+create {qq $~})
|
||||
::
|
||||
++ save-dest-iddd
|
||||
(mold %post /saved-searches+destroy {ii $~})
|
||||
::
|
||||
++ geoo-iddd-plac
|
||||
(mold %get /geo+id {ii $~})
|
||||
::
|
||||
++ geoo-reve
|
||||
(mold %get /geo+reverse-geocode {la lo $~})
|
||||
::
|
||||
++ geoo-sear
|
||||
(mold %get /geo+search $~)
|
||||
::
|
||||
++ geoo-simi
|
||||
(mold %get /geo+similar-places {la lo na $~})
|
||||
::
|
||||
++ tren-plac
|
||||
(mold %get /trends+place {id $~})
|
||||
::
|
||||
++ tren-avai
|
||||
(mold %get /trends+available $~)
|
||||
::
|
||||
++ tren-clos
|
||||
(mold %get /trends+closest {la lo $~})
|
||||
::
|
||||
++ user-repo
|
||||
(mold %post /users+report-spam {sd $~})
|
||||
::
|
||||
++ oaut-auth-cate
|
||||
(mold %get /oauth+authenticate $~)
|
||||
::
|
||||
++ oaut-auth-rize
|
||||
(mold %get /oauth+authorize $~)
|
||||
::
|
||||
++ oaut-acce
|
||||
(mold %post /oauth+access-token $~)
|
||||
::
|
||||
++ oaut-requ
|
||||
(mold %post /oauth+request-token {oa $~})
|
||||
::
|
||||
++ oaut-toke
|
||||
(mold %post /oauth2/token {gr $~})
|
||||
::
|
||||
++ oaut-inva
|
||||
(mold %post /oauth2/invalidate-token {at $~})
|
||||
::
|
||||
++ help-conf
|
||||
(mold %get /help+configuration $~)
|
||||
::
|
||||
++ help-lang
|
||||
(mold %get /help+languages $~)
|
||||
::
|
||||
++ help-priv
|
||||
(mold %get /help+privacy $~)
|
||||
::
|
||||
++ help-toss
|
||||
(mold %get /help+tos $~)
|
||||
::
|
||||
++ appl-rate
|
||||
(mold %get /application+rate-limit-status $~)
|
||||
::
|
||||
++ stat-look
|
||||
(mold %get /statuses+lookup {us $~})
|
||||
--
|
||||
--
|
@ -1,18 +0,0 @@
|
||||
|%
|
||||
++ bit-any
|
||||
$% {$bit-get-token bit-get-token}
|
||||
{$bit-api-call tok/@t bit-api-call}
|
||||
==
|
||||
++ bit-api-call
|
||||
$% {$send bit-send}
|
||||
{$txt-send to/@t btc/@t}
|
||||
{$buy amount/@t currency/@t}
|
||||
{$sell amount/@t currency/@t}
|
||||
{$list $~}
|
||||
==
|
||||
++ bit-send {adr/@uc btc/@t}
|
||||
++ bit-ship-send {who/@p btc/@t}
|
||||
++ bit-get-token {oat/@t {cid/@t sec/@t} red/purl}
|
||||
++ bit-accounts (list {id/@t name/@t balance/{num/@t cur/term}})
|
||||
--
|
||||
|
@ -1,7 +0,0 @@
|
||||
::
|
||||
:::: /hoon+gate+down+sur
|
||||
::
|
||||
/? 314
|
||||
/- markdown
|
||||
down.markdown
|
||||
|
@ -1 +0,0 @@
|
||||
,@
|
@ -1,39 +0,0 @@
|
||||
|%
|
||||
++ down (list elem)
|
||||
++ kids (list inline)
|
||||
++ inline
|
||||
=+ ^= inlik
|
||||
$% {$emph p/?} :: strong?
|
||||
{$delt $~} :: strikethrough
|
||||
{$link p/tape q/(unit tape)}
|
||||
{$blot p/tape q/(unit tape)} :: image
|
||||
==
|
||||
=+ ^= inlin
|
||||
$% {$$ p/tape}
|
||||
{$line $~}
|
||||
{$code p/tape}
|
||||
{$htmt p/cord} :: XX (each marx mane)
|
||||
==
|
||||
$^({p/inlik q/kids} inlin)
|
||||
::
|
||||
::
|
||||
++ elem $^(tops node)
|
||||
++ tops :: childful block
|
||||
$: $= p
|
||||
$% {$bloq $~}
|
||||
{$list p/? q/$@(char {p/@u q/char})} :: tight ordered?
|
||||
{$item $~}
|
||||
==
|
||||
q/down
|
||||
==
|
||||
++ node :: childless block
|
||||
$% {$para p/kids}
|
||||
{$meta p/(map cord cord)} :: front matter
|
||||
{$hrul $~}
|
||||
{$head p/@u q/kids}
|
||||
{$code p/(unit {p/char q/@u r/tape}) q/wain} :: info contents
|
||||
{$html p/wain}
|
||||
{$defn $~} :: empty para
|
||||
==
|
||||
--
|
||||
|
@ -1,16 +0,0 @@
|
||||
:: :: ::
|
||||
:::: /hoon+oct1/sur :::::: dependencies
|
||||
:: :: ::
|
||||
/? 310 :: arvo version
|
||||
:: :: ::
|
||||
:::: :::::: semantics
|
||||
:: :: ::
|
||||
|% ::
|
||||
++ board @ :: one-player bitfield
|
||||
++ point {x/@ y/@} :: coordinate
|
||||
++ game :: game state
|
||||
$: who/? :: whose turn
|
||||
box/board :: X board
|
||||
boo/board :: O board
|
||||
== ::
|
||||
--
|
@ -1,19 +0,0 @@
|
||||
:: :: ::
|
||||
:::: /hoon+oct2/sur :::::: dependencies
|
||||
:: :: ::
|
||||
/? 310 :: arvo version
|
||||
:: :: ::
|
||||
:::: :::::: semantics
|
||||
:: :: ::
|
||||
|% ::
|
||||
++ board @ :: one-player bitfield
|
||||
++ point {x/@ y/@} :: coordinate
|
||||
++ stage (pair (unit ship) (unit ship)) :: players
|
||||
++ game :: game state
|
||||
$: who/? :: whose turn
|
||||
sag/stage :: who's playing
|
||||
aud/(map ship @ud) :: who's watching
|
||||
box/board :: X board
|
||||
boo/board :: O board
|
||||
== ::
|
||||
--
|
@ -1,20 +0,0 @@
|
||||
:: :: ::
|
||||
:::: /hoon+oct3/sur :::::: dependencies
|
||||
:: :: ::
|
||||
/? 310 :: arvo version
|
||||
:: :: ::
|
||||
:::: :::::: semantics
|
||||
:: :: ::
|
||||
|% ::
|
||||
++ board @ :: one-player bitfield
|
||||
++ point {x/@ y/@} :: coordinate
|
||||
++ stage (pair (unit ship) (unit ship)) :: players
|
||||
++ play (each game tape) :: update
|
||||
++ game :: game state
|
||||
$: who/? :: whose turn
|
||||
sag/stage :: who's playing
|
||||
aud/(map ship @ud) :: who's watching
|
||||
box/board :: X board
|
||||
boo/board :: O board
|
||||
== ::
|
||||
--
|
@ -1,20 +0,0 @@
|
||||
:: :: ::
|
||||
:::: /hoon+oct4/sur :::::: dependencies
|
||||
:: :: ::
|
||||
/? 310 ::
|
||||
:: :: ::
|
||||
:::: :::::: semantics
|
||||
:: :: ::
|
||||
|% ::
|
||||
++ board @ :: one-player bitfield
|
||||
++ point {x/@ y/@} :: coordinate
|
||||
++ stage (pair (unit ship) (unit ship)) :: players
|
||||
++ play (each game tape) :: update
|
||||
++ game :: game state
|
||||
$: who/? :: whose turn
|
||||
sag/stage :: who's playing
|
||||
aud/(map ship @ud) :: who's watching
|
||||
box/board :: X board
|
||||
boo/board :: O board
|
||||
== ::
|
||||
--
|
@ -1 +0,0 @@
|
||||
,%hail
|
@ -1,7 +0,0 @@
|
||||
$: pax=path ::
|
||||
$= jof ::
|
||||
$% [%line p=cord] ::
|
||||
[%res p=span] ::
|
||||
[%cmd p=char] ::
|
||||
[%type p=?] ::
|
||||
== == ::
|
@ -1,4 +0,0 @@
|
||||
$: p=[p=cord q=prom r=cord]
|
||||
q=(list cord)
|
||||
r=(list ?(tank [%stem p=@da q=tank r=tank]))
|
||||
==
|
@ -1,7 +0,0 @@
|
||||
|-
|
||||
$: body/json
|
||||
head/json
|
||||
snip/json
|
||||
meta/json
|
||||
sect/json
|
||||
==
|
@ -1,16 +0,0 @@
|
||||
|%
|
||||
++ twit-do => twit {p/span q/command} :: user and action
|
||||
++ twit-stat {id/@u who/@ta now/@da txt/@t} :: received tweet
|
||||
++ twit
|
||||
|%
|
||||
++ 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
|
||||
==
|
||||
--
|
||||
--
|
@ -1,3 +0,0 @@
|
||||
$% {$in p/{p/@p q/@t}}
|
||||
{$out p/{p/@p q/@t}}
|
||||
==
|
@ -1 +0,0 @@
|
||||
(list {p/@p q/@t})
|
@ -1,6 +0,0 @@
|
||||
::
|
||||
:::: /hoon+gate+down+sur
|
||||
::
|
||||
/? 314
|
||||
/- markdown
|
||||
down
|
@ -1,58 +0,0 @@
|
||||
::
|
||||
:::: /hoon+work+sur
|
||||
::
|
||||
:: A block comment might go here!
|
||||
::
|
||||
/- talk
|
||||
|%
|
||||
++ client
|
||||
$: tasks/(map @uvH client-task)
|
||||
sort/(list @uvH)
|
||||
==
|
||||
++ client-task
|
||||
$: archived/_|
|
||||
audience/(set station:talk)
|
||||
tax/task
|
||||
==
|
||||
++ task
|
||||
$: id/@uvH
|
||||
date-created/@da
|
||||
version/@u
|
||||
date-modified/@da
|
||||
creator/@p
|
||||
doer/(unit @p)
|
||||
tags/(set @t)
|
||||
date-due/(unit @da)
|
||||
done/(unit @da)
|
||||
title/@t
|
||||
description/@t :: XX (list @t)
|
||||
discussion/(list comment)
|
||||
==
|
||||
++ comment
|
||||
$: date/@da
|
||||
ship/@p
|
||||
body/@t :: XX (list @t)
|
||||
==
|
||||
++ command
|
||||
$% {$new audience/(set station:talk) task}
|
||||
{$old id/@uvH dif/update}
|
||||
{$sort p/(list @uvH)}
|
||||
==
|
||||
++ update :: XX rename, web-edit?
|
||||
$% $: $set
|
||||
$% {$audience to/(set station:talk)}
|
||||
{$date-due p/(unit @da)}
|
||||
{$title p/@t}
|
||||
{$description p/@t}
|
||||
{$tags p/(set @t)}
|
||||
{$done p/?}
|
||||
== ==
|
||||
$: $add
|
||||
$% {$comment @t}
|
||||
== ==
|
||||
$: $doer
|
||||
$% {$release $~}
|
||||
{$claim $~}
|
||||
== ==
|
||||
==
|
||||
--
|
@ -1,6 +0,0 @@
|
||||
$: %mess p=path
|
||||
$= q
|
||||
$% [%do p=@t]
|
||||
[%exp p=@t q=tank]
|
||||
[%say p=@t]
|
||||
== ==
|
@ -1,6 +0,0 @@
|
||||
$% $: %mess p=@da q=ship
|
||||
$= r
|
||||
$% [%do p=@t]
|
||||
[%exp p=@t q=tank]
|
||||
[%say p=@t]
|
||||
== == ==
|
@ -1,8 +0,0 @@
|
||||
$% $: %mess p=path
|
||||
$= q
|
||||
$% [%do p=@t]
|
||||
[%exp p=@t q=tank]
|
||||
[%say p=@t]
|
||||
== ==
|
||||
[%init p=ship q=path]
|
||||
==
|
Loading…
Reference in New Issue
Block a user