include some DID info on the contact list page

This commit is contained in:
2024-08-31 13:05:59 -06:00
parent 5b9e767f88
commit fe627ed6b2
2 changed files with 20 additions and 0 deletions

1
src/db/tables/README.md Normal file
View File

@@ -0,0 +1 @@
Check the contact & settings export to see whether you want your new table to be included in it.

View File

@@ -160,6 +160,10 @@
>
<fa icon="circle-info" class="text-blue-500 ml-4" />
</router-link>
<span class="ml-4 text-sm overflow-hidden"
>{{ shortDid(contact.did) }}...</span
><!-- The first 18 characters of did:peer are the same. -->
</div>
<div id="ContactActions" class="flex gap-1.5 mt-2">
<div
@@ -1145,5 +1149,20 @@ export default class ContactsView extends Vue {
);
});
}
private shortDid(did: string) {
if (did.startsWith("did:peer:")) {
return (
did.substring(0, "did:peer:".length + 2) +
"..." +
did.substring("did:peer:".length + 18, "did:peer:".length + 25) +
"..."
);
} else if (did.startsWith("did:ethr:")) {
return did.substring(0, "did:ethr:".length + 9) + "...";
} else {
return did.substring(0, did.indexOf(":", 4) + 7) + "...";
}
}
}
</script>