mirror of
https://github.com/tadad/blog.git
synced 2024-09-11 20:57:23 +03:00
Merge pull request #9 from morelazers/feat/sss
added solid state subscriptions for integration with portal
This commit is contained in:
commit
706827e3ad
191
app/blog.hoon
191
app/blog.hoon
@ -1,5 +1,5 @@
|
|||||||
/- blog
|
/- blog, blog-paths
|
||||||
/+ blog-lib=blog, dbug, default-agent
|
/+ blog-lib=blog, dbug, default-agent, *sss
|
||||||
::
|
::
|
||||||
%- agent:dbug
|
%- agent:dbug
|
||||||
^- agent:gall
|
^- agent:gall
|
||||||
@ -7,6 +7,7 @@
|
|||||||
+$ versioned-state
|
+$ versioned-state
|
||||||
$% state-1
|
$% state-1
|
||||||
state-2
|
state-2
|
||||||
|
state-3
|
||||||
==
|
==
|
||||||
+$ state-1
|
+$ state-1
|
||||||
$: %1
|
$: %1
|
||||||
@ -19,13 +20,22 @@
|
|||||||
drafts=(map path md=@t)
|
drafts=(map path md=@t)
|
||||||
themes=(map @tas css=@t)
|
themes=(map @tas css=@t)
|
||||||
==
|
==
|
||||||
|
+$ state-3
|
||||||
|
$: %3
|
||||||
|
files=(map path [html=@t md=@t theme=@tas])
|
||||||
|
drafts=(map path md=@t)
|
||||||
|
themes=(map @tas css=@t)
|
||||||
|
pub-paths=_(mk-pubs blog-paths ,[%paths ~])
|
||||||
|
==
|
||||||
+$ card $+(card card:agent:gall)
|
+$ card $+(card card:agent:gall)
|
||||||
--
|
--
|
||||||
=| state-2
|
=| state-3
|
||||||
=* state -
|
=* state -
|
||||||
|_ =bowl:gall
|
|_ =bowl:gall
|
||||||
+* this .
|
+* this .
|
||||||
def ~(. (default-agent this %.n) bowl)
|
def ~(. (default-agent this %.n) bowl)
|
||||||
|
du-paths =/ du (du blog-paths ,[%paths ~])
|
||||||
|
(du pub-paths bowl -:!>(*result:du))
|
||||||
++ on-init
|
++ on-init
|
||||||
^- (quip card _this)
|
^- (quip card _this)
|
||||||
`this(themes (~(gas by themes) [%default default-theme:blog-lib]~))
|
`this(themes (~(gas by themes) [%default default-theme:blog-lib]~))
|
||||||
@ -44,16 +54,39 @@
|
|||||||
==
|
==
|
||||||
%= this
|
%= this
|
||||||
state
|
state
|
||||||
:^ %2
|
:* %3
|
||||||
(~(urn by files.old) |=([=path html=@t md=@t] [html md %none]))
|
(~(urn by files.old) |=([=path html=@t md=@t] [html md %none]))
|
||||||
drafts.old
|
drafts.old
|
||||||
(~(gas by *(map @tas @t)) [%default default-theme:blog-lib]~)
|
(~(gas by *(map @tas @t)) [%default default-theme:blog-lib]~)
|
||||||
|
pub-paths
|
||||||
|
==
|
||||||
==
|
==
|
||||||
::
|
::
|
||||||
%2
|
%2
|
||||||
|
=. state [%3 files.old drafts.old themes.old pub-paths]
|
||||||
|
=^ cards pub-paths (give:du-paths [%paths ~] [%init ~(key by files)])
|
||||||
|
:_ this
|
||||||
|
%+ welp cards
|
||||||
|
%- zing %+ turn ~(tap by files.old)
|
||||||
|
|= [=path html=@t md=@t theme=@tas]
|
||||||
|
:~ [%pass /bind %arvo %e %disconnect `path]
|
||||||
|
:* %pass /bind %arvo %e
|
||||||
|
%set-response (spat path)
|
||||||
|
~ %.n %payload
|
||||||
|
[200 ['Content-Type' 'text/html; charset=utf-8']~]
|
||||||
|
=/ tem=@t (~(gut by themes.old) theme '')
|
||||||
|
`(as-octs:mimes:^html (cat 3 html (add-style:blog-lib tem)))
|
||||||
|
==
|
||||||
|
:* %pass /bind %arvo %e
|
||||||
|
%set-response (cat 3 (spat path) '.md')
|
||||||
|
~ %.n %payload
|
||||||
|
[200 ['Content-Type' 'text/plain; charset=utf-8']~]
|
||||||
|
`(as-octs:mimes:^html md)
|
||||||
|
== ==
|
||||||
|
::
|
||||||
|
%3
|
||||||
:_ this(state old)
|
:_ this(state old)
|
||||||
%- zing
|
%- zing %+ turn ~(tap by files.old)
|
||||||
%+ turn ~(tap by files.old)
|
|
||||||
|= [=path html=@t md=@t theme=@tas]
|
|= [=path html=@t md=@t theme=@tas]
|
||||||
:~ [%pass /bind %arvo %e %disconnect `path]
|
:~ [%pass /bind %arvo %e %disconnect `path]
|
||||||
:* %pass /bind %arvo %e
|
:* %pass /bind %arvo %e
|
||||||
@ -74,67 +107,83 @@
|
|||||||
++ on-poke
|
++ on-poke
|
||||||
|= [=mark =vase]
|
|= [=mark =vase]
|
||||||
^- (quip card _this)
|
^- (quip card _this)
|
||||||
~| "unexpected poke to {<dap.bowl>} with mark {<mark>}"
|
?+ mark
|
||||||
?> =(%blog-action mark)
|
~|("unexpected poke to {<dap.bowl>} with mark {<mark>}" !!)
|
||||||
=+ !<(act=action:blog vase)
|
|
||||||
?> =(src.bowl our.bowl)
|
|
||||||
?- -.act
|
|
||||||
%publish
|
|
||||||
:_ this(files (~(put by files) [path html md theme]:act))
|
|
||||||
:~ :* %pass /bind %arvo %e
|
|
||||||
%set-response (cat 3 (spat path.act) '.md')
|
|
||||||
~ %.n %payload
|
|
||||||
[200 ['Content-Type' 'text/plain; charset=utf-8']~]
|
|
||||||
`(as-octs:mimes:html md.act)
|
|
||||||
==
|
|
||||||
::
|
::
|
||||||
:* %pass /bind %arvo %e
|
%blog-action
|
||||||
%set-response (spat path.act)
|
=+ !<(act=action:blog vase)
|
||||||
~ %.n %payload
|
?> =(src.bowl our.bowl)
|
||||||
[200 ['Content-Type' 'text/html; charset=utf-8']~]
|
?- -.act
|
||||||
=/ tem=@t (~(gut by themes) theme.act '')
|
%publish
|
||||||
`(as-octs:mimes:html (cat 3 html.act (add-style:blog-lib tem)))
|
=^ cards pub-paths (give:du-paths [%paths ~] [%post path.act])
|
||||||
== ==
|
:_ this(files (~(put by files) [path html md theme]:act))
|
||||||
::
|
%+ welp cards
|
||||||
%unpublish
|
:~ :* %pass /bind %arvo %e
|
||||||
:_ this(files (~(del by files) path.act))
|
%set-response (cat 3 (spat path.act) '.md')
|
||||||
:~ [%pass /bind %arvo %e %set-response `@t`(cat 3 (spat path.act) '.md') ~]
|
~ %.n %payload
|
||||||
[%pass /bind %arvo %e %set-response (spat path.act) ~]
|
[200 ['Content-Type' 'text/plain; charset=utf-8']~]
|
||||||
==
|
`(as-octs:mimes:html md.act)
|
||||||
::
|
==
|
||||||
%export
|
|
||||||
=/ soba-html=soba:clay
|
|
||||||
%- zing
|
|
||||||
%+ turn ~(tap by files)
|
|
||||||
|= [=path html=@t md=@t theme=@tas]
|
|
||||||
^- soba:clay
|
|
||||||
=/ tem (~(gut by themes) theme '')
|
|
||||||
:~ :- [%export %published %html (snoc path %html)]
|
|
||||||
[%ins %html !>((cat 3 html (add-style:blog-lib tem)))]
|
|
||||||
::
|
::
|
||||||
:- [%export %published %md (snoc path %md)]
|
:* %pass /bind %arvo %e
|
||||||
[%ins %md !>([md ~])]
|
%set-response (spat path.act)
|
||||||
|
~ %.n %payload
|
||||||
|
[200 ['Content-Type' 'text/html; charset=utf-8']~]
|
||||||
|
=/ tem=@t (~(gut by themes) theme.act '')
|
||||||
|
`(as-octs:mimes:html (cat 3 html.act (add-style:blog-lib tem)))
|
||||||
|
== ==
|
||||||
|
::
|
||||||
|
%unpublish
|
||||||
|
=^ cards pub-paths (give:du-paths [%paths ~] [%depost path.act])
|
||||||
|
:_ this(files (~(del by files) path.act))
|
||||||
|
%+ welp cards
|
||||||
|
:~ [%pass /bind %arvo %e %set-response `@t`(cat 3 (spat path.act) '.md') ~]
|
||||||
|
[%pass /bind %arvo %e %set-response (spat path.act) ~]
|
||||||
==
|
==
|
||||||
=/ soba-md=soba:clay
|
::
|
||||||
%+ turn ~(tap by drafts)
|
%export
|
||||||
|= [=path md=@t]
|
=/ soba-html=soba:clay
|
||||||
^- (pair ^path miso:clay)
|
%- zing
|
||||||
[[%export %drafts (snoc path %md)] %ins %md !>([md ~])]
|
%+ turn ~(tap by files)
|
||||||
=/ soba-css=soba:clay
|
|= [=path html=@t md=@t theme=@tas]
|
||||||
%+ turn ~(tap by themes)
|
^- soba:clay
|
||||||
|= [theme=@tas css=@t]
|
=/ tem (~(gut by themes) theme '')
|
||||||
^- (pair path miso:clay)
|
:~ :- [%export %published %html (snoc path %html)]
|
||||||
[[%export %themes theme %css ~] %ins %css !>(css)]
|
[%ins %html !>((cat 3 html (add-style:blog-lib tem)))]
|
||||||
:_ this
|
::
|
||||||
:~ [%pass /info %arvo %c %info %blog %& soba-html]
|
:- [%export %published %md (snoc path %md)]
|
||||||
[%pass /info %arvo %c %info %blog %& soba-md]
|
[%ins %md !>([md ~])]
|
||||||
[%pass /info %arvo %c %info %blog %& soba-css]
|
==
|
||||||
|
=/ soba-md=soba:clay
|
||||||
|
%+ turn ~(tap by drafts)
|
||||||
|
|= [=path md=@t]
|
||||||
|
^- (pair ^path miso:clay)
|
||||||
|
[[%export %drafts (snoc path %md)] %ins %md !>([md ~])]
|
||||||
|
=/ soba-css=soba:clay
|
||||||
|
%+ turn ~(tap by themes)
|
||||||
|
|= [theme=@tas css=@t]
|
||||||
|
^- (pair path miso:clay)
|
||||||
|
[[%export %themes theme %css ~] %ins %css !>(css)]
|
||||||
|
:_ this
|
||||||
|
:~ [%pass /info %arvo %c %info %blog %& soba-html]
|
||||||
|
[%pass /info %arvo %c %info %blog %& soba-md]
|
||||||
|
[%pass /info %arvo %c %info %blog %& soba-css]
|
||||||
|
==
|
||||||
|
::
|
||||||
|
%save-draft `this(drafts (~(put by drafts) [path md]:act))
|
||||||
|
%delete-draft `this(drafts (~(del by drafts) path.act))
|
||||||
|
%save-theme `this(themes (~(put by themes) [theme css]:act))
|
||||||
|
%delete-theme `this(themes (~(del by themes) theme.act))
|
||||||
|
::
|
||||||
|
%update-uri
|
||||||
|
=^ cards pub-paths (give:du-paths [%paths ~] [%uri uri.act])
|
||||||
|
[cards this]
|
||||||
==
|
==
|
||||||
::
|
::
|
||||||
%save-draft `this(drafts (~(put by drafts) [path md]:act))
|
%sss-to-pub
|
||||||
%delete-draft `this(drafts (~(del by drafts) path.act))
|
=/ msg !<(into:du-paths (fled vase))
|
||||||
%save-theme `this(themes (~(put by themes) [theme css]:act))
|
=^ cards pub-paths (apply:du-paths msg)
|
||||||
%delete-theme `this(themes (~(del by themes) theme.act))
|
[cards this]
|
||||||
==
|
==
|
||||||
::
|
::
|
||||||
++ on-peek
|
++ on-peek
|
||||||
@ -146,6 +195,7 @@
|
|||||||
[%x %html ^] ``blog+!>(-:(~(got by files) t.t.path))
|
[%x %html ^] ``blog+!>(-:(~(got by files) t.t.path))
|
||||||
[%x %draft ^] ``blog+!>((~(got by drafts) t.t.path))
|
[%x %draft ^] ``blog+!>((~(got by drafts) t.t.path))
|
||||||
[%x %theme @ ~] ``blog+!>((~(got by themes) i.t.t.path))
|
[%x %theme @ ~] ``blog+!>((~(got by themes) i.t.t.path))
|
||||||
|
[%x %uri ~] ``blog+!>(uri:rock:(~(got by read:du-paths) [%paths ~]))
|
||||||
::
|
::
|
||||||
[%x %pages ~]
|
[%x %pages ~]
|
||||||
=; pages ``json+!>([%a pages])
|
=; pages ``json+!>([%a pages])
|
||||||
@ -188,12 +238,7 @@
|
|||||||
==
|
==
|
||||||
==
|
==
|
||||||
::
|
::
|
||||||
++ on-arvo
|
++ on-arvo on-arvo:def
|
||||||
|= [=wire =sign-arvo]
|
|
||||||
^- (quip card _this)
|
|
||||||
?+ wire (on-arvo:def wire sign-arvo)
|
|
||||||
[%bind ~] ?>(?=([%eyre %bound %.y *] sign-arvo) `this)
|
|
||||||
==
|
|
||||||
++ on-agent on-agent:def
|
++ on-agent on-agent:def
|
||||||
++ on-watch on-watch:def
|
++ on-watch on-watch:def
|
||||||
++ on-leave on-leave:def
|
++ on-leave on-leave:def
|
||||||
|
1
lib/mip.hoon
Symbolic link
1
lib/mip.hoon
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../../base-dev/lib/mip.hoon
|
1
lib/sss.hoon
Symbolic link
1
lib/sss.hoon
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../../base-dev/lib/sss.hoon
|
@ -13,6 +13,7 @@
|
|||||||
[%delete-draft (ot ~[path+pa])]
|
[%delete-draft (ot ~[path+pa])]
|
||||||
[%save-theme (ot ~[theme+so css+so])]
|
[%save-theme (ot ~[theme+so css+so])]
|
||||||
[%delete-theme (ot ~[theme+so])]
|
[%delete-theme (ot ~[theme+so])]
|
||||||
|
[%update-uri (ot ~[uri+so])]
|
||||||
==
|
==
|
||||||
--
|
--
|
||||||
::
|
::
|
||||||
|
3
mar/sss/blog-paths.hoon
Normal file
3
mar/sss/blog-paths.hoon
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
/- blog-paths
|
||||||
|
/+ *sss
|
||||||
|
(mk-mar blog-paths)
|
12
mar/sss/to-pub.hoon
Normal file
12
mar/sss/to-pub.hoon
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
/- *sss
|
||||||
|
|_ =(request:poke)
|
||||||
|
++ grow
|
||||||
|
|%
|
||||||
|
++ noun request
|
||||||
|
--
|
||||||
|
++ grab
|
||||||
|
|%
|
||||||
|
++ noun (request:poke)
|
||||||
|
--
|
||||||
|
++ grad %noun
|
||||||
|
--
|
18
sur/blog-paths.hoon
Normal file
18
sur/blog-paths.hoon
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
|%
|
||||||
|
++ name %blog-paths
|
||||||
|
+$ rock [uri=@t paths=(set path)]
|
||||||
|
+$ wave
|
||||||
|
$% [%init paths=(set path)]
|
||||||
|
[%post =path]
|
||||||
|
[%depost =path]
|
||||||
|
[%uri uri=@t]
|
||||||
|
==
|
||||||
|
++ wash
|
||||||
|
|= [=rock =wave]
|
||||||
|
?- -.wave
|
||||||
|
%init rock(paths paths.wave)
|
||||||
|
%post rock(paths (~(put in paths.rock) path.wave))
|
||||||
|
%depost rock(paths (~(del in paths.rock) path.wave))
|
||||||
|
%uri rock(uri uri.wave)
|
||||||
|
==
|
||||||
|
--
|
@ -7,5 +7,7 @@
|
|||||||
[%delete-draft =path]
|
[%delete-draft =path]
|
||||||
[%save-theme theme=@tas css=@t]
|
[%save-theme theme=@tas css=@t]
|
||||||
[%delete-theme theme=@tas]
|
[%delete-theme theme=@tas]
|
||||||
|
[%update-uri uri=@t]
|
||||||
==
|
==
|
||||||
|
+$ sub [%sub =ship]
|
||||||
--
|
--
|
1
sur/sss.hoon
Symbolic link
1
sur/sss.hoon
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../../base-dev/sur/sss.hoon
|
Loading…
Reference in New Issue
Block a user