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
d0caf4c6
Commit
d0caf4c6
authored
Sep 09, 2021
by
bunsenstraat
Committed by
davidzagi93@gmail.com
Sep 14, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
always push to remix ipfs too
parent
31acac39
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
7 deletions
+16
-7
dgitProvider.js
apps/remix-ide/src/app/files/dgitProvider.js
+16
-7
No files found.
apps/remix-ide/src/app/files/dgitProvider.js
View file @
d0caf4c6
...
@@ -122,6 +122,7 @@ class DGitProvider extends Plugin {
...
@@ -122,6 +122,7 @@ class DGitProvider extends Plugin {
try
{
try
{
remotes
=
await
git
.
listRemotes
({
...
await
this
.
getGitConfig
()
})
remotes
=
await
git
.
listRemotes
({
...
await
this
.
getGitConfig
()
})
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
e
)
}
}
return
remotes
return
remotes
}
}
...
@@ -142,7 +143,7 @@ class DGitProvider extends Plugin {
...
@@ -142,7 +143,7 @@ class DGitProvider extends Plugin {
return
name
return
name
}
}
async
branches
(
input
)
{
async
branches
()
{
const
cmd
=
{
const
cmd
=
{
...
await
this
.
getGitConfig
()
...
await
this
.
getGitConfig
()
}
}
...
@@ -165,7 +166,9 @@ class DGitProvider extends Plugin {
...
@@ -165,7 +166,9 @@ class DGitProvider extends Plugin {
...
cmd
...
cmd
})
})
return
sha
return
sha
}
catch
(
e
)
{
}
}
catch
(
e
)
{
throw
new
Error
(
e
)
}
}
}
async
lsfiles
(
cmd
)
{
async
lsfiles
(
cmd
)
{
...
@@ -291,8 +294,8 @@ class DGitProvider extends Plugin {
...
@@ -291,8 +294,8 @@ class DGitProvider extends Plugin {
return
result
return
result
}
}
async
export
()
{
async
export
(
config
)
{
if
(
!
this
.
checkIpfsConfig
())
return
false
if
(
!
this
.
checkIpfsConfig
(
config
))
return
false
const
workspace
=
await
this
.
call
(
'filePanel'
,
'getCurrentWorkspace'
)
const
workspace
=
await
this
.
call
(
'filePanel'
,
'getCurrentWorkspace'
)
const
files
=
await
this
.
getDirectory
(
'/'
)
const
files
=
await
this
.
getDirectory
(
'/'
)
this
.
filesToSend
=
[]
this
.
filesToSend
=
[]
...
@@ -360,7 +363,7 @@ class DGitProvider extends Plugin {
...
@@ -360,7 +363,7 @@ class DGitProvider extends Plugin {
data
.
append
(
'pinataMetadata'
,
metadata
)
data
.
append
(
'pinataMetadata'
,
metadata
)
const
url
=
'https://api.pinata.cloud/pinning/pinFileToIPFS'
const
url
=
'https://api.pinata.cloud/pinning/pinFileToIPFS'
try
{
try
{
const
result
=
await
axios
await
axios
.
post
(
url
,
data
,
{
.
post
(
url
,
data
,
{
maxBodyLength
:
'Infinity'
,
maxBodyLength
:
'Infinity'
,
headers
:
{
headers
:
{
...
@@ -369,7 +372,8 @@ class DGitProvider extends Plugin {
...
@@ -369,7 +372,8 @@ class DGitProvider extends Plugin {
pinata_secret_api_key
:
pinataSecretApiKey
pinata_secret_api_key
:
pinataSecretApiKey
}
}
})
})
return
result
.
data
.
IpfsHash
// also commit to remix IPFS for availability after pinning to Pinata
return
await
this
.
export
(
this
.
remixIPFS
)
}
catch
(
error
)
{
}
catch
(
error
)
{
throw
new
Error
(
error
)
throw
new
Error
(
error
)
}
}
...
@@ -460,7 +464,12 @@ class DGitProvider extends Plugin {
...
@@ -460,7 +464,12 @@ class DGitProvider extends Plugin {
const
cid
=
cmd
.
cid
const
cid
=
cmd
.
cid
await
this
.
call
(
'filePanel'
,
'createWorkspace'
,
`workspace_
${
Date
.
now
()}
`
,
false
)
await
this
.
call
(
'filePanel'
,
'createWorkspace'
,
`workspace_
${
Date
.
now
()}
`
,
false
)
const
workspace
=
await
this
.
call
(
'filePanel'
,
'getCurrentWorkspace'
)
const
workspace
=
await
this
.
call
(
'filePanel'
,
'getCurrentWorkspace'
)
const
result
=
await
this
.
importIPFSFiles
(
this
.
globalIPFSConfig
,
cid
,
workspace
)
||
await
this
.
importIPFSFiles
(
this
.
ipfsconfig
,
cid
,
workspace
)
||
await
this
.
importIPFSFiles
(
this
.
remixIPFS
,
cid
,
workspace
)
let
result
if
(
cmd
.
local
)
{
result
=
await
this
.
importIPFSFiles
(
this
.
ipfsconfig
,
cid
,
workspace
)
}
else
{
result
=
await
this
.
importIPFSFiles
(
this
.
remixIPFS
,
cid
,
workspace
)
||
await
this
.
importIPFSFiles
(
this
.
ipfsconfig
,
cid
,
workspace
)
||
await
this
.
importIPFSFiles
(
this
.
globalIPFSConfig
,
cid
,
workspace
)
}
await
this
.
call
(
'fileManager'
,
'refresh'
)
await
this
.
call
(
'fileManager'
,
'refresh'
)
if
(
!
result
)
throw
new
Error
(
`Cannot pull files from IPFS at
${
cid
}
`
)
if
(
!
result
)
throw
new
Error
(
`Cannot pull files from IPFS at
${
cid
}
`
)
}
}
...
...
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