wiki-server 0.22.1 → 0.23.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/page.coffee +9 -2
- package/lib/server.coffee +12 -6
- package/package.json +2 -2
- package/test/server.coffee +2 -2
package/lib/page.coffee
CHANGED
|
@@ -338,11 +338,18 @@ module.exports = exports = (argv) ->
|
|
|
338
338
|
cb null, sitemap.filter (item) -> if item? then true
|
|
339
339
|
|
|
340
340
|
itself.slugs = (cb) ->
|
|
341
|
-
fs.readdir argv.db, (e, files) ->
|
|
341
|
+
fs.readdir argv.db, {withFileTypes: true}, (e, files) ->
|
|
342
342
|
if e
|
|
343
343
|
console.log 'Problem reading pages directory', e
|
|
344
344
|
cb(e)
|
|
345
345
|
else
|
|
346
|
-
|
|
346
|
+
onlyFiles = files.map((i) ->
|
|
347
|
+
if i.isFile()
|
|
348
|
+
return i.name
|
|
349
|
+
else
|
|
350
|
+
return null
|
|
351
|
+
).filter((i) ->
|
|
352
|
+
i != null && !i?.startsWith('.'))
|
|
353
|
+
cb(null, onlyFiles)
|
|
347
354
|
|
|
348
355
|
itself
|
package/lib/server.coffee
CHANGED
|
@@ -652,7 +652,7 @@ module.exports = exports = (argv) ->
|
|
|
652
652
|
if not page.journal
|
|
653
653
|
page.journal = []
|
|
654
654
|
if action.fork
|
|
655
|
-
page.journal.push({type: "fork", site: action.fork})
|
|
655
|
+
page.journal.push({type: "fork", site: action.fork, date: action.date - 1})
|
|
656
656
|
delete action.fork
|
|
657
657
|
page.journal.push(action)
|
|
658
658
|
pagehandler.put req.params[0], page, (e) ->
|
|
@@ -674,7 +674,13 @@ module.exports = exports = (argv) ->
|
|
|
674
674
|
pagehandler.saveToRecycler req.params[0], (err) ->
|
|
675
675
|
if err and err isnt 'page does not exist'
|
|
676
676
|
console.log "Error saving #{req.params[0]} before fork: #{err}"
|
|
677
|
-
|
|
677
|
+
if action.forkPage
|
|
678
|
+
forkPageCopy = JSON.parse(JSON.stringify(action.forkPage))
|
|
679
|
+
delete action.forkPage
|
|
680
|
+
actionCB(null, forkPageCopy)
|
|
681
|
+
else
|
|
682
|
+
# Legacy path, new clients will provide forkPage on implicit forks.
|
|
683
|
+
remoteGet(action.fork, req.params[0], actionCB)
|
|
678
684
|
else if action.type is 'create'
|
|
679
685
|
# Prevent attempt to write circular structure
|
|
680
686
|
itemCopy = JSON.parse(JSON.stringify(action.item))
|
|
@@ -688,10 +694,10 @@ module.exports = exports = (argv) ->
|
|
|
688
694
|
else if action.type == 'fork'
|
|
689
695
|
pagehandler.saveToRecycler req.params[0], (err) ->
|
|
690
696
|
if err then console.log "Error saving #{req.params[0]} before fork: #{err}"
|
|
691
|
-
if action.
|
|
692
|
-
|
|
693
|
-
delete action.
|
|
694
|
-
actionCB(null,
|
|
697
|
+
if action.forkPage # push
|
|
698
|
+
forkPageCopy = JSON.parse(JSON.stringify(action.forkPage))
|
|
699
|
+
delete action.forkPage
|
|
700
|
+
actionCB(null, forkPageCopy)
|
|
695
701
|
else # pull
|
|
696
702
|
remoteGet(action.site, req.params[0], actionCB)
|
|
697
703
|
else
|
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.23.0",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Ward Cunningham",
|
|
7
7
|
"email": "ward@c2.com",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"mocha": "^10.2.0",
|
|
52
52
|
"should": "^13.2.3",
|
|
53
53
|
"supertest": "^6.3.3",
|
|
54
|
-
"wiki-client": "^0.27.
|
|
54
|
+
"wiki-client": "^0.27.1",
|
|
55
55
|
"wiki-plugin-activity": "^0.5.0",
|
|
56
56
|
"wiki-plugin-video": "^0.3.0"
|
|
57
57
|
},
|
package/test/server.coffee
CHANGED
|
@@ -4,7 +4,7 @@ server = require '..'
|
|
|
4
4
|
path = require 'path'
|
|
5
5
|
random = require '../lib/random_id'
|
|
6
6
|
testid = random()
|
|
7
|
-
argv = require('../lib/defaultargs.coffee')({data: path.join('/tmp', 'sfwtests', testid), packageDir: path.join(__dirname, '..', 'node_modules'), port:
|
|
7
|
+
argv = require('../lib/defaultargs.coffee')({data: path.join('/tmp', 'sfwtests', testid), packageDir: path.join(__dirname, '..', 'node_modules'), port: 55557, security_legacy: true})
|
|
8
8
|
|
|
9
9
|
describe 'server', ->
|
|
10
10
|
app = {}
|
|
@@ -21,7 +21,7 @@ describe 'server', ->
|
|
|
21
21
|
))
|
|
22
22
|
|
|
23
23
|
|
|
24
|
-
request = request('http://localhost:
|
|
24
|
+
request = request('http://localhost:55557')
|
|
25
25
|
|
|
26
26
|
# location of the test page
|
|
27
27
|
loc = path.join('/tmp', 'sfwtests', testid, 'pages', 'adsf-test-page')
|