wiki-server 0.21.3 → 0.22.1
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.
- package/.github/workflows/node.js.yml +1 -1
- package/Gruntfile.js +0 -6
- package/lib/server.coffee +13 -15
- package/package.json +16 -18
package/Gruntfile.js
CHANGED
|
@@ -5,7 +5,6 @@ module.exports = function( grunt ) {
|
|
|
5
5
|
grunt.loadNpmTasks('grunt-contrib-watch');
|
|
6
6
|
grunt.loadNpmTasks('grunt-mocha-test');
|
|
7
7
|
grunt.loadNpmTasks('grunt-git-authors');
|
|
8
|
-
grunt.loadNpmTasks('grunt-retire');
|
|
9
8
|
|
|
10
9
|
grunt.initConfig({
|
|
11
10
|
pkg: grunt.file.readJSON('package.json'),
|
|
@@ -42,11 +41,6 @@ module.exports = function( grunt ) {
|
|
|
42
41
|
]
|
|
43
42
|
},
|
|
44
43
|
|
|
45
|
-
retire: {
|
|
46
|
-
node: ['.'],
|
|
47
|
-
options: {packageOnly: true}
|
|
48
|
-
},
|
|
49
|
-
|
|
50
44
|
watch: {
|
|
51
45
|
all: {
|
|
52
46
|
files: ['lib/*.coffee', 'test/*.coffee'],
|
package/lib/server.coffee
CHANGED
|
@@ -23,6 +23,7 @@ fs = require 'fs'
|
|
|
23
23
|
path = require 'path'
|
|
24
24
|
http = require 'http'
|
|
25
25
|
url = require 'url'
|
|
26
|
+
{ pipeline } = require 'node:stream/promises'
|
|
26
27
|
|
|
27
28
|
# From npm
|
|
28
29
|
mkdirp = require 'mkdirp'
|
|
@@ -42,7 +43,7 @@ methodOverride = require 'method-override'
|
|
|
42
43
|
sessions = require 'client-sessions'
|
|
43
44
|
bodyParser = require 'body-parser'
|
|
44
45
|
errorHandler = require 'errorhandler'
|
|
45
|
-
|
|
46
|
+
|
|
46
47
|
|
|
47
48
|
|
|
48
49
|
# Local files
|
|
@@ -584,20 +585,17 @@ module.exports = exports = (argv) ->
|
|
|
584
585
|
requestURL = 'http://' + remoteHost + '/' + remoteResource
|
|
585
586
|
console.log("PROXY Request: ", requestURL)
|
|
586
587
|
if requestURL.endsWith('.json') or requestURL.endsWith('.png') or requestURL.endsWith('.jpg') or pathParts[0] is "plugin"
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
.
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
catch error
|
|
599
|
-
console.log "PROXY Error", error
|
|
600
|
-
res.status(500).end()
|
|
588
|
+
fetch(requestURL, {timeout: 2000})
|
|
589
|
+
.then (fetchRes) ->
|
|
590
|
+
if fetchRes.ok
|
|
591
|
+
res.set('content-type', fetchRes.headers.get('content-type'))
|
|
592
|
+
res.set('last-modified', fetchRes.headers.get('last-modified'))
|
|
593
|
+
await pipeline(fetchRes.body, res)
|
|
594
|
+
else
|
|
595
|
+
res.status(fetchRes.status).end()
|
|
596
|
+
.catch (err) ->
|
|
597
|
+
console.log("ERROR: Proxy Request ", requestURL, err)
|
|
598
|
+
res.status(500).end()
|
|
601
599
|
else
|
|
602
600
|
res.status(400).end()
|
|
603
601
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wiki-server",
|
|
3
3
|
"description": "A Federated Wiki Server",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.22.1",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Ward Cunningham",
|
|
7
7
|
"email": "ward@c2.com",
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
],
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@mapbox/sanitize-caja": "^0.1.4",
|
|
24
|
-
"async": "^2.
|
|
25
|
-
"body-parser": "^1.
|
|
24
|
+
"async": "^3.2.4",
|
|
25
|
+
"body-parser": "^1.20.2",
|
|
26
26
|
"client-sessions": "^0.8.0",
|
|
27
27
|
"coffeescript": "^2.5.0",
|
|
28
28
|
"cookie-parser": "^1.4.4",
|
|
@@ -30,32 +30,30 @@
|
|
|
30
30
|
"express": "^4.17.1",
|
|
31
31
|
"express-hbs": "^2.3.3",
|
|
32
32
|
"flates": "0.0.5",
|
|
33
|
-
"glob": "^7.
|
|
33
|
+
"glob": "^7.2.3",
|
|
34
34
|
"lodash": "^4.17.19",
|
|
35
|
-
"method-override": "^
|
|
36
|
-
"minisearch": "^6.0.
|
|
37
|
-
"mkdirp": "^0.5.
|
|
35
|
+
"method-override": "^3.0.0",
|
|
36
|
+
"minisearch": "^6.0.1",
|
|
37
|
+
"mkdirp": "^0.5.6",
|
|
38
38
|
"morgan": "^1.9.1",
|
|
39
|
-
"node-fetch": "^2.6.
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"xml2js": "^0.4.23"
|
|
39
|
+
"node-fetch": "^2.6.8",
|
|
40
|
+
"write-file-atomic": "^5.0.0",
|
|
41
|
+
"xml2js": "^0.5.0"
|
|
43
42
|
},
|
|
44
43
|
"scripts": {
|
|
45
44
|
"test": "grunt mochaTest"
|
|
46
45
|
},
|
|
47
46
|
"devDependencies": {
|
|
48
|
-
"grunt": "^1.
|
|
47
|
+
"grunt": "^1.6.1",
|
|
49
48
|
"grunt-contrib-watch": "^1.0.0",
|
|
50
49
|
"grunt-git-authors": "^3.2.0",
|
|
51
50
|
"grunt-mocha-test": "^0.13.2",
|
|
52
|
-
"
|
|
53
|
-
"mocha": "^9.2.2",
|
|
51
|
+
"mocha": "^10.2.0",
|
|
54
52
|
"should": "^13.2.3",
|
|
55
|
-
"supertest": "^
|
|
56
|
-
"wiki-client": "^0.
|
|
57
|
-
"wiki-plugin-activity": "^0.
|
|
58
|
-
"wiki-plugin-video": "^0.
|
|
53
|
+
"supertest": "^6.3.3",
|
|
54
|
+
"wiki-client": "^0.27.0",
|
|
55
|
+
"wiki-plugin-activity": "^0.5.0",
|
|
56
|
+
"wiki-plugin-video": "^0.3.0"
|
|
59
57
|
},
|
|
60
58
|
"engines": {
|
|
61
59
|
"node": ">=12.x"
|