diff --git a/app/package.json b/app/package.json index 6263630e9b8260721c1342d55546445d4665e72f..a2b2d74d88991db14045a389b53b5642b50baf22 100644 --- a/app/package.json +++ b/app/package.json @@ -12,7 +12,7 @@ "core-js": "^3.6.5", "file-loader": "^6.0.0", "interactive-shape-recognition": "^1.0.1", - "ipfs": "^0.45.0", + "ipfs": "^0.46.0", "marked": "^1.1.0", "pouchdb": "^7.2.1", "pouchdb-find": "^7.2.1", diff --git a/app/src/components/IpfsInfo.vue b/app/src/components/IpfsInfo.vue new file mode 100644 index 0000000000000000000000000000000000000000..7b4fc9f5594ae88dbd21f0fe02cb3d55a770b170 --- /dev/null +++ b/app/src/components/IpfsInfo.vue @@ -0,0 +1,66 @@ +<template> + <div> + <h1>{{ status }}</h1> + <h2>ID: {{ id }}</h2> + <h2>Agent version: {{ agentVersion }}</h2> + + <form> + <input + type="file" + name="import_file" + v-on:change="selectedFile($event)" + /> + </form> + </div> +</template> + +<script> +import VueIpfs from 'ipfs' +const ipfs = VueIpfs.create() + +// var ipfs = VueIpfs +// TODO: WOULD BE TO USE add and data is what has come from Vue Form +// ipfs.add(data, [options]) + +// The below code should create an IPFS node to add files to +export default { + name: 'IpfsInfo', + data: function () { + return { + status: 'Connecting to IPFS...', + id: '', + agentVersion: '', + } + }, + mounted: function () { + console.log(VueIpfs) + this.getIpfsNodeInfo() + }, + methods: { + selectedFile(event) { + this.file = event.target.files[0] + console.log(this.file) + // ipfs.add(this.file) + }, + async getIpfsNodeInfo() { + try { + // Await for ipfs node instance. + const node = await ipfs + //console.log(ipfs) + // Call ipfs `id` method. + // Returns the identity of the Peer. + const { agentVersion, id } = await node.id() + this.agentVersion = agentVersion + this.id = id + // Set successful status text. + this.status = 'Connected to IPFS =)' + } catch (err) { + // Set error status text. + this.status = `Error: ${err}` + } + }, + }, +} +</script> + +<style lang="css" scoped></style> diff --git a/app/src/router/index.js b/app/src/router/index.js index cc1562b66a762d2f399fafe9d56e379ed9bdf6ac..bbde88509813f1a0c5f43baca263e0c355276de3 100644 --- a/app/src/router/index.js +++ b/app/src/router/index.js @@ -2,6 +2,7 @@ import Vue from 'vue' import VueRouter from 'vue-router' import Home from '../views/Home.vue' import Oldhome from '../views/Oldhome' +import Test from '../views/Test' Vue.use(VueRouter) @@ -16,6 +17,11 @@ export const routes = [ name: 'Old Home', component: Oldhome, }, + { + path: '/test', + name: 'Test', + component: Test, + }, { path: '/about', name: 'About', diff --git a/app/src/views/Test.vue b/app/src/views/Test.vue new file mode 100644 index 0000000000000000000000000000000000000000..9d3cd40785d888229aa5aecc1db24ad822ba0e3f --- /dev/null +++ b/app/src/views/Test.vue @@ -0,0 +1,18 @@ +<template> + <div> + <IpfsInfo /> + </div> +</template> + +<script> +import IpfsInfo from '@/components/IpfsInfo' +export default { + name: 'Test', + + components: { + IpfsInfo, + }, +} +</script> + +<style lang="css" scoped></style> diff --git a/app/yarn.lock b/app/yarn.lock index 9ef0afc555de08b38db4657ea4f012252ba7f985..4fa5c7779392188f614f3bc8bc203353de45b2e6 100644 --- a/app/yarn.lock +++ b/app/yarn.lock @@ -2193,10 +2193,6 @@ binary-extensions@^1.0.0: version "1.13.1" resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-1.13.1.tgz#598afe54755b2868a5330d2aff9d4ebb53209b65" -binary-querystring@^0.1.2: - version "0.1.2" - resolved "https://registry.yarnpkg.com/binary-querystring/-/binary-querystring-0.1.2.tgz#84a6f9ac21fcf2752e305f60397d445bb84551e9" - bindings@^1.2.1, bindings@^1.3.0, bindings@^1.5.0: version "1.5.0" resolved "https://registry.yarnpkg.com/bindings/-/bindings-1.5.0.tgz#10353c9e945334bc0511a6d90b38fbc7c9c504df" @@ -5520,9 +5516,9 @@ ipfs-http-client@^44.0.0: parse-duration "^0.1.2" stream-to-it "^0.2.0" -ipfs-http-client@^44.1.1: - version "44.1.1" - resolved "https://registry.yarnpkg.com/ipfs-http-client/-/ipfs-http-client-44.1.1.tgz#d5d72874dcc805fbaaca2e1ac3876cb33f2100a2" +ipfs-http-client@^44.2.0: + version "44.2.0" + resolved "https://registry.yarnpkg.com/ipfs-http-client/-/ipfs-http-client-44.2.0.tgz#d924c46b64689847cd46b5eac3669346ae48f03a" dependencies: abort-controller "^3.0.0" any-signal "^1.1.0" @@ -5609,27 +5605,27 @@ ipfs-repo@^3.0.0: proper-lockfile "^4.0.0" sort-keys "^4.0.0" -ipfs-unixfs-exporter@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/ipfs-unixfs-exporter/-/ipfs-unixfs-exporter-2.0.1.tgz#b182b759b23ca40683bab97f56c365c60d43333f" +ipfs-unixfs-exporter@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/ipfs-unixfs-exporter/-/ipfs-unixfs-exporter-2.0.2.tgz#ca36488d37e380ec53b49664bdee326622b191db" dependencies: buffer "^5.6.0" cids "^0.8.0" err-code "^2.0.0" hamt-sharding "^1.0.0" - ipfs-unixfs "^1.0.2" + ipfs-unixfs "^1.0.3" it-last "^1.0.1" multihashing-async "^0.8.0" -ipfs-unixfs-importer@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/ipfs-unixfs-importer/-/ipfs-unixfs-importer-2.0.1.tgz#586ce2569afc90733b02a66e4418bfffbb34f67d" +ipfs-unixfs-importer@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/ipfs-unixfs-importer/-/ipfs-unixfs-importer-2.0.2.tgz#1b568d1f23ec902a32ae8017f0a7456810102bd4" dependencies: bl "^4.0.0" buffer "^5.6.0" err-code "^2.0.0" hamt-sharding "^1.0.0" - ipfs-unixfs "^1.0.2" + ipfs-unixfs "^1.0.3" ipld-dag-pb "^0.18.5" it-all "^1.0.1" it-batch "^1.0.3" @@ -5639,9 +5635,9 @@ ipfs-unixfs-importer@^2.0.1: multihashing-async "^0.8.0" rabin-wasm "^0.1.1" -ipfs-unixfs@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/ipfs-unixfs/-/ipfs-unixfs-1.0.2.tgz#205c0f802ffcd141b6bf0a076e2d24ef79cee4d6" +ipfs-unixfs@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/ipfs-unixfs/-/ipfs-unixfs-1.0.3.tgz#59d46ab45b5ec211f93bdaff0b4827595350b8dc" dependencies: err-code "^2.0.0" protons "^1.2.0" @@ -5679,9 +5675,9 @@ ipfs-utils@^2.2.0, ipfs-utils@^2.2.2: node-fetch "^2.6.0" stream-to-it "^0.2.0" -ipfs@^0.45.0: - version "0.45.0" - resolved "https://registry.yarnpkg.com/ipfs/-/ipfs-0.45.0.tgz#4931a8be8b0a7fdbe6a3fad5cd5cb4e65c9b4091" +ipfs@^0.46.0: + version "0.46.0" + resolved "https://registry.yarnpkg.com/ipfs/-/ipfs-0.46.0.tgz#8d4e2b3a7e0a128dd597b50f340f6e4dbead6475" dependencies: "@hapi/ammo" "^3.1.2" "@hapi/boom" "^7.4.3" @@ -5692,7 +5688,6 @@ ipfs@^0.45.0: any-signal "^1.1.0" array-shuffle "^1.0.1" bignumber.js "^9.0.0" - binary-querystring "^0.1.2" bl "^4.0.2" bs58 "^4.0.1" buffer "^5.6.0" @@ -5717,12 +5712,12 @@ ipfs@^0.45.0: ipfs-bitswap "^1.0.0" ipfs-block-service "^0.17.1" ipfs-core-utils "^0.2.3" - ipfs-http-client "^44.1.1" + ipfs-http-client "^44.2.0" ipfs-http-response "^0.5.0" ipfs-repo "^3.0.0" - ipfs-unixfs "^1.0.2" - ipfs-unixfs-exporter "^2.0.1" - ipfs-unixfs-importer "^2.0.1" + ipfs-unixfs "^1.0.3" + ipfs-unixfs-exporter "^2.0.2" + ipfs-unixfs-importer "^2.0.2" ipfs-utils "^2.2.2" ipld "^0.26.2" ipld-bitcoin "^0.3.0" @@ -5755,8 +5750,8 @@ ipfs@^0.45.0: libp2p-crypto "^0.17.6" libp2p-delegated-content-routing "^0.4.4" libp2p-delegated-peer-routing "^0.4.2" - libp2p-floodsub "^0.20.0" - libp2p-gossipsub "^0.3.0" + libp2p-floodsub "^0.20.4" + libp2p-gossipsub "^0.3.1" libp2p-kad-dht "^0.18.7" libp2p-keychain "^0.6.0" libp2p-mdns "^0.13.1" @@ -6920,30 +6915,30 @@ libp2p-delegated-peer-routing@^0.4.2: peer-id "^0.13.11" peer-info "^0.17.5" -libp2p-floodsub@^0.20.0: - version "0.20.3" - resolved "https://registry.yarnpkg.com/libp2p-floodsub/-/libp2p-floodsub-0.20.3.tgz#5ef3fc3e733b06df216491b9891a7845224db98e" +libp2p-floodsub@^0.20.4: + version "0.20.4" + resolved "https://registry.yarnpkg.com/libp2p-floodsub/-/libp2p-floodsub-0.20.4.tgz#19ced0443f1b098c7406e50ff3d80bea613bf215" dependencies: async.nexttick "^0.5.2" buffer "^5.6.0" debug "^4.1.1" it-length-prefixed "^3.0.0" it-pipe "^1.0.1" - libp2p-pubsub "~0.4.0" + libp2p-pubsub "~0.4.5" p-map "^3.0.0" protons "^1.0.1" time-cache "^0.3.0" -libp2p-gossipsub@^0.3.0: - version "0.3.0" - resolved "https://registry.yarnpkg.com/libp2p-gossipsub/-/libp2p-gossipsub-0.3.0.tgz#d1fb6bce3dc236d7eb8ec2235531f9e6025d6cef" +libp2p-gossipsub@^0.3.1: + version "0.3.1" + resolved "https://registry.yarnpkg.com/libp2p-gossipsub/-/libp2p-gossipsub-0.3.1.tgz#ca5b1ad535f5e0816c0539c9df598e1b191d83a2" dependencies: buffer "^5.6.0" debug "^4.1.1" err-code "^2.0.0" it-length-prefixed "^3.0.0" it-pipe "^1.0.1" - libp2p-pubsub "~0.4.2" + libp2p-pubsub "~0.4.5" p-map "^4.0.0" peer-id "~0.13.3" peer-info "~0.17.0" @@ -7044,9 +7039,9 @@ libp2p-mplex@^0.9.3: it-pushable "^1.3.1" varint "^5.0.0" -libp2p-pubsub@~0.4.0, libp2p-pubsub@~0.4.2: - version "0.4.4" - resolved "https://registry.yarnpkg.com/libp2p-pubsub/-/libp2p-pubsub-0.4.4.tgz#ca2ee85dc0bd6f2b39ab38df522bf6d3f7a74336" +libp2p-pubsub@~0.4.5: + version "0.4.5" + resolved "https://registry.yarnpkg.com/libp2p-pubsub/-/libp2p-pubsub-0.4.5.tgz#a8c3daf9c92eb1e5b4bc017fe58f3b3a9b066943" dependencies: debug "^4.1.1" err-code "^2.0.0"