Skip to content

Commit

Permalink
Merge pull request #241 from perspect3vism/duplicateTrustedAgents
Browse files Browse the repository at this point in the history
Fix did copy & deduplicate trusted agents
  • Loading branch information
lucksus authored Feb 13, 2023
2 parents 435379f + 9f182cd commit a5b4f22
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 14 deletions.
4 changes: 3 additions & 1 deletion executor/src/core/RuntimeService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,9 @@ export default class RuntimeService {
}

getTrustedAgents(): string[] {
return [this.#did!, ...this.#config.trustedAgents, ..._get(this.trustedAgentsPath())]
let agents = [this.#did!, ...this.#config.trustedAgents, ..._get(this.trustedAgentsPath())]
let dedupAgents = [...new Set(agents)]
return dedupAgents
}

addKnowLinkLanguageTemplates(addresses: string[]): void {
Expand Down
18 changes: 5 additions & 13 deletions ui/src/components/Settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,10 @@ const Profile = (props: Props) => {
);
};

const copyProxy = () => {
copyTextToClipboard(proxy);
const copyText = (text: string) => {
copyTextToClipboard(text);
showNotification({
message: "Proxy endpoint copied to clipboard",
message: "Text copied to clipboard",
autoClose: 1000,
});
};
Expand All @@ -178,14 +178,6 @@ const Profile = (props: Props) => {
}
};

const copyUrl = () => {
copyTextToClipboard(url);
showNotification({
message: "URL copied to clipboard",
autoClose: 1000,
});
};

const setupProxy = async () => {
try {
const proxy: string = await invoke("setup_proxy", { subdomain: did });
Expand Down Expand Up @@ -218,7 +210,7 @@ const Profile = (props: Props) => {
<>
<ActionButton
title="Proxy URL"
onClick={copyProxy}
onClick={() => copyText(proxy)}
icon="clipboard"
/>
<ActionButton
Expand Down Expand Up @@ -297,7 +289,7 @@ const Profile = (props: Props) => {
<j-button
size="xs"
variant="transparent"
onClick={() => console.log("wow")}
onClick={() => copyText(e?.did)}
>
<j-icon size="xs" slot="end" name="clipboard"></j-icon>
</j-button>
Expand Down

0 comments on commit a5b4f22

Please sign in to comment.