wiki-server 0.22.2 → 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/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
- remoteGet(action.fork, req.params[0], actionCB)
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.item # push
692
- itemCopy = JSON.parse(JSON.stringify(action.item))
693
- delete action.item
694
- actionCB(null, itemCopy)
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.22.2",
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.0",
54
+ "wiki-client": "^0.27.1",
55
55
  "wiki-plugin-activity": "^0.5.0",
56
56
  "wiki-plugin-video": "^0.3.0"
57
57
  },
@@ -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: 55555, security_legacy: true})
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:55555')
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')