akashaorg / ipfs-connector Goto Github PK
View Code? Open in Web Editor NEWAKASHA <---> IPFS connector
License: Mozilla Public License 2.0
AKASHA <---> IPFS connector
License: Mozilla Public License 2.0
It would be nice to have access to the download progression for user feedback (download slow or stalled ...).
I looked at this a while ago without finding an obvious way, but maybe with a fork of bin-wrapper it would be doable (maybe https://github.com/simonepri/bin-manager ?).
Seems due to the usage of relative path?
Or it just doesn't support 'client/browser' ?
import {Injectable} from '@angular/core';
import {Http} from '@angular/http';
import 'rxjs/add/operator/map';
import {IpfsConnector} from "@akashaproject/ipfs-connector";
/*
Generated class for the Data provider.
See https://angular.io/docs/ts/latest/guide/dependency-injection.html
for more info on providers and Angular 2 DI.
*/
@Injectable()
export class Data {
ipfsConnector: IpfsConnector;
constructor(public http: Http) {
console.log('Hello Data Provider');
this.ipfsConnector = IpfsConnector.getInstance();
console.log(this.ipfsConnector);
}
}
The last version of ipfs-connector has js-ipfs
as a dependency, even if I would like to use only go-ipfs. A nice thing would be to be able to choose the ipfs implementation.
On a side note, this is currently a problem for me because of a error in one of the dependencies that ultimately pull react (!) and break my app. I filed an issue there: https://github.com/ipld/js-ipld-eth-storage-trie/issues/3
└─┬ @akashaproject/[email protected]
└─┬ [email protected]
└─┬ [email protected]
└─┬ [email protected]
└─┬ [email protected]
└─┬ [email protected]
└── [email protected]
js-ipfs-api
is initialized with the first call to IpfsConnector.api() but need to get overwritten after the call to staticSetPorts(). I'm not sure what code path is used, but I end up with js-ipfs-api
doing call to the default port 5001 instead of the one I set up.
For reference, this is what I use to start the daemon:
const instance = IpfsConnector.getInstance()
const userDataPath = app.getPath('userData')
// set the download path for ipfs
instance.setBinPath(userDataPath)
// set the repo path
instance.setIpfsFolder(path.join(userDataPath,'ipfs-repo'))
// enable some experimental features
instance.setOption('args', [
'daemon',
'--enable-pubsub-experiment'
])
ports = {
api: await getPort(4280),
gateway: await getPort(4281),
swarm: await getPort(4282)
}
await instance.staticSetPorts(ports)
// start ipfs daemon and download binaries if needed
instance.start()
My recent Post's Images are not showing Properly.just showing as "Loading Image".
someone said my images are too heavy but its only 500~700kb.
i tried with 72kb image but still not working.
this is my post.
https://beta.akasha.world/#/0x9548169acd9cec9121d4fa4a8460d8797ee348f7/0xaf264c9572587a335c250f6267229597ee3188f5a84ecab1f02a9b59201866e8
After updating ipfs-connector to the latest version I expected it to download a newer version of IPFS since the expected version is different in the new version (0.4.9 instead of 0.4.7).
But that's not the case, IPFS 0.4.7 still get launched.
I guess you use something like this for akasha ?
const onServiceStarted = async () => {
const instance = IpfsConnector.getInstance()
const versionOK = await instance.checkVersion()
if(!versionOK) {
console.log("Need to update IPFS")
await instance.stop()
await instance.downloadManager.deleteBin()
instance.start()
return
}
....
}
Would it be better to have ipfs-connector deal with this ? It will break with a wrong version for the daemon anyway since you expect a specific API.
Hello,
Could you make a release with the new go-ipfs v0.4.14-rc1 ?
Thank you !
The example in the readme say that:
// start ipfs daemon and download binaries if needed
instance.start().then(...);
The .then(...)
part led me to think that IPFS was ready at that point. Actually the promise resolve as soon as the binary is spawned, so the API is not ready at this point and will throw an error.
What you need to do is to install some listener like this:
instance.on(ipfsEvents.SERVICE_STARTED, onServiceStarted)
Maybe the start() promise should resolve once the API is available ?
Hydrus is a client that allows for downloading of images from popular imageboards,
it also allows people to upload their tagged media database directly to IPFS.
Currently IPFS, and by extension Hydrus has no systems against leeching.
However, Ethereum does have such a system (Zero Knowledge Proofs).
It would be great if Hydrus and Akasha can collaborate on a common goal,
to fight against censorship, to protect public access of information and art.
https://hydrusnetwork.github.io/hydrus/
Currently, IPFS need to be started to change the port configuration but that cause problem when one of the port are already in use.
IPFS allow to change the port through the ipfs binary, when the daemon is not running:
// Change the api port config
ipfs config Addresses.API /ip4/127.0.0.1/tcp/5003
// Disable the gateway
ipfs config Addresses.Gateway ''
This could even be made config-less by using something like https://github.com/daaku/nodejs-freeport to find a free port.
Hi,
i try to use your project but i have a issue when use tsc command to transpile my project.
tsc --version
version 1.8.10
when try transpile my project a i have ths error
node_modules/@akashaproject/ipfs-connector/src/IpfsApiHelper.d.ts(2,1): error TS1084: Invalid 'reference' directive syntax.
node_modules/@akashaproject/ipfs-connector/src/IpfsApiHelper.d.ts(3,1): error TS1084: Invalid 'reference' directive syntax.
node_modules/@akashaproject/ipfs-connector/src/IpfsApiHelper.d.ts(10,21): error TS1005: '=' expected.
node_modules/@akashaproject/ipfs-connector/src/IpfsApiHelper.d.ts(10,32): error TS1005: ';' expected.
node_modules/@akashaproject/ipfs-connector/src/IpfsApiHelper.d.ts(11,21): error TS1005: '=' expected.
node_modules/@akashaproject/ipfs-connector/src/IpfsApiHelper.d.ts(11,31): error TS1005: ';' expected.
node_modules/@akashaproject/ipfs-connector/src/IpfsApiHelper.d.ts(12,21): error TS1005: '=' expected.
/node_modules/@akashaproject/ipfs-connector/src/IpfsApiHelper.d.ts(12,33): error TS1005: ';' expected.
/node_modules/@akashaproject/ipfs-connector/src/IpfsApiHelper.d.ts(13,21): error TS1005: '=' expected.
/node_modules/@akashaproject/ipfs-connector/src/IpfsApiHelper.d.ts(13,31): error TS1005: ';' expected.
/node_modules/@akashaproject/ipfs-connector/src/IpfsBin.d.ts(2,1): error TS1084: Invalid 'reference' directive syntax.
node_modules/@akashaproject/ipfs-connector/src/IpfsConnector.d.ts(2,1): error TS1084: Invalid 'reference' directive syntax.
node_modules/@akashaproject/ipfs-connector/src/IpfsConnector.d.ts(3,1): error TS1084: Invalid 'reference' directive syntax.
/node_modules/@akashaproject/ipfs-connector/src/IpfsConnector.d.ts(31,14): error TS1005: '=' expected.
node_modules/@akashaproject/ipfs-connector/src/IpfsConnector.d.ts(31,17): error TS1005: ';' expected.
node_modules/@akashaproject/ipfs-connector/typings/main.d.ts(1,29): error TS1005: '{' expected.
node_modules/@akashaproject/ipfs-connector/typings/main.d.ts(2,26): error TS1005: '{' expected.
node_modules/@akashaproject/ipfs-connector/typings/main.d.ts(3,22): error TS1005: '{' expected.
node_modules/@akashaproject/ipfs-connector/typings/main.d.ts(4,25): error TS1005: '{' expected.
thx in advance for your help.
your idea is very interesting and i hope solve my needs.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.