mirror of
https://github.com/Vencord/Vesktop.git
synced 2025-02-22 13:25:10 +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"
|
||||
},
|
||||
"dependencies": {
|
||||
"arrpc": "github:OpenAsar/arrpc#2234e9c9111f4c42ebcc3aa6a2215bfd979eef77",
|
||||
"arrpc": "github:OpenAsar/arrpc#32c6c76a2129e42a786f17883b2e9f806f45dfb9",
|
||||
"electron-updater": "^6.3.9"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
|
|
|
@ -1,14 +1,27 @@
|
|||
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
|
||||
+++ 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 { fileURLToPath } from 'url';
|
||||
|
||||
-const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||
-const DetectableDB = JSON.parse(fs.readFileSync(join(__dirname, 'detectable.json'), 'utf8'));
|
||||
+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';
|
||||
const Native = Natives[process.platform];
|
||||
|
|
13
pnpm-lock.yaml
generated
13
pnpm-lock.yaml
generated
|
@ -6,7 +6,7 @@ settings:
|
|||
|
||||
patchedDependencies:
|
||||
arrpc@3.5.0:
|
||||
hash: biyukfa6dww2wxujy4eyvkhrti
|
||||
hash: sczviclcirm3d4e2soabfniygq
|
||||
path: patches/arrpc@3.5.0.patch
|
||||
|
||||
importers:
|
||||
|
@ -14,8 +14,8 @@ importers:
|
|||
.:
|
||||
dependencies:
|
||||
arrpc:
|
||||
specifier: github:OpenAsar/arrpc#2234e9c9111f4c42ebcc3aa6a2215bfd979eef77
|
||||
version: https://codeload.github.com/OpenAsar/arrpc/tar.gz/2234e9c9111f4c42ebcc3aa6a2215bfd979eef77(patch_hash=biyukfa6dww2wxujy4eyvkhrti)
|
||||
specifier: github:OpenAsar/arrpc#32c6c76a2129e42a786f17883b2e9f806f45dfb9
|
||||
version: https://codeload.github.com/OpenAsar/arrpc/tar.gz/32c6c76a2129e42a786f17883b2e9f806f45dfb9(patch_hash=sczviclcirm3d4e2soabfniygq)
|
||||
electron-updater:
|
||||
specifier: ^6.3.9
|
||||
version: 6.3.9
|
||||
|
@ -792,8 +792,8 @@ packages:
|
|||
resolution: {integrity: sha512-BNoCY6SXXPQ7gF2opIP4GBE+Xw7U+pHMYKuzjgCN3GwiaIR09UUeKfheyIry77QtrCBlC0KK0q5/TER/tYh3PQ==}
|
||||
engines: {node: '>= 0.4'}
|
||||
|
||||
arrpc@https://codeload.github.com/OpenAsar/arrpc/tar.gz/2234e9c9111f4c42ebcc3aa6a2215bfd979eef77:
|
||||
resolution: {tarball: 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/32c6c76a2129e42a786f17883b2e9f806f45dfb9}
|
||||
version: 3.5.0
|
||||
hasBin: true
|
||||
|
||||
|
@ -2009,6 +2009,7 @@ packages:
|
|||
|
||||
lodash.isequal@4.5.0:
|
||||
resolution: {integrity: sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ==}
|
||||
deprecated: This package is deprecated. Use require('node:util').isDeepStrictEqual instead.
|
||||
|
||||
lodash.isplainobject@4.0.6:
|
||||
resolution: {integrity: sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA==}
|
||||
|
@ -3689,7 +3690,7 @@ snapshots:
|
|||
get-intrinsic: 1.2.7
|
||||
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:
|
||||
ws: 8.18.0
|
||||
transitivePeerDependencies:
|
||||
|
|
|
@ -4,23 +4,36 @@
|
|||
* 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 { IpcCommands } from "shared/IpcEvents";
|
||||
|
||||
import { onIpcCommand } from "./ipcCommands";
|
||||
import { Settings } from "./settings";
|
||||
|
||||
const StreamerModeStore = findStoreLazy("StreamerModeStore");
|
||||
|
||||
const arRPC = Vencord.Plugins.plugins["WebRichPresence (arRPC)"] as any as {
|
||||
handleEvent(e: MessageEvent): void;
|
||||
};
|
||||
|
||||
onIpcCommand(IpcCommands.RPC_ACTIVITY, async data => {
|
||||
onIpcCommand(IpcCommands.RPC_ACTIVITY, async jsonData => {
|
||||
if (!Settings.store.arRPC) return;
|
||||
|
||||
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 => {
|
||||
|
|
|
@ -12,4 +12,5 @@ import "./hideVenmicInput";
|
|||
import "./screenShareFixes";
|
||||
import "./spellCheck";
|
||||
import "./windowsTitleBar";
|
||||
import "./streamerMode";
|
||||
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