extract swarm hash

pull/3094/head
yann300 7 years ago
parent a57259dd12
commit a168813432
  1. 6
      src/app/compiler/compiler-imports.js

@ -28,9 +28,9 @@ module.exports = {
}) })
}, },
handleSwarmImport: function (url, cb) { handleSwarmImport: function (url, cleanUrl, cb) {
swarmgw.get(url, function (err, content) { swarmgw.get(url, function (err, content) {
cb(err, content, url) cb(err, content, cleanUrl)
}) })
}, },
@ -56,7 +56,7 @@ module.exports = {
handlers: function () { handlers: function () {
return [ return [
{ type: 'github', match: /^(https?:\/\/)?(www.)?github.com\/([^/]*\/[^/]*)\/(.*)/, handler: (match, cb) => { this.handleGithubCall(match[3], match[4], cb) } }, { type: 'github', match: /^(https?:\/\/)?(www.)?github.com\/([^/]*\/[^/]*)\/(.*)/, handler: (match, cb) => { this.handleGithubCall(match[3], match[4], cb) } },
{ type: 'swarm', match: /^(bzz[ri]?:\/\/?.*)$/, handler: (match, cb) => { this.handleSwarmImport(match[1], cb) } }, { type: 'swarm', match: /^(bzz[ri]?:\/\/?(.*))$/, handler: (match, cb) => { this.handleSwarmImport(match[1], match[2], cb) } },
{ type: 'ipfs', match: /^(ipfs:\/\/?.+)/, handler: (match, cb) => { this.handleIPFS(match[1], cb) } } { type: 'ipfs', match: /^(ipfs:\/\/?.+)/, handler: (match, cb) => { this.handleIPFS(match[1], cb) } }
] ]
}, },

Loading…
Cancel
Save