ldn-inbox-server 1.4.0 → 1.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -83,9 +83,20 @@ async function handle({path,options,config}) {
|
|
|
83
83
|
|
|
84
84
|
fs.writeFileSync(metaFile, JSON.stringify({
|
|
85
85
|
'Content-Type': 'application/ld+json',
|
|
86
|
-
'Last-Modified': nowISO()
|
|
86
|
+
'Last-Modified': nowISO(),
|
|
87
|
+
'Access-Control-Allow-Origin': '*',
|
|
88
|
+
'Access-Control-Expose-Headers': 'Link, Link-Template'
|
|
87
89
|
},null,4));
|
|
88
90
|
|
|
91
|
+
const eventMetaFile = `${eventFile}.meta`;
|
|
92
|
+
|
|
93
|
+
fs.writeFileSync(eventMetaFile, JSON.stringify({
|
|
94
|
+
'Content-Type': 'application/ld+json',
|
|
95
|
+
'Last-Modified': nowISO(),
|
|
96
|
+
'Access-Control-Allow-Origin': '*',
|
|
97
|
+
'Access-Control-Expose-Headers': 'Link, Link-Template'
|
|
98
|
+
},null,4));
|
|
99
|
+
|
|
89
100
|
// Store the path in the options .. yeah yeah we know ugly but it works for now
|
|
90
101
|
|
|
91
102
|
const eventPath = `${eventDir}/${fileName}`;
|
package/lib/index.js
CHANGED
|
@@ -73,7 +73,7 @@ function doInboxGET(req,res) {
|
|
|
73
73
|
if (pathItem === '/') {
|
|
74
74
|
doInboxGET_Index(req,res);
|
|
75
75
|
}
|
|
76
|
-
else if (pathItem.match(/^\/[
|
|
76
|
+
else if (pathItem.match(/^\/[A-Za-z0-9_-]+\.jsonld$/)) {
|
|
77
77
|
doInboxGET_Read(req,res);
|
|
78
78
|
}
|
|
79
79
|
else {
|
|
@@ -94,7 +94,7 @@ function doInboxHEAD(req,res) {
|
|
|
94
94
|
return;
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
if (pathItem.match(/^\/[
|
|
97
|
+
if (pathItem.match(/^\/[A-Za-z0-9_-]+\.jsonld$/)) {
|
|
98
98
|
const id = pathItem.substring(1);
|
|
99
99
|
const result = getBody(id);
|
|
100
100
|
|
package/package.json
CHANGED
|
@@ -2,5 +2,7 @@
|
|
|
2
2
|
"Content-Type": "text/html",
|
|
3
3
|
"X-Artifact": true,
|
|
4
4
|
"Link-Template": "\"https://{YOUR-SERVER}/artifacts/artifact1.jsonld\"; rel=\"eventlog\"",
|
|
5
|
-
"Link": "</inbox/> ; rel=\"http://www.w3.org/ns/ldp#inbox\""
|
|
5
|
+
"Link": "</inbox/> ; rel=\"http://www.w3.org/ns/ldp#inbox\"" ,
|
|
6
|
+
"Access-Control-Allow-Origin": "*" ,
|
|
7
|
+
"Access-Control-Expose-Headers": "Link, Link-Template"
|
|
6
8
|
}
|
|
@@ -2,5 +2,7 @@
|
|
|
2
2
|
"Content-Type": "text/html",
|
|
3
3
|
"X-Artifact": true,
|
|
4
4
|
"Link-Template": "\"https://{YOUR-SERVER}/artifacts/artifact2.jsonld\"; rel=\"eventlog\"",
|
|
5
|
-
"Link": "</inbox/> ; rel=\"http://www.w3.org/ns/ldp#inbox\""
|
|
5
|
+
"Link": "</inbox/> ; rel=\"http://www.w3.org/ns/ldp#inbox\"",
|
|
6
|
+
"Access-Control-Allow-Origin": "*",
|
|
7
|
+
"Access-Control-Expose-Headers": "Link, Link-Template"
|
|
6
8
|
}
|