Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
baas-ide
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
guxukai
baas-ide
Commits
272961f3
Commit
272961f3
authored
May 21, 2019
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix publish on swarm
parent
0a1bf379
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
25 additions
and
8 deletions
+25
-8
publishOnSwarm.js
src/app/contract/publishOnSwarm.js
+13
-2
basicReadOnlyExplorer.js
src/app/files/basicReadOnlyExplorer.js
+3
-3
file-explorer.js
src/app/files/file-explorer.js
+2
-1
file-explorer-styles.js
src/app/files/styles/file-explorer-styles.js
+6
-1
compile-tab.js
src/app/tabs/compile-tab.js
+1
-1
No files found.
src/app/contract/publishOnSwarm.js
View file @
272961f3
...
@@ -47,6 +47,11 @@ module.exports = (contract, fileManager, cb, swarmVerifiedPublishCallBack) => {
...
@@ -47,6 +47,11 @@ module.exports = (contract, fileManager, cb, swarmVerifiedPublishCallBack) => {
var
uploaded
=
[]
var
uploaded
=
[]
async
.
eachSeries
(
sources
,
function
(
item
,
cb
)
{
async
.
eachSeries
(
sources
,
function
(
item
,
cb
)
{
swarmVerifiedPublish
(
item
.
content
,
item
.
hash
,
(
error
,
result
)
=>
{
swarmVerifiedPublish
(
item
.
content
,
item
.
hash
,
(
error
,
result
)
=>
{
try
{
item
.
hash
=
result
.
url
.
match
(
'bzz-raw://(.+)'
)[
1
]
}
catch
(
e
)
{
item
.
hash
=
'<Metadata inconsistency> - '
+
item
.
fileName
}
if
(
!
error
&&
swarmVerifiedPublishCallBack
)
swarmVerifiedPublishCallBack
(
item
)
if
(
!
error
&&
swarmVerifiedPublishCallBack
)
swarmVerifiedPublishCallBack
(
item
)
item
.
output
=
result
item
.
output
=
result
uploaded
.
push
(
item
)
uploaded
.
push
(
item
)
...
@@ -55,10 +60,16 @@ module.exports = (contract, fileManager, cb, swarmVerifiedPublishCallBack) => {
...
@@ -55,10 +60,16 @@ module.exports = (contract, fileManager, cb, swarmVerifiedPublishCallBack) => {
cb
(
error
)
cb
(
error
)
})
})
},
()
=>
{
},
()
=>
{
swarmVerifiedPublish
(
JSON
.
stringify
(
metadata
),
''
,
(
error
,
result
)
=>
{
const
metadataContent
=
JSON
.
stringify
(
metadata
)
swarmVerifiedPublish
(
metadataContent
,
''
,
(
error
,
result
)
=>
{
try
{
contract
.
metadataHash
=
result
.
url
.
match
(
'bzz-raw://(.+)'
)[
1
]
}
catch
(
e
)
{
contract
.
metadataHash
=
'<Metadata inconsistency> - metadata.json'
}
if
(
!
error
&&
swarmVerifiedPublishCallBack
)
{
if
(
!
error
&&
swarmVerifiedPublishCallBack
)
{
swarmVerifiedPublishCallBack
({
swarmVerifiedPublishCallBack
({
content
:
contract
.
metadata
,
content
:
metadataContent
,
hash
:
contract
.
metadataHash
hash
:
contract
.
metadataHash
})
})
}
}
...
...
src/app/files/basicReadOnlyExplorer.js
View file @
272961f3
...
@@ -41,13 +41,13 @@ class BasicReadOnlyExplorer {
...
@@ -41,13 +41,13 @@ class BasicReadOnlyExplorer {
}
}
set
(
path
,
content
,
cb
)
{
set
(
path
,
content
,
cb
)
{
var
unprefixedPath
=
this
.
removePrefix
(
path
)
this
.
addReadOnly
(
path
,
content
)
this
.
addReadOnly
(
unprefixedPath
,
content
)
if
(
cb
)
cb
()
if
(
cb
)
cb
()
return
true
return
true
}
}
addReadOnly
(
path
,
content
,
rawPath
)
{
addReadOnly
(
path
,
content
,
rawPath
)
{
path
=
this
.
removePrefix
(
path
)
try
{
// lazy try to format JSON
try
{
// lazy try to format JSON
content
=
JSON
.
stringify
(
JSON
.
parse
(
content
),
null
,
'
\
t'
)
content
=
JSON
.
stringify
(
JSON
.
parse
(
content
),
null
,
'
\
t'
)
}
catch
(
e
)
{}
}
catch
(
e
)
{}
...
@@ -67,7 +67,7 @@ class BasicReadOnlyExplorer {
...
@@ -67,7 +67,7 @@ class BasicReadOnlyExplorer {
this
.
paths
[
this
.
type
][
split
]
=
{
isDirectory
:
folder
}
this
.
paths
[
this
.
type
][
split
]
=
{
isDirectory
:
folder
}
this
.
files
[
path
]
=
content
this
.
files
[
path
]
=
content
this
.
normalizedNames
[
rawPath
]
=
path
this
.
normalizedNames
[
rawPath
]
=
path
this
.
event
.
trigger
(
'fileAdded'
,
[
path
,
true
])
this
.
event
.
trigger
(
'fileAdded'
,
[
this
.
type
+
'/'
+
path
,
true
])
return
true
return
true
}
}
...
...
src/app/files/file-explorer.js
View file @
272961f3
...
@@ -158,7 +158,8 @@ function fileExplorer (localRegistry, files, menuItems) {
...
@@ -158,7 +158,8 @@ function fileExplorer (localRegistry, files, menuItems) {
return
yo
`
return
yo
`
<div class="
${
css
.
items
}
">
<div class="
${
css
.
items
}
">
<label
<label
class=
${
css
.
label
}
title="
${
data
.
path
}
"
class="
${
css
.
label
}
${
!
isRoot
?
css
.
leaf
:
''
}
"
data-path="
${
data
.
path
}
"
data-path="
${
data
.
path
}
"
style="
${
isRoot
?
'font-weight:bold;'
:
''
}
"
style="
${
isRoot
?
'font-weight:bold;'
:
''
}
"
onkeydown=
${
editModeOff
}
onkeydown=
${
editModeOff
}
...
...
src/app/files/styles/file-explorer-styles.js
View file @
272961f3
...
@@ -2,7 +2,12 @@ var csjs = require('csjs-inject')
...
@@ -2,7 +2,12 @@ var csjs = require('csjs-inject')
var
css
=
csjs
`
var
css
=
csjs
`
.label {
.label {
margin-top : 4px
margin-top : 4px;
}
.leaf {
overflow : hidden;
text-overflow : ellipsis;
width : 90%;
}
}
.fileexplorer {
.fileexplorer {
box-sizing : border-box;
box-sizing : border-box;
...
...
src/app/tabs/compile-tab.js
View file @
272961f3
...
@@ -259,7 +259,7 @@ class CompileTab extends CompilerApi {
...
@@ -259,7 +259,7 @@ class CompileTab extends CompilerApi {
modalDialogCustom
.
alert
(
yo
`<span>Metadata published successfully.<br> <pre>
${
result
}
</pre> </span>`
)
modalDialogCustom
.
alert
(
yo
`<span>Metadata published successfully.<br> <pre>
${
result
}
</pre> </span>`
)
}
}
},
(
item
)
=>
{
// triggered each time there's a new verified publish (means hash correspond)
},
(
item
)
=>
{
// triggered each time there's a new verified publish (means hash correspond)
this
.
swarmfileProvider
.
addReadOnly
(
item
.
hash
,
item
.
content
)
this
.
swarmfileProvider
.
addReadOnly
(
'swarm/'
+
item
.
hash
,
item
.
content
)
})
})
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment