mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Subject metadata cleanup (#13090)
This PR fixes some subject metadata-related issues that were missed in #13026.
This commit is contained in:
parent
69e27c8a82
commit
c03b6dd19b
@ -48,9 +48,9 @@ export const currentNetworkTxListSample = {
|
|||||||
|
|
||||||
export const subjectMetadata = {
|
export const subjectMetadata = {
|
||||||
"https://metamask.github.io": {
|
"https://metamask.github.io": {
|
||||||
|
"origin": "https://metamask.github.io",
|
||||||
"name": "E2E Test Dapp",
|
"name": "E2E Test Dapp",
|
||||||
"icon": "https://metamask.github.io/test-dapp/metamask-fox.svg",
|
"iconUrl": "https://metamask.github.io/test-dapp/metamask-fox.svg",
|
||||||
"lastUpdated": 1620723443380,
|
"subjectType": "website"
|
||||||
"host": "metamask.github.io"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1175,15 +1175,15 @@ const state = {
|
|||||||
subjectMetadata: {
|
subjectMetadata: {
|
||||||
'https://metamask.github.io': {
|
'https://metamask.github.io': {
|
||||||
name: 'E2E Test Dapp',
|
name: 'E2E Test Dapp',
|
||||||
icon: 'https://metamask.github.io/test-dapp/metamask-fox.svg',
|
origin: 'https://metamask.github.io',
|
||||||
lastUpdated: 1620723443380,
|
iconUrl: 'https://metamask.github.io/test-dapp/metamask-fox.svg',
|
||||||
host: 'metamask.github.io',
|
subjectType: 'website',
|
||||||
},
|
},
|
||||||
'https://app.uniswap.org': {
|
'https://app.uniswap.org': {
|
||||||
name: 'Uniswap',
|
name: 'Uniswap',
|
||||||
icon: './UNI.png',
|
origin: 'https://app.uniswap.org',
|
||||||
lastUpdated: 1620723443380,
|
iconUrl: './UNI.png',
|
||||||
host: 'app.uniswap.org',
|
subjectType: 'website',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
threeBoxSyncingAllowed: false,
|
threeBoxSyncingAllowed: false,
|
||||||
|
@ -2634,6 +2634,7 @@ export default class MetamaskController extends EventEmitter {
|
|||||||
subjectType = SUBJECT_TYPES.EXTENSION;
|
subjectType = SUBJECT_TYPES.EXTENSION;
|
||||||
this.subjectMetadataController.addSubjectMetadata(origin, {
|
this.subjectMetadataController.addSubjectMetadata(origin, {
|
||||||
extensionId: sender.id,
|
extensionId: sender.id,
|
||||||
|
subjectType: SUBJECT_TYPES.EXTENSION,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,10 +7,11 @@ import PermissionsConnectPermissionList from '../../permissions-connect-permissi
|
|||||||
export default class PermissionPageContainerContent extends PureComponent {
|
export default class PermissionPageContainerContent extends PureComponent {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
subjectMetadata: PropTypes.shape({
|
subjectMetadata: PropTypes.shape({
|
||||||
extensionId: PropTypes.string,
|
|
||||||
iconUrl: PropTypes.string,
|
|
||||||
name: PropTypes.string.isRequired,
|
name: PropTypes.string.isRequired,
|
||||||
origin: PropTypes.string.isRequired,
|
origin: PropTypes.string.isRequired,
|
||||||
|
subjectType: PropTypes.string.isRequired,
|
||||||
|
extensionId: PropTypes.string,
|
||||||
|
iconUrl: PropTypes.string,
|
||||||
}),
|
}),
|
||||||
selectedPermissions: PropTypes.object.isRequired,
|
selectedPermissions: PropTypes.object.isRequired,
|
||||||
selectedIdentities: PropTypes.array,
|
selectedIdentities: PropTypes.array,
|
||||||
|
@ -14,10 +14,11 @@ export default class PermissionPageContainer extends Component {
|
|||||||
request: PropTypes.object,
|
request: PropTypes.object,
|
||||||
requestMetadata: PropTypes.object,
|
requestMetadata: PropTypes.object,
|
||||||
targetSubjectMetadata: PropTypes.shape({
|
targetSubjectMetadata: PropTypes.shape({
|
||||||
extensionId: PropTypes.string,
|
|
||||||
icon: PropTypes.string,
|
|
||||||
name: PropTypes.string.isRequired,
|
name: PropTypes.string.isRequired,
|
||||||
origin: PropTypes.string.isRequired,
|
origin: PropTypes.string.isRequired,
|
||||||
|
subjectType: PropTypes.string.isRequired,
|
||||||
|
extensionId: PropTypes.string,
|
||||||
|
iconUrl: PropTypes.string,
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -21,8 +21,8 @@ export function useOriginMetadata(origin) {
|
|||||||
if (!origin) {
|
if (!origin) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
const url = new URL(origin);
|
|
||||||
|
|
||||||
|
const url = new URL(origin);
|
||||||
const minimumOriginMetadata = {
|
const minimumOriginMetadata = {
|
||||||
host: url.host,
|
host: url.host,
|
||||||
hostname: url.hostname,
|
hostname: url.hostname,
|
||||||
|
@ -50,9 +50,10 @@ const mapStateToProps = (state, ownProps) => {
|
|||||||
} else {
|
} else {
|
||||||
const targetUrl = new URL(origin);
|
const targetUrl = new URL(origin);
|
||||||
targetSubjectMetadata = {
|
targetSubjectMetadata = {
|
||||||
host: targetUrl.host,
|
|
||||||
name: targetUrl.hostname,
|
name: targetUrl.hostname,
|
||||||
origin,
|
origin,
|
||||||
|
iconUrl: null,
|
||||||
|
extensionId: null,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -50,6 +50,7 @@ PermissionsRedirect.propTypes = {
|
|||||||
subjectMetadata: PropTypes.shape({
|
subjectMetadata: PropTypes.shape({
|
||||||
extensionId: PropTypes.string,
|
extensionId: PropTypes.string,
|
||||||
iconUrl: PropTypes.string,
|
iconUrl: PropTypes.string,
|
||||||
|
subjectType: PropTypes.string,
|
||||||
name: PropTypes.string.isRequired,
|
name: PropTypes.string.isRequired,
|
||||||
origin: PropTypes.string.isRequired,
|
origin: PropTypes.string.isRequired,
|
||||||
}),
|
}),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user