git ssb

2+

arj / dat-share



Commit fd782cb508efaf36affa4bb4fbd77af9a02a0148

Document sbot plugin usage and better config names

Anders Rune Jensen committed on 9/22/2017, 7:12:52 PM
Parent: cf7e8c012199e2e0fe63032b824cdd36e6990015

Files changed

README.mdchanged
bin.jschanged
index.jschanged
README.mdView
@@ -1,22 +1,41 @@
11 # ssb-dat-share
22
3-Tries to find dat links and shares them automatically
3 +Find dat links in posts and share them automatically
44
5-Usage (assuming you want to share from the dats folder):
5 +Command line usage (assuming you want to share from the dats folder):
66
77 ```
88 node bin.js -f ./dats
99 ```
1010
1111 Can also take a -i option to only share links from people you follow.
1212
13-Gives:
13 +This should give you something like this:
1414
1515 ```
1616 Looking for dat links
1717 Found 2
1818 Saving to: ./dats/50237519bcfec8c86632112906ee39c76004a3d4bbf1b342c0b2926f4af67d35
1919 Saving to: ./dats/64a10ea39416aceb6c5852d262c89edc1dfa95d4c3f1f838eb36c4cb2edffc2a
2020 sharing: dat://50237519bcfec8c86632112906ee39c76004a3d4bbf1b342c0b2926f4af67d35
2121 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.jsView
@@ -4,18 +4,18 @@
44
55 var program = require('commander');
66
77 program
8- .option('-f, --folder [value]', 'Folder for sharing')
8 + .option('-f, --share-folder [value]', 'Folder for sharing')
99 .option('-i, --only-people-i-follow', 'Only seed urls from people or channels I follow')
1010 .parse(process.argv);
1111
1212 require('ssb-client')((err, sbot) => {
1313 if (err) throw err;
1414
15- var shareFolder = program.folder || '/tmp'
15 + var shareFolder = program.shareFolder || '/tmp'
1616
17- console.log("Sharing dat links from: ", shareFolder)
17 + console.log("Sharing dat links from:", shareFolder)
1818
1919 if (program.onlyPeopleIFollow)
2020 lib.getFromPeopleIFollow(sbot, shareFolder)
2121 else
index.jsView
@@ -5,14 +5,13 @@
55 exports.manifest = {}
66
77 exports.init = function (ssb, config) {
88 var conf = config.datShare || {}
9- var onlyPeopleIFollow = conf.onlyPeopleIFollow || false
10- var shareFolder = conf.folder || '/tmp'
9 + var shareFolder = conf.shareFolder || '/tmp'
1110
12- console.log("Sharing dat links from: ", shareFolder)
11 + console.log("Sharing dat links from:", shareFolder)
1312
14- if (onlyPeopleIFollow)
13 + if (conf.onlyPeopleIFollow)
1514 lib.getFromPeopleIFollow(ssb, shareFolder)
1615 else
1716 lib.getAll(ssb, shareFolder)
1817 }

Built with git-ssb-web