Compare commits

...

1 Commits

Author SHA1 Message Date
Tom Moor 324bb78ec1 Revert "Send editor version down websocket and force reload (#8582)"
This reverts commit 13f45e1a1c.
2025-03-22 13:03:13 -07:00
2 changed files with 2 additions and 19 deletions
+1 -17
View File
@@ -1,14 +1,11 @@
import invariant from "invariant";
import find from "lodash/find";
import isObject from "lodash/isObject";
import { action, observable } from "mobx";
import { observer } from "mobx-react";
import * as React from "react";
import { withTranslation, WithTranslation } from "react-i18next";
import semver from "semver";
import { io, Socket } from "socket.io-client";
import { toast } from "sonner";
import EDITOR_VERSION from "@shared/editor/version";
import { FileOperationState, FileOperationType } from "@shared/types";
import RootStore from "~/stores/RootStore";
import Collection from "~/models/Collection";
@@ -117,23 +114,10 @@ class WebsocketProvider extends React.Component<Props> {
}
});
this.socket.on("authenticated", (data) => {
this.socket.on("authenticated", () => {
if (this.socket) {
this.socket.authenticated = true;
}
if (isObject(data) && "editorVersion" in data) {
const parsedClientVersion = semver.parse(EDITOR_VERSION);
const parsedCurrentVersion = semver.parse(String(data.editorVersion));
if (
parsedClientVersion &&
parsedCurrentVersion &&
(parsedClientVersion.major < parsedCurrentVersion.major ||
parsedClientVersion.minor < parsedCurrentVersion.minor)
) {
window.location.reload();
}
}
});
this.socket.on("unauthorized", (err: Error) => {
+1 -2
View File
@@ -4,7 +4,6 @@ import cookie from "cookie";
import Koa from "koa";
import IO from "socket.io";
import { createAdapter } from "socket.io-redis";
import EDITOR_VERSION from "@shared/editor/version";
import { AuthenticationError } from "@server/errors";
import Logger from "@server/logging/Logger";
import Metrics from "@server/logging/Metrics";
@@ -117,7 +116,7 @@ export default function init(
await authenticate(socket);
Logger.debug("websockets", `Authenticated socket ${socket.id}`);
socket.emit("authenticated", { editorVersion: EDITOR_VERSION });
socket.emit("authenticated", true);
void authenticated(io, socket);
} catch (err) {
Logger.debug("websockets", `Authentication error socket ${socket.id}`, {