Skip to content

Commit

Permalink
Provide display/copy links for all subjectAltNames.
Browse files Browse the repository at this point in the history
  • Loading branch information
coddingtonbear committed Jun 19, 2024
1 parent 1fadcf0 commit fd7b87d
Showing 1 changed file with 32 additions and 6 deletions.
38 changes: 32 additions & 6 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -274,10 +274,23 @@ class LocalRestApiSettingTab extends PluginSettingTab {
<td class="name">
Encrypted (HTTPS) API URL
</td>
<td class="url">
${secureUrl} <a href="javascript:navigator.clipboard.writeText('${secureUrl}')">(copy)</a>
</td>
`;
const secureUrlsTd = secureTr.createEl("td", { cls: "url" });
secureUrlsTd.innerHTML = `
${secureUrl} <a href="javascript:navigator.clipboard.writeText('${secureUrl}')">(copy)</a><br />
`;
if (this.plugin.settings.subjectAltNames) {
for (const name of this.plugin.settings.subjectAltNames.split("\n")) {
if (name.trim()) {
const altSecureUrl = `https://${name.trim()}:${
this.plugin.settings.port
}/`;
secureUrlsTd.innerHTML += `
${altSecureUrl} <a href="javascript:navigator.clipboard.writeText('${altSecureUrl}')">(copy)</a><br />
`;
}
}
}

const insecureTr = connectionUrlsTbody.createEl(
"tr",
Expand All @@ -302,10 +315,23 @@ class LocalRestApiSettingTab extends PluginSettingTab {
: ""
}
</td>
<td class="url">
${insecureUrl} <a href="javascript:navigator.clipboard.writeText('${insecureUrl}')">(copy)</a>
</td>
`;
const insecureUrlsTd = insecureTr.createEl("td", { cls: "url" });
insecureUrlsTd.innerHTML = `
${insecureUrl} <a href="javascript:navigator.clipboard.writeText('${insecureUrl}')">(copy)</a><br />
`;
if (this.plugin.settings.subjectAltNames) {
for (const name of this.plugin.settings.subjectAltNames.split("\n")) {
if (name.trim()) {
const altSecureUrl = `https://${name.trim()}:${
this.plugin.settings.insecurePort
}/`;
insecureUrlsTd.innerHTML += `
${altSecureUrl} <a href="javascript:navigator.clipboard.writeText('${altSecureUrl}')">(copy)</a><br />
`;
}
}
}

const seeMore = apiKeyDiv.createEl("p");
seeMore.innerHTML = `
Expand Down

0 comments on commit fd7b87d

Please sign in to comment.