Skip to content

Commit

Permalink
allow old ens names to be replaced with minus characters (angular-cor…
Browse files Browse the repository at this point in the history
…e, angular-libs, smart-contracts)
  • Loading branch information
Tobias Winkler committed Jul 3, 2019
1 parent e43d7ac commit c0b410f
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 6 deletions.
5 changes: 5 additions & 0 deletions VERSIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@

### Deprecations

## Version 2.2.2
### Fixes
- allow old ens names to be replaced with minus characters (angular-core, angular-libs, smart-contracts)


## Version 2.2.1
### Fixes
- allow minus symbols for ens names
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -154,5 +154,5 @@
"serve": "gulp --cwd . --gulpfile gulp/serve.js serve",
"serve-build": "gulp --cwd . --gulpfile gulp/serve.js serve --build"
},
"version": "2.2.1"
"version": "2.2.2"
}
5 changes: 4 additions & 1 deletion src/app/dapp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,10 @@ function getVersionDBCPHashFromDAppVersion(requiredVersion: string, childENS: st
if (childDefinition && childDefinition) {
const originalVersion = requiredVersion;
const childVersions = childDefinition.versions || { };
childVersions[childDefinition.version] = childENS;
childVersions[childDefinition.version] = childENS
.replace(`angular-core`, `angularcore`)
.replace(`angular-libs`, `angularlibs`)
.replace(`smart-contracts`, `smartcontracts`);

const versionKeys = Object.keys(childVersions);
const splittedVersion = getSplittedVersion(requiredVersion);
Expand Down
6 changes: 4 additions & 2 deletions src/app/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,10 @@ evanGlobals.System.map['@evan.network/api-blockchain-core'] = `bcc.${ getDomainN
evanGlobals.System.map['@evan.network/dbcp'] = `bcc.${ getDomainName() }!dapp-content`;
evanGlobals.System.map['smart-contracts'] = `smartcontracts.${ getDomainName() }!dapp-content`;
evanGlobals.System.map['@evan.network/smart-contracts-core'] = `smartcontracts.${ getDomainName() }!dapp-content`;
System.map['@evan.network/ui-angular-libs'] = 'angularlibs.evan!dapp-content';
System.map['@evan.network/ui-angular-core'] = 'angularcore.evan!dapp-content';
evanGlobals.System.map['@evan.network/ui-angular-libs'] = 'angularlibs.evan!dapp-content';
evanGlobals.System.map['angular-libs'] = 'angularlibs.evan!dapp-content';
evanGlobals.System.map['@evan.network/ui-angular-core'] = 'angularcore.evan!dapp-content';
evanGlobals.System.map['angular-core'] = 'angularcore.evan!dapp-content';

/**
* Starts the whole dapp-browser.
Expand Down
11 changes: 9 additions & 2 deletions src/systemjs-plugins/ens.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,18 @@ try {
*/
const getDefinitionFromEns = function(ensAddress, domain) {
// remove domain from the end of the ensAddress to get the dapp name
let dappName = ensAddress.split('.');
let dappName = ensAddress
.replace(`angular-core`, `angularcore`)
.replace(`angular-libs`, `angularlibs`)
.replace(`smart-contracts`, `smartcontracts`)
.split('.');
dappName = dappName.slice(0, dappName.length - 1).join('.');

// get correct ens address and check if a cached ens is availabled
const validEnsAddress = ensAddress;
const validEnsAddress = ensAddress
.replace(`angular-core`, `angularcore`)
.replace(`angular-libs`, `angularlibs`)
.replace(`smart-contracts`, `smartcontracts`);
const cacheAvailable = ensCache[validEnsAddress] && ensCache[validEnsAddress] !== 'invalid';

// loading chain used to reload the ens data after 3 seconds, when cached
Expand Down

0 comments on commit c0b410f

Please sign in to comment.