Something
This commit is contained in:
parent
2dde9d75ed
commit
d03d8f9db0
|
@ -2,13 +2,10 @@
|
||||||
# SPDX-License-Identifier: Unlicense
|
# SPDX-License-Identifier: Unlicense
|
||||||
|
|
||||||
import std/[json, sequtils, tables, uri]
|
import std/[json, sequtils, tables, uri]
|
||||||
import preserves, preserves/jsonhooks, syndicate
|
import preserves, preserves/jsonhooks, syndicate, syndicate/relays
|
||||||
from syndicate/protocols/dataspace import Observe
|
|
||||||
|
|
||||||
import ./icalendar_components
|
import ./icalendar_components
|
||||||
|
|
||||||
type Observe = dataspace.Observe[Cap]
|
|
||||||
|
|
||||||
type BootArgs {.preservesDictionary.} = object
|
type BootArgs {.preservesDictionary.} = object
|
||||||
dataspace: Cap
|
dataspace: Cap
|
||||||
|
|
||||||
|
@ -19,8 +16,8 @@ proc importCalendar(location: string): Component =
|
||||||
else:
|
else:
|
||||||
var
|
var
|
||||||
js = parseFile(uri.path)
|
js = parseFile(uri.path)
|
||||||
pr = jsonhooks.toPreserveHook(js, void)
|
pr = jsonhooks.toPreservesHook(js)
|
||||||
if not result.fromPreserve(pr):
|
if not result.fromPreserves(pr):
|
||||||
# TODO: convert directly from JsonNode
|
# TODO: convert directly from JsonNode
|
||||||
raise newException(ValueError, "Preserves was not a valid iCalendar component")
|
raise newException(ValueError, "Preserves was not a valid iCalendar component")
|
||||||
if result.label != "vcalendar":
|
if result.label != "vcalendar":
|
||||||
|
@ -50,9 +47,9 @@ proc serve(turn: var Turn; url: string): Cap =
|
||||||
ds
|
ds
|
||||||
|
|
||||||
runActor("icalendar_actor") do (root: Cap; turn: var Turn):
|
runActor("icalendar_actor") do (root: Cap; turn: var Turn):
|
||||||
connectStdio(root, turn)
|
connectStdio(turn, root)
|
||||||
stderr.writeLine "connected stdio to ", root
|
stderr.writeLine "connected stdio to ", root
|
||||||
during(turn, root, ?BootArgs) do (ds: Cap):
|
during(turn, root, ?:BootArgs) do (ds: Cap):
|
||||||
stderr.writeLine "got dataspace at ", ds
|
stderr.writeLine "got dataspace at ", ds
|
||||||
during(turn, ds, ?Observe(pattern: !CalendarDataspace) ?? {0: grabLit()}) do (url: string):
|
during(turn, ds, ?Observe(pattern: !CalendarDataspace) ?? {0: grabLit()}) do (url: string):
|
||||||
let cap = serve(turn, url)
|
let cap = serve(turn, url)
|
||||||
|
|
Loading…
Reference in New Issue