mirror of
https://github.com/Vencord/Vesktop.git
synced 2025-02-22 21:35:08 +00:00
arrpc: support OBS auto streamer mode (#822)
Co-authored-by: Vendicated <vendicated@riseup.net>
This commit is contained in:
parent
56442ae1e9
commit
7b5e1ed4da
6 changed files with 61 additions and 12 deletions
|
@ -26,7 +26,7 @@
|
||||||
"postinstall": "pnpm updateArrpcDB"
|
"postinstall": "pnpm updateArrpcDB"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"arrpc": "github:OpenAsar/arrpc#2234e9c9111f4c42ebcc3aa6a2215bfd979eef77",
|
"arrpc": "github:OpenAsar/arrpc#32c6c76a2129e42a786f17883b2e9f806f45dfb9",
|
||||||
"electron-updater": "^6.3.9"
|
"electron-updater": "^6.3.9"
|
||||||
},
|
},
|
||||||
"optionalDependencies": {
|
"optionalDependencies": {
|
||||||
|
|
|
@ -1,14 +1,27 @@
|
||||||
diff --git a/src/process/index.js b/src/process/index.js
|
diff --git a/src/process/index.js b/src/process/index.js
|
||||||
index 97ea6514b54dd9c5df588c78f0397d31ab5f882a..c2bdbd6aaa5611bc6ff1d993beeb380b1f5ec575 100644
|
index 389b0845256a34b4536d6da99edb00d17f13a6b4..f17a0ac687e9110ebfd33cb91fd2f6250d318643 100644
|
||||||
--- a/src/process/index.js
|
--- a/src/process/index.js
|
||||||
+++ b/src/process/index.js
|
+++ b/src/process/index.js
|
||||||
@@ -5,8 +5,7 @@ import fs from 'node:fs';
|
@@ -5,8 +5,20 @@ import fs from 'node:fs';
|
||||||
import { dirname, join } from 'path';
|
import { dirname, join } from 'path';
|
||||||
import { fileURLToPath } from 'url';
|
import { fileURLToPath } from 'url';
|
||||||
|
|
||||||
-const __dirname = dirname(fileURLToPath(import.meta.url));
|
-const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||||
-const DetectableDB = JSON.parse(fs.readFileSync(join(__dirname, 'detectable.json'), 'utf8'));
|
-const DetectableDB = JSON.parse(fs.readFileSync(join(__dirname, 'detectable.json'), 'utf8'));
|
||||||
+const DetectableDB = require('./detectable.json');
|
+const DetectableDB = require('./detectable.json');
|
||||||
|
+DetectableDB.push(
|
||||||
|
+ {
|
||||||
|
+ aliases: ["Obs"],
|
||||||
|
+ executables: [
|
||||||
|
+ { is_launcher: false, name: "obs", os: "linux" },
|
||||||
|
+ { is_launcher: false, name: "obs.exe", os: "win32" },
|
||||||
|
+ { is_launcher: false, name: "obs.app", os: "darwin" }
|
||||||
|
+ ],
|
||||||
|
+ hook: true,
|
||||||
|
+ id: "STREAMERMODE",
|
||||||
|
+ name: "OBS"
|
||||||
|
+ }
|
||||||
|
+);
|
||||||
|
|
||||||
import * as Natives from './native/index.js';
|
import * as Natives from './native/index.js';
|
||||||
const Native = Natives[process.platform];
|
const Native = Natives[process.platform];
|
||||||
|
|
13
pnpm-lock.yaml
generated
13
pnpm-lock.yaml
generated
|
@ -6,7 +6,7 @@ settings:
|
||||||
|
|
||||||
patchedDependencies:
|
patchedDependencies:
|
||||||
arrpc@3.5.0:
|
arrpc@3.5.0:
|
||||||
hash: biyukfa6dww2wxujy4eyvkhrti
|
hash: sczviclcirm3d4e2soabfniygq
|
||||||
path: patches/arrpc@3.5.0.patch
|
path: patches/arrpc@3.5.0.patch
|
||||||
|
|
||||||
importers:
|
importers:
|
||||||
|
@ -14,8 +14,8 @@ importers:
|
||||||
.:
|
.:
|
||||||
dependencies:
|
dependencies:
|
||||||
arrpc:
|
arrpc:
|
||||||
specifier: github:OpenAsar/arrpc#2234e9c9111f4c42ebcc3aa6a2215bfd979eef77
|
specifier: github:OpenAsar/arrpc#32c6c76a2129e42a786f17883b2e9f806f45dfb9
|
||||||
version: https://codeload.github.com/OpenAsar/arrpc/tar.gz/2234e9c9111f4c42ebcc3aa6a2215bfd979eef77(patch_hash=biyukfa6dww2wxujy4eyvkhrti)
|
version: https://codeload.github.com/OpenAsar/arrpc/tar.gz/32c6c76a2129e42a786f17883b2e9f806f45dfb9(patch_hash=sczviclcirm3d4e2soabfniygq)
|
||||||
electron-updater:
|
electron-updater:
|
||||||
specifier: ^6.3.9
|
specifier: ^6.3.9
|
||||||
version: 6.3.9
|
version: 6.3.9
|
||||||
|
@ -792,8 +792,8 @@ packages:
|
||||||
resolution: {integrity: sha512-BNoCY6SXXPQ7gF2opIP4GBE+Xw7U+pHMYKuzjgCN3GwiaIR09UUeKfheyIry77QtrCBlC0KK0q5/TER/tYh3PQ==}
|
resolution: {integrity: sha512-BNoCY6SXXPQ7gF2opIP4GBE+Xw7U+pHMYKuzjgCN3GwiaIR09UUeKfheyIry77QtrCBlC0KK0q5/TER/tYh3PQ==}
|
||||||
engines: {node: '>= 0.4'}
|
engines: {node: '>= 0.4'}
|
||||||
|
|
||||||
arrpc@https://codeload.github.com/OpenAsar/arrpc/tar.gz/2234e9c9111f4c42ebcc3aa6a2215bfd979eef77:
|
arrpc@https://codeload.github.com/OpenAsar/arrpc/tar.gz/32c6c76a2129e42a786f17883b2e9f806f45dfb9:
|
||||||
resolution: {tarball: https://codeload.github.com/OpenAsar/arrpc/tar.gz/2234e9c9111f4c42ebcc3aa6a2215bfd979eef77}
|
resolution: {tarball: https://codeload.github.com/OpenAsar/arrpc/tar.gz/32c6c76a2129e42a786f17883b2e9f806f45dfb9}
|
||||||
version: 3.5.0
|
version: 3.5.0
|
||||||
hasBin: true
|
hasBin: true
|
||||||
|
|
||||||
|
@ -2009,6 +2009,7 @@ packages:
|
||||||
|
|
||||||
lodash.isequal@4.5.0:
|
lodash.isequal@4.5.0:
|
||||||
resolution: {integrity: sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ==}
|
resolution: {integrity: sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ==}
|
||||||
|
deprecated: This package is deprecated. Use require('node:util').isDeepStrictEqual instead.
|
||||||
|
|
||||||
lodash.isplainobject@4.0.6:
|
lodash.isplainobject@4.0.6:
|
||||||
resolution: {integrity: sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA==}
|
resolution: {integrity: sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA==}
|
||||||
|
@ -3689,7 +3690,7 @@ snapshots:
|
||||||
get-intrinsic: 1.2.7
|
get-intrinsic: 1.2.7
|
||||||
is-array-buffer: 3.0.5
|
is-array-buffer: 3.0.5
|
||||||
|
|
||||||
arrpc@https://codeload.github.com/OpenAsar/arrpc/tar.gz/2234e9c9111f4c42ebcc3aa6a2215bfd979eef77(patch_hash=biyukfa6dww2wxujy4eyvkhrti):
|
arrpc@https://codeload.github.com/OpenAsar/arrpc/tar.gz/32c6c76a2129e42a786f17883b2e9f806f45dfb9(patch_hash=sczviclcirm3d4e2soabfniygq):
|
||||||
dependencies:
|
dependencies:
|
||||||
ws: 8.18.0
|
ws: 8.18.0
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
|
|
|
@ -4,23 +4,36 @@
|
||||||
* Copyright (c) 2023 Vendicated and Vencord contributors
|
* Copyright (c) 2023 Vendicated and Vencord contributors
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { findLazy, onceReady } from "@vencord/types/webpack";
|
import { findLazy, findStoreLazy, onceReady } from "@vencord/types/webpack";
|
||||||
import { FluxDispatcher, InviteActions } from "@vencord/types/webpack/common";
|
import { FluxDispatcher, InviteActions } from "@vencord/types/webpack/common";
|
||||||
import { IpcCommands } from "shared/IpcEvents";
|
import { IpcCommands } from "shared/IpcEvents";
|
||||||
|
|
||||||
import { onIpcCommand } from "./ipcCommands";
|
import { onIpcCommand } from "./ipcCommands";
|
||||||
import { Settings } from "./settings";
|
import { Settings } from "./settings";
|
||||||
|
|
||||||
|
const StreamerModeStore = findStoreLazy("StreamerModeStore");
|
||||||
|
|
||||||
const arRPC = Vencord.Plugins.plugins["WebRichPresence (arRPC)"] as any as {
|
const arRPC = Vencord.Plugins.plugins["WebRichPresence (arRPC)"] as any as {
|
||||||
handleEvent(e: MessageEvent): void;
|
handleEvent(e: MessageEvent): void;
|
||||||
};
|
};
|
||||||
|
|
||||||
onIpcCommand(IpcCommands.RPC_ACTIVITY, async data => {
|
onIpcCommand(IpcCommands.RPC_ACTIVITY, async jsonData => {
|
||||||
if (!Settings.store.arRPC) return;
|
if (!Settings.store.arRPC) return;
|
||||||
|
|
||||||
await onceReady;
|
await onceReady;
|
||||||
|
|
||||||
arRPC.handleEvent(new MessageEvent("message", { data }));
|
const data = JSON.parse(jsonData);
|
||||||
|
|
||||||
|
if (data.socketId === "STREAMERMODE" && StreamerModeStore.autoToggle) {
|
||||||
|
FluxDispatcher.dispatch({
|
||||||
|
type: "STREAMER_MODE_UPDATE",
|
||||||
|
key: "enabled",
|
||||||
|
value: data.activity?.application_id === "STREAMERMODE"
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
arRPC.handleEvent(new MessageEvent("message", { data: jsonData }));
|
||||||
});
|
});
|
||||||
|
|
||||||
onIpcCommand(IpcCommands.RPC_INVITE, async code => {
|
onIpcCommand(IpcCommands.RPC_INVITE, async code => {
|
||||||
|
|
|
@ -12,4 +12,5 @@ import "./hideVenmicInput";
|
||||||
import "./screenShareFixes";
|
import "./screenShareFixes";
|
||||||
import "./spellCheck";
|
import "./spellCheck";
|
||||||
import "./windowsTitleBar";
|
import "./windowsTitleBar";
|
||||||
|
import "./streamerMode";
|
||||||
import "./nativeFocus";
|
import "./nativeFocus";
|
||||||
|
|
21
src/renderer/patches/streamerMode.ts
Normal file
21
src/renderer/patches/streamerMode.ts
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
/*
|
||||||
|
* SPDX-License-Identifier: GPL-3.0
|
||||||
|
* Vesktop, a desktop app aiming to give you a snappier Discord Experience
|
||||||
|
* Copyright (c) 2023 Vendicated and Vencord contributors
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { addPatch } from "./shared";
|
||||||
|
|
||||||
|
addPatch({
|
||||||
|
patches: [
|
||||||
|
{
|
||||||
|
find: ".STREAMER_MODE_ENABLE,",
|
||||||
|
replacement: {
|
||||||
|
// remove if (platformEmbedded) check from streamer mode toggle
|
||||||
|
// eslint-disable-next-line no-useless-escape
|
||||||
|
match: /if\(\i\.\i\)(?=return.{0,200}?"autoToggle")/g,
|
||||||
|
replace: ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
Loading…
Add table
Reference in a new issue