this repo has no description
chromewebstore.google.com/detail/lmahbdngkjgdbcabpggmcjgemmjkafac
extension
atproto
1function load() {
2 chrome.storage.sync.get({ destinationDomain: "deer.social" }, (items) => {
3 document.getElementById("destination").value =
4 items.destinationDomain || "deer.social";
5 });
6}
7
8function isValidDomain(value) {
9 // Basic domain validation: letters, numbers, hyphens, dots; no protocol or path
10 if (!value) return false;
11 if (value.startsWith("http://") || value.startsWith("https://")) return false;
12 if (value.includes("/") || value.includes(" ")) return false;
13 const domainRegex = /^(?:[a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/;
14 return domainRegex.test(value);
15}
16
17function save() {
18 const input = document.getElementById("destination");
19 const status = document.getElementById("status");
20 const value = (input.value || "").trim();
21 if (!isValidDomain(value)) {
22 status.textContent =
23 ' Enter a valid domain like "deer.social" (no protocol).';
24 status.className = "hint error";
25 return;
26 }
27 chrome.storage.sync.set({ destinationDomain: value }, () => {
28 status.textContent =
29 " Saved. Redirects will now go to https://" + value + "/…";
30 status.className = "hint ok";
31 });
32}
33
34document.addEventListener("DOMContentLoaded", () => {
35 load();
36 document.getElementById("save").addEventListener("click", save);
37});