wiki-server 0.24.3 → 0.25.0
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/lib/plugins.coffee +4 -3
- package/lib/server.coffee +23 -9
- package/package.json +4 -4
package/lib/plugins.coffee
CHANGED
|
@@ -29,11 +29,12 @@ module.exports = exports = (argv) ->
|
|
|
29
29
|
fs.exists server, (exists) ->
|
|
30
30
|
if exists
|
|
31
31
|
console.log 'starting plugin', plugin
|
|
32
|
-
|
|
33
|
-
plugins[plugin] =
|
|
32
|
+
import(server).then((exported) ->
|
|
33
|
+
plugins[plugin] = exported
|
|
34
34
|
plugins[plugin].startServer?(params)
|
|
35
|
-
catch
|
|
35
|
+
).catch((e) ->
|
|
36
36
|
console.log 'failed to start plugin', plugin, e?.stack or e
|
|
37
|
+
)
|
|
37
38
|
|
|
38
39
|
startServers = (params) ->
|
|
39
40
|
# emitter = new events.EventEmitter()
|
package/lib/server.coffee
CHANGED
|
@@ -163,15 +163,15 @@ module.exports = exports = (argv) ->
|
|
|
163
163
|
.catch (err) ->
|
|
164
164
|
console.error('Unable to fetch remote resource', remote, slug, err)
|
|
165
165
|
cb(err, 'Page not found', 404)
|
|
166
|
-
|
|
167
166
|
|
|
168
|
-
|
|
167
|
+
|
|
168
|
+
|
|
169
169
|
#### Express configuration ####
|
|
170
170
|
# Set up all the standard express server options,
|
|
171
171
|
# including hbs to use handlebars/mustache templates
|
|
172
172
|
# saved with a .html extension, and no layout.
|
|
173
173
|
|
|
174
|
-
#
|
|
174
|
+
#
|
|
175
175
|
staticPathOptions = {
|
|
176
176
|
dotfiles: 'ignore'
|
|
177
177
|
etag: true
|
|
@@ -186,10 +186,24 @@ module.exports = exports = (argv) ->
|
|
|
186
186
|
app.engine('html', hbs.express4())
|
|
187
187
|
app.set('view options', layout: false)
|
|
188
188
|
|
|
189
|
-
|
|
190
|
-
|
|
189
|
+
# return deterministically colored strings
|
|
190
|
+
colorString = (str) ->
|
|
191
|
+
colorReset = '\x1b[0m'
|
|
192
|
+
hash = 0;
|
|
193
|
+
str.split('').forEach (char) ->
|
|
194
|
+
hash = char.charCodeAt(0) + ((hash << 5) - hash)
|
|
195
|
+
color = '\x1b[38;2'
|
|
196
|
+
for i in [0..2]
|
|
197
|
+
do (i) ->
|
|
198
|
+
value = (hash >> (i * 8)) & 0xff
|
|
199
|
+
color += ';' + value.toString()
|
|
200
|
+
color += 'm'
|
|
201
|
+
return color + str + colorReset
|
|
202
|
+
|
|
203
|
+
# use logger, at least in development, probably needs a param to configure (or turn off).
|
|
204
|
+
# use stream to direct to somewhere other than stdout.
|
|
191
205
|
logger.token('vhost', (req, res) ->
|
|
192
|
-
return req.hostname)
|
|
206
|
+
return colorString(req.hostname))
|
|
193
207
|
app.use(logger(':vhost :method :url :status :res[content-length] - :response-time ms'))
|
|
194
208
|
app.use(cookieParser())
|
|
195
209
|
app.use(bodyParser.json({ limit: argv.uploadLimit}))
|
|
@@ -558,7 +572,7 @@ module.exports = exports = (argv) ->
|
|
|
558
572
|
dict
|
|
559
573
|
, {}))
|
|
560
574
|
)
|
|
561
|
-
|
|
575
|
+
|
|
562
576
|
admin = (req, res, next) ->
|
|
563
577
|
if securityhandler.isAdmin(req)
|
|
564
578
|
next()
|
|
@@ -603,7 +617,7 @@ module.exports = exports = (argv) ->
|
|
|
603
617
|
res.status(fetchRes.status).end()
|
|
604
618
|
.catch (err) ->
|
|
605
619
|
console.log("ERROR: Proxy Request ", requestURL, err)
|
|
606
|
-
res.status(500).end()
|
|
620
|
+
res.status(500).end()
|
|
607
621
|
else
|
|
608
622
|
res.status(400).end()
|
|
609
623
|
|
|
@@ -680,7 +694,7 @@ module.exports = exports = (argv) ->
|
|
|
680
694
|
# otherwise ask pagehandler for it.
|
|
681
695
|
if action.fork
|
|
682
696
|
pagehandler.saveToRecycler req.params[0], (err) ->
|
|
683
|
-
if err and err isnt 'page does not exist'
|
|
697
|
+
if err and err isnt 'page does not exist'
|
|
684
698
|
console.log "Error saving #{req.params[0]} before fork: #{err}"
|
|
685
699
|
if action.forkPage
|
|
686
700
|
forkPageCopy = JSON.parse(JSON.stringify(action.forkPage))
|
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.25.0",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Ward Cunningham",
|
|
7
7
|
"email": "ward@c2.com",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"glob": "^7.2.3",
|
|
34
34
|
"jsdom": "^24.0.0",
|
|
35
35
|
"method-override": "^3.0.0",
|
|
36
|
-
"minisearch": "^
|
|
36
|
+
"minisearch": "^7.1.0",
|
|
37
37
|
"morgan": "^1.9.1",
|
|
38
38
|
"node-fetch": "^3.3.2",
|
|
39
39
|
"write-file-atomic": "^5.0.0",
|
|
@@ -49,9 +49,9 @@
|
|
|
49
49
|
"grunt-mocha-test": "^0.13.3",
|
|
50
50
|
"mocha": "^10.4.0",
|
|
51
51
|
"should": "^13.2.3",
|
|
52
|
-
"supertest": "^
|
|
52
|
+
"supertest": "^7.0.0",
|
|
53
53
|
"wiki-client": "^0.29.1",
|
|
54
|
-
"wiki-plugin-activity": "^0.
|
|
54
|
+
"wiki-plugin-activity": "^0.6.0",
|
|
55
55
|
"wiki-plugin-video": "^0.3.1"
|
|
56
56
|
},
|
|
57
57
|
"engines": {
|