Merge pull request #7100 from paritytech/jg-dapp-localUrl

Local dapp development URL
This commit is contained in:
Marek Kotewicz
2017-11-21 20:42:51 +01:00
committed by GitHub
11 changed files with 56 additions and 8 deletions

View File

@@ -110,7 +110,9 @@ export default class Dapp extends Component {
switch (app.type) {
case 'local':
src = `${dappsUrl}/${app.id}/`;
src = app.localUrl
? `${app.localUrl}?appId=${app.id}`
: `${dappsUrl}/${app.id}/`;
break;
case 'network':

View File

@@ -15,16 +15,19 @@
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
import Api from '@parity/api';
import qs from 'query-string';
import Web3 from 'web3';
import web3extensions from './web3.extensions';
function initProvider () {
const parts = window.location.pathname.split('/');
let appId = parts[1];
const path = window.location.pathname.split('/');
const query = qs.parse(window.location.search);
let appId = path[1] || query.appId;
if (appId === 'dapps') {
appId = parts[2];
appId = path[2];
} else if (!Api.util.isHex(appId)) {
appId = Api.util.sha3(appId);
}