Skip to content

Commit

Permalink
updated calDav plugins and added syncDav plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
gedaiu committed Apr 26, 2015
1 parent 71d2550 commit e03ed68
Show file tree
Hide file tree
Showing 15 changed files with 635 additions and 287 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,9 @@ examples/fileDav/dub.selections.json
.buildpath

.settings/org.dsource.ddt.ide.core.prefs

examples/fileDav/dub.selections.json

examples/fileDav/dub.selections.json

examples/fileDav/dub.selections.json
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,4 @@ auto router = new URLRouter;
* Improve XML support (eg: change xml node format from "name:DAV:" to "{DAV:}name")
* Add DB support
* Add migration tools from https://github.com/Kozea/Radicale
* Maybe update the @ResourceProperty... Structs to something more general like @ResourceProperty!"<tag>%value</tag>"()
2 changes: 1 addition & 1 deletion dub.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"authors": ["Szabo Bogdan"],
"license": "MIT",
"dependencies": {
"vibe-d": "~>0.7.22",
"vibe-d": "~>0.7.23",
"tested": "~>0.9.2"
},

Expand Down
2 changes: 1 addition & 1 deletion examples/webDav/dub.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"copyright": "Copyright © 2015, Szabo Bogdan",
"authors": ["Szabo Bogdan"],
"dependencies": {
"vibe-d": "~>0.7.19",
"vibe-d": "~>0.7.23",
"vibe-dav": {
"version": "~>0.2.0",
"path": "../.."
Expand Down

This file was deleted.

This file was deleted.

77 changes: 0 additions & 77 deletions examples/webDav/public/calendar/admin/personal/main.ics

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//Apple Inc.//Mac OS X 10.10.3//EN
CALSCALE:GREGORIAN
BEGIN:VTIMEZONE
TZID:Europe/Bucharest
BEGIN:DAYLIGHT
TZOFFSETFROM:+0200
RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU
DTSTART:19970330T030000
TZNAME:EEST
TZOFFSETTO:+0300
END:DAYLIGHT
BEGIN:STANDARD
TZOFFSETFROM:+0300
RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU
DTSTART:19971026T040000
TZNAME:EET
TZOFFSETTO:+0200
END:STANDARD
END:VTIMEZONE
BEGIN:VEVENT
CREATED:20150426T104512Z
UID:4AF119BE-84A2-462C-9F8A-529F01454B18
DTEND;TZID=Europe/Bucharest:20150415T100000
TRANSP:OPAQUE
SUMMARY:New Event
DTSTART;TZID=Europe/Bucharest:20150415T090000
DTSTAMP:20150426T104512Z
SEQUENCE:0
END:VEVENT
END:VCALENDAR
37 changes: 9 additions & 28 deletions examples/webDav/source/app.d
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,17 @@
* License: Subject to the terms of the MIT license, as written in the included LICENSE.txt file.
* Copyright: Public Domain
*/
import vibe.core.file;
import vibe.core.log;
import vibe.inet.message;
import vibe.inet.mimetypes;
import vibe.http.router : URLRouter;
import vibe.http.server;
import vibe.http.fileserver;
import vibe.http.auth.basic_auth;

import vibedav.filedav;
import vibedav.acldav;
import vibedav.caldav;
import vibedav.user;
import vibedav.prop;
import vibedav.userhome;
import vibedav.syncdav;

import core.time;
import std.conv : to;
import std.stdio;
import std.file;
import std.path;
import std.digest.md;
import std.datetime;
import std.functional : toDelegate;

bool checkPassword(string user, string password)
Expand All @@ -35,29 +24,21 @@ bool checkPassword(string user, string password)

shared static this()
{
writeln("Starting WebDav server.");
writeln("Start Kangal server");

auto router = new URLRouter;

// now any request is matched and checked for authentication:
router.any("/calendar/*", performBasicAuth("Site Realm", toDelegate(&checkPassword)));
router.any("/principals/*", performBasicAuth("Site Realm", toDelegate(&checkPassword)));

auto userConnection = new BaseCalDavUserCollection;
auto dav = router.serveFileDav("", "public");

alias factory = FileDavResourceFactory!(
"calendar", "public/calendar",
"", FileDavCollection, FileDavResource,
":user/", FileDavCollection, FileDavResource,
":user/inbox", FileDavCollection, FileDavResource,
":user/outbox", FileDavCollection, FileDavResource,
":user/personal", FileDavCalendarCollection, FileDavCalendarResource
);

router.serveFileDav!("/files/", "public/files/")(userConnection);
router.serveFileDav!factory(userConnection);
new ACLDavPlugin(dav);
new CalDavPlugin(dav);
new SyncDavPlugin(dav);

auto settings = new HTTPServerSettings;
settings.port = 8080;
settings.bindAddresses = ["::1", "127.0.0.1"];
settings.bindAddresses = ["::1", "127.0.0.1", "192.168.0.13", "192.168.0.100"];
listenHTTP(settings, router);
}
Loading

0 comments on commit e03ed68

Please sign in to comment.