diff --git a/dub.selections.json b/dub.selections.json new file mode 100644 index 0000000..44e64bd --- /dev/null +++ b/dub.selections.json @@ -0,0 +1,23 @@ +{ + "fileVersion": 1, + "versions": { + "botan": "1.12.10", + "botan-math": "1.0.3", + "diet-ng": "1.6.0", + "dxml": "0.4.1", + "eventcore": "0.8.46", + "libasync": "0.8.4", + "libevent": "2.0.2+2.0.16", + "memutils": "0.4.13", + "mir-linux-kernel": "1.0.1", + "openssl": "1.1.6+1.0.1g", + "pegged": "0.4.4", + "std-experimental-xml": "0.1.7", + "stdx-allocator": "2.77.5", + "sumtype": "0.8.13", + "taggedalgebraic": "0.11.4", + "vibe-core": "1.7.0", + "vibe-d": "0.8.6-rc.1", + "vibe-http": {"path":"../saoc/vibe-http"} + } +} diff --git a/source/app.d b/source/app.d index 8109938..9235eb9 100644 --- a/source/app.d +++ b/source/app.d @@ -39,6 +39,16 @@ > elinks \"http://localhost:8080\" ---------------------------------------------"; +void runWebServer(ref URLRouter router, immutable string bindAddress, immutable ushort bindPort) +{ + auto settings = new HTTPServerSettings; + settings.port = bindPort; + settings.bindAddresses = ["127.0.0.1", bindAddress]; + + listenHTTP(settings, router); + runEventLoop(); +} + void runDaemon(EndpointType[] endpoints, immutable string feedsFile, immutable string bindAddress, immutable ushort bindPort) { @@ -54,21 +64,16 @@ (RSSFeed[] fl) { fl.each!( (RSSFeed feed) { - tasks[feed.name] = runWorkerTaskH(&updateFeed, feed.path); + tasks[feed.name] = runWorkerTaskH(&feedActor, feed.name, feed.path); }); }); - - // start server to accept client requests + // initialize a new service to serve endpoints auto router = new URLRouter; router.registerWebInterface(new EndpointService(feeds, tasks)); - auto settings = new HTTPServerSettings; - settings.port = bindPort; - settings.bindAddresses = ["127.0.0.1", bindAddress]; - - listenHTTP(settings, router); - runEventLoop(); + // start the webserver in main thread + runWebServer(router, bindAddress, bindPort); } void runClient(immutable string bindAddress, immutable ushort bindPort) diff --git a/views/index.dt b/views/index.dt index 1bc7338..bfa7e41 100644 --- a/views/index.dt +++ b/views/index.dt @@ -3,11 +3,25 @@ head title CartaStraccia - RSS Feed Reader body - h1 fname - - foreach(newsItem; newsList) - - auto htmlData = newsItem.description; - - auto nLink = newsItem.link; - - auto nTitle = newsItem.title; - h2 nTitle - p!= htmlData - b a(href=nLink) + h1 Cartastraccia RSS Channels + p Click channel name to read, click Source link for remote source + ul#index + - uint cnt = 0; + - foreach(feed; fl) + - cnt++; + li + Feed #{cnt}: + a(href="#"~feed.name) #{feed.name} + p + a(href=feed.path) View source + + - foreach(chit; channelItems) + h1(id=chit.fname) #{chit.cname} + - uint icnt = 0; + - foreach(item; chit.items) + - icnt++; + b #{icnt}. #{item.title} + p + a(href=item.link) View source + p!= item.description +