refactor into deskjam and deskpack-0 marks

This commit is contained in:
niblyx 2023-03-17 12:56:31 -04:00
parent ba24b4bbf7
commit 96d1d6e21e
11 changed files with 65 additions and 60 deletions

View File

@ -2,8 +2,12 @@
/+ webui, rudder, server, dbug, verb, default-agent, /+ webui, rudder, server, dbug, verb, default-agent,
j=jam-desk j=jam-desk
:: import to force compilation during development :: import to force compilation during development
/= j- /mar/jam-desk-0 /= dj- /mar/deskjam
/$ jam-to-mime %jam %mime /= dp- /mar/deskpack-0
/= jt- /ted/jam-desk-url
::
/$ deskpack-0-to-mime %deskpack-0 %mime
/$ deskjam-to-deskpack-0 %deskjam %deskpack-0
:: ::
|% |%
+$ state-0 [%0 data] +$ state-0 [%0 data]
@ -137,7 +141,7 @@
=/ =jam !<(jam result) =/ =jam !<(jam result)
:_ this :_ this
:~ :* %pass / %agent [our dap]:bowl %poke :~ :* %pass / %agent [our dap]:bowl %poke
%jam-desk-action !>(stage-mapp+(cue-and-clam:jc jam)) %jam-desk-action !>([%stage-mapp (deskjam-to-deskpack-0 jam)])
== == == ==
== ==
:: ::
@ -147,15 +151,8 @@
|_ =bowl:gall |_ =bowl:gall
++ sour (scot %p our.bowl) ++ sour (scot %p our.bowl)
++ snow (scot %da now.bowl) ++ snow (scot %da now.bowl)
++ jam-mark %jam-desk-0
++ desks .^((set desk) %cd /[sour]/base/[snow]) ++ desks .^((set desk) %cd /[sour]/base/[snow])
:: ::
:: ++ jam-to-mime
:: |= =beak
:: .^ $-(@ mime) %cf
:: (weld (en-beam beak(q %base) ~) /jam/mime)
:: ==
::
++ new-desk-card ++ new-desk-card
|= [=desk =mapp] |= [=desk =mapp]
^- card ^- card
@ -200,18 +197,6 @@
:: ::
++ en-mapp ++ en-mapp
|= [=desk files=(list path)] |= [=desk files=(list path)]
:: ^- mapp
:: |^
:: (~(gas by *mapp) (turn files mage))
:: ++ mage
:: |= file=path
:: ^- (pair path page:clay)
:: :- file
:: ^- page:clay
:: :- (rear file)
:: ~| [%missing-source-file beak file]
:: .^(* %cx (weld (en-beam beak ~) file))
:: --
^- mapp ^- mapp
=+ .^(=dome:clay %cv /[sour]/[desk]/[snow]) =+ .^(=dome:clay %cv /[sour]/[desk]/[snow])
=/ commit=@ud ud:.^(cass:clay %cw /[sour]/[desk]/[snow]) =/ commit=@ud ud:.^(cass:clay %cw /[sour]/[desk]/[snow])
@ -239,9 +224,8 @@
++ desk-to-mime ++ desk-to-mime
|= =desk |= =desk
^- mime ^- mime
%- jam-to-mime %- deskpack-0-to-mime
%- jam ^- (cask) [desk (en-mapp-full desk)]
[jam-mark desk (en-mapp-full desk)]
:: ::
++ file-args ++ file-args
|= args=(list [k=@t v=@t]) |= args=(list [k=@t v=@t])
@ -254,9 +238,8 @@
++ subdesk-to-mime ++ subdesk-to-mime
|= [=desk files=(list path)] |= [=desk files=(list path)]
^- mime ^- mime
%- jam-to-mime %- deskpack-0-to-mime
%- jam ^- (cask) [desk (en-mapp-part desk files)]
[jam-mark desk (en-mapp-part desk files)]
:: ::
++ simple-desk-jam ++ simple-desk-jam
|= [=eyre-id =desk] |= [=eyre-id =desk]

View File

@ -1,18 +1,9 @@
/- *jam-desk /- *jam-desk
/+ multipart /+ multipart
|_ [our=ship now=time] |_ [our=ship now=time]
++ en-beak |=(dap=term /(scot %p our)/[dap]/(scot %da now)) ++ sour (scot %p our)
++ jam-to-mime .^($-(@ mime) %cf (welp (en-beak %base) /jam/mime)) ++ snow (scot %da now)
++ desks .^((set desk) %cd (en-beak %base)) ++ desks .^((set desk) %cd /[sour]/base/[snow])
::
++ cue-and-clam
|= =jam
^- [desk mapp]
=/ =(cask) ((cask) (cue jam))
?+ p.cask !!
%jam-desk-0
(,[desk mapp] q.cask)
==
:: list to unit :: list to unit
:: ::
++ lint ++ lint
@ -32,7 +23,7 @@
?. =(key n) ~ ?. =(key n) ~
[~ `mold`body:p] [~ `mold`body:p]
:: ::
++ desk-files |=(=desk .^((list path) %ct (en-beak desk))) ++ desk-files |=(=desk .^((list path) %ct /[sour]/[desk]/[snow]))
:: ::
++ desk-axal ++ desk-axal
|= =desk |= =desk

View File

@ -1,5 +1,6 @@
/- *jam-desk /- *jam-desk
/+ rudder, multipart, w=webui-pages, h=jam-desk /+ rudder, multipart, w=webui-pages, h=jam-desk
/$ deskjam-to-deskpack-0 %deskjam %deskpack-0
|% |%
++ path-to-term ++ path-to-term
|= =path |= =path
@ -31,7 +32,7 @@
=/ args=(map @t @t) =/ args=(map @t @t)
?~(body ~ (frisk:rudder q.u.body)) ?~(body ~ (frisk:rudder q.u.body))
?~ url=(~(get by args) 'url') ~ ?~ url=(~(get by args) 'url') ~
url-thread+u.url [%url-thread u.url]
=/ jam=(unit jam) =/ jam=(unit jam)
%- lint:hc %- lint:hc
^- (list jam) ^- (list jam)
@ -42,7 +43,7 @@
%file [~ `jam`body:p] %file [~ `jam`body:p]
== ==
?~ jam ~ ?~ jam ~
stage-mapp+(cue-and-clam:hc u.jam) [%stage-mapp (deskjam-to-deskpack-0 u.jam)]
:: ::
++ final ++ final
%+ alert:rudder %+ alert:rudder

View File

@ -39,7 +39,7 @@
;td ;td
;a/"/apps/jam-desk/download/{(trip desk)}" ;a/"/apps/jam-desk/download/{(trip desk)}"
=id "download" =id "download"
=download "{(trip desk)}.jam" =download "{(trip desk)}.deskjam"
=title "download this file" =title "download this file"
; ⬇️ ; ⬇️
== ==

View File

@ -35,7 +35,7 @@
;input ;input
=type "file" =type "file"
=name "file" =name "file"
=accept ".jam"; =accept ".deskjam";
== ==
;td ;td
;button ;button

View File

@ -28,7 +28,7 @@
Select files and folders to jam. Select files and folders to jam.
== ==
;td ;td
;button(type "submit", download "{(trip desk)}.jam"): download ;button(type "submit", download "{(trip desk)}.deskjam"): download
== ==
== ==
;* folder-hierarchy ;* folder-hierarchy

16
desk/mar/deskjam.hoon Normal file
View File

@ -0,0 +1,16 @@
=, mimes:html
|_ mud=@
++ grow
|%
++ noun mud
++ jam mud
++ mime [/application/octet-stream (as-octs mud)]
--
++ grab
|%
++ noun @
++ jam @
++ mime |=(mim=^mime q.q.mim)
--
++ grad %mime
--

25
desk/mar/deskpack-0.hoon Normal file
View File

@ -0,0 +1,25 @@
/- *jam-desk
=, mimes:html
|_ dp=deskpack
++ grow
|%
++ noun dp
++ deskjam jam
++ jam (^jam [%deskpack-0 dp])
++ mime :- /application/octet-stream
(as-octs:mimes:html jam)
--
++ grab
|%
++ noun deskpack
++ deskjam jam
++ jam
|= mud=@
=/ =(cask) ;;((cask) (cue mud))
?+ p.cask ~|([%unknown-deskjam-mark mark=p.cask] !!)
%deskpack-0 ;;(deskpack q.cask)
==
++ mime |=(mim=^mime (jam q.q.mim))
--
++ grad %noun
--

View File

@ -1,12 +0,0 @@
/- *jam-desk
|_ [=desk =mapp]
++ grow
|%
++ noun [desk mapp]
--
++ grab
|%
++ noun ,[^desk ^mapp]
--
++ grad %noun
--

View File

@ -10,8 +10,8 @@
++ mime [/application/octet-stream (as-octs mud)] ++ mime [/application/octet-stream (as-octs mud)]
-- --
++ grab ++ grab
|% :: convert from |%
++ noun @ :: clam from %noun ++ noun @
-- --
++ grad %mime ++ grad %mime
-- --

View File

@ -1,6 +1,7 @@
|% |%
+$ data [=staged dest=(unit [mode=?(%n %m) =desk])] +$ data [=staged dest=(unit [mode=?(%n %m) =desk])]
+$ mapp (map path page:clay) +$ mapp (map path page:clay)
+$ deskpack [desk mapp]
+$ staged +$ staged
%- unit %- unit
$: =stage=time $: =stage=time