From 0bd294480dcd0a29bc3cd53a6934439fbc687ece Mon Sep 17 00:00:00 2001
From: smartfridge <37928912+smartfrigde@users.noreply.github.com>
Date: Sat, 19 Nov 2022 20:26:13 +0100
Subject: [PATCH 01/18] Add Windows ARM64 dev build
---
.github/workflows/dev.yml | 42 ++++++++++++++++++++++++++++++++++--
.github/workflows/winArm.yml | 38 --------------------------------
2 files changed, 40 insertions(+), 40 deletions(-)
delete mode 100644 .github/workflows/winArm.yml
diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml
index 0c540d3..389de9e 100644
--- a/.github/workflows/dev.yml
+++ b/.github/workflows/dev.yml
@@ -113,11 +113,44 @@ jobs:
with:
name: ArmCordWindows.zip
path: dist/ArmCord-3.1.0-win.zip
-
+ build-windowsOnARM:
+ runs-on: windows-latest
+
+ steps:
+ - uses: actions/setup-node@v3
+ with:
+ node-version: '18'
+
+ - name: Checkout code
+ uses: actions/checkout@v2
+
+ - name: Set architecture
+ run: set npm_config_arch=arm64
+
+ - uses: pnpm/action-setup@v2 # Install pnpm using packageManager key in package.json
+
+ - name: Install Node dependencies
+ run: pnpm install -g cargo-cp-artifact && pnpm install
+
+ - name: Install Electron-Builder
+ run: pnpm install -g electron-builder
+
+ - name: Replace the version number
+ run: (Get-Content src/utils.ts) -replace "\d\.\d\.\d", "DEV" | Out-File src/utils.ts
+
+ - name: Build
+ run: npm run build && electron-builder --windows zip --arm64
+ env:
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ - name: Upload artifact
+ uses: actions/upload-artifact@v2
+ with:
+ name: ArmCordWindowsArm64.zip
+ path: dist\ArmCord-3.1.0-arm64-win.zip
release:
runs-on: ubuntu-latest
- needs: [build-linux, build-mac, build-windows]
+ needs: [build-linux, build-mac, build-windows, build-windowsOnARM]
steps:
- name: Checkout code
@@ -142,6 +175,10 @@ jobs:
with:
name: ArmCordLinuxArm64.zip
path: linux
+ - uses: actions/download-artifact@v2
+ with:
+ name: ArmCordWindowsArm64.zip
+ path: windows
- name: Get some values needed for the release
id: vars
@@ -171,3 +208,4 @@ jobs:
linux/ArmCord-3.1.0-arm64.zip
macos/ArmCord-3.1.0-mac.zip
windows/ArmCord-3.1.0-win.zip
+ windows/ArmCord-3.1.0-arm64-win.zip
diff --git a/.github/workflows/winArm.yml b/.github/workflows/winArm.yml
deleted file mode 100644
index 3dd0dff..0000000
--- a/.github/workflows/winArm.yml
+++ /dev/null
@@ -1,38 +0,0 @@
-name: Windows on ARM
-on:
- push:
- branches:
- - dev
-jobs:
- build-windowsOnARM:
- runs-on: windows-latest
-
- steps:
- - uses: actions/setup-node@v3
- with:
- node-version: '18'
-
- - name: Checkout code
- uses: actions/checkout@v2
-
- - name: Install pnpm
- run: npm i -g pnpm && pnpm setup
- - name: Set architecture
- run: set npm_config_arch=arm64
- - name: Install Node dependencies
- run: pnpm install -g cargo-cp-artifact && pnpm install
-
- - name: Install Electron-Builder
- run: pnpm install -g electron-builder
-
- - name: Build
- run: npm run build && electron-builder --windows --arm64
- env:
- GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- - name: Delete unpacked builds
- run: Remove-Item -LiteralPath ".\dist\win-unpacked" -Force -Recurse
- - name: Upload artifact
- uses: actions/upload-artifact@v2
- with:
- name: ArmCordWindows
- path: dist/
\ No newline at end of file
From a0e0f6a516b7ba59e79de478489bf04f8464aeaa Mon Sep 17 00:00:00 2001
From: smartfridge <37928912+smartfrigde@users.noreply.github.com>
Date: Sat, 19 Nov 2022 23:15:05 +0100
Subject: [PATCH 02/18] Add experimental arrpc
---
README.md | 2 +-
log.txt | 146 +++++++++++++++
package.json | 1 +
pnpm-lock.yaml | 26 +++
src/arrpc/.gitignore | 2 +
src/arrpc/LICENSE | 21 +++
src/arrpc/README.md | 44 +++++
src/arrpc/package.json | 22 +++
src/arrpc/simple_mod.js | 31 ++++
src/arrpc/src/bridge.js | 8 +
src/arrpc/src/index.js | 11 ++
src/arrpc/src/server.js | 82 +++++++++
src/arrpc/src/transports/ipc.js | 255 ++++++++++++++++++++++++++
src/arrpc/src/transports/websocket.js | 124 +++++++++++++
src/preload/preload.ts | 37 +++-
src/window.ts | 4 +-
16 files changed, 813 insertions(+), 3 deletions(-)
create mode 100644 log.txt
create mode 100644 src/arrpc/.gitignore
create mode 100644 src/arrpc/LICENSE
create mode 100644 src/arrpc/README.md
create mode 100644 src/arrpc/package.json
create mode 100644 src/arrpc/simple_mod.js
create mode 100644 src/arrpc/src/bridge.js
create mode 100644 src/arrpc/src/index.js
create mode 100644 src/arrpc/src/server.js
create mode 100644 src/arrpc/src/transports/ipc.js
create mode 100644 src/arrpc/src/transports/websocket.js
diff --git a/README.md b/README.md
index c8d7f47..8f01108 100644
--- a/README.md
+++ b/README.md
@@ -13,7 +13,7 @@
- **Various mods built in**
- Enjoy Cumcord, GooseMod, Flicker, and their many features, or have a more vanilla experience, it's your choice!
+ Enjoy Vencord, Shelter and their many features, or have a more vanilla experience, it's your choice!
- **Made for Privacy™**
diff --git a/log.txt b/log.txt
new file mode 100644
index 0000000..be8622e
--- /dev/null
+++ b/log.txt
@@ -0,0 +1,146 @@
+
+> ArmCord@3.1.0 start
+> npm run build && electron ./ts-out/main.js
+
+
+> ArmCord@3.1.0 build
+> tsc && copyfiles -u 1 src/**/*.html src/**/**/*.css ts-out/ && copyfiles package.json ts-out/ && copyfiles assets/**/** ts-out/
+
+[Config manager] doneSetup: undefined
+[Config manager] performanceMode: none
+ArmCord has been run before. Skipping setup.
+No performance modes set
+[Config manager] windowStyle: default
+[Config manager] armcordCSP: true
+[Config manager] doneSetup: undefined
+[Config manager] customIcon: undefined
+Setting up CSP unstricter...
+[Config manager] trayIcon: default
+[Config manager] windowStyle: default
+[Config manager] windowStyle: default
+[Config manager] ignoreProtocolWarning: undefined
+[Config manager] clientName: undefined
+[Config manager] 0: undefined
+[Config manager] mods: vencord
+Downloading mod bundle
+[Config manager] mods: vencord
+[Config manager] mobileMode: false
+[Config manager] trayIcon: default
+[Mod loader] Loaded ArmCord Mod Loader made by Vendicated
+[Config manager] alternativePaste: false
+undefined
+[Config manager] inviteWebsocket: true
+[Config manager] skipSplash: undefined
+[[38;2;88;101;242marRPC[0m > [38;2;254;231;92mipc[0m] checking /run/user/1000/discord-ipc-0
+Error: connect ECONNREFUSED /run/user/1000/discord-ipc-0
+ at PipeConnectWrap.afterConnect [as oncomplete] (node:net:1187:16) {
+ errno: -111,
+ code: 'ECONNREFUSED',
+ syscall: 'connect',
+ address: '/run/user/1000/discord-ipc-0'
+}
+[Config manager] channel: stable
+[Config manager] mods: vencord
+[Config manager] automaticPatches: false
+[Config manager] channel: stable
+[[38;2;88;101;242marRPC[0m > [38;2;254;231;92mipc[0m] checked if socket is available: false - reason: timed out
+[[38;2;88;101;242marRPC[0m > [38;2;254;231;92mipc[0m] not available, trying again (attempt 1)
+[[38;2;88;101;242marRPC[0m > [38;2;254;231;92mipc[0m] checking /run/user/1000/discord-ipc-1
+Error: connect ENOENT /run/user/1000/discord-ipc-1
+ at PipeConnectWrap.afterConnect [as oncomplete] (node:net:1187:16) {
+ errno: -2,
+ code: 'ENOENT',
+ syscall: 'connect',
+ address: '/run/user/1000/discord-ipc-1'
+}
+[[38;2;88;101;242marRPC[0m > [38;2;254;231;92mipc[0m] checked if socket is available: false - reason: timed out
+[[38;2;88;101;242marRPC[0m > [38;2;254;231;92mipc[0m] not available, trying again (attempt 2)
+[[38;2;88;101;242marRPC[0m > [38;2;254;231;92mipc[0m] checking /run/user/1000/discord-ipc-2
+Error: connect ENOENT /run/user/1000/discord-ipc-2
+ at PipeConnectWrap.afterConnect [as oncomplete] (node:net:1187:16) {
+ errno: -2,
+ code: 'ENOENT',
+ syscall: 'connect',
+ address: '/run/user/1000/discord-ipc-2'
+}
+[[38;2;88;101;242marRPC[0m > [38;2;254;231;92mipc[0m] checked if socket is available: false - reason: timed out
+[[38;2;88;101;242marRPC[0m > [38;2;254;231;92mipc[0m] not available, trying again (attempt 3)
+[[38;2;88;101;242marRPC[0m > [38;2;254;231;92mipc[0m] checking /run/user/1000/discord-ipc-3
+Error: connect ENOENT /run/user/1000/discord-ipc-3
+ at PipeConnectWrap.afterConnect [as oncomplete] (node:net:1187:16) {
+ errno: -2,
+ code: 'ENOENT',
+ syscall: 'connect',
+ address: '/run/user/1000/discord-ipc-3'
+}
+[Window state manager] width: 800
+[Window state manager] height: 600
+[Window state manager] isMaximized: false
+[Window state manager] Not maximized.
+[Config manager] channel: stable
+[Config manager] mods: vencord
+[Config manager] automaticPatches: false
+[Config manager] channel: stable
+[Config manager] mobileMode: false
+[[38;2;88;101;242marRPC[0m > [38;2;254;231;92mipc[0m] checked if socket is available: false - reason: timed out
+[[38;2;88;101;242marRPC[0m > [38;2;254;231;92mipc[0m] not available, trying again (attempt 4)
+[[38;2;88;101;242marRPC[0m > [38;2;254;231;92mipc[0m] checking /run/user/1000/discord-ipc-4
+Error: connect ENOENT /run/user/1000/discord-ipc-4
+ at PipeConnectWrap.afterConnect [as oncomplete] (node:net:1187:16) {
+ errno: -2,
+ code: 'ENOENT',
+ syscall: 'connect',
+ address: '/run/user/1000/discord-ipc-4'
+}
+[[38;2;88;101;242marRPC[0m > [38;2;254;231;92mipc[0m] checked if socket is available: false - reason: timed out
+[[38;2;88;101;242marRPC[0m > [38;2;254;231;92mipc[0m] not available, trying again (attempt 5)
+[[38;2;88;101;242marRPC[0m > [38;2;254;231;92mipc[0m] checking /run/user/1000/discord-ipc-5
+Error: connect ENOENT /run/user/1000/discord-ipc-5
+ at PipeConnectWrap.afterConnect [as oncomplete] (node:net:1187:16) {
+ errno: -2,
+ code: 'ENOENT',
+ syscall: 'connect',
+ address: '/run/user/1000/discord-ipc-5'
+}
+[[38;2;88;101;242marRPC[0m > [38;2;254;231;92mipc[0m] checked if socket is available: false - reason: timed out
+[[38;2;88;101;242marRPC[0m > [38;2;254;231;92mipc[0m] not available, trying again (attempt 6)
+[[38;2;88;101;242marRPC[0m > [38;2;254;231;92mipc[0m] checking /run/user/1000/discord-ipc-6
+Error: connect ENOENT /run/user/1000/discord-ipc-6
+ at PipeConnectWrap.afterConnect [as oncomplete] (node:net:1187:16) {
+ errno: -2,
+ code: 'ENOENT',
+ syscall: 'connect',
+ address: '/run/user/1000/discord-ipc-6'
+}
+[[38;2;88;101;242marRPC[0m > [38;2;254;231;92mipc[0m] checked if socket is available: false - reason: timed out
+[[38;2;88;101;242marRPC[0m > [38;2;254;231;92mipc[0m] not available, trying again (attempt 7)
+[[38;2;88;101;242marRPC[0m > [38;2;254;231;92mipc[0m] checking /run/user/1000/discord-ipc-7
+Error: connect ENOENT /run/user/1000/discord-ipc-7
+ at PipeConnectWrap.afterConnect [as oncomplete] (node:net:1187:16) {
+ errno: -2,
+ code: 'ENOENT',
+ syscall: 'connect',
+ address: '/run/user/1000/discord-ipc-7'
+}
+[[38;2;88;101;242marRPC[0m > [38;2;254;231;92mipc[0m] checked if socket is available: false - reason: timed out
+[[38;2;88;101;242marRPC[0m > [38;2;254;231;92mipc[0m] not available, trying again (attempt 8)
+[[38;2;88;101;242marRPC[0m > [38;2;254;231;92mipc[0m] checking /run/user/1000/discord-ipc-8
+Error: connect ENOENT /run/user/1000/discord-ipc-8
+ at PipeConnectWrap.afterConnect [as oncomplete] (node:net:1187:16) {
+ errno: -2,
+ code: 'ENOENT',
+ syscall: 'connect',
+ address: '/run/user/1000/discord-ipc-8'
+}
+[[38;2;88;101;242marRPC[0m > [38;2;254;231;92mipc[0m] checked if socket is available: false - reason: timed out
+[[38;2;88;101;242marRPC[0m > [38;2;254;231;92mipc[0m] not available, trying again (attempt 9)
+[[38;2;88;101;242marRPC[0m > [38;2;254;231;92mipc[0m] checking /run/user/1000/discord-ipc-9
+Error: connect ENOENT /run/user/1000/discord-ipc-9
+ at PipeConnectWrap.afterConnect [as oncomplete] (node:net:1187:16) {
+ errno: -2,
+ code: 'ENOENT',
+ syscall: 'connect',
+ address: '/run/user/1000/discord-ipc-9'
+}
+[[38;2;88;101;242marRPC[0m > [38;2;254;231;92mipc[0m] checked if socket is available: false - reason: timed out
+[[38;2;88;101;242marRPC[0m > [38;2;254;231;92mipc[0m] not available, trying again (attempt 10)
diff --git a/package.json b/package.json
index 98ed1b3..905962c 100644
--- a/package.json
+++ b/package.json
@@ -43,6 +43,7 @@
"electron-context-menu": "github:ArmCord/electron-context-menu",
"extract-zip": "^2.0.1",
"node-fetch": "v2",
+ "arrpc": "file:./src/arrpc",
"os-locale": "^6.0.2",
"v8-compile-cache": "^2.3.0",
"ws": "^8.8.0"
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index d4dd7f3..671badb 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -5,6 +5,7 @@ specifiers:
'@types/node': ^17.0.42
'@types/node-fetch': ^2.6.2
'@types/ws': ^8.5.3
+ arrpc: file:./src/arrpc
chalk-cli: ^5.0.0
copyfiles: ^2.4.1
electron: ^20.1.0
@@ -21,6 +22,7 @@ specifiers:
dependencies:
'@pyke/vibe': github.com/pykeio/vibe/11984868ce9e007859ed91ff159c7f7f0a34e7ae_electron@20.3.1
+ arrpc: file:src/arrpc
electron-context-menu: github.com/ArmCord/electron-context-menu/280c81398c02a063f46e3285a9708d8db1a7ce32
extract-zip: 2.0.1
node-fetch: 2.6.7
@@ -2188,6 +2190,19 @@ packages:
/wrappy/1.0.2:
resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==}
+ /ws/8.11.0:
+ resolution: {integrity: sha512-HPG3wQd9sNQoT9xHyNCXoDUa+Xw/VevmY9FoHyQ+g+rrMn4j6FB4np7Z0OhdTgjx6MgQLK7jwSy1YecU1+4Asg==}
+ engines: {node: '>=10.0.0'}
+ peerDependencies:
+ bufferutil: ^4.0.1
+ utf-8-validate: ^5.0.2
+ peerDependenciesMeta:
+ bufferutil:
+ optional: true
+ utf-8-validate:
+ optional: true
+ dev: false
+
/ws/8.9.0:
resolution: {integrity: sha512-Ja7nszREasGaYUYCI2k4lCKIRTt+y7XuqVoHR44YpI49TtryyqbqvDMn5eqfW7e6HzTukDRIsXqzVHScqRcafg==}
engines: {node: '>=10.0.0'}
@@ -2267,6 +2282,17 @@ packages:
engines: {node: '>=10'}
dev: true
+ file:src/arrpc:
+ resolution: {directory: src/arrpc, type: directory}
+ name: arrpc
+ version: 0.1.0
+ dependencies:
+ ws: 8.11.0
+ transitivePeerDependencies:
+ - bufferutil
+ - utf-8-validate
+ dev: false
+
github.com/ArmCord/electron-context-menu/280c81398c02a063f46e3285a9708d8db1a7ce32:
resolution: {tarball: https://codeload.github.com/ArmCord/electron-context-menu/tar.gz/280c81398c02a063f46e3285a9708d8db1a7ce32}
name: electron-context-menu
diff --git a/src/arrpc/.gitignore b/src/arrpc/.gitignore
new file mode 100644
index 0000000..25c8fdb
--- /dev/null
+++ b/src/arrpc/.gitignore
@@ -0,0 +1,2 @@
+node_modules
+package-lock.json
\ No newline at end of file
diff --git a/src/arrpc/LICENSE b/src/arrpc/LICENSE
new file mode 100644
index 0000000..f5617f1
--- /dev/null
+++ b/src/arrpc/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2022 OpenAsar
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/src/arrpc/README.md b/src/arrpc/README.md
new file mode 100644
index 0000000..3106e64
--- /dev/null
+++ b/src/arrpc/README.md
@@ -0,0 +1,44 @@
+# arRPC
+
+arRPC is an open source implementation of Discord's half-documented local RPC servers for their desktop client. This open source implementation purely in NodeJS allows it to be used in many places where it is otherwise impossible to do: Discord web and alternative clients like Armcord/etc. It opens a simple bridge WebSocket server which messages the JSON of exactly what to dispatch with in the client with no extra processing needed, allowing small and simple mods or plugins. **It is currently in alpha and is very WIP, expect bugs, etc.**
+
+### How to try
+
+1. Clone repo
+2. Run server with `node src` (use new Node)
+3. Open Discord in browser with CSP disabled (using an extension)
+4. Run content of [`simple_mod.js`](simple_mod.js) in console
+5. Use an app/thing with RPC
+6. Hope it works, if not report bugs :)
+
+## Supported
+
+### Transports
+
+- [x] WebSocket Server
+ - [x] JSON
+ - [ ] Erlpack
+- [ ] HTTP Server
+- [x] IPC
+
+### Commands
+
+- [x] DISPATCH
+- [ ] AUTHORIZE
+- [ ] AUTHENTICATE
+- [ ] GET_GUILD
+- [ ] GET_GUILDS
+- [ ] GET_CHANNEL
+- [ ] GET_CHANNELS
+- [ ] SUBSCRIBE
+- [ ] UNSUBSCRIBE
+- [ ] SET_USER_VOICE_SETTINGS
+- [ ] SELECT_VOICE_CHANNEL
+- [ ] GET_SELECTED_VOICE_CHANNEL
+- [ ] SELECT_TEXT_CHANNEL
+- [ ] GET_VOICE_SETTINGS
+- [ ] SET_VOICE_SETTINGS
+- [ ] SET_CERTIFIED_DEVICES
+- [x] SET_ACTIVITY
+- [ ] SEND_ACTIVITY_JOIN_INVITE
+- [ ] CLOSE_ACTIVITY_REQUEST
diff --git a/src/arrpc/package.json b/src/arrpc/package.json
new file mode 100644
index 0000000..ca74963
--- /dev/null
+++ b/src/arrpc/package.json
@@ -0,0 +1,22 @@
+{
+ "name": "arrpc",
+ "version": "0.1.0",
+ "description": "Open Discord RPC server for atypical setups",
+ "main": "src/index.js",
+ "scripts": {
+ "test": "echo \"Error: no test specified\" && exit 1"
+ },
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/OpenAsar/arrpc.git"
+ },
+ "author": "OpenAsar",
+ "license": "MIT",
+ "bugs": {
+ "url": "https://github.com/OpenAsar/arrpc/issues"
+ },
+ "homepage": "https://github.com/OpenAsar/arrpc#readme",
+ "dependencies": {
+ "ws": "^8.11.0"
+ }
+}
diff --git a/src/arrpc/simple_mod.js b/src/arrpc/simple_mod.js
new file mode 100644
index 0000000..5b4bc8b
--- /dev/null
+++ b/src/arrpc/simple_mod.js
@@ -0,0 +1,31 @@
+const dispatch = (() => {
+ let Dispatcher;
+
+ return function (event) {
+ Dispatcher ??= window.Vencord?.Webpack.Common.FluxDispatcher;
+ if (!Dispatcher) {
+ const cache = webpackChunkdiscord_app.push([[Symbol()], {}, (w) => w]).c;
+ webpackChunkdiscord_app.pop();
+
+ outer: for (const id in cache) {
+ const mod = cache[id].exports;
+ for (const exp in mod) {
+ if (mod[exp]?.isDispatching) {
+ Dispatcher = mod[exp];
+ break outer;
+ }
+ }
+ }
+ }
+ if (!Dispatcher) return; // failed to find, your choice if and how u wanna handle this
+
+ return Dispatcher.dispatch(event);
+ };
+})();
+const ws = new WebSocket("ws://localhost:1337"); // connect to arRPC bridge
+ws.onmessage = (x) => {
+ msg = JSON.parse(x.data);
+ console.log(msg);
+
+ dispatch({type: "LOCAL_ACTIVITY_UPDATE", ...msg}); // set RPC status
+};
diff --git a/src/arrpc/src/bridge.js b/src/arrpc/src/bridge.js
new file mode 100644
index 0000000..2e7d82f
--- /dev/null
+++ b/src/arrpc/src/bridge.js
@@ -0,0 +1,8 @@
+const ws = require("ws");
+const send = (msg) => {
+ wss.clients.forEach((x) => x.send(JSON.stringify(msg)));
+};
+
+const wss = new ws.WebSocketServer({port: 1337});
+
+module.exports = {send};
diff --git a/src/arrpc/src/index.js b/src/arrpc/src/index.js
new file mode 100644
index 0000000..b8d34f8
--- /dev/null
+++ b/src/arrpc/src/index.js
@@ -0,0 +1,11 @@
+var __importDefault =
+ (this && this.__importDefault) ||
+ function (mod) {
+ return mod && mod.__esModule ? mod : {default: mod};
+ };
+const server = require("./server.js");
+global.fetch = __importDefault(require("node-fetch"));
+async function start() {
+ const x = await new server.RPCServer();
+}
+start();
diff --git a/src/arrpc/src/server.js b/src/arrpc/src/server.js
new file mode 100644
index 0000000..4a4a782
--- /dev/null
+++ b/src/arrpc/src/server.js
@@ -0,0 +1,82 @@
+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(87, 242, 135, "bridge")}]`, ...args);
+
+const IPCServer = require("./transports/ipc.js");
+
+const WSServer = require("./transports/websocket.js");
+const Bridge = require("./bridge.js");
+
+const lookupAsset = (name, assets) => {
+ return assets.find((x) => x.name === name)?.id;
+};
+class RPCServer {
+ constructor() {
+ return (async () => {
+ this.onConnection = this.onConnection.bind(this);
+ this.onMessage = this.onMessage.bind(this);
+
+ this.ipc = await new IPCServer.IPCServer(this.onMessage, this.onConnection);
+ this.ws = await new WSServer.WSServer(this.onMessage, this.onConnection);
+ })();
+ }
+
+ onConnection(socket) {
+ socket.send({
+ cmd: "DISPATCH",
+ evt: "READY",
+ data: {}
+ });
+ }
+
+ async onMessage(socket, {cmd, args}) {
+ switch (cmd) {
+ case "SET_ACTIVITY":
+ if (!socket.application) {
+ socket.application = await (
+ await fetch(`https://discord.com/api/v9/oauth2/applications/${socket.clientId}/rpc`)
+ ).json();
+ socket.application.assets = await (
+ await fetch(`https://discord.com/api/v9/oauth2/applications/${socket.clientId}/assets`)
+ ).json();
+ log("fetched app info for", socket.clientId, socket.application);
+ }
+
+ const {activity, pid} = args;
+ const {buttons, timestamps, instance} = activity;
+
+ const metadata = {};
+ const extra = {};
+ if (buttons) {
+ metadata.button_urls = buttons.map((x) => x.url);
+ extra.buttons = buttons.map((x) => x.label);
+ }
+
+ if (timestamps)
+ for (const x in timestamps) {
+ if (Date.now().toString().length - timestamps[x].toString().length > 2)
+ timestamps[x] = Math.floor(1e3 * timestamps[x]);
+ }
+
+ if (activity.assets?.large_image)
+ activity.assets.large_image = lookupAsset(activity.assets.large_image, socket.application.assets);
+ if (activity.assets?.small_image)
+ activity.assets.small_image = lookupAsset(activity.assets.small_image, socket.application.assets);
+
+ Bridge.send({
+ activity: {
+ name: socket.application.name,
+ application_id: socket.application.id,
+ type: 0,
+ metadata,
+ flags: instance ? 1 << 0 : 0,
+ ...activity,
+ ...extra
+ },
+ pid
+ });
+
+ break;
+ }
+ }
+}
+module.exports = {RPCServer};
diff --git a/src/arrpc/src/transports/ipc.js b/src/arrpc/src/transports/ipc.js
new file mode 100644
index 0000000..3ef8fb4
--- /dev/null
+++ b/src/arrpc/src/transports/ipc.js
@@ -0,0 +1,255 @@
+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(254, 231, 92, "ipc")}]`, ...args);
+const path = require("path");
+const {platform, env} = require("process");
+const {unlinkSync} = require("fs");
+const {createServer, createConnection} = require("net");
+
+const SOCKET_PATH =
+ platform === "win32"
+ ? "\\\\?\\pipe\\discord-ipc"
+ : path.join(env.XDG_RUNTIME_DIR || env.TMPDIR || env.TMP || env.TEMP || "/tmp", "discord-ipc");
+
+const Types = {
+ HANDSHAKE: 0,
+ FRAME: 1,
+ CLOSE: 2,
+ PING: 3,
+ PONG: 4
+};
+
+const CloseCodes = {
+ CLOSE_NORMAL: 1000,
+ CLOSE_UNSUPPORTED: 1003,
+ CLOSE_ABNORMAL: 1006
+};
+
+const ErrorCodes = {
+ INVALID_CLIENTID: 4000,
+ INVALID_ORIGIN: 4001,
+ RATELIMITED: 4002,
+ TOKEN_REVOKED: 4003,
+ INVALID_VERSION: 4004,
+ INVALID_ENCODING: 4005
+};
+
+let uniqueId = 0;
+
+const encode = (type, data) => {
+ data = JSON.stringify(data);
+ const dataSize = Buffer.byteLength(data);
+
+ const buf = Buffer.alloc(dataSize + 8);
+ buf.writeInt32LE(type, 0); // type
+ buf.writeInt32LE(dataSize, 4); // data size
+ buf.write(data, 8, dataSize); // data
+
+ return buf;
+};
+
+const read = (socket) => {
+ let resp = socket.read(8);
+ if (!resp) return;
+
+ resp = Buffer.from(resp);
+ const type = resp.readInt32LE(0);
+ const dataSize = resp.readInt32LE(4);
+
+ if (type < 0 || type >= Object.keys(Types).length) throw new Error("invalid type");
+
+ let data = socket.read(dataSize);
+ if (!data) throw new Error("failed reading data");
+
+ data = JSON.parse(Buffer.from(data).toString());
+
+ switch (type) {
+ case Types.PING:
+ socket.emit("ping", data);
+ socket.write(encode(Types.PONG, data));
+ break;
+
+ case Types.PONG:
+ socket.emit("pong", data);
+ break;
+
+ case Types.HANDSHAKE:
+ if (socket._handshook) throw new Error("already handshook");
+
+ socket._handshook = true;
+ socket.emit("handshake", data);
+ break;
+
+ case Types.FRAME:
+ if (!socket._handshook) throw new Error("need to handshake first");
+
+ socket.emit("request", data);
+ break;
+
+ case Types.CLOSE:
+ socket.end();
+ socket.destroy();
+ break;
+ }
+
+ read(socket);
+};
+
+const socketIsAvailable = async (socket) => {
+ socket.pause();
+ socket.on("readable", () => {
+ try {
+ read(socket);
+ } catch (e) {
+ log("error whilst reading", e);
+
+ socket.end(
+ encode(Types.CLOSE, {
+ code: CloseCodes.CLOSE_UNSUPPORTED,
+ message: e.message
+ })
+ );
+ socket.destroy();
+ }
+ });
+
+ const stop = () => {
+ try {
+ socket.end();
+ socket.destroy();
+ } catch {}
+ };
+
+ const possibleOutcomes = Promise.race([
+ new Promise((res) => socket.on("error", res)), // errore
+ new Promise((res, rej) => socket.on("pong", () => rej("socket ponged"))), // ponged
+ new Promise((res, rej) => setTimeout(() => rej("timed out"), 1000)) // timed out
+ ]).then(
+ () => true,
+ (e) => e
+ );
+
+ socket.write(encode(Types.PING, ++uniqueId));
+
+ const outcome = await possibleOutcomes;
+ stop();
+ log("checked if socket is available:", outcome === true, outcome === true ? "" : `- reason: ${outcome}`);
+
+ return outcome === true;
+};
+
+const getAvailableSocket = async (tries = 0) => {
+ if (tries > 9) {
+ throw new Error("ran out of tries to find socket", tries);
+ }
+
+ const path = SOCKET_PATH + "-" + tries;
+ const socket = createConnection(path);
+
+ log("checking", path);
+
+ if (await socketIsAvailable(socket)) {
+ if (platform !== "win32")
+ try {
+ unlinkSync(path);
+ } catch {}
+
+ return path;
+ }
+
+ log(`not available, trying again (attempt ${tries + 1})`);
+ return getAvailableSocket(tries + 1);
+};
+
+class IPCServer {
+ constructor(messageHandler, connectionHandler) {
+ return new Promise(async (res) => {
+ this.messageHandler = messageHandler;
+ this.connectionHandler = connectionHandler;
+
+ this.onConnection = this.onConnection.bind(this);
+ this.onMessage = this.onMessage.bind(this);
+
+ const server = createServer(this.onConnection);
+ server.on("error", (e) => {
+ log("server error", e);
+ });
+
+ const socketPath = await getAvailableSocket();
+ server.listen(socketPath, () => {
+ log("listening at", socketPath);
+ this.server = server;
+
+ res(this);
+ });
+ });
+ }
+
+ onConnection(socket) {
+ log("new connection!");
+
+ socket.pause();
+ socket.on("readable", () => {
+ try {
+ read(socket);
+ } catch (e) {
+ log("error whilst reading", e);
+
+ socket.end(
+ encode(Types.CLOSE, {
+ code: CloseCodes.CLOSE_UNSUPPORTED,
+ message: e.message
+ })
+ );
+ socket.destroy();
+ }
+ });
+
+ socket.once("handshake", (params) => {
+ log("handshake:", params);
+
+ const ver = params.v ?? 1;
+ const clientId = params.client_id ?? "";
+
+ if (ver !== 1) {
+ log("unsupported version requested", ver);
+
+ socket.close(ErrorCodes.INVALID_VERSION);
+ return;
+ }
+
+ if (clientId === "") {
+ log("client id required");
+
+ socket.close(ErrorCodes.INVALID_CLIENTID);
+ return;
+ }
+
+ socket.on("error", (e) => {
+ log("socket error", e);
+ });
+
+ socket.on("close", (e) => {
+ log("socket closed", e);
+ });
+
+ socket.on("request", this.onMessage.bind(this, socket));
+
+ socket._send = socket.send;
+ socket.send = (msg) => {
+ log("sending", msg);
+ socket.write(encode(Types.FRAME, msg));
+ };
+
+ socket.clientId = clientId;
+
+ this.connectionHandler(socket);
+ });
+ }
+
+ onMessage(socket, msg) {
+ log("message", msg);
+ this.messageHandler(socket, msg);
+ }
+}
+
+module.exports = {IPCServer};
diff --git a/src/arrpc/src/transports/websocket.js b/src/arrpc/src/transports/websocket.js
new file mode 100644
index 0000000..4de9402
--- /dev/null
+++ b/src/arrpc/src/transports/websocket.js
@@ -0,0 +1,124 @@
+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(235, 69, 158, "websocket")}]`, ...args);
+const ws = require("ws");
+const {createServer} = require("http");
+const querystring = require("querystring");
+
+const portRange = [6463, 6472];
+
+class WSServer {
+ constructor(messageHandler, connectionHandler) {
+ return new Promise(async (res) => {
+ this.messageHandler = messageHandler;
+ this.connectionHandler = connectionHandler;
+
+ this.onConnection = this.onConnection.bind(this);
+ this.onMessage = this.onMessage.bind(this);
+
+ let port = portRange[0];
+
+ let http, wss;
+ while (port <= portRange[1]) {
+ try {
+ log("trying port", port);
+
+ http = createServer();
+ http.on("error", (e) => {
+ log("http error", e);
+
+ if (e.code === "EADDRINUSE") {
+ log(port, "in use!");
+ }
+ });
+
+ wss = new ws.WebSocketServer({server: http});
+ wss.on("error", (e) => {
+ log("wss error", e);
+ });
+
+ wss.on("connection", this.onConnection);
+
+ http.listen(port, "127.0.0.1", () => {
+ log("listening on", port);
+
+ this.http = http;
+ this.wss = wss;
+
+ res(this);
+ });
+ } catch (e) {
+ log("failed to start", e);
+ }
+
+ break;
+ }
+ });
+ }
+
+ onConnection(socket, req) {
+ const params = querystring.parse(req.url.split("?")[1]);
+ const ver = parseInt(params.v ?? 1);
+ const encoding = params.encoding ?? "json";
+ const clientId = params.client_id ?? "";
+
+ const origin = req.headers.origin ?? "";
+
+ log(`new connection! origin:`, origin, JSON.parse(JSON.stringify(params)));
+
+ if (origin !== "") {
+ log("origin is defined, denying", origin);
+
+ socket.close();
+ return;
+ }
+
+ if (encoding !== "json") {
+ log("unsupported encoding requested", encoding);
+
+ socket.close();
+ return;
+ }
+
+ if (ver !== 1) {
+ log("unsupported version requested", ver);
+
+ socket.close();
+ return;
+ }
+
+ if (clientId === "") {
+ log("client id required");
+
+ socket.close();
+ return;
+ }
+
+ socket.clientId = clientId;
+ socket.encoding = encoding;
+
+ socket.on("error", (e) => {
+ log("socket error", e);
+ });
+
+ socket.on("close", (e, r) => {
+ log("socket closed", e);
+ });
+
+ socket.on("message", this.onMessage.bind(this, socket));
+
+ socket._send = socket.send;
+ socket.send = (msg) => {
+ log("sending", msg);
+ socket._send(JSON.stringify(msg));
+ };
+
+ this.connectionHandler(socket);
+ }
+
+ onMessage(socket, msg) {
+ log("message", JSON.parse(msg));
+ this.messageHandler(socket, JSON.parse(msg));
+ }
+}
+
+module.exports = {WSServer};
diff --git a/src/preload/preload.ts b/src/preload/preload.ts
index 8ab16e2..7536f3c 100644
--- a/src/preload/preload.ts
+++ b/src/preload/preload.ts
@@ -5,7 +5,7 @@ import "./patch";
import * as fs from "fs";
import * as path from "path";
import {injectHummusTitlebar, injectTitlebar} from "./titlebar";
-import {sleep, addStyle} from "../utils";
+import {sleep, addStyle, addScript} from "../utils";
import {injectMobileStuff} from "./mobile";
var version = ipcRenderer.sendSync("displayVersion");
var channel = ipcRenderer.sendSync("channel");
@@ -42,6 +42,41 @@ if (window.location.href.indexOf("splash.html") > -1) {
injectMobileStuff();
}
sleep(5000).then(async () => {
+ addScript(`
+ const dispatch = (() => {
+ let Dispatcher;
+
+ return function (event) {
+ Dispatcher ??= window.Vencord?.Webpack.Common.FluxDispatcher
+ if (!Dispatcher) {
+ const cache = webpackChunkdiscord_app.push([[Symbol()], {}, w => w]).c;
+ webpackChunkdiscord_app.pop()
+
+ outer:
+ for (const id in cache) {
+ const mod = cache[id].exports;
+ for (const exp in mod) {
+ if (mod[exp]?.isDispatching) {
+ Dispatcher = mod[exp];
+ break outer;
+ }
+ }
+ }
+ }
+ if (!Dispatcher)
+ return; // failed to find, your choice if and how u wanna handle this
+
+ return Dispatcher.dispatch(event);
+ };
+ })();
+ const ws = new WebSocket('ws://localhost:1337'); // connect to arRPC bridge
+ ws.onmessage = x => {
+ msg = JSON.parse(x.data);
+ console.log(msg);
+
+ dispatch({ type: "LOCAL_ACTIVITY_UPDATE", ...msg }); // set RPC status
+ };
+ `);
const cssPath = path.join(__dirname, "../", "/content/css/discord.css");
addStyle(fs.readFileSync(cssPath, "utf8"));
await updateLang();
diff --git a/src/window.ts b/src/window.ts
index e2fc8fe..94f8c8a 100644
--- a/src/window.ts
+++ b/src/window.ts
@@ -205,7 +205,9 @@ async function doAfterDefiningTheWindow() {
});
console.log(contentPath);
if ((await getConfig("inviteWebsocket")) == true) {
- await startServer();
+ //@ts-ignore
+ import("arrpc")
+ //await startServer();
}
if (firstRun) {
await setLang(Intl.DateTimeFormat().resolvedOptions().locale);
From 3b571f2322f3704d97206f13e8e9f422a2fcec86 Mon Sep 17 00:00:00 2001
From: smartfridge <37928912+smartfrigde@users.noreply.github.com>
Date: Sat, 19 Nov 2022 23:16:47 +0100
Subject: [PATCH 03/18] [skip ci] Remove log.txt
---
log.txt | 146 --------------------------------------------------------
1 file changed, 146 deletions(-)
delete mode 100644 log.txt
diff --git a/log.txt b/log.txt
deleted file mode 100644
index be8622e..0000000
--- a/log.txt
+++ /dev/null
@@ -1,146 +0,0 @@
-
-> ArmCord@3.1.0 start
-> npm run build && electron ./ts-out/main.js
-
-
-> ArmCord@3.1.0 build
-> tsc && copyfiles -u 1 src/**/*.html src/**/**/*.css ts-out/ && copyfiles package.json ts-out/ && copyfiles assets/**/** ts-out/
-
-[Config manager] doneSetup: undefined
-[Config manager] performanceMode: none
-ArmCord has been run before. Skipping setup.
-No performance modes set
-[Config manager] windowStyle: default
-[Config manager] armcordCSP: true
-[Config manager] doneSetup: undefined
-[Config manager] customIcon: undefined
-Setting up CSP unstricter...
-[Config manager] trayIcon: default
-[Config manager] windowStyle: default
-[Config manager] windowStyle: default
-[Config manager] ignoreProtocolWarning: undefined
-[Config manager] clientName: undefined
-[Config manager] 0: undefined
-[Config manager] mods: vencord
-Downloading mod bundle
-[Config manager] mods: vencord
-[Config manager] mobileMode: false
-[Config manager] trayIcon: default
-[Mod loader] Loaded ArmCord Mod Loader made by Vendicated
-[Config manager] alternativePaste: false
-undefined
-[Config manager] inviteWebsocket: true
-[Config manager] skipSplash: undefined
-[[38;2;88;101;242marRPC[0m > [38;2;254;231;92mipc[0m] checking /run/user/1000/discord-ipc-0
-Error: connect ECONNREFUSED /run/user/1000/discord-ipc-0
- at PipeConnectWrap.afterConnect [as oncomplete] (node:net:1187:16) {
- errno: -111,
- code: 'ECONNREFUSED',
- syscall: 'connect',
- address: '/run/user/1000/discord-ipc-0'
-}
-[Config manager] channel: stable
-[Config manager] mods: vencord
-[Config manager] automaticPatches: false
-[Config manager] channel: stable
-[[38;2;88;101;242marRPC[0m > [38;2;254;231;92mipc[0m] checked if socket is available: false - reason: timed out
-[[38;2;88;101;242marRPC[0m > [38;2;254;231;92mipc[0m] not available, trying again (attempt 1)
-[[38;2;88;101;242marRPC[0m > [38;2;254;231;92mipc[0m] checking /run/user/1000/discord-ipc-1
-Error: connect ENOENT /run/user/1000/discord-ipc-1
- at PipeConnectWrap.afterConnect [as oncomplete] (node:net:1187:16) {
- errno: -2,
- code: 'ENOENT',
- syscall: 'connect',
- address: '/run/user/1000/discord-ipc-1'
-}
-[[38;2;88;101;242marRPC[0m > [38;2;254;231;92mipc[0m] checked if socket is available: false - reason: timed out
-[[38;2;88;101;242marRPC[0m > [38;2;254;231;92mipc[0m] not available, trying again (attempt 2)
-[[38;2;88;101;242marRPC[0m > [38;2;254;231;92mipc[0m] checking /run/user/1000/discord-ipc-2
-Error: connect ENOENT /run/user/1000/discord-ipc-2
- at PipeConnectWrap.afterConnect [as oncomplete] (node:net:1187:16) {
- errno: -2,
- code: 'ENOENT',
- syscall: 'connect',
- address: '/run/user/1000/discord-ipc-2'
-}
-[[38;2;88;101;242marRPC[0m > [38;2;254;231;92mipc[0m] checked if socket is available: false - reason: timed out
-[[38;2;88;101;242marRPC[0m > [38;2;254;231;92mipc[0m] not available, trying again (attempt 3)
-[[38;2;88;101;242marRPC[0m > [38;2;254;231;92mipc[0m] checking /run/user/1000/discord-ipc-3
-Error: connect ENOENT /run/user/1000/discord-ipc-3
- at PipeConnectWrap.afterConnect [as oncomplete] (node:net:1187:16) {
- errno: -2,
- code: 'ENOENT',
- syscall: 'connect',
- address: '/run/user/1000/discord-ipc-3'
-}
-[Window state manager] width: 800
-[Window state manager] height: 600
-[Window state manager] isMaximized: false
-[Window state manager] Not maximized.
-[Config manager] channel: stable
-[Config manager] mods: vencord
-[Config manager] automaticPatches: false
-[Config manager] channel: stable
-[Config manager] mobileMode: false
-[[38;2;88;101;242marRPC[0m > [38;2;254;231;92mipc[0m] checked if socket is available: false - reason: timed out
-[[38;2;88;101;242marRPC[0m > [38;2;254;231;92mipc[0m] not available, trying again (attempt 4)
-[[38;2;88;101;242marRPC[0m > [38;2;254;231;92mipc[0m] checking /run/user/1000/discord-ipc-4
-Error: connect ENOENT /run/user/1000/discord-ipc-4
- at PipeConnectWrap.afterConnect [as oncomplete] (node:net:1187:16) {
- errno: -2,
- code: 'ENOENT',
- syscall: 'connect',
- address: '/run/user/1000/discord-ipc-4'
-}
-[[38;2;88;101;242marRPC[0m > [38;2;254;231;92mipc[0m] checked if socket is available: false - reason: timed out
-[[38;2;88;101;242marRPC[0m > [38;2;254;231;92mipc[0m] not available, trying again (attempt 5)
-[[38;2;88;101;242marRPC[0m > [38;2;254;231;92mipc[0m] checking /run/user/1000/discord-ipc-5
-Error: connect ENOENT /run/user/1000/discord-ipc-5
- at PipeConnectWrap.afterConnect [as oncomplete] (node:net:1187:16) {
- errno: -2,
- code: 'ENOENT',
- syscall: 'connect',
- address: '/run/user/1000/discord-ipc-5'
-}
-[[38;2;88;101;242marRPC[0m > [38;2;254;231;92mipc[0m] checked if socket is available: false - reason: timed out
-[[38;2;88;101;242marRPC[0m > [38;2;254;231;92mipc[0m] not available, trying again (attempt 6)
-[[38;2;88;101;242marRPC[0m > [38;2;254;231;92mipc[0m] checking /run/user/1000/discord-ipc-6
-Error: connect ENOENT /run/user/1000/discord-ipc-6
- at PipeConnectWrap.afterConnect [as oncomplete] (node:net:1187:16) {
- errno: -2,
- code: 'ENOENT',
- syscall: 'connect',
- address: '/run/user/1000/discord-ipc-6'
-}
-[[38;2;88;101;242marRPC[0m > [38;2;254;231;92mipc[0m] checked if socket is available: false - reason: timed out
-[[38;2;88;101;242marRPC[0m > [38;2;254;231;92mipc[0m] not available, trying again (attempt 7)
-[[38;2;88;101;242marRPC[0m > [38;2;254;231;92mipc[0m] checking /run/user/1000/discord-ipc-7
-Error: connect ENOENT /run/user/1000/discord-ipc-7
- at PipeConnectWrap.afterConnect [as oncomplete] (node:net:1187:16) {
- errno: -2,
- code: 'ENOENT',
- syscall: 'connect',
- address: '/run/user/1000/discord-ipc-7'
-}
-[[38;2;88;101;242marRPC[0m > [38;2;254;231;92mipc[0m] checked if socket is available: false - reason: timed out
-[[38;2;88;101;242marRPC[0m > [38;2;254;231;92mipc[0m] not available, trying again (attempt 8)
-[[38;2;88;101;242marRPC[0m > [38;2;254;231;92mipc[0m] checking /run/user/1000/discord-ipc-8
-Error: connect ENOENT /run/user/1000/discord-ipc-8
- at PipeConnectWrap.afterConnect [as oncomplete] (node:net:1187:16) {
- errno: -2,
- code: 'ENOENT',
- syscall: 'connect',
- address: '/run/user/1000/discord-ipc-8'
-}
-[[38;2;88;101;242marRPC[0m > [38;2;254;231;92mipc[0m] checked if socket is available: false - reason: timed out
-[[38;2;88;101;242marRPC[0m > [38;2;254;231;92mipc[0m] not available, trying again (attempt 9)
-[[38;2;88;101;242marRPC[0m > [38;2;254;231;92mipc[0m] checking /run/user/1000/discord-ipc-9
-Error: connect ENOENT /run/user/1000/discord-ipc-9
- at PipeConnectWrap.afterConnect [as oncomplete] (node:net:1187:16) {
- errno: -2,
- code: 'ENOENT',
- syscall: 'connect',
- address: '/run/user/1000/discord-ipc-9'
-}
-[[38;2;88;101;242marRPC[0m > [38;2;254;231;92mipc[0m] checked if socket is available: false - reason: timed out
-[[38;2;88;101;242marRPC[0m > [38;2;254;231;92mipc[0m] not available, trying again (attempt 10)
From ac806fffb75c47d3a9a909ce3205dbd02a395b28 Mon Sep 17 00:00:00 2001
From: smartfridge <37928912+smartfrigde@users.noreply.github.com>
Date: Sat, 19 Nov 2022 23:29:12 +0100
Subject: [PATCH 04/18] Dependencies fix
---
package.json | 3 +-
pnpm-lock.yaml | 107 ++++++++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 108 insertions(+), 2 deletions(-)
diff --git a/package.json b/package.json
index 905962c..1d454a3 100644
--- a/package.json
+++ b/package.json
@@ -40,12 +40,13 @@
},
"dependencies": {
"@pyke/vibe": "github:pykeio/vibe#11984868ce9e007859ed91ff159c7f7f0a34e7ae",
+ "arrpc": "file:./src/arrpc",
"electron-context-menu": "github:ArmCord/electron-context-menu",
"extract-zip": "^2.0.1",
"node-fetch": "v2",
- "arrpc": "file:./src/arrpc",
"os-locale": "^6.0.2",
"v8-compile-cache": "^2.3.0",
+ "whatwg-url": "^11.0.0",
"ws": "^8.8.0"
},
"build": {
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 671badb..bb532c7 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -13,11 +13,14 @@ specifiers:
electron-context-menu: github:ArmCord/electron-context-menu
extract-zip: ^2.0.1
husky: ^8.0.1
+ i: ^0.3.7
node-fetch: v2
+ npm: ^9.1.2
os-locale: ^6.0.2
prettier: ^2.7.0
typescript: ^4.7.3
v8-compile-cache: ^2.3.0
+ whatwg-url: ^11.0.0
ws: ^8.8.0
dependencies:
@@ -25,9 +28,12 @@ dependencies:
arrpc: file:src/arrpc
electron-context-menu: github.com/ArmCord/electron-context-menu/280c81398c02a063f46e3285a9708d8db1a7ce32
extract-zip: 2.0.1
+ i: 0.3.7
node-fetch: 2.6.7
+ npm: 9.1.2
os-locale: 6.0.2
v8-compile-cache: 2.3.0
+ whatwg-url: 11.0.0
ws: 8.9.0
devDependencies:
@@ -1235,6 +1241,11 @@ packages:
hasBin: true
dev: true
+ /i/0.3.7:
+ resolution: {integrity: sha512-FYz4wlXgkQwIPqhzC5TdNMLSE5+GS1IIDJZY/1ZiEPCT2S3COUVZeT5OW4BmW4r5LHLQuOosSwsvnroG9GR59Q==}
+ engines: {node: '>=0.4'}
+ dev: false
+
/iconv-corefoundation/1.1.7:
resolution: {integrity: sha512-T10qvkw0zz4wnm560lOEg0PovVqUXuOFhhHAkixw8/sycy7TJt7v/RrkEKEQnAw2viPSJu6iAkErxnzR0g8PpQ==}
engines: {node: ^8.11.2 || >=10}
@@ -1617,6 +1628,81 @@ packages:
pify: 3.0.0
optional: true
+ /npm/9.1.2:
+ resolution: {integrity: sha512-qOFg33/5YCHLArtRBep9HJydPZURbCwt8nxwXDRHZO9PZtTUMCo1C4iXBFPW1TxnzAdHscdw76ihbupdmL7cmw==}
+ engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0}
+ hasBin: true
+ dev: false
+ bundledDependencies:
+ - '@isaacs/string-locale-compare'
+ - '@npmcli/arborist'
+ - '@npmcli/config'
+ - '@npmcli/map-workspaces'
+ - '@npmcli/package-json'
+ - '@npmcli/run-script'
+ - abbrev
+ - archy
+ - cacache
+ - chalk
+ - ci-info
+ - cli-columns
+ - cli-table3
+ - columnify
+ - fastest-levenshtein
+ - fs-minipass
+ - glob
+ - graceful-fs
+ - hosted-git-info
+ - ini
+ - init-package-json
+ - is-cidr
+ - json-parse-even-better-errors
+ - libnpmaccess
+ - libnpmdiff
+ - libnpmexec
+ - libnpmfund
+ - libnpmhook
+ - libnpmorg
+ - libnpmpack
+ - libnpmpublish
+ - libnpmsearch
+ - libnpmteam
+ - libnpmversion
+ - make-fetch-happen
+ - minimatch
+ - minipass
+ - minipass-pipeline
+ - mkdirp
+ - ms
+ - node-gyp
+ - nopt
+ - npm-audit-report
+ - npm-install-checks
+ - npm-package-arg
+ - npm-pick-manifest
+ - npm-profile
+ - npm-registry-fetch
+ - npm-user-validate
+ - npmlog
+ - p-map
+ - pacote
+ - parse-conflict-json
+ - proc-log
+ - qrcode-terminal
+ - read
+ - read-package-json
+ - read-package-json-fast
+ - rimraf
+ - semver
+ - ssri
+ - tar
+ - text-table
+ - tiny-relative-date
+ - treeverse
+ - validate-npm-package-name
+ - which
+ - write-file-atomic
+
/object-keys/1.1.1:
resolution: {integrity: sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==}
engines: {node: '>= 0.4'}
@@ -1724,7 +1810,6 @@ packages:
resolution: {integrity: sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==}
engines: {node: '>=6'}
requiresBuild: true
- dev: true
/pupa/2.1.1:
resolution: {integrity: sha512-l1jNAspIBSFqbT+y+5FosojNpVpF94nlI+wDUpqP9enwOTfHx9f0gh5nB96vl+6yTpsJsypeNrwfzPrKuHB41A==}
@@ -2062,6 +2147,13 @@ packages:
resolution: {integrity: sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==}
dev: false
+ /tr46/3.0.0:
+ resolution: {integrity: sha512-l7FvfAHlcmulp8kr+flpQZmVwtu7nfRV7NZujtN0OqES8EL4O4e0qqzL0DC5gAvx/ZC/9lk6rhcUwYvkBnBnYA==}
+ engines: {node: '>=12'}
+ dependencies:
+ punycode: 2.1.1
+ dev: false
+
/trim-newlines/4.0.2:
resolution: {integrity: sha512-GJtWyq9InR/2HRiLZgpIKv+ufIKrVrvjQWEj7PxAXNc5dwbNJkqhAUoAGgzRmULAnoOM5EIpveYd3J2VeSAIew==}
engines: {node: '>=12'}
@@ -2163,6 +2255,19 @@ packages:
resolution: {integrity: sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==}
dev: false
+ /webidl-conversions/7.0.0:
+ resolution: {integrity: sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==}
+ engines: {node: '>=12'}
+ dev: false
+
+ /whatwg-url/11.0.0:
+ resolution: {integrity: sha512-RKT8HExMpoYx4igMiVMY83lN6UeITKJlBQ+vR/8ZJ8OCdSiN3RwCq+9gH0+Xzj0+5IrM6i4j/6LuvzbZIQgEcQ==}
+ engines: {node: '>=12'}
+ dependencies:
+ tr46: 3.0.0
+ webidl-conversions: 7.0.0
+ dev: false
+
/whatwg-url/5.0.0:
resolution: {integrity: sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==}
dependencies:
From 35b86b92e33fae7626950db1da8b24e99f05e21f Mon Sep 17 00:00:00 2001
From: smartfridge <37928912+smartfrigde@users.noreply.github.com>
Date: Sat, 19 Nov 2022 23:30:51 +0100
Subject: [PATCH 05/18] Update pnpm lock
---
pnpm-lock.yaml | 84 --------------------------------------------------
1 file changed, 84 deletions(-)
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index bb532c7..cb77663 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -13,9 +13,7 @@ specifiers:
electron-context-menu: github:ArmCord/electron-context-menu
extract-zip: ^2.0.1
husky: ^8.0.1
- i: ^0.3.7
node-fetch: v2
- npm: ^9.1.2
os-locale: ^6.0.2
prettier: ^2.7.0
typescript: ^4.7.3
@@ -28,9 +26,7 @@ dependencies:
arrpc: file:src/arrpc
electron-context-menu: github.com/ArmCord/electron-context-menu/280c81398c02a063f46e3285a9708d8db1a7ce32
extract-zip: 2.0.1
- i: 0.3.7
node-fetch: 2.6.7
- npm: 9.1.2
os-locale: 6.0.2
v8-compile-cache: 2.3.0
whatwg-url: 11.0.0
@@ -1241,11 +1237,6 @@ packages:
hasBin: true
dev: true
- /i/0.3.7:
- resolution: {integrity: sha512-FYz4wlXgkQwIPqhzC5TdNMLSE5+GS1IIDJZY/1ZiEPCT2S3COUVZeT5OW4BmW4r5LHLQuOosSwsvnroG9GR59Q==}
- engines: {node: '>=0.4'}
- dev: false
-
/iconv-corefoundation/1.1.7:
resolution: {integrity: sha512-T10qvkw0zz4wnm560lOEg0PovVqUXuOFhhHAkixw8/sycy7TJt7v/RrkEKEQnAw2viPSJu6iAkErxnzR0g8PpQ==}
engines: {node: ^8.11.2 || >=10}
@@ -1628,81 +1619,6 @@ packages:
pify: 3.0.0
optional: true
- /npm/9.1.2:
- resolution: {integrity: sha512-qOFg33/5YCHLArtRBep9HJydPZURbCwt8nxwXDRHZO9PZtTUMCo1C4iXBFPW1TxnzAdHscdw76ihbupdmL7cmw==}
- engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0}
- hasBin: true
- dev: false
- bundledDependencies:
- - '@isaacs/string-locale-compare'
- - '@npmcli/arborist'
- - '@npmcli/config'
- - '@npmcli/map-workspaces'
- - '@npmcli/package-json'
- - '@npmcli/run-script'
- - abbrev
- - archy
- - cacache
- - chalk
- - ci-info
- - cli-columns
- - cli-table3
- - columnify
- - fastest-levenshtein
- - fs-minipass
- - glob
- - graceful-fs
- - hosted-git-info
- - ini
- - init-package-json
- - is-cidr
- - json-parse-even-better-errors
- - libnpmaccess
- - libnpmdiff
- - libnpmexec
- - libnpmfund
- - libnpmhook
- - libnpmorg
- - libnpmpack
- - libnpmpublish
- - libnpmsearch
- - libnpmteam
- - libnpmversion
- - make-fetch-happen
- - minimatch
- - minipass
- - minipass-pipeline
- - mkdirp
- - ms
- - node-gyp
- - nopt
- - npm-audit-report
- - npm-install-checks
- - npm-package-arg
- - npm-pick-manifest
- - npm-profile
- - npm-registry-fetch
- - npm-user-validate
- - npmlog
- - p-map
- - pacote
- - parse-conflict-json
- - proc-log
- - qrcode-terminal
- - read
- - read-package-json
- - read-package-json-fast
- - rimraf
- - semver
- - ssri
- - tar
- - text-table
- - tiny-relative-date
- - treeverse
- - validate-npm-package-name
- - which
- - write-file-atomic
-
/object-keys/1.1.1:
resolution: {integrity: sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==}
engines: {node: '>= 0.4'}
From 235015bd241b6f9a80b3761ce44d8aea463ef164 Mon Sep 17 00:00:00 2001
From: CanadaHonk <19228318+CanadaHonk@users.noreply.github.com>
Date: Sat, 19 Nov 2022 22:53:11 +0000
Subject: [PATCH 06/18] Rename Invite Websocket setting to Rich Presence (#257)
---
assets/lang/en-US.json | 4 ++--
src/settings/settings.html | 5 ++---
2 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/assets/lang/en-US.json b/assets/lang/en-US.json
index 094cd29..371e7c1 100644
--- a/assets/lang/en-US.json
+++ b/assets/lang/en-US.json
@@ -32,8 +32,8 @@
"settings-channel-desc3": "this is alpha test release of Discord. By using it you gain access to the newest\n features and fixes.",
"settings-channel-desc4": "public test build. Receives features earlier than stable but is a bit older than Canary.",
"settings-channel-desc5": "unofficial instance of Discord that takes you back to 2016! Only client mod\n available to run alongside with it is Cordwood. It's run by community, so you take all the risk by\n using it.",
- "settings-invitewebsocket": "Invite Websocket",
- "settings-invitewebsocket-desc": "When enabled ArmCord will support Discord.gg links which means that if you open an invite link in your\n browser, ArmCord will automatically accept the invite. Can be unresponsive at times.",
+ "settings-invitewebsocket": "Rich Presence (Experimental)",
+ "settings-invitewebsocket-desc": "Uses arRPC to support Discord RPC (Rich Presence) with local programs on your machine. Work in progress.",
"settings-altPaste": "Alternative Paste",
"settings-altPaste-desc": "If you're on Gnome on Linux or just simply can't paste images copied from other messages, then this is\n for you. This enables alternative module for pasting images. Only enable this when you're experiencing\n issues.",
"settings-mod": "Client mod",
diff --git a/src/settings/settings.html b/src/settings/settings.html
index 603d2cd..7e6fd4a 100644
--- a/src/settings/settings.html
+++ b/src/settings/settings.html
@@ -62,12 +62,11 @@
-
+
- When enabled ArmCord will support Discord.gg links which means that if you open an invite link in your
- browser, ArmCord will automatically accept the invite. Can be unresponsive at times.
+ Uses arRPC to support Discord RPC (Rich Presence) with local programs on your machine. Work in progress.
- Uses arRPC to support Discord RPC (Rich Presence) with local programs on your machine. Work in progress.
+ Uses arRPC to support Discord RPC (Rich
+ Presence) with local programs on your machine. Work in progress.