@yz-social/civildefense.io 4.5.7 → 4.5.9
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 +2 -2
- package/public/about/en.html +1 -1
- package/public/about/es.html +1 -1
- package/public/index.html +102 -102
- package/public/javascripts/alert.js +7 -6
- package/public/javascripts/conversation.js +8 -5
- package/public/javascripts/hashtags.js +188 -21
- package/public/javascripts/map.js +4 -2
- package/public/javascripts/p2pWebNetwork.js +8 -0
- package/public/junk.html +145 -0
- package/public/material-combobox.html +379 -0
- package/public/service-worker.js +1 -1
- package/public/stylesheets/style.css +69 -8
- package/server/app.js +19 -5
- package/server/location.json +7 -0
- package/spec/conversationSpec.js +2 -2
package/server/app.js
CHANGED
|
@@ -46,6 +46,12 @@ const argv = yargs(hideBin(process.argv))
|
|
|
46
46
|
default: 5,
|
|
47
47
|
description: "Additional variable seconds (+/- variableSpacing/2) to add to fixedSpacing between each portal."
|
|
48
48
|
})
|
|
49
|
+
.option('info', {
|
|
50
|
+
alias: 'i',
|
|
51
|
+
type: 'boolean',
|
|
52
|
+
default: true,
|
|
53
|
+
description: "Run with info logging."
|
|
54
|
+
})
|
|
49
55
|
.option('verbose', {
|
|
50
56
|
alias: 'v',
|
|
51
57
|
type: 'boolean',
|
|
@@ -94,20 +100,28 @@ if (cluster.isPrimary) { // Parent process with portal webserver through which c
|
|
|
94
100
|
}));
|
|
95
101
|
|
|
96
102
|
app.listen(port);
|
|
97
|
-
console.log(
|
|
103
|
+
console.log(new Date(), `Listening on ${port} and starting ${argv.nPortals} nodes on ${logicalCores} ${cpus()[0].model} logical cores.`);
|
|
98
104
|
for (let i = 0; i < argv.nPortals; i++) {
|
|
99
105
|
cluster.fork();
|
|
100
|
-
await new Promise(resolve => setTimeout(resolve,
|
|
106
|
+
await new Promise(resolve => setTimeout(resolve, 2e3)); // Number chosen to give an unspikey rise in packets/s.
|
|
101
107
|
}
|
|
102
108
|
} else {
|
|
103
109
|
process.title = 'axona-starting';
|
|
104
110
|
const { P2PWebNetwork, location } = await import('../index.js');
|
|
105
|
-
const network = await P2PWebNetwork.create({
|
|
111
|
+
const network = await P2PWebNetwork.create({
|
|
112
|
+
region: location,
|
|
113
|
+
infoLogger: (...rest) => argv.info && console.log(new Date(), ...rest),
|
|
114
|
+
debugLogger: (...rest) => argv.verbose && console.log(new Date(), ...rest)
|
|
115
|
+
});
|
|
106
116
|
process.title = 'axona-' + network.nodeIdentity.id;
|
|
107
|
-
|
|
117
|
+
let update = setInterval(() => {
|
|
118
|
+
const roles = network.peer.health().axonRoles;
|
|
119
|
+
network.debug(roles.length, 'axons',
|
|
120
|
+
roles.reduce((total, role) => total + (role.isRoot ? 1 : 0), 0), 'roots');
|
|
121
|
+
}, 10e3);
|
|
108
122
|
process.on('SIGINT', async () => { // Leave the network politely.
|
|
109
123
|
console.log(process.title, 'Shutdown for Ctrl+C');
|
|
110
|
-
|
|
124
|
+
clearInterval(update)
|
|
111
125
|
await network.disconnect();
|
|
112
126
|
process.exit(0);
|
|
113
127
|
});
|
package/spec/conversationSpec.js
CHANGED
|
@@ -31,8 +31,8 @@ describe("Conversation", function () {
|
|
|
31
31
|
let keep = true;
|
|
32
32
|
let tag = "caching";
|
|
33
33
|
class CacheConversation extends Conversation {
|
|
34
|
-
update() { return keep &&
|
|
35
|
-
initialize() { return keep &&
|
|
34
|
+
update(properties) { return keep && super.update(properties); }
|
|
35
|
+
initialize(properties) { return keep && super.initialize(properties); }
|
|
36
36
|
}
|
|
37
37
|
it("ends with explicit removal.", async function () {
|
|
38
38
|
let initial = await Conversation.ensure({tag, agent, payload});
|