diff --git a/index.html b/index.html
index 8238b57..28bcb01 100644
--- a/index.html
+++ b/index.html
@@ -3,7 +3,7 @@
-
+
ArmCord
+
+ `;
+ document.body.appendChild(selectionElem);
+
+ document
+ .querySelectorAll(".desktop-capturer-selection__btn")
+ .forEach((button) => {
+ button.addEventListener("click", async () => {
+ try {
+ const id = button.getAttribute("data-id");
+ const source = sources.find((source) => source.id === id);
+ if (!source) {
+ throw new Error(`Source with id ${id} does not exist`);
+ }
+ const stream = await navigator.mediaDevices.getUserMedia({
+ audio: false,
+ video: {
+ mandatory: {
+ chromeMediaSource: "desktop",
+ chromeMediaSourceId: source.id,
+ },
+ },
+ });
+ resolve(stream);
+ selectionElem.remove();
+ } catch (err) {
+ console.error("Error selecting desktop capture source:", err);
+ reject(err);
+ }
+ });
+ });
+ document.querySelectorAll(".desktop-capturer-close").forEach((button) => {
+ button.addEventListener("click", () => {
+ selectionElem.remove();
+ });
+ });
+ } catch (err) {
+ console.error("Error displaying desktop capture sources:", err);
+ reject(err);
+ }
+ });
+};
+console.log("Desktop capturer has been preloaded 🎉️");
diff --git a/utils/updater.js b/utils/updater.js
new file mode 100644
index 0000000..cc38959
--- /dev/null
+++ b/utils/updater.js
@@ -0,0 +1,66 @@
+const electron = require("electron");
+const APP_VERSION = require("../package.json").version;
+
+/* IMPORTANT!
+ This url will need to be modified for yours */
+// The url that the application is going to query for new release
+const AUTO_UPDATE_URL =
+ 'https://api.dev.update.rocks/update/github.com/smartfrigde/armcord/stable/' + process.platform + '/' + APP_VERSION
+
+function init() {
+ if (process.platform === "linux") {
+ /* There is no auto update for linux however you can still
+ notify the user that a new update has been released
+ our service will return an answer with the latest version. */
+ console.log("Auto updates not available on linux");
+ } else {
+ initDarwinWin32();
+ }
+}
+
+function initDarwinWin32() {
+ electron.autoUpdater.on("error", (err) =>
+ console.error(`Update error: ${err.message}`)
+ );
+
+ electron.autoUpdater.on("checking-for-update", () =>
+ console.log("Checking for update")
+ );
+
+ electron.autoUpdater.on("update-available", () =>
+ console.log("Update available")
+ );
+
+ electron.autoUpdater.on("update-not-available", () =>
+ console.log("No update available")
+ );
+
+ // Ask the user if he wants to update if update is available
+ electron.autoUpdater.on(
+ "update-downloaded",
+ (event, releaseNotes, releaseName) => {
+ dialog.showMessageBox(
+ window,
+ {
+ type: "question",
+ buttons: ["Update", "Cancel"],
+ defaultId: 0,
+ message: `Version ${releaseName} is available, do you want to install it now?`,
+ title: "Update available",
+ },
+ (response) => {
+ if (response === 0) {
+ electron.autoUpdater.quitAndInstall();
+ }
+ }
+ );
+ }
+ );
+
+ electron.autoUpdater.setFeedURL(AUTO_UPDATE_URL);
+ electron.autoUpdater.checkForUpdates();
+}
+
+module.exports = {
+ init,
+};