Commit fd782cb508efaf36affa4bb4fbd77af9a02a0148
Document sbot plugin usage and better config names
Anders Rune Jensen committed on 9/22/2017, 7:12:52 PMParent: cf7e8c012199e2e0fe63032b824cdd36e6990015
Files changed
README.md | changed |
bin.js | changed |
index.js | changed |
README.md | ||
---|---|---|
@@ -1,22 +1,41 @@ | ||
1 | 1 … | # ssb-dat-share |
2 | 2 … | |
3 | -Tries to find dat links and shares them automatically | |
3 … | +Find dat links in posts and share them automatically | |
4 | 4 … | |
5 | -Usage (assuming you want to share from the dats folder): | |
5 … | +Command line usage (assuming you want to share from the dats folder): | |
6 | 6 … | |
7 | 7 … | ``` |
8 | 8 … | node bin.js -f ./dats |
9 | 9 … | ``` |
10 | 10 … | |
11 | 11 … | Can also take a -i option to only share links from people you follow. |
12 | 12 … | |
13 | -Gives: | |
13 … | +This should give you something like this: | |
14 | 14 … | |
15 | 15 … | ``` |
16 | 16 … | Looking for dat links |
17 | 17 … | Found 2 |
18 | 18 … | Saving to: ./dats/50237519bcfec8c86632112906ee39c76004a3d4bbf1b342c0b2926f4af67d35 |
19 | 19 … | Saving to: ./dats/64a10ea39416aceb6c5852d262c89edc1dfa95d4c3f1f838eb36c4cb2edffc2a |
20 | 20 … | sharing: dat://50237519bcfec8c86632112906ee39c76004a3d4bbf1b342c0b2926f4af67d35 |
21 | 21 … | sharing: dat://64a10ea39416aceb6c5852d262c89edc1dfa95d4c3f1f838eb36c4cb2edffc2a |
22 | -``` | |
22 … | +``` | |
23 … | + | |
24 … | +Sbot plugin usage: | |
25 … | +```sh | |
26 … | +mkdir -p ~/.ssb/node_modules | |
27 … | +cd ~/.ssb/node_modules | |
28 … | +git clone ssb-dat-share ssb://%HGaRHwvAX9LW8lUAaz8NypXZRCVqOsHTKhj//pkiEiQ=.sha256 && cd ssb-dat-share | |
29 … | +npm install | |
30 … | +sbot plugins.enable ssb-viewer | |
31 … | +# restart sbot | |
32 … | +``` | |
33 … | + | |
34 … | +For configuration, you can change options in ~/.ssb/config, add: | |
35 … | + | |
36 … | +``` | |
37 … | + "datShare": { | |
38 … | + "shareFolder": "PATH_TO_MY_SHARE_FOLDER", | |
39 … | + "onlyPeopleIFollow": true | |
40 … | + } | |
41 … | +``` |
bin.js | |||
---|---|---|---|
@@ -4,18 +4,18 @@ | |||
4 | 4 … | ||
5 | 5 … | var program = require('commander'); | |
6 | 6 … | ||
7 | 7 … | program | |
8 | - .option('-f, --folder [value]', 'Folder for sharing') | ||
8 … | + .option('-f, --share-folder [value]', 'Folder for sharing') | ||
9 | 9 … | .option('-i, --only-people-i-follow', 'Only seed urls from people or channels I follow') | |
10 | 10 … | .parse(process.argv); | |
11 | 11 … | ||
12 | 12 … | require('ssb-client')((err, sbot) => { | |
13 | 13 … | if (err) throw err; | |
14 | 14 … | ||
15 | - var shareFolder = program.folder || '/tmp' | ||
15 … | + var shareFolder = program.shareFolder || '/tmp' | ||
16 | 16 … | ||
17 | - console.log("Sharing dat links from: ", shareFolder) | ||
17 … | + console.log("Sharing dat links from:", shareFolder) | ||
18 | 18 … | ||
19 | 19 … | if (program.onlyPeopleIFollow) | |
20 | 20 … | lib.getFromPeopleIFollow(sbot, shareFolder) | |
21 | 21 … | else |
index.js | ||
---|---|---|
@@ -5,14 +5,13 @@ | ||
5 | 5 … | exports.manifest = {} |
6 | 6 … | |
7 | 7 … | exports.init = function (ssb, config) { |
8 | 8 … | var conf = config.datShare || {} |
9 | - var onlyPeopleIFollow = conf.onlyPeopleIFollow || false | |
10 | - var shareFolder = conf.folder || '/tmp' | |
9 … | + var shareFolder = conf.shareFolder || '/tmp' | |
11 | 10 … | |
12 | - console.log("Sharing dat links from: ", shareFolder) | |
11 … | + console.log("Sharing dat links from:", shareFolder) | |
13 | 12 … | |
14 | - if (onlyPeopleIFollow) | |
13 … | + if (conf.onlyPeopleIFollow) | |
15 | 14 … | lib.getFromPeopleIFollow(ssb, shareFolder) |
16 | 15 … | else |
17 | 16 … | lib.getAll(ssb, shareFolder) |
18 | 17 … | } |
Built with git-ssb-web