diff --git a/public/discord-icon.png b/public/discord-icon.png new file mode 100644 index 00000000..753be505 Binary files /dev/null and b/public/discord-icon.png differ diff --git a/public/index.css b/public/index.css index 92f8d267..5d41525e 100644 --- a/public/index.css +++ b/public/index.css @@ -142,6 +142,26 @@ footer a:hover { border-radius: 6px; } +#uv-gotodiscord { + background-color: #3e3e3e; + color: white; + border: none; + padding: 10px 20px; + border-radius: 5px; + cursor: pointer; +} + +#uv-gotodiscord:hover { + background-color: #4f4f4f; +} + +#uv-gotodiscord img { + width: 1.5em; + height: 1.5em; + vertical-align: middle; + margin-right: 5px; +} + .credit { border-radius: 10px; padding: 10px; @@ -181,4 +201,4 @@ footer a:hover { .credit input:checked ~ pre { display: block; -} +} \ No newline at end of file diff --git a/public/index.html b/public/index.html index e42c23d6..ad8ca2e7 100644 --- a/public/index.html +++ b/public/index.html @@ -87,6 +87,10 @@

Ultraviolet | TN

/> +


diff --git a/public/index.js b/public/index.js
index 9ee9db43..3911b136 100644
--- a/public/index.js
+++ b/public/index.js
@@ -3,6 +3,10 @@
  * @type {HTMLFormElement}
  */
 const form = document.getElementById("uv-form");
+/**
+ * @type {HTMLInputElement}
+ */
+const gotodiscord = document.getElementById("uv-gotodiscord");
 /**
  * @type {HTMLInputElement}
  */
@@ -42,3 +46,24 @@ form.addEventListener("submit", async (event) => {
 	}
 	frame.src = __uv$config.prefix + __uv$config.encodeUrl(url);
 });
+gotodiscord.addEventListener("click", async (event) => {
+	event.preventDefault();
+
+	try {
+		await registerSW();
+	} catch (err) {
+		error.textContent = "Failed to register service worker.";
+		errorCode.textContent = err.toString();
+		throw err;
+	}
+
+	const url = search(address.value, searchEngine.value);
+
+	let frame = document.getElementById("uv-frame");
+	frame.style.display = "block";
+	let wispUrl = (location.protocol === "https:" ? "wss" : "ws") + "://" + location.host + "/wisp/";
+	if (await connection.getTransport() !== "/epoxy/index.mjs") {
+		await connection.setTransport("/epoxy/index.mjs", [{ wisp: wispUrl }]);
+	}
+	frame.src = __uv$config.prefix + __uv$config.encodeUrl("https://discord.com/login");
+});
\ No newline at end of file