This commit is contained in:
dachus 2023-02-11 20:43:23 -06:00
parent 497675ba2e
commit 8e6bf7c313
7 changed files with 69 additions and 24 deletions

View File

@ -36,26 +36,22 @@
%blog-action
=+ !<(act=action:blog vase)
?- -.act
%blog-bind
%unbind-post :: TODO probably dont' need this
:_ this
[%pass /bind %arvo %e %connect `path.act dap.bowl]~
::
%blog-unbind
:_ this
[%pass /bind %arvo %e %disconnect `path.act]~
[%pass /bind %arvo %e %disconnect `bind.act]~
::
%save-file
~& > text.act
~& > file.act
:: /=blog=/blogs/...
=* file
%+ weld
/(scot %p our.bowl)/blog/(scot %da now.bowl)/blogs
file.act
=* file [%posts file.act]
=* nor `nori:clay`[%& [file %ins %html !>(text.act)]~]
[%pass / %arvo %c %info %blog nor]~^this
:_ this
:~ [%pass / %arvo %c %info %blog nor]
[%pass /serve %arvo %e %serve `file.act dap.bowl /gen/blog/hoon ~]
==
::
%delete-file
%delete-file :: TODO unbind here as well
=* nor `nori:clay`[%& [file.act %del ~]~]
[%pass / %arvo %c %info %blog nor]~^this
==
@ -70,12 +66,16 @@
^- (unit (unit cage))
?+ path ~
::
:: [%x %existing-bindings ~]
:: =* pax /(scot %p our.bowl)/bindings/(scot %da now.bowl)
:: :^ ~ ~ %bindings !>
:: .^((list [binding:eyre duct action:eyre]) %e pax)
[%x %existing-bindings ~]
=* pax /(scot %p our.bowl)/bindings/(scot %da now.bowl)
:^ ~ ~ %bindings !>
.^((list [binding:eyre duct action:eyre]) %e pax)
::
[%x %blog ^]
[%x %posts ~]
=* pax /(scot %p our.bowl)/blog/(scot %da now.bowl)/blogs
``arch+!>((turn ~(tap by dir:.^(arch %cy pax)) head))
::
[%x %content ^]
:^ ~ ~ %html
!> ^- cord
%- of-wain:format
@ -92,7 +92,7 @@
|= [=wire =sign-arvo]
^- (quip card _this)
?+ wire (on-arvo:def wire sign-arvo)
[%bind ~]
[%serve ~]
?> ?=(%eyre -.sign-arvo)
?> ?=(%bound +<.sign-arvo)
?- accepted.sign-arvo

13
gen/blog.hoon Normal file
View File

@ -0,0 +1,13 @@
|= [[now=@da eny=@uvJ byk=beak] ~ ~]
|= [authenticated=? =request:http]
^- simple-payload:http
=* data
%- as-octs:mimes:html
.^ @t
%cx
%+ weld
/(scot %p p.byk)/blog/(scot r.byk)/posts
(pa:dejs:format [%s url.request])
==
:_ `(unit octs)``data
`response-header:http`[200 ['Content-Type' 'text/html']~]

16
mar/arch.hoon Normal file
View File

@ -0,0 +1,16 @@
|_ arch=(list @ta)
::
++ grab
|%
++ noun (list @ta)
--
::
++ grow
|%
++ noun arch
++ json
[%a (turn arch |=(c=@ta [%s c]))]
--
::
++ grad %noun
--

1
mar/bill.hoon Symbolic link
View File

@ -0,0 +1 @@
../../base-dev/mar/bill.hoon

19
mar/bindings.hoon Normal file
View File

@ -0,0 +1,19 @@
|_ bind=(list [binding:eyre duct action:eyre])
::
++ grab
|%
++ noun (list [binding:eyre duct action:eyre])
--
::
++ grow
|%
++ noun bind
++ json
:- %a
%+ turn bind
|= [=binding:eyre duct action:eyre]
(path:enjs:format path.binding)
--
::
++ grad %noun
--

View File

@ -5,12 +5,9 @@
|%
++ noun action:blog
++ json
|= jon=^json
=, dejs:format
^- action:pyro
%- of
:~ [%blog-bind pa]
[%blog-unbind pa]
:~ [%unbind-post pa]
[%save-file (ot ~[file+pa text+so])]
[%delete-file pa]
==

View File

@ -1,7 +1,6 @@
|%
+$ action
$% [%blog-bind =path]
[%blog-unbind =path]
$% [%unbind-post bind=path]
[%save-file file=path text=@t]
[%delete-file file=path]
==