pathchain 1.1.25 → 1.1.26
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/package.json +1 -1
- package/updater.js +7 -29
package/package.json
CHANGED
package/updater.js
CHANGED
|
@@ -51,21 +51,13 @@ function setLinkNext(xlink = '', xnextlink = '') {
|
|
|
51
51
|
|
|
52
52
|
const fileContents = fs.readFileSync(`files/${xlink}`);
|
|
53
53
|
const linkObj = link_pb.link.decode(fileContents);
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
register: linkObj.register,
|
|
58
|
-
author: linkObj.author,
|
|
59
|
-
prev: xnextlink,
|
|
60
|
-
next: linkObj.next,
|
|
61
|
-
target: linkObj.target,
|
|
62
|
-
ancestor: linkObj.ancestor,
|
|
63
|
-
tag: linkObj.tag
|
|
64
|
-
});
|
|
54
|
+
linkObj.next = xnextlink;
|
|
55
|
+
fs.writeFileSync(`files/${xlink}`, link_pb.link.encode(linkObj));
|
|
56
|
+
|
|
65
57
|
|
|
66
58
|
// Ensure the directory exists and overwrite the link buffer to a file
|
|
67
|
-
checker.checkDir(`files/${xlink}`);
|
|
68
|
-
fs.writeFileSync(`files/${xlink}`, buffer);
|
|
59
|
+
// checker.checkDir(`files/${xlink}`);
|
|
60
|
+
// fs.writeFileSync(`files/${xlink}`, buffer);
|
|
69
61
|
|
|
70
62
|
return xlink;
|
|
71
63
|
} catch (err) {
|
|
@@ -86,27 +78,13 @@ function setLinkPrev(xlink = '', xprevlink = '') {
|
|
|
86
78
|
const link_pb = pb(fs.readFileSync('node_modules/pathchain/proto/link.proto'));
|
|
87
79
|
|
|
88
80
|
try {
|
|
89
|
-
// Check if both links exist
|
|
90
81
|
fs.readFileSync(`files/${xlink}`);
|
|
91
82
|
fs.readFileSync(`files/${xprevlink}`);
|
|
92
83
|
|
|
93
84
|
const fileContents = fs.readFileSync(`files/${xlink}`);
|
|
94
85
|
const linkObj = link_pb.link.decode(fileContents);
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
const buffer = link_pb.link.encode({
|
|
98
|
-
register: linkObj.register,
|
|
99
|
-
author: linkObj.author,
|
|
100
|
-
prev: xprevlink,
|
|
101
|
-
next: linkObj.next,
|
|
102
|
-
target: linkObj.target,
|
|
103
|
-
ancestor: linkObj.ancestor,
|
|
104
|
-
tag: linkObj.tag
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
// Ensure the directory exists and overwrite the link buffer to a file
|
|
108
|
-
checker.checkDir(`files/${xlink}`);
|
|
109
|
-
fs.writeFileSync(`files/${xlink}`, buffer);
|
|
86
|
+
linkObj.prev = xprevlink;
|
|
87
|
+
fs.writeFileSync(`files/${xlink}`, link_pb.link.encode(linkObj));
|
|
110
88
|
|
|
111
89
|
return xlink;
|
|
112
90
|
|