-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add a IpfsGet API access to actually write files on disk
Will not work, ipfs/kubo#1210
- Loading branch information
1 parent
db2dc57
commit d4e678e
Showing
8 changed files
with
66 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,6 +64,7 @@ void Ipfs::init() | |
|
||
void Ipfs::init_commands() | ||
{ | ||
get.init(); | ||
id.init(); | ||
pin.init(); | ||
swarm.init(); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#include "ipfsget.h" | ||
#include "ipfs/ipfs.h" | ||
|
||
#include <QUrl> | ||
#include <QUrlQuery> | ||
|
||
const QString API_COMMAND = "get"; | ||
|
||
IpfsGet::IpfsGet(QObject *parent) | ||
: AbstractIpfsCommand(parent) | ||
{ | ||
|
||
} | ||
|
||
void IpfsGet::write_on_disk(const IpfsHash &hash, const QString &path) | ||
{ | ||
QUrl url = Ipfs::instance().api_url(API_COMMAND); | ||
QUrlQuery query; | ||
|
||
query.addQueryItem("arg", hash.ToString()); | ||
query.addQueryItem("o", path); | ||
|
||
url.setQuery(query); | ||
Ipfs::instance().query(url, this); | ||
} | ||
|
||
void IpfsGet::init() {} | ||
|
||
void IpfsGet::on_reply(const QJsonObject *json) | ||
{ | ||
Q_UNUSED(json); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#ifndef IPFSGET_H | ||
#define IPFSGET_H | ||
|
||
#include "ipfs/abstractipfscommand.h" | ||
#include "ipfs/ipfshash.h" | ||
#include <QObject> | ||
|
||
class IpfsGet : public AbstractIpfsCommand | ||
{ | ||
Q_OBJECT | ||
public: | ||
explicit IpfsGet(QObject *parent = 0); | ||
virtual ~IpfsGet() {} | ||
|
||
/* Will not work, https://github.com/ipfs/go-ipfs/issues/1210 */ | ||
void write_on_disk(const IpfsHash &hash, const QString &path); | ||
|
||
// AbstractIpfsCommand interface | ||
public: | ||
void init(); | ||
void on_reply(const QJsonObject *json); | ||
}; | ||
|
||
#endif // IPFSGET_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters