|
|
@ -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 { |
|
|
|
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 { |
|
|
|
...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 { |
|
|
|
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 { |
|
|
|
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 { |
|
|
|
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) |
|
|
|
} |
|
|
|
} |
|
|
@ -458,7 +462,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}`) |
|
|
|
} |
|
|
|
} |
|
|
|