This commit is contained in:
Florian Metz
2023-12-24 15:46:44 +01:00
parent 76cb9026f9
commit f7f04213de
2 changed files with 16 additions and 4 deletions

View File

@@ -2,7 +2,7 @@
"name": "premid",
"productName": "PreMiD",
"description": "Discord Rich Presence for web services.",
"version": "2.2.0",
"version": "2.2.1",
"repository": "https://github.com/PreMiD/PreMiD",
"scripts": {
"init": "tsc --skipLibCheck && tsc pkg util/prepare util/zip && devScript --copyOnly",

View File

@@ -4,7 +4,12 @@ import socketIo from "socket.io";
import { trayManager } from "../";
import { error, success } from "../util/debug";
import { clearActivity, getDiscordUser, rpcClients, setActivity } from "./discordManager";
import {
clearActivity,
getDiscordUser,
rpcClients,
setActivity
} from "./discordManager";
import { openFileDialog } from "./presenceDevManager";
import { update as updateSettings } from "./settingsManager";
@@ -25,8 +30,15 @@ export function init() {
serveClient: false,
allowEIO3: true,
allowRequest: (req, callback) => {
const noOriginHeader = req.headers.origin === undefined;
callback(null, noOriginHeader);
if (req.headers.origin === undefined) return callback(null, true);
//* 2.5.0+ only allows extensions to connect
if (
req.headers.origin.startsWith("chrome-extension://") ||
req.headers.origin.startsWith("moz-extension://")
)
return callback(null, true);
callback("Origin not allowed", false);
}
});
server.listen(3020, () => {