Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
N
nodenogg-duplicate
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Procter Projects
nodenogg-duplicate
Commits
fabe1910
Commit
fabe1910
authored
Jun 21, 2020
by
Adam Procter
Browse files
Options
Downloads
Plain Diff
Merge branch 'IPFS2'
parents
efcccfcf
02cd91b2
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
app/src/components/IpfsInfo.vue
+53
-31
53 additions, 31 deletions
app/src/components/IpfsInfo.vue
app/src/experimental/ModeToolbar.vue
+6
-0
6 additions, 0 deletions
app/src/experimental/ModeToolbar.vue
app/src/experimental/icons/Icon.vue
+6
-6
6 additions, 6 deletions
app/src/experimental/icons/Icon.vue
with
65 additions
and
37 deletions
app/src/components/IpfsInfo.vue
+
53
−
31
View file @
fabe1910
...
@@ -4,8 +4,14 @@
...
@@ -4,8 +4,14 @@
<h3>
Testing Only
</h3>
<h3>
Testing Only
</h3>
<h1>
{{
status
}}
</h1>
<h1>
{{
status
}}
</h1>
<h2>
ID:
{{
id
}}
</h2>
<h2>
ID:
{{
id
}}
</h2>
<h2>
Agent version:
{{
agentVersion
}}
</h2>
<!--
<h2>
Agent version:
{{
agentVersion
}}
</h2>
-->
<h3>
Files :
{{
fileContents
}}
</h3>
<!--
<h3>
Files :
{{
fileContents
}}
</h3>
-->
<!--
<h3>
Path:
{{
path
}}
</h3>
-->
<div
v-if=
"path == 'ready'"
></div>
<div
v-else
>
<img
:src=
"'https://ipfs.io/ipfs/' + path"
/>
</div>
<!--
<img
:src=
"'data:image/jpg;base64,' + output"
/>
-->
<form>
<form>
<input
<input
...
@@ -18,8 +24,10 @@
...
@@ -18,8 +24,10 @@
<!--
<button
@
click=
"this.refs.selectedFile.click()"
>
Choose File
</button>
-->
<!--
<button
@
click=
"this.refs.selectedFile.click()"
>
Choose File
</button>
-->
<button
type=
"button"
@
click=
"saveIPFS"
>
Upload
</button>
<button
type=
"button"
@
click=
"saveIPFS"
>
Upload
</button>
<button
type=
"button"
@
click=
"getIPFS"
>
Get IPFS
</button>
<button
type=
"button"
@
click=
"getIPFS"
>
Get IPFS
</button>
<!--
<textarea>
https://ipfs.io/ipfs/
{{
path
}}
</textarea>
-->
<textarea
v-model=
"copytext"
></textarea>
</form>
</form>
</div>
</div>
</
template
>
</
template
>
...
@@ -28,8 +36,10 @@
...
@@ -28,8 +36,10 @@
import
VueIpfs
from
'
ipfs
'
import
VueIpfs
from
'
ipfs
'
const
ipfs
=
VueIpfs
.
create
()
const
ipfs
=
VueIpfs
.
create
()
var
node
var
node
var
file
var
output
const
fileContents
=
[]
var
path
=
'
ready
'
var
copytext
=
''
//const fileContents = []
// The below code should create an IPFS node to add files to
// The below code should create an IPFS node to add files to
export
default
{
export
default
{
...
@@ -38,9 +48,12 @@ export default {
...
@@ -38,9 +48,12 @@ export default {
return
{
return
{
status
:
'
Connecting to IPFS...
'
,
status
:
'
Connecting to IPFS...
'
,
id
:
''
,
id
:
''
,
agentVersion
:
''
,
//
agentVersion: '',
selectedFile
:
null
,
selectedFile
:
null
,
fileContents
:
this
.
fileContents
,
fileContents
:
this
.
fileContents
,
output
:
output
,
path
:
path
,
copytext
:
copytext
,
}
}
},
},
mounted
:
function
()
{
mounted
:
function
()
{
...
@@ -48,31 +61,6 @@ export default {
...
@@ -48,31 +61,6 @@ export default {
this
.
getIpfsNodeInfo
()
this
.
getIpfsNodeInfo
()
},
},
methods
:
{
methods
:
{
onFileSelected
(
event
)
{
this
.
selectedFile
=
event
.
target
.
files
[
0
]
},
saveIPFS
()
{
file
=
node
.
files
.
write
(
'
/
'
+
this
.
selectedFile
.
name
,
this
.
selectedFile
,
{
create
:
true
,
})
return
file
},
// getIPFS() {
// const resultPart = node.files.ls('/')
// fileContents.push(resultPart)
// // console.log(fileContents)
// return fileContents
// },
getIPFS
()
{
const
resultPart
=
node
.
files
.
read
(
'
/
'
)
fileContents
.
push
(
resultPart
)
// console.log(fileContents)
return
fileContents
},
async
getIpfsNodeInfo
()
{
async
getIpfsNodeInfo
()
{
try
{
try
{
// Await for ipfs node instance.
// Await for ipfs node instance.
...
@@ -90,6 +78,36 @@ export default {
...
@@ -90,6 +78,36 @@ export default {
this
.
status
=
`Error:
${
err
}
`
this
.
status
=
`Error:
${
err
}
`
}
}
},
},
onFileSelected
(
event
)
{
this
.
selectedFile
=
event
.
target
.
files
[
0
]
// this.saveIPFS()
},
async
saveIPFS
()
{
for
await
(
const
result
of
node
.
add
(
this
.
selectedFile
))
{
//console.log(result.cid.string)
this
.
fileContents
=
result
// console.log(this.fileContents.path)
// node.swarm.peers().then((a) => console.log(a))
// this.getIPFS()
}
},
async
getIPFS
()
{
for
await
(
const
newfile
of
node
.
get
(
this
.
fileContents
.
path
))
{
// console.log(newfile.path)
this
.
path
=
newfile
.
path
this
.
copyClipBoard
(
this
.
path
)
}
},
copyClipBoard
(
e
)
{
this
.
copytext
=
'
https://ipfs.io/ipfs/
'
+
e
// copyText.select()
// document.execCommand('copy')
console
.
log
(
copytext
)
},
},
},
}
}
</
script
>
</
script
>
...
@@ -105,6 +123,10 @@ export default {
...
@@ -105,6 +123,10 @@ export default {
margin-right
:
1em
;
margin-right
:
1em
;
}
}
img
{
width
:
50%
;
}
h1
{
h1
{
font-size
:
1em
;
font-size
:
1em
;
}
}
...
...
This diff is collapsed.
Click to expand it.
app/src/experimental/ModeToolbar.vue
+
6
−
0
View file @
fabe1910
...
@@ -42,7 +42,13 @@ export default {
...
@@ -42,7 +42,13 @@ export default {
if
(
mode
==
'
addNode
'
)
{
if
(
mode
==
'
addNode
'
)
{
this
.
$store
.
dispatch
(
'
addNode
'
)
this
.
$store
.
dispatch
(
'
addNode
'
)
}
}
if
(
mode
==
'
upload
'
)
{
// onFileSelected(event) {
// this.selectedFile = event.target.files[0]
// }
}
},
},
isActive
(
mode
)
{
isActive
(
mode
)
{
return
this
.
mode
===
mode
.
name
return
this
.
mode
===
mode
.
name
},
},
...
...
This diff is collapsed.
Click to expand it.
app/src/experimental/icons/Icon.vue
+
6
−
6
View file @
fabe1910
...
@@ -19,20 +19,20 @@ export default {
...
@@ -19,20 +19,20 @@ export default {
props
:
{
props
:
{
size
:
{
size
:
{
type
:
Number
,
type
:
Number
,
default
:
40
default
:
40
,
},
},
theme
:
{
theme
:
{
type
:
String
,
type
:
String
,
default
:
'
light
'
default
:
'
light
'
,
},
},
type
:
String
type
:
String
,
},
},
computed
:
{
computed
:
{
style
()
{
style
()
{
return
{
return
{
width
:
`
${
this
.
size
}
px`
,
width
:
`
${
this
.
size
}
px`
,
height
:
`
${
this
.
size
}
px`
height
:
`
${
this
.
size
}
px`
,
}
}
},
},
hasComponent
()
{
hasComponent
()
{
...
@@ -40,8 +40,8 @@ export default {
...
@@ -40,8 +40,8 @@ export default {
},
},
iconComponent
()
{
iconComponent
()
{
return
iconLibrary
[
this
.
type
]
return
iconLibrary
[
this
.
type
]
}
}
,
}
}
,
}
}
</
script
>
</
script
>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment