mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-18 04:11:49 +03:00
Merge branch 'test' of https://github.com/urbit/urbit into test
Conflicts: urb/zod/base/ape/octo/core.hook
This commit is contained in:
commit
4bee29b89c
@ -3,17 +3,17 @@
|
||||
::::
|
||||
::
|
||||
/? 314
|
||||
/- *talk
|
||||
/+ talk, sole, http
|
||||
/- *talk, *bit-api
|
||||
/+ talk, sole, http, mean
|
||||
!:
|
||||
:::: sivtyv-barnel
|
||||
:: be sure to have oauth2-code markk
|
||||
|%
|
||||
++ axle cred
|
||||
++ cred
|
||||
$: client-id=(unit ,@t) app-secret=(unit ,@t)
|
||||
oauth-code=(unit ,@t) auth-token=(unit ,@t)
|
||||
refr-token=(unit ,@t) contacts=(map ,@t ,@t)
|
||||
++ 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]
|
||||
@ -21,6 +21,7 @@ $: client-id=(unit ,@t) app-secret=(unit ,@t)
|
||||
++ note
|
||||
$% [%send wire [ship term] %poke mesa]
|
||||
[%them wire (unit hiss)]
|
||||
[%hiss wire mark bit-any]
|
||||
==
|
||||
++ gift
|
||||
$% [%nice ~]
|
||||
@ -39,78 +40,80 @@ $: client-id=(unit ,@t) app-secret=(unit ,@t)
|
||||
::
|
||||
!:
|
||||
|_ [hid=bowl vat=axle]
|
||||
::++ prep ,_`.
|
||||
++ redirect-uri (crip (weld hostname "/~~/home/pub/bit/fab"))
|
||||
++ hostname
|
||||
:: ++ prep ,_`.
|
||||
++ return [*(list move) .]
|
||||
++ redirect-uri [hostname `/~~/home/pub/bit/fab ~]
|
||||
++ hostname ^- hart
|
||||
?+ (clan our.hid) !!
|
||||
%czar "http://localhost:{?+(our.hid !! %~zod "8443", %~fyr "8444")}"
|
||||
%duke "http://{+:<our.hid>}.urbit.org"
|
||||
%czar [| ?+(our.hid !! %~zod `8.443, %~fyr `8.444) `/localhost]
|
||||
%duke [| ~ `/org/urbit/(crip +:<our.hid>)]
|
||||
==
|
||||
++ auth-url
|
||||
%+ weld "https://www.coinbase.com/oauth/authorize"
|
||||
%- tail:earn :~
|
||||
'response_type'^%code
|
||||
'client_id'^(need client-id.vat)
|
||||
'redirect_uri'^redirect-uri
|
||||
'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'
|
||||
==
|
||||
++ api-call
|
||||
|= [ost=bone pour-path=wire end-point=path req=$|(%get [%post p=json])]
|
||||
++ old-api
|
||||
|= [pour-path=wire end-point=path req=$|(%get [%post p=json])]
|
||||
^- move
|
||||
%^ httpreq ost pour-path
|
||||
[/com/coinbase/api v1/end-point req ~ ['access_token' (need auth-token.vat)]~]
|
||||
%^ httpreq ost.hid pour-path
|
||||
[/com/coinbase/api v1/end-point req ~ ['access_token' access:(need auth.vat)]~]
|
||||
::
|
||||
++ callback-uri (weld hostname "/~/to/{(trip app.hid)}/json.json?anon&wire=/")
|
||||
++ 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]]
|
||||
=: app-secret.vat [~ secr.arg]
|
||||
client-id.vat [~ id.arg]
|
||||
==
|
||||
|= arg=[secr=cord id=cord]
|
||||
=. cred.vat `arg
|
||||
=+ prl=`purl`(need (epur (crip auth-url)))
|
||||
:_ +>.$
|
||||
:- %^ publish ost you
|
||||
:- %- 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
|
||||
|= [ost=bone way=wire his=ship mez=$%([%bit-addr-request ~] [%bit-addr-made @t])]
|
||||
|= [way=wire his=ship mez=$%([%bit-addr-request ~] [%bit-addr-made @t])]
|
||||
^- move
|
||||
[ost %send way [his app.hid] %poke mez]
|
||||
[ost.hid %send way [his dap.hid] %poke mez]
|
||||
::
|
||||
++ poke-bit-send :: send to address
|
||||
|= [addr=@uc amount=@t]
|
||||
:_ +>.$
|
||||
:_ ~
|
||||
=+ info=[to/s/(rsh 3 2 (scot %uc addr)) amount/s/amount ~]
|
||||
=+ jon=(joba %transaction (jobe info))
|
||||
(api-call ost /send /transactions/'send_money' %post jon)
|
||||
++ 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 ost /sent to %bit-addr-request ~)
|
||||
(send-friend /sent to %bit-addr-request ~)
|
||||
++ poke-bit-addr-request :: give your address to receive bit
|
||||
|= [req=~] :: gen new address with callback
|
||||
|= ~ :: gen new address with callback
|
||||
:_ +>.$
|
||||
:_ ~
|
||||
%^ api-call ost /addr-request/(scot %p his)
|
||||
%+ old-api /addr-request/(scot %p src.hid)
|
||||
:+ /addresses %post
|
||||
%+ joba %address
|
||||
%- jobe :~
|
||||
label/(jape "address for {<his>}")
|
||||
'callback_url'^(jape callback-uri)
|
||||
label/(jape "address for {<src.hid>}")
|
||||
'callback_url'^(jape (earn callback-uri))
|
||||
==
|
||||
::
|
||||
++ pour-addr-request :: send new address to sender
|
||||
|= [ost=bone pax=path rez=json]
|
||||
|= [pax=path rez=json]
|
||||
=+ adr=(need ((ot address/so ~):jo rez))
|
||||
=+ his=(slav %p +<.pax)
|
||||
~! incoming.vat
|
||||
@ -118,68 +121,35 @@ $: client-id=(unit ,@t) app-secret=(unit ,@t)
|
||||
(~(put by incoming.vat) adr his)
|
||||
:_ +>.$
|
||||
:_ ~
|
||||
(send-friend ost [%message ~] his %bit-addr-made adr)
|
||||
(send-friend [%message ~] his %bit-addr-made adr)
|
||||
::
|
||||
++ poke-bit-addr-made :: receive address for sending
|
||||
|= [addr=@t]
|
||||
:_ +>.$
|
||||
:_ ~
|
||||
=+ amount=(~(got by outgoing.vat) his) :: get amount to send
|
||||
=+ info=[to/s/addr amount/s/amount ~]
|
||||
=+ jon=(joba %transaction (jobe info))
|
||||
(api-call ost /send /transactions/'send_money' %post jon)
|
||||
::
|
||||
|= 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]
|
||||
|= code=cord
|
||||
=. oauth-code.vat
|
||||
[~ code]
|
||||
?< |(?=(~ client-id.vat) ?=(~ oauth-code.vat))
|
||||
=+ ^= queries
|
||||
:~ ['grant_type' 'authorization_code']
|
||||
['code' (need oauth-code.vat)]
|
||||
['redirect_uri' redirect-uri]
|
||||
['client_id' (need client-id.vat)]
|
||||
['client_secret' (need app-secret.vat)]
|
||||
==
|
||||
:_ +>.$
|
||||
:- (httpreq ost /auth-token /com/coinbase /oauth/token [%post ~] ~ queries)
|
||||
~
|
||||
?< ?=(~ 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)
|
||||
=+ query=['access_token' (need auth-token.vat)]~
|
||||
=+ ^= pst
|
||||
?: =(~ currency.arg)
|
||||
(jobe qty/s/amount.arg ~)
|
||||
(jobe qty/s/amount.arg currency/s/currency.arg ~)
|
||||
:_ +>.$
|
||||
:- (httpreq ost /buy /com/coinbase/api /v1/buys [%post pst] ~ query)
|
||||
~
|
||||
::
|
||||
++ poke-list
|
||||
|= [arg=~]
|
||||
=+ query=['access_token' (need auth-token.vat)]~
|
||||
:_ +>.$
|
||||
:- (httpreq ost /list /com/coinbase/api /v1/accounts %get ~ query)
|
||||
~
|
||||
::
|
||||
|=(arg=[amount=@t currency=@t] ?<(=(amount.arg ~) (api-call %json %buy arg)))
|
||||
++ poke-sell
|
||||
|= [arg=[amount=@t currency=@t]]
|
||||
?< =(amount.arg ~)
|
||||
=+ query=['access_token' (need auth-token.vat)]~
|
||||
=+ ^= pst
|
||||
?: =(~ currency.arg)
|
||||
(jobe qty/s/amount.arg currency/s/currency.arg ~)
|
||||
(jobe qty/s/amount.arg ~)
|
||||
:_ +>.$
|
||||
:+ ~
|
||||
(httpreq ost /buy /com/coinbase/api /v1/sells [%post pst] ~ query)
|
||||
~
|
||||
::
|
||||
|=(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)))
|
||||
=+ query=['access_token' (need auth-token.vat)]~
|
||||
=+ 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) ~]
|
||||
@ -187,23 +157,18 @@ $: client-id=(unit ,@t) app-secret=(unit ,@t)
|
||||
[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) ~)
|
||||
:_ +>.$
|
||||
:- (httpreq ost /send /com/coinbase/api /v1/transactions/'send_money' [%post pst] ~ query)
|
||||
~
|
||||
(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)
|
||||
:_ ~
|
||||
~! frm
|
||||
(publish ost our.hid [%lin & (crip "just received {(trip amo)} BTC from {<frm>}")]~)
|
||||
::(api-call ost /get-id /transactions/[transaction-id] %get)
|
||||
|= 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
|
||||
|= [ost=bone pax=path rez=json]
|
||||
|= [pax=path rez=json]
|
||||
:_ +>.$
|
||||
:_ ~
|
||||
!!
|
||||
@ -211,48 +176,17 @@ $: client-id=(unit ,@t) app-secret=(unit ,@t)
|
||||
++ thou
|
||||
|= [way=wire res=httr]
|
||||
?+ -.way !!
|
||||
%auth-token
|
||||
~| 'must receive a 200'^oauth-code.vat
|
||||
~| res
|
||||
?> =(200 p.res)
|
||||
=+ resp=(rash q:(need r.res) apex:poja)
|
||||
=+ parsed=(need ((ot 'refresh_token'^so 'access_token'^so ~):jo resp))
|
||||
~& parsed
|
||||
=: auth-token.vat [~ +.parsed]
|
||||
refr-token.vat [~ -.parsed]
|
||||
==
|
||||
:_ +>.$
|
||||
:_ ~
|
||||
(publish ost our.hid [%lin & 'authenticated.']~)
|
||||
%message `+>.$
|
||||
?(%addr-request %get-id)
|
||||
~| 'must receive a 200'
|
||||
~| res
|
||||
?> =(200 p.res)
|
||||
%- ?-(-.way %addr-request pour-addr-request, %get-id pour-get-id)
|
||||
[ost way (rash q:(need r.res) apex:poja)]
|
||||
%auth
|
||||
:_ +>.$
|
||||
~
|
||||
?(%get-id %send %buy %list %sell)
|
||||
~& [`@tas`-.way res]
|
||||
:_ +>.$
|
||||
~
|
||||
%sent
|
||||
~| 'must receive a 200'
|
||||
~| res
|
||||
?> =(200 p.res)
|
||||
=+ resp=(rash q:(need r.res) apex:poja)
|
||||
=+ suc=((ot success/so ~):jo resp)
|
||||
:_ +>.$
|
||||
:_ ~
|
||||
?~ suc
|
||||
(publish ost our.hid [%lin & (crip "something went wrong")]~)
|
||||
(publish ost our.hid [%lin & (crip "success!")]~)
|
||||
[way (rash q:(need r.res) apex:poja)]
|
||||
==
|
||||
::
|
||||
++ publish
|
||||
|= [ost=bone you=ship act=(list speech)]
|
||||
|= act=(list speech)
|
||||
^- move
|
||||
=+ ^= thotz
|
||||
%+ turn act
|
||||
@ -267,5 +201,5 @@ $: client-id=(unit ,@t) app-secret=(unit ,@t)
|
||||
`statement`[now.hid ~ sp]
|
||||
:- `@`(sham eny.hid tail)
|
||||
tail
|
||||
[ost %send /auth [our.hid %talk] %poke [%talk-command %publish thotz]]
|
||||
[ost.hid %send /auth [our.hid %talk] %poke [%talk-command %publish thotz]]
|
||||
--
|
||||
|
@ -1122,7 +1122,11 @@
|
||||
|= [cof=cafe cay=cage]
|
||||
^- (bolt gage)
|
||||
%+ cool |.(leaf/"ford: casting {<p.cay>} to {<p.kas>}")
|
||||
%+ cope (link cof p.kas p.cay q.cay)
|
||||
%+ cope (lion cof p.kas p.cay ~)
|
||||
|= [cof=cafe wuy=(list ,@tas)]
|
||||
%+ cope
|
||||
?~ wuy (link cof p.kas p.cay q.cay)
|
||||
(lope cof i.wuy t.wuy q.cay)
|
||||
|= [cof=cafe vax=vase]
|
||||
(fine cof [%& p.kas vax])
|
||||
::
|
||||
|
@ -1,5 +1,5 @@
|
||||
::
|
||||
:::: /hook/core/sole/lib;
|
||||
:::: /hook/core/http/lib
|
||||
::
|
||||
::
|
||||
::
|
||||
@ -8,21 +8,28 @@
|
||||
|%
|
||||
++ httpreq
|
||||
|= $: ost=bone pour-path=wire
|
||||
domain=(list cord) end-point=path
|
||||
req-type=$?(%get [%post json]) headers=math
|
||||
$= params
|
||||
$: domain=(list cord) end-point=path
|
||||
req-type=$?(%get [%post json]) headers=math
|
||||
queries=quay
|
||||
==
|
||||
==
|
||||
:^ ost %them pour-path
|
||||
`(unit hiss)`[~ (httpreq-to-hiss params)]
|
||||
::
|
||||
++ httpreq-to-hiss
|
||||
|= $: domain=(list cord) end-point=path
|
||||
req-type=$?(%get [%post p=json]) headers=math
|
||||
queries=quay
|
||||
==
|
||||
=+ ^- parsed-url=purl
|
||||
^- hiss :: cast to hiss
|
||||
:- ^- parsed-url=purl
|
||||
:+ :+ security=%.y
|
||||
port=~
|
||||
host=[%.y [path=domain]]
|
||||
endpoint=[extensions=~ point=end-point] :: ++pork,
|
||||
q-strings=queries :: ++quay
|
||||
=+ ^- request=hiss :: cast to hiss
|
||||
:- parsed-url
|
||||
?@ req-type
|
||||
[%get headers ~]
|
||||
[%post headers ~ (tact (pojo +.req-type))]
|
||||
:^ ost %them pour-path
|
||||
`(unit hiss)`[~ request]
|
||||
?@ req-type
|
||||
[%get headers ~]
|
||||
[%post headers ~ (tact (pojo p.req-type))]
|
||||
--
|
||||
|
20
base/mar/bit-accounts/door.hook
Normal file
20
base/mar/bit-accounts/door.hook
Normal file
@ -0,0 +1,20 @@
|
||||
:: this mark is used to receive a confirmed transaction
|
||||
::
|
||||
:::: /hook/door/bit-accounts/mar
|
||||
::
|
||||
/? 310
|
||||
/- *bit-api
|
||||
!:
|
||||
|_ bit-accounts
|
||||
::
|
||||
++ grab :: converter arm
|
||||
|%
|
||||
++ noun bit-accounts :: clam from noun
|
||||
++ json |= jon=^json ^- bit-accounts
|
||||
~| jon
|
||||
%- need %. jon
|
||||
=> jo
|
||||
=+ bal=(ot amount/so currency/(cu cass sa) ~)
|
||||
(ot accounts/(ar (ot id/so name/so balance/bal ~)) ~)
|
||||
--
|
||||
--
|
30
base/mar/bit-api-call/door.hook
Normal file
30
base/mar/bit-api-call/door.hook
Normal file
@ -0,0 +1,30 @@
|
||||
::
|
||||
:::: /hook/door/bit-api-call/mar
|
||||
::
|
||||
/? 314
|
||||
/- *bit-api
|
||||
|_ [access-token=@t req=bit-api-call]
|
||||
::
|
||||
++ wrap
|
||||
|= [end-point=path req=$|(%get [%post p=json])]
|
||||
[/com/coinbase/api v1/end-point req ~ ['access_token' access-token]~]
|
||||
::
|
||||
++ order
|
||||
|= [amount=@t currency=@t] ^- json
|
||||
(jobe qty/s/amount ?~(currency ~ [currency/s/currency ~]))
|
||||
++ grow
|
||||
|% ++ httpreq
|
||||
%- wrap
|
||||
|-
|
||||
?- -.req
|
||||
%list [/accounts %get]
|
||||
%buy [/buys %post (order +.req)]
|
||||
%sell [/sells %post (order +.req)]
|
||||
%send $(req [%txt-send (rsh 3 2 (scot %uc adr.req)) btc.req])
|
||||
%txt-send
|
||||
:+ /transactions/'send_money' %post
|
||||
(joba %transaction (jobe to/s/to.req amount/s/btc.req ~))
|
||||
|
||||
==
|
||||
--
|
||||
--
|
19
base/mar/bit-get-token/door.hook
Normal file
19
base/mar/bit-get-token/door.hook
Normal file
@ -0,0 +1,19 @@
|
||||
::
|
||||
:::: /hook/door/bit-get-token/mar
|
||||
::
|
||||
/? 314
|
||||
/- *bit-api
|
||||
/+ http
|
||||
|_ req=bit-get-token
|
||||
::
|
||||
++ grow
|
||||
|% ++ httpreq
|
||||
=- [/com/coinbase /oauth/token [%post ~] ~ `quay`-]
|
||||
:~ ['grant_type' 'authorization_code']
|
||||
['code' oat.req]
|
||||
['redirect_uri' (crip (earn red.req))]
|
||||
['client_id' cid.req]
|
||||
['client_secret' sec.req]
|
||||
==
|
||||
--
|
||||
--
|
17
base/mar/bit-transaction/door.hook
Normal file
17
base/mar/bit-transaction/door.hook
Normal file
@ -0,0 +1,17 @@
|
||||
:: this mark is used to receive a confirmed transaction
|
||||
::
|
||||
:::: /hook/door/bit-transaction/mar
|
||||
::
|
||||
/? 310
|
||||
!:
|
||||
|_ id=@t ::XX time
|
||||
::
|
||||
++ grab :: converter arm
|
||||
|%
|
||||
++ noun ,@t :: clam from noun
|
||||
++ json |= jon=^json
|
||||
~| jon
|
||||
(need ((ot transaction/(ot id/so ~) ~):jo jon))
|
||||
--
|
||||
--
|
||||
|
9
base/mar/hiss/door.hook
Normal file
9
base/mar/hiss/door.hook
Normal file
@ -0,0 +1,9 @@
|
||||
::
|
||||
:::: /hook/door/hiss/mar
|
||||
::
|
||||
/? 314
|
||||
/+ http
|
||||
|_ hiss
|
||||
::
|
||||
++ grab |% ++ httpreq httpreq-to-hiss
|
||||
-- --
|
9
base/mar/httpreq/door.hook
Normal file
9
base/mar/httpreq/door.hook
Normal file
@ -0,0 +1,9 @@
|
||||
::
|
||||
:::: /hoon/core/httpreq/pro
|
||||
::
|
||||
/? 314
|
||||
/+ http
|
||||
::
|
||||
|_ req=_+<.httpreq-to-hiss
|
||||
++ garb [%hiss ~]
|
||||
--
|
@ -5,9 +5,12 @@
|
||||
|_ hit=httr
|
||||
::
|
||||
++ grow |% ++ wall (turn wain trip)
|
||||
++ wain ~| hit
|
||||
?> =(2 (div p.hit 100))
|
||||
(lore q:(need r.hit))
|
||||
++ wain (lore cord)
|
||||
++ json (need (poja cord))
|
||||
++ cord
|
||||
~| hit
|
||||
?> =(2 (div p.hit 100))
|
||||
q:(need r.hit)
|
||||
--
|
||||
++ grab :: convert from
|
||||
|%
|
||||
|
15
base/mar/oauth-tokens/door.hook
Normal file
15
base/mar/oauth-tokens/door.hook
Normal file
@ -0,0 +1,15 @@
|
||||
:: this mark is used to receive incoming oauth2 refresh/access tokens
|
||||
::
|
||||
:::: /hook/door/oauth-tokens/mar
|
||||
::
|
||||
/? 310
|
||||
!:
|
||||
|_ [tok=@t ref=@t]
|
||||
::
|
||||
++ grab :: converter arm
|
||||
|%
|
||||
++ noun ,[@t @t] :: clam from noun
|
||||
++ json (corl need (ot 'access_token'^so 'refresh_token'^so ~):jo)
|
||||
--
|
||||
--
|
||||
|
@ -7,7 +7,7 @@ is a general-purpose computing stack designed to live in the cloud.
|
||||
|
||||
`arvo` is event driven and modular. `arvo` modules are called 'vanes'.
|
||||
|
||||
<list dataPath="/doc/arvo" dataPreview="true"></list>
|
||||
<list dataPath="/pub/doc/arvo" dataPreview="true"></list>
|
||||
|
||||
------------------------------------------------------------------------
|
||||
|
||||
|
@ -7,26 +7,25 @@
|
||||
;head
|
||||
;meta(charset "utf-8");
|
||||
;script(type "text/javascript", src "//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.js");
|
||||
;script(type "text/javascript", src "/~/at/base/lib/urb.js");
|
||||
;script(type "text/javascript", src "/~~/~/at/base/lib/urb.js");
|
||||
;link(type "text/css", rel "stylesheet", href "/home/lib/base.css");
|
||||
;link(type "text/css", rel "stylesheet", href "/home/pub/octo/src/main.css");
|
||||
;title: :octo
|
||||
==
|
||||
;body
|
||||
;div#what
|
||||
;div#ship
|
||||
;div.sig: ~
|
||||
;div#x
|
||||
;div.ship;
|
||||
;div.as;
|
||||
;div.as: ✕
|
||||
==
|
||||
;div#vs: vs
|
||||
;div#user
|
||||
;div.sig: ~
|
||||
;div#o
|
||||
;div.ship;
|
||||
;div.as;
|
||||
;div.as: ◯
|
||||
==
|
||||
==
|
||||
;div#bord;
|
||||
;div#audi;
|
||||
;script(type "text/javascript", src "/home/pub/octo/src/main.js");
|
||||
==
|
||||
==
|
||||
|
@ -1,5 +1,6 @@
|
||||
#what,
|
||||
#bord {
|
||||
#bord,
|
||||
#audi {
|
||||
width: 600px;
|
||||
text-align: center;
|
||||
position: absolute;
|
||||
@ -16,13 +17,31 @@
|
||||
height: 600px;
|
||||
position: absolute;
|
||||
top: 111px;
|
||||
opacity: .6;
|
||||
opacity: .3;
|
||||
}
|
||||
|
||||
#audi {
|
||||
top: 760px;
|
||||
}
|
||||
|
||||
.turn #bord {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
#message {
|
||||
position:absolute;
|
||||
left: 0; top: 0;
|
||||
width: 100%; height: 90px;
|
||||
line-height: 90px;
|
||||
background-color: #000;
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#message .ship {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
#what {
|
||||
font-family: "bau";
|
||||
}
|
||||
@ -31,19 +50,32 @@
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
#what .ship {
|
||||
.ship {
|
||||
padding: .3rem;
|
||||
font-weight: 400;
|
||||
letter-spacing: 1px;
|
||||
text-transform: uppercase;
|
||||
line-height:2rem;
|
||||
}
|
||||
|
||||
.turn #what #ship,
|
||||
#what #user {
|
||||
.ship:before {
|
||||
content: "~";
|
||||
font-weight: 500;
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
.waiting.ship:before {
|
||||
content: "Waiting";
|
||||
color: #ccc;
|
||||
}
|
||||
|
||||
#what #x,
|
||||
#what #o {
|
||||
border: 2px solid #fff;
|
||||
}
|
||||
|
||||
#what #ship,
|
||||
.turn #what #user {
|
||||
.x #what #x,
|
||||
.o #what #o {
|
||||
border: 2px solid red;
|
||||
}
|
||||
|
||||
@ -56,6 +88,7 @@
|
||||
width: 1.6rem;
|
||||
}
|
||||
|
||||
#audi h1,
|
||||
#vs {
|
||||
margin: 0 1rem;
|
||||
padding: .3rem;
|
||||
@ -63,6 +96,22 @@
|
||||
background-color: #000;
|
||||
}
|
||||
|
||||
#audi h1 {
|
||||
font-size: .9rem;
|
||||
text-transform: uppercase;
|
||||
display: inline-block;
|
||||
background-color: #ccc;
|
||||
}
|
||||
|
||||
#audi h1:after {
|
||||
content: "";
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
#audi .ship {
|
||||
color: #ccc;
|
||||
}
|
||||
|
||||
.spac {
|
||||
font-size: 100px;
|
||||
line-height: 200px;
|
||||
|
@ -1,10 +1,11 @@
|
||||
$(function() {
|
||||
$bord = $('#bord')
|
||||
$audi = $('#audi')
|
||||
$whom = $('#whom')
|
||||
|
||||
lett = ["x","o"]
|
||||
symb = [" ","✕","◯"]
|
||||
draw = function(state) {
|
||||
drab = function(state) {
|
||||
space = function(_state,y,x) {
|
||||
return "<div class='spac' data-index='"+y+"-"+x+
|
||||
"'>"+symb[_state]+"</div>"
|
||||
@ -22,32 +23,58 @@ $(function() {
|
||||
}
|
||||
}
|
||||
$bord.html(s)
|
||||
turn(state.who)
|
||||
}
|
||||
|
||||
which = null
|
||||
turn = function(who) {
|
||||
$('body').toggleClass('turn',(who == which))
|
||||
audi = function(state) {
|
||||
a = "<h1>audience</h1>"
|
||||
for(i=0;i<state.aud.length;i++) {
|
||||
a += "<div class='ship'>"+state.aud[i].slice(1)+"</div>"
|
||||
}
|
||||
$audi.html(a)
|
||||
}
|
||||
|
||||
assign = function(who) {
|
||||
which = who
|
||||
turn(who)
|
||||
$('#ship .as').text(symb[Number(!lett.indexOf(who))+1])
|
||||
$('#user .as').text(symb[lett.indexOf(who)+1])
|
||||
who = null
|
||||
turn = function(state) {
|
||||
if(state.plx.slice(1) == window.urb.user)
|
||||
who = "x"
|
||||
if(state.plo.slice(1) == window.urb.user)
|
||||
who = "o"
|
||||
if(who == null && (state.plx == "" || state.plo == ""))
|
||||
wurn = true
|
||||
else
|
||||
wurn = (state.who == who)
|
||||
$('body').toggleClass('turn',wurn)
|
||||
$('body').toggleClass('x',(state.who == 'x'))
|
||||
$('body').toggleClass('o',(state.who == 'o'))
|
||||
}
|
||||
|
||||
assign = function(state) {
|
||||
if(!state.plo)
|
||||
state.plo = ""
|
||||
if(!state.plx)
|
||||
state.plx = ""
|
||||
$('#o .ship').toggleClass('waiting', (state.plo=="")).text(state.plo.slice(1))
|
||||
$('#x .ship').toggleClass('waiting', (state.plx=="")).text(state.plx.slice(1))
|
||||
}
|
||||
|
||||
message = function(mess) {
|
||||
mess = mess.split('"')[1]
|
||||
mess = mess.split("=")
|
||||
mess = "<div class='ship'>"+mess[0].slice(1)+"</div> ["+symb[lett.indexOf(mess[1].toLowerCase())+1]+"] WINS"
|
||||
$('body').append('<div id="message">'+mess+'</div>')
|
||||
setTimeout(function() { $('#message').fadeOut().remove(); }, 2000)
|
||||
}
|
||||
|
||||
urb.appl = 'octo'
|
||||
urb.bind('/octo/web', function(err,res) {
|
||||
if(which == null) { assign(res.data.who) }
|
||||
draw(res.data)
|
||||
urb.bind('/octo', function(err,res) {
|
||||
if(typeof(res.data) == 'string')
|
||||
return message(res.data)
|
||||
assign(res.data)
|
||||
drab(res.data)
|
||||
audi(res.data)
|
||||
turn(res.data)
|
||||
})
|
||||
|
||||
// draw({
|
||||
// box:[false,false,false,false,false,false,false,false,false],
|
||||
// boo:[false,false,false,false,false,false,false,false,false]
|
||||
// })
|
||||
|
||||
$bord.on('click', function(e) {
|
||||
if(!$('body').hasClass('turn')) { return false }
|
||||
$t = $(e.target).closest('.spac')
|
||||
@ -56,7 +83,4 @@ $(function() {
|
||||
function(i) { return Number(i); })
|
||||
urb.send({mark:'octo-move',data:data})
|
||||
})
|
||||
|
||||
$('#ship .ship').text(window.urb.ship)
|
||||
$('#user .ship').text(window.urb.user)
|
||||
})
|
||||
|
@ -120,7 +120,6 @@ input {
|
||||
display: inline;
|
||||
}
|
||||
.ship {
|
||||
font-weight: 500;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.05rem;
|
||||
}
|
||||
@ -148,8 +147,8 @@ body {
|
||||
position: fixed;
|
||||
width: 58rem;
|
||||
max-height: 4rem;
|
||||
background-color: #ccc;
|
||||
color: #fff;
|
||||
background-color: rgba(255,255,255,0.95);
|
||||
color: #555;
|
||||
overflow: hidden;
|
||||
z-index: 10;
|
||||
border-bottom: 1px solid #ddd;
|
||||
@ -166,7 +165,7 @@ body {
|
||||
}
|
||||
#messages-container {
|
||||
vertical-align: top;
|
||||
margin-top: 4rem;
|
||||
margin-top: 5rem;
|
||||
}
|
||||
.caret,
|
||||
.circle {
|
||||
@ -204,13 +203,12 @@ body {
|
||||
#head {
|
||||
width: 100%;
|
||||
height: 4rem;
|
||||
background-color: #fff;
|
||||
color: #333;
|
||||
border-bottom: 1px solid #ddd;
|
||||
}
|
||||
#station-container h1 {
|
||||
display: none;
|
||||
color: #fff;
|
||||
color: #555;
|
||||
font-weight: 400;
|
||||
font-size: 1rem;
|
||||
letter-spacing: 0.06rem;
|
||||
@ -285,6 +283,12 @@ body {
|
||||
}
|
||||
#members > div {
|
||||
display: block;
|
||||
max-width: 24rem;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
}
|
||||
#members > div:hover {
|
||||
white-space: normal;
|
||||
}
|
||||
#members > div div {
|
||||
display: inline-block;
|
||||
@ -431,11 +435,12 @@ a {
|
||||
.type.private:before {
|
||||
content: "•";
|
||||
font-size: 1rem;
|
||||
line-height: 0.7rem;
|
||||
line-height: 1.1rem;
|
||||
}
|
||||
.type.public:before {
|
||||
content: "▒";
|
||||
line-height: 1.1rem;
|
||||
font-size: 0.8rem;
|
||||
line-height: 0.8rem;
|
||||
}
|
||||
.mess,
|
||||
.iden,
|
||||
@ -449,6 +454,7 @@ a {
|
||||
vertical-align: top;
|
||||
}
|
||||
.attr > div {
|
||||
line-height: 1.4rem;
|
||||
max-width: 16rem;
|
||||
}
|
||||
.attr {
|
||||
|
@ -48,7 +48,6 @@ input
|
||||
// font-size .7rem
|
||||
|
||||
.ship
|
||||
font-weight 500
|
||||
text-transform uppercase
|
||||
letter-spacing .05rem
|
||||
|
||||
@ -80,8 +79,8 @@ body
|
||||
position fixed
|
||||
width 58rem
|
||||
max-height 4rem
|
||||
background-color #ccc
|
||||
color white
|
||||
background-color rgba(255,255,255,.95)
|
||||
color #555
|
||||
overflow hidden
|
||||
z-index 10
|
||||
border-bottom 1px solid #ddd
|
||||
@ -144,13 +143,12 @@ body
|
||||
#head
|
||||
width 100%
|
||||
height 4rem
|
||||
background-color white
|
||||
color #333
|
||||
border-bottom 1px solid #ddd
|
||||
|
||||
#station-container h1
|
||||
display none
|
||||
color white
|
||||
color #555
|
||||
font-weight 400
|
||||
font-size 1rem
|
||||
letter-spacing .06rem
|
||||
@ -225,6 +223,12 @@ body
|
||||
|
||||
#members > div
|
||||
display block
|
||||
max-width 24rem
|
||||
overflow hidden
|
||||
white-space nowrap
|
||||
|
||||
#members > div:hover
|
||||
white-space normal
|
||||
|
||||
#members > div div
|
||||
display inline-block
|
||||
@ -385,7 +389,8 @@ a
|
||||
|
||||
.type.public:before
|
||||
content "▒"
|
||||
line-height 1.1rem
|
||||
font-size .8rem
|
||||
line-height .8rem
|
||||
|
||||
.mess
|
||||
.iden
|
||||
|
18
base/sur/bit-api/core.hook
Normal file
18
base/sur/bit-api/core.hook
Normal file
@ -0,0 +1,18 @@
|
||||
|%
|
||||
++ 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]])
|
||||
--
|
||||
|
Loading…
Reference in New Issue
Block a user