dcp-client 4.2.24 → 4.2.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/bin/build-dcp-config +8 -18
- package/bin/download +5 -1
- package/dcp-client.js +16 -4
- package/dist/dcp-client-bundle.js +3 -6138
- package/index.js +336 -201
- package/package.json +1 -1
- package/templates/dcp-modal.css +1 -0
- package/test-pseudo-root/etc/dcp/config.tap/dcp-config.js +11 -0
- package/test-pseudo-root/etc/dcp/dcp-config.js +12 -0
- package/test-pseudo-root/etc/dcp/override-dcp-config.js +17 -0
- package/test-pseudo-root/home/username/.dcp/config.tap/dcp-config.js +15 -0
- package/test-pseudo-root/home/username/.dcp/dcp-config.js +19 -0
- package/test-pseudo-root/home/username/.dcp/default.keystore +1 -0
- package/test-pseudo-root/home/username/.dcp/id.keystore +1 -0
- package/test-pseudo-root/home/username/README.md +3 -0
package/bin/build-dcp-config
CHANGED
|
@@ -11,30 +11,20 @@ const fs = require('fs');
|
|
|
11
11
|
|
|
12
12
|
const dcpClient = require('..');
|
|
13
13
|
const { Address } = require('dcp/wallet');
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
// To be able to serialize dcpConfig identities
|
|
17
|
-
serializer.userCtors.dcpEth$$Address = Address;
|
|
18
|
-
const { serializeAsync, deserialize } = serializer;
|
|
14
|
+
const kvin = require('kvin');
|
|
19
15
|
|
|
20
16
|
let outputFd = +(process.env.BUILD_DCP_CONFIG_OUTPUT_FD || "3");
|
|
21
17
|
|
|
22
18
|
async function main() {
|
|
23
|
-
|
|
24
|
-
|
|
19
|
+
const custom = new kvin.KVIN();
|
|
20
|
+
custom.userCtors.dcpEth$$Address = Address;
|
|
21
|
+
|
|
25
22
|
dcpClient._initHead();
|
|
26
23
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
} else {
|
|
32
|
-
initArgv = [];
|
|
33
|
-
programName = false;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
let outputObjects = await dcpClient.createAggregateConfig(initArgv, programName);
|
|
37
|
-
const output = await serializeAsync(outputObjects);
|
|
24
|
+
const input = fs.readFileSync(process.stdin.fd, 'utf-8');
|
|
25
|
+
const { initConfig, options } = custom.deserialize(input);
|
|
26
|
+
const outputObjects = await dcpClient.createAggregateConfig(initConfig, options);
|
|
27
|
+
const output = await custom.serializeAsync(outputObjects);
|
|
38
28
|
|
|
39
29
|
try {
|
|
40
30
|
fs.writeSync(outputFd, output, 'utf-8');
|
package/bin/download
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* @date May 2020
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
const dcpClient = require('..');
|
|
10
|
+
const dcpClient = require('..'); /* eslint-disable no-unused-vars */
|
|
11
11
|
const fs = require('fs');
|
|
12
12
|
|
|
13
13
|
function usage() {
|
|
@@ -16,6 +16,7 @@ function usage() {
|
|
|
16
16
|
Where:
|
|
17
17
|
--fd=N: send all output to file descriptor N
|
|
18
18
|
--quiet: suppress progress messages
|
|
19
|
+
--silent: suppress progress and error messages
|
|
19
20
|
`);
|
|
20
21
|
}
|
|
21
22
|
|
|
@@ -29,6 +30,9 @@ async function main(argv) {
|
|
|
29
30
|
let [,key,,value] = argv[i].match(/(^[^=]*)(=?)(.*)/); /* separate by first = */
|
|
30
31
|
|
|
31
32
|
switch(key) {
|
|
33
|
+
case '--silent':
|
|
34
|
+
console.error = function(){};
|
|
35
|
+
/* fallthrough */
|
|
32
36
|
case '--quiet':
|
|
33
37
|
argv.splice(i--,1);
|
|
34
38
|
console.log = console.debug = function(){};
|
package/dcp-client.js
CHANGED
|
@@ -12,7 +12,21 @@
|
|
|
12
12
|
* @author Wes Garland, wes@kingsds.network
|
|
13
13
|
* @date Aug 2019
|
|
14
14
|
*/
|
|
15
|
-
|
|
15
|
+
const allScripts = document.getElementsByTagName('SCRIPT');
|
|
16
|
+
const thisScript = allScripts[allScripts.length - 1];
|
|
17
|
+
|
|
18
|
+
if (thisScript.getAttribute('data-autoinit') === 'false')
|
|
19
|
+
{
|
|
20
|
+
thisScript.removeAttribute('data-autoinit');
|
|
21
|
+
window.dcp = { init: namespace };
|
|
22
|
+
}
|
|
23
|
+
else
|
|
24
|
+
{
|
|
25
|
+
namespace();
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function namespace()
|
|
29
|
+
{
|
|
16
30
|
|
|
17
31
|
console.log(`%c
|
|
18
32
|
_____ _____ ___________ _
|
|
@@ -31,8 +45,6 @@ https://distributed.computer/`, "font-weight: bold; font-size: 1.2em; color: #00
|
|
|
31
45
|
var _dcpConfig = typeof dcpConfig === 'object' ? dcpConfig : undefined;
|
|
32
46
|
|
|
33
47
|
{
|
|
34
|
-
let allScripts = document.getElementsByTagName('SCRIPT');
|
|
35
|
-
let thisScript = allScripts[allScripts.length - 1];
|
|
36
48
|
let thisScriptURL = new URL(thisScript.src)
|
|
37
49
|
let schedulerURL;
|
|
38
50
|
let dcpConfigHref = thisScript.getAttribute('dcpConfig');
|
|
@@ -177,5 +189,5 @@ https://distributed.computer/`, "font-weight: bold; font-size: 1.2em; color: #00
|
|
|
177
189
|
loadBundle(shimCallback);
|
|
178
190
|
loadLinks();
|
|
179
191
|
}
|
|
180
|
-
}
|
|
192
|
+
};
|
|
181
193
|
|