After upload message regarding CORS and public gateways

This commit is contained in:
emizzle 2018-09-27 15:35:37 +10:00 committed by Pascal Precht
parent 967703a333
commit 9aa3217331
No known key found for this signature in database
GPG Key ID: 0EE28D8D6FD85D7D
4 changed files with 54 additions and 3 deletions

View File

@ -125,7 +125,8 @@ class IPFS {
let upload_ipfs = new UploadIPFS({
buildDir: self.buildDir || 'dist/',
storageConfig: self.storageConfig,
configIpfsBin: self.storageConfig.ipfs_bin || "ipfs"
configIpfsBin: self.storageConfig.ipfs_bin || "ipfs",
env: this.embark.env
});
upload_ipfs.deploy(cb);

View File

@ -10,6 +10,7 @@ class IPFS {
this.buildDir = options.buildDir || 'dist/';
this.storageConfig = options.storageConfig;
this.configIpfsBin = this.storageConfig.ipfs_bin || "ipfs";
this.env = options.env;
}
deploy(cb) {
@ -45,6 +46,30 @@ class IPFS {
function printUrls(dir_hash, callback) {
console.log(("=== " + __("DApp available at") + " http://localhost:8080/ipfs/" + dir_hash + "/").green);
console.log(("=== " + __("DApp available at") + " https://ipfs.infura.io/ipfs/" + dir_hash + "/").green);
if(self.env === 'development') {
console.log(("\n=== " +
"Blockchain must be running".bold +
" ===").yellow);
console.log((
"embark run".italic +
__(" or ") +
"embark blockchain".italic +
__(" must be running when the site is loaded to interact with the blockchain.\n")
).yellow);
console.log(("=== " +
"Usage with the public gateway".bold +
" ===").yellow);
console.log((
__("If you wish to load your development site from the public gateway (ipfs.infura.io), you will need to first update your CORS settings (") +
"config/blockchain.js > wsOrigins".italic +
__(" and ") +
"config/blockchain.js > rpcCorsDomain".italic +
__(") to allow ") +
"ipfs.infura.io".underline +
__(". If these were set to 'auto', they would now need to be set to ") +
"https://ipfs.infura.io,http://localhost:8000,http://localhost:8500,embark".underline +
".\n").yellow);
}
callback(null, dir_hash);
}

View File

@ -108,7 +108,8 @@ class Swarm {
buildDir: self.buildDir || 'dist/',
storageConfig: self.storageConfig,
providerUrl: self.providerUrl,
swarm: self.swarm
swarm: self.swarm,
env: self.embark.env
});
upload_swarm.deploy(cb);

View File

@ -7,6 +7,7 @@ class Swarm {
this.buildDir = options.buildDir || 'dist/';
this.swarm = options.swarm;
this.providerUrl = options.providerUrl;
this.env = options.env;
}
deploy(cb) {
@ -24,7 +25,30 @@ class Swarm {
}
console.log(("=== " + __("DApp available at") + ` ${self.providerUrl}/bzz:/${dir_hash}/index.html`).green);
console.log(("=== " + __("DApp available at") + ` https://swarm-gateways.net/bzz:/${dir_hash}/index.html`).green);
console.log(("=== " + __("NOTE: Swarm AND a blockchain node must be running for the dApp to work correctly (ie 'embark run')").yellow));
if(self.env === 'development') {
console.log(("\n=== " +
"Blockchain must be running".bold +
" ===").yellow);
console.log((
"embark run".italic +
__(" or ") +
"embark blockchain".italic +
__(" must be running when the site is loaded to interact with the blockchain.\n")
).yellow);
console.log(("=== " +
"Usage with the public gateway".bold +
" ===").yellow);
console.log((
__("If you wish to load your development site from the public gateway (swarm-gateways.net), you will need to first update your CORS settings (") +
"config/blockchain.js > wsOrigins".italic +
__(" and ") +
"config/blockchain.js > rpcCorsDomain".italic +
__(") to allow ") +
"swarm-gateways.net".underline +
__(". If these were set to 'auto', they would now need to be set to ") +
"https://swarm-gateways.net,http://localhost:8000,http://localhost:8500,embark".underline +
".\n").yellow);
}
callback(null, dir_hash);
}