project-client/patches/arrpc@3.4.0.patch

59 lines
2.1 KiB
Diff
Raw Normal View History

2024-06-16 16:42:48 +00:00
diff --git a/src/process/index.js b/src/process/index.js
index 97ea651..28f0eb5 100644
2024-06-16 16:42:48 +00:00
--- a/src/process/index.js
+++ b/src/process/index.js
@@ -1,12 +1,7 @@
const rgb = (r, g, b, msg) => `\x1b[38;2;${r};${g};${b}m${msg}\x1b[0m`;
const log = (...args) => console.log(`[${rgb(88, 101, 242, 'arRPC')} > ${rgb(237, 66, 69, 'process')}]`, ...args);
2024-06-16 16:42:48 +00:00
-import fs from 'node:fs';
-import { dirname, join } from 'path';
-import { fileURLToPath } from 'url';
-
2024-06-16 16:42:48 +00:00
-const __dirname = dirname(fileURLToPath(import.meta.url));
-const DetectableDB = JSON.parse(fs.readFileSync(join(__dirname, 'detectable.json'), 'utf8'));
+const DetectableDB = require('./detectable.json');
import * as Natives from './native/index.js';
const Native = Natives[process.platform];
@@ -38,7 +33,7 @@ export default class ProcessServer {
const path = _path.toLowerCase().replaceAll('\\', '/');
const toCompare = [];
const splitPath = path.split('/');
- for (let i = 1; i < splitPath.length; i++) {
+ for (let i = 0; i < splitPath.length; i++) {
toCompare.push(splitPath.slice(-i).join('/'));
}
diff --git a/update_db.js b/update_db.js
index ed94923..3170685 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,21 @@ 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');
})
});