Quick update on DTube IPFS Discord Bot: Now it pins files immediately after downloading!steemCreated with Sketch.

in #onelovedtube6 years ago

Repository

https://github.com/techcoderx/DTube-IPFS-Bot


Yesterday, I made a Utopian development post regarding all the new features that has been added to my IPFS bot. For those who haven't see it, make sure you check it out by clicking here.

Referring to the original post that I wrote about the bot, it is not possible to use the js-ipfs-api to pin downloaded files as the ipfs.add method does not support the trickledag (-t) option which is needed in order to obtain the same hash as the hash in the file name of downloaded file. Since I can't execute .bash scripts directly from JavaScript (it's a huge security risk to do so), I was stuck with manual pinning scripts, or having to deal with buggy crontabs.

New feature: Bot now pins files to IPFS node immediately after downloading!

Today, I came across a dependency for NodeJS applications called ShellJS. It's a dependency that allows developers to execute Unix shell commands within a NodeJS application. With this dependency, I was be able to call the exec() method to execute any valid shell commands.

Therefore, I can use this method to pin downloaded files right after it has completed downloading. Firstly, I have to add the downloaded file to IPFS, then in the callback function, I can pin the file that has been added to IPFS. shell.rm method deletes the original downloaded file from disk as the file is already in the IPFS repo after pinning has been done.

Screen Shot 20180910 at 9.29.01 PM.png

To clean up the repository, most script files and pinning queue text files have been deleted as you can see here as manual pinning is no longer needed after ShellJS dependency has been installed to execute pinning scripts right after completing the download.

To finish off, the pre-configured settings has been changed to notify that files have been pinned to IPFS instead of file being added to manual pinning queue.

Screen Shot 20180910 at 8.16.23 PM.png
Note: the above replies have been modified to differentiate between 2 different servers (in a different location) running the same bot.


Demo

This bot has been invited into the following Discord servers so that you can try it out:

  1. OneLoveDTube
  2. Helpie
  3. Nebulus.app

Github account

https://github.com/techcoderx

Sort:  

Thanks for the contribution, @techcoderx! A small, but cool feature nonetheless! One thing I'd like to point out that it would be great if you could link the relevant commit(s) in the body of your post so it's easier for us to review (in this case it wasn't hard to find them, but still).

As was pointed out on your previous contribution the commit messages could be better. One of the commits includes 377 changed files with 27,082 additions and 41 deletions, which could've been separated better in my opinion (so it's easier to see which commit adds what).


Your contribution has been evaluated according to Utopian policies and guidelines, as well as a predefined set of questions pertaining to the category.

To view those questions and the relevant answers related to your post, click here.


Need help? Write a ticket on https://support.utopian.io/.
Chat with us on Discord.
[utopian-moderator]

Thank you for your review, @amosbastian!

So far this week you've reviewed 7 contributions. Keep up the good work!

Hi @techcoderx!

Your post was upvoted by @steem-ua, new Steem dApp, using UserAuthority for algorithmic post curation!
Your post is eligible for our upvote, thanks to our collaboration with @utopian-io!
Feel free to join our @steem-ua Discord server

Hey, @techcoderx!

Thanks for contributing on Utopian.
We’re already looking forward to your next contribution!

Get higher incentives and support Utopian.io!
Simply set @utopian.pay as a 5% (or higher) payout beneficiary on your contribution post (via SteemPlus or Steeditor).

Want to chat? Join us on Discord https://discord.gg/h52nFrV.

Vote for Utopian Witness!

Coin Marketplace

STEEM 0.18
TRX 0.16
JST 0.030
BTC 61720.10
ETH 2429.72
USDT 1.00
SBD 2.63