Merge 630584a62c into d008f90399
				
					
				
			This commit is contained in:
		
						commit
						ffd3393cad
					
				
					 6 changed files with 88 additions and 17 deletions
				
			
		|  | @ -1,14 +1,50 @@ | ||||||
| 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 97ea651..29e964e 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';
 | @@ -1,12 +1,7 @@
 | ||||||
|  import { dirname, join } from 'path'; |  const rgb = (r, g, b, msg) => `\x1b[38;2;${r};${g};${b}m${msg}\x1b[0m`; | ||||||
|  import { fileURLToPath } from 'url'; |  const log = (...args) => console.log(`[${rgb(88, 101, 242, 'arRPC')} > ${rgb(237, 66, 69, 'process')}]`, ...args); | ||||||
|   |   | ||||||
|  | -import fs from 'node:fs';
 | ||||||
|  | -import { dirname, join } from 'path';
 | ||||||
|  | -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');
 | ||||||
|   |   | ||||||
|  import * as Natives from './native/index.js'; |  import * as Natives from './native/index.js'; | ||||||
|  const Native = Natives[process.platform]; |  const Native = Natives[process.platform]; | ||||||
|  | diff --git a/update_db.js b/update_db.js
 | ||||||
|  | index ed94923..24deace 100644
 | ||||||
|  | --- a/update_db.js
 | ||||||
|  | +++ b/update_db.js
 | ||||||
|  | @@ -1,5 +1,5 @@
 | ||||||
|  |  #!/usr/bin/env node | ||||||
|  | -import { createWriteStream, readFileSync } from 'fs';
 | ||||||
|  | +import { createWriteStream, readFileSync, writeFileSync } from 'fs';
 | ||||||
|  |  import { get } from 'https'; | ||||||
|  |   | ||||||
|  |  import { dirname, join } from 'path'; | ||||||
|  | @@ -25,5 +25,19 @@ get('https://discord.com/api/v9/applications/detectable', res => {
 | ||||||
|  |      const oldNames = current.map(x => x.name); | ||||||
|  |      const newNames = updated.map(x => x.name); | ||||||
|  |      console.log(newNames.filter(x => !oldNames.includes(x))); | ||||||
|  | +
 | ||||||
|  | +    // append obs for auto streammode
 | ||||||
|  | +    updated.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"
 | ||||||
|  | +    });
 | ||||||
|  | +    writeFileSync(path, JSON.stringify(updated), 'utf8');
 | ||||||
|  |    }) | ||||||
|  |  }); | ||||||
|  | \ No newline at end of file | ||||||
|  |  | ||||||
|  | @ -6,7 +6,7 @@ settings: | ||||||
| 
 | 
 | ||||||
| patchedDependencies: | patchedDependencies: | ||||||
|   arrpc@3.5.0: |   arrpc@3.5.0: | ||||||
|     hash: biyukfa6dww2wxujy4eyvkhrti |     hash: 5y62pyz5uz22dpw2tkbo3xeuo4 | ||||||
|     path: patches/arrpc@3.5.0.patch |     path: patches/arrpc@3.5.0.patch | ||||||
| 
 | 
 | ||||||
| importers: | importers: | ||||||
|  | @ -15,7 +15,7 @@ importers: | ||||||
|     dependencies: |     dependencies: | ||||||
|       arrpc: |       arrpc: | ||||||
|         specifier: github:OpenAsar/arrpc#5aadc307cb9bf4479f0a12364a253b07a77ace22 |         specifier: github:OpenAsar/arrpc#5aadc307cb9bf4479f0a12364a253b07a77ace22 | ||||||
|         version: https://codeload.github.com/OpenAsar/arrpc/tar.gz/5aadc307cb9bf4479f0a12364a253b07a77ace22(patch_hash=biyukfa6dww2wxujy4eyvkhrti) |         version: https://codeload.github.com/OpenAsar/arrpc/tar.gz/5aadc307cb9bf4479f0a12364a253b07a77ace22(patch_hash=5y62pyz5uz22dpw2tkbo3xeuo4) | ||||||
|       electron-updater: |       electron-updater: | ||||||
|         specifier: ^6.3.4 |         specifier: ^6.3.4 | ||||||
|         version: 6.3.4 |         version: 6.3.4 | ||||||
|  | @ -3214,7 +3214,7 @@ snapshots: | ||||||
| 
 | 
 | ||||||
|   app-builder-bin@5.0.0-alpha.7: {} |   app-builder-bin@5.0.0-alpha.7: {} | ||||||
| 
 | 
 | ||||||
|   app-builder-lib@25.0.5(dmg-builder@25.0.5(electron-builder-squirrel-windows@25.0.5(dmg-builder@25.0.5)))(electron-builder-squirrel-windows@25.0.5(dmg-builder@25.0.5)): |   app-builder-lib@25.0.5(dmg-builder@25.0.5(electron-builder-squirrel-windows@25.0.5))(electron-builder-squirrel-windows@25.0.5(dmg-builder@25.0.5)): | ||||||
|     dependencies: |     dependencies: | ||||||
|       '@develar/schema-utils': 2.6.5 |       '@develar/schema-utils': 2.6.5 | ||||||
|       '@electron/notarize': 2.3.2 |       '@electron/notarize': 2.3.2 | ||||||
|  | @ -3229,7 +3229,7 @@ snapshots: | ||||||
|       builder-util-runtime: 9.2.5 |       builder-util-runtime: 9.2.5 | ||||||
|       chromium-pickle-js: 0.2.0 |       chromium-pickle-js: 0.2.0 | ||||||
|       debug: 4.3.7 |       debug: 4.3.7 | ||||||
|       dmg-builder: 25.0.5(electron-builder-squirrel-windows@25.0.5(dmg-builder@25.0.5)) |       dmg-builder: 25.0.5(electron-builder-squirrel-windows@25.0.5) | ||||||
|       ejs: 3.1.10 |       ejs: 3.1.10 | ||||||
|       electron-builder-squirrel-windows: 25.0.5(dmg-builder@25.0.5) |       electron-builder-squirrel-windows: 25.0.5(dmg-builder@25.0.5) | ||||||
|       electron-publish: 25.0.3 |       electron-publish: 25.0.3 | ||||||
|  | @ -3350,7 +3350,7 @@ snapshots: | ||||||
|       is-array-buffer: 3.0.4 |       is-array-buffer: 3.0.4 | ||||||
|       is-shared-array-buffer: 1.0.3 |       is-shared-array-buffer: 1.0.3 | ||||||
| 
 | 
 | ||||||
|   arrpc@https://codeload.github.com/OpenAsar/arrpc/tar.gz/5aadc307cb9bf4479f0a12364a253b07a77ace22(patch_hash=biyukfa6dww2wxujy4eyvkhrti): |   arrpc@https://codeload.github.com/OpenAsar/arrpc/tar.gz/5aadc307cb9bf4479f0a12364a253b07a77ace22(patch_hash=5y62pyz5uz22dpw2tkbo3xeuo4): | ||||||
|     dependencies: |     dependencies: | ||||||
|       ws: 8.18.0 |       ws: 8.18.0 | ||||||
|     transitivePeerDependencies: |     transitivePeerDependencies: | ||||||
|  | @ -3744,9 +3744,9 @@ snapshots: | ||||||
|       '@types/react': 17.0.2 |       '@types/react': 17.0.2 | ||||||
|       moment: 2.30.1 |       moment: 2.30.1 | ||||||
| 
 | 
 | ||||||
|   dmg-builder@25.0.5(electron-builder-squirrel-windows@25.0.5(dmg-builder@25.0.5)): |   dmg-builder@25.0.5(electron-builder-squirrel-windows@25.0.5): | ||||||
|     dependencies: |     dependencies: | ||||||
|       app-builder-lib: 25.0.5(dmg-builder@25.0.5(electron-builder-squirrel-windows@25.0.5(dmg-builder@25.0.5)))(electron-builder-squirrel-windows@25.0.5(dmg-builder@25.0.5)) |       app-builder-lib: 25.0.5(dmg-builder@25.0.5(electron-builder-squirrel-windows@25.0.5))(electron-builder-squirrel-windows@25.0.5(dmg-builder@25.0.5)) | ||||||
|       builder-util: 25.0.3 |       builder-util: 25.0.3 | ||||||
|       builder-util-runtime: 9.2.5 |       builder-util-runtime: 9.2.5 | ||||||
|       fs-extra: 10.1.0 |       fs-extra: 10.1.0 | ||||||
|  | @ -3789,7 +3789,7 @@ snapshots: | ||||||
| 
 | 
 | ||||||
|   electron-builder-squirrel-windows@25.0.5(dmg-builder@25.0.5): |   electron-builder-squirrel-windows@25.0.5(dmg-builder@25.0.5): | ||||||
|     dependencies: |     dependencies: | ||||||
|       app-builder-lib: 25.0.5(dmg-builder@25.0.5(electron-builder-squirrel-windows@25.0.5(dmg-builder@25.0.5)))(electron-builder-squirrel-windows@25.0.5(dmg-builder@25.0.5)) |       app-builder-lib: 25.0.5(dmg-builder@25.0.5(electron-builder-squirrel-windows@25.0.5))(electron-builder-squirrel-windows@25.0.5(dmg-builder@25.0.5)) | ||||||
|       archiver: 5.3.2 |       archiver: 5.3.2 | ||||||
|       builder-util: 25.0.3 |       builder-util: 25.0.3 | ||||||
|       fs-extra: 10.1.0 |       fs-extra: 10.1.0 | ||||||
|  | @ -3800,11 +3800,11 @@ snapshots: | ||||||
| 
 | 
 | ||||||
|   electron-builder@25.0.5(electron-builder-squirrel-windows@25.0.5(dmg-builder@25.0.5)): |   electron-builder@25.0.5(electron-builder-squirrel-windows@25.0.5(dmg-builder@25.0.5)): | ||||||
|     dependencies: |     dependencies: | ||||||
|       app-builder-lib: 25.0.5(dmg-builder@25.0.5(electron-builder-squirrel-windows@25.0.5(dmg-builder@25.0.5)))(electron-builder-squirrel-windows@25.0.5(dmg-builder@25.0.5)) |       app-builder-lib: 25.0.5(dmg-builder@25.0.5(electron-builder-squirrel-windows@25.0.5))(electron-builder-squirrel-windows@25.0.5(dmg-builder@25.0.5)) | ||||||
|       builder-util: 25.0.3 |       builder-util: 25.0.3 | ||||||
|       builder-util-runtime: 9.2.5 |       builder-util-runtime: 9.2.5 | ||||||
|       chalk: 4.1.2 |       chalk: 4.1.2 | ||||||
|       dmg-builder: 25.0.5(electron-builder-squirrel-windows@25.0.5(dmg-builder@25.0.5)) |       dmg-builder: 25.0.5(electron-builder-squirrel-windows@25.0.5) | ||||||
|       fs-extra: 10.1.0 |       fs-extra: 10.1.0 | ||||||
|       is-ci: 3.0.1 |       is-ci: 3.0.1 | ||||||
|       lazy-val: 1.0.5 |       lazy-val: 1.0.5 | ||||||
|  |  | ||||||
|  | @ -4,6 +4,7 @@ | ||||||
|  * Copyright (c) 2023 Vendicated and Vencord contributors |  * Copyright (c) 2023 Vendicated and Vencord contributors | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
|  | import { execSync } from "child_process"; | ||||||
| import { BuildContext, BuildOptions, context } from "esbuild"; | import { BuildContext, BuildOptions, context } from "esbuild"; | ||||||
| import { copyFile } from "fs/promises"; | import { copyFile } from "fs/promises"; | ||||||
| 
 | 
 | ||||||
|  | @ -49,8 +50,15 @@ async function copyVenmic() { | ||||||
|     ]).catch(() => console.warn("Failed to copy venmic. Building without venmic support")); |     ]).catch(() => console.warn("Failed to copy venmic. Building without venmic support")); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | async function updateArrpcDb() { | ||||||
|  |     return Promise.all([execSync("node node_modules/arrpc/update_db.js")]).catch(() => | ||||||
|  |         console.warn("Error running update_db.js Auto streamermode will not work.") | ||||||
|  |     ); | ||||||
|  | } | ||||||
|  | 
 | ||||||
| await Promise.all([ | await Promise.all([ | ||||||
|     copyVenmic(), |     copyVenmic(), | ||||||
|  |     updateArrpcDb(), | ||||||
|     createContext({ |     createContext({ | ||||||
|         ...NodeCommonOpts, |         ...NodeCommonOpts, | ||||||
|         entryPoints: ["src/main/index.ts"], |         entryPoints: ["src/main/index.ts"], | ||||||
|  |  | ||||||
|  | @ -12,7 +12,7 @@ import "./themedSplash"; | ||||||
| console.log("read if cute :3"); | console.log("read if cute :3"); | ||||||
| 
 | 
 | ||||||
| export * as Components from "./components"; | export * as Components from "./components"; | ||||||
| import { findByPropsLazy, onceReady } from "@vencord/types/webpack"; | import { findByPropsLazy, findStore, onceReady } from "@vencord/types/webpack"; | ||||||
| import { Alerts, FluxDispatcher } from "@vencord/types/webpack/common"; | import { Alerts, FluxDispatcher } from "@vencord/types/webpack/common"; | ||||||
| 
 | 
 | ||||||
| import SettingsUi from "./components/settings/Settings"; | import SettingsUi from "./components/settings/Settings"; | ||||||
|  | @ -56,8 +56,14 @@ VesktopNative.arrpc.onActivity(async data => { | ||||||
|     if (!Settings.store.arRPC) return; |     if (!Settings.store.arRPC) return; | ||||||
| 
 | 
 | ||||||
|     await onceReady; |     await onceReady; | ||||||
| 
 |     const StreamerModeStore = findStore("StreamerModeStore"); | ||||||
|     arRPC.handleEvent(new MessageEvent("message", { data })); |     if (JSON.parse(data).socketId === "STREAMERMODE" && StreamerModeStore.autoToggle) { | ||||||
|  |         FluxDispatcher.dispatch({ | ||||||
|  |             type: "STREAMER_MODE_UPDATE", | ||||||
|  |             key: "enabled", | ||||||
|  |             value: JSON.parse(data).activity?.application_id === "STREAMERMODE" | ||||||
|  |         }); | ||||||
|  |     } else arRPC.handleEvent(new MessageEvent("message", { data })); | ||||||
| }); | }); | ||||||
| 
 | 
 | ||||||
| // TODO: remove soon
 | // TODO: remove soon
 | ||||||
|  |  | ||||||
|  | @ -12,3 +12,4 @@ import "./hideVenmicInput"; | ||||||
| import "./screenShareFixes"; | import "./screenShareFixes"; | ||||||
| import "./spellCheck"; | import "./spellCheck"; | ||||||
| import "./windowsTitleBar"; | import "./windowsTitleBar"; | ||||||
|  | import "./streamerMode"; | ||||||
|  |  | ||||||
							
								
								
									
										20
									
								
								src/renderer/patches/streamerMode.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								src/renderer/patches/streamerMode.ts
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,20 @@ | ||||||
|  | /* | ||||||
|  |  * 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: { | ||||||
|  |                 // eslint-disable-next-line no-useless-escape
 | ||||||
|  |                 match: /\i\.isPlatformEmbedded/g, | ||||||
|  |                 replace: "true" | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |     ] | ||||||
|  | }); | ||||||
		Loading…
	
		Reference in a new issue
	
	 Cookie
						Cookie