Skip to content

Commit 1d2182d

Browse files
committed
finally making solid-ws working
1 parent 0a58dcb commit 1d2182d

5 files changed

Lines changed: 11 additions & 7 deletions

File tree

lib/create-server.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ function createServer(argv) {
7070

7171
// Setup Express app
7272
if (ldp.live) {
73-
SolidWs(server, app)
73+
var solidWs = SolidWs(server, ldpApp)
74+
ldpApp.locals.ldp.live = solidWs.publish.bind(solidWs)
7475
}
7576

7677
return server

lib/handlers/delete.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ function handler(req, res, next) {
2020
}
2121

2222
debug("DELETE -- Ok.");
23-
if (ldp.live) ldp.live(req.originalUrl)
23+
if (ldp.live) ldp.live(utils.uriAbs(req) + path.basename(req.originalUrl))
24+
if (ldp.live) ldp.live(utils.uriAbs(req) + req.originalUrl)
2425
return res.sendStatus(200);
2526
});
2627

lib/handlers/patch.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,8 @@ function handler(req, res, next) {
3939
return next(err);
4040
}
4141

42-
if (ldp.live) {
43-
ldp.live(req.originalUrl)
44-
// subscription.publishDelta(req, res, patchKB, targetURI);
45-
}
42+
if (ldp.live) ldp.live(utils.uriAbs(req) + req.originalUrl)
43+
// subscription.publishDelta(req, res, patchKB, targetURI);
4644
debug("PATCH -- applied OK (sync)");
4745
res.send("Patch applied OK\n");
4846
});

lib/handlers/post.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ function handler(req, res, next) {
133133

134134
debug("POST -- Created new container " + resourceBaseUri);
135135
res.set('Location', resourceBaseUri);
136+
if (ldp.live) ldp.live(utils.uriAbs(req) + path.basename(req.originalUrl))
136137
return res.sendStatus(201);
137138
}
138139

@@ -142,6 +143,8 @@ function handler(req, res, next) {
142143
return next(err);
143144
}
144145
res.set('Location', resourceBaseUri);
146+
if (ldp.live) ldp.live(utils.uriAbs(req) + req.originalUrl)
147+
if (ldp.live) ldp.live(utils.uriAbs(req) + path.basename(req.originalUrl))
145148
return res.sendStatus(201);
146149
}
147150
}

lib/handlers/put.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
var mime = require('mime');
55
var path = require('path');
66
var $rdf = require('rdflib');
7+
var path = require('path')
78

89
var debug = require('../debug').handlers;
910
var utils = require('../utils.js');
@@ -26,7 +27,7 @@ function handler(req, res, next) {
2627

2728
debug("PUT -- Write Ok. Bytes written: " + req.text.length);
2829

29-
if (ldp.live) ldp.live(req.originalUrl)
30+
if (ldp.live) ldp.live(utils.uriAbs(req) + req.originalUrl)
3031
return res.sendStatus(201);
3132
});
3233
}

0 commit comments

Comments
 (0)