openasar / arrpc Goto Github PK
View Code? Open in Web Editor NEWOpen Discord RPC server for atypical setups
Home Page: https://arrpc.openasar.dev
License: MIT License
Open Discord RPC server for atypical setups
Home Page: https://arrpc.openasar.dev
License: MIT License
Latest discord update also broke client mods like vencord for a while until they fixed it.
arrpc makes discord-ipc-0 but no activity appears in discord.
heres the logs when using something with rich presence:
Oct 28 05:49:01 turkey arrpc[372956]: [arRPC > ipc] new connection!
Oct 28 05:49:01 turkey arrpc[372956]: [arRPC > ipc] handshake: { client_id: '1162506170972520599', v: 1 }
Oct 28 05:49:01 turkey arrpc[372956]: [arRPC > ipc] sending {
Oct 28 05:49:01 turkey arrpc[372956]: cmd: 'DISPATCH',
Oct 28 05:49:01 turkey arrpc[372956]: evt: 'READY',
Oct 28 05:49:01 turkey arrpc[372956]: data: {
Oct 28 05:49:01 turkey arrpc[372956]: v: 1,
Oct 28 05:49:01 turkey arrpc[372956]: user: {
Oct 28 05:49:01 turkey arrpc[372956]: id: '1045800378228281345',
Oct 28 05:49:01 turkey arrpc[372956]: username: 'arRPC',
Oct 28 05:49:01 turkey arrpc[372956]: discriminator: '0000',
Oct 28 05:49:01 turkey arrpc[372956]: avatar: 'cfefa4d9839fb4bdf030f91c2a13e95c',
Oct 28 05:49:01 turkey arrpc[372956]: flags: 0,
Oct 28 05:49:01 turkey arrpc[372956]: premium_type: 0
Oct 28 05:49:01 turkey arrpc[372956]: },
Oct 28 05:49:01 turkey arrpc[372956]: config: {
Oct 28 05:49:01 turkey arrpc[372956]: api_endpoint: '//discord.com/api',
Oct 28 05:49:01 turkey arrpc[372956]: cdn_host: 'cdn.discordapp.com',
Oct 28 05:49:01 turkey arrpc[372956]: environment: 'production'
Oct 28 05:49:01 turkey arrpc[372956]: }
Oct 28 05:49:01 turkey arrpc[372956]: }
Oct 28 05:49:01 turkey arrpc[372956]: }
Oct 28 05:49:01 turkey arrpc[372956]: [arRPC > ipc] message {
Oct 28 05:49:01 turkey arrpc[372956]: args: {
Oct 28 05:49:01 turkey arrpc[372956]: activity: { assets: [Object], details: '', timestamps: [Object] },
Oct 28 05:49:01 turkey arrpc[372956]: pid: 373333
Oct 28 05:49:01 turkey arrpc[372956]: },
Oct 28 05:49:01 turkey arrpc[372956]: cmd: 'SET_ACTIVITY',
Oct 28 05:49:01 turkey arrpc[372956]: nonce: 'fdc05e6a-9456-48e7-92f8-e112d426424d'
Oct 28 05:49:01 turkey arrpc[372956]: }
Oct 28 05:49:01 turkey arrpc[372956]: [arRPC > ipc] sending {
Oct 28 05:49:01 turkey arrpc[372956]: cmd: 'SET_ACTIVITY',
Oct 28 05:49:01 turkey arrpc[372956]: data: null,
Oct 28 05:49:01 turkey arrpc[372956]: evt: null,
Oct 28 05:49:01 turkey arrpc[372956]: nonce: 'fdc05e6a-9456-48e7-92f8-e112d426424d'
Oct 28 05:49:01 turkey arrpc[372956]: }
i'm currently running endeavouros and i wish there was a way to just let arRPC run in the background instead of having a terminal window open and unusable all the time because it's running node src all the time, is there a way to actually make it just run and let me use my terminal or like, make it be a background daemon or something? i dont know jackshit about nodejs so im sorry about this if it is a stupid question, but i also saw nothing about it in the README so i figured i should ask it here
Hi, I got the arrpc plugin installed and followed all the steps for git cloning and installing node to get the rpc server working. It worked fine and detected my game until I rebooted. now when I run node src in the arrpc folder it just outputs the error in the title. Im not sure what I did to break it but no amount of research, reinstalling or troubleshooting of mine can fix it.
I recently swapped to the web version (or, something based to it) and want to use RPC, so I came across this.
Getting arrpc running is weird, as I have to install node, which isn't very fun on an immutable distro, so I have to use containers.
I believe it would be beneficial to provide some generic way to run the server, such as via Docker, or maybe a Flatpak bundle if that works too.
So ArRPC is a real lifesaver for me as I use Vencord. But it requires node environment and I can't add it to windows autostart (and also obligated to have console window all the time). You may have other reasons to have prebuilt binaries, but whatever
esbuild
and pkg
:npm i -g esbuild pkg
import * as Bridge from './bridge.js';
import Server from './server.js';
- const server = await new Server();
- server.on('activity', data => Bridge.send(data));
+ async function main() {
+ const server = await new Server();
+ server.on('activity', data => Bridge.send(data));
+ }
+ main();
pkg
):esbuild --bundle --platform=node --target=node18 --outdir=dist .\src\index.js
pkg -t node18-win-x64 -o arrpc .\dist\index.js #Windows amd64, Node 18.x
pkg -t node18-linux-x64 -o arrpc .\dist\index.js #Linux amd64, Node 18.x
pkg -t node18-macos-x64 -o arrpc .\dist\index.js #MacOS amd64, Node 18.x
Hello,
When I execute examples/bridge_mod.js in the DevTools Console while the arRPC server is active, I encounter the error 'Uncaught (in promise) TypeError: Illegal invocation'
at line:
Line 18 in 3e22fd7
not sure if it'd be truly useful but could be helpful in future (people submitting new games, etc) to not depend on upstream/official DB
I want to use this to run some RPC things from my server without the discord client installed, I was wondering if there's a way to set this up without web/client and just using javascript
Hey! I'm trying to package arrpc for NixOS, however, packaging node applications for nix benefits heavily from vendored package-lock.json
Any chance it could be included in the repo for packaging purposes?
People can set an alias to the start command and get it running easily
notepad $PROFILE
New-Item -Path $PROFILE -Type File -Force
beforefunction Invoke-ARRPC {
Start-Job -ScriptBlock {
Set-Location -Path "D:\EDM115\Programmes\Discord RPC\arrpc"
node src
} -Name "arrpc"
}
Set-Alias -Name arrpc -Value Invoke-ARRPC
npm install
on the folder if you run it for the first time. $PROFILE
arrpc
Receive-Job -Name "arrpc"
Stop-Job -Name "arrpc"
[arRPC > ipc] new connection!
[arRPC > ipc] handshake: { v: 1, client_id: '568815339807309834' }
[arRPC > ipc] sending { cmd: 'DISPATCH', evt: 'READY', data: { v: 1 } }
[arRPC > ipc] message {
args: {
pid: 18106,
activity: {
buttons: [Array],
state: 'Idling',
details: 'Main Menu',
timestamps: [Object],
assets: [Object],
instance: false
}
},
cmd: 'SET_ACTIVITY',
nonce: '1'
}
file:///home/pm/Documents/arrpc/src/server.js:40
socket.application = await (await fetch(`https://discord.com/api/v9/oauth2/applications/${socket.clientId}/rpc`)).json();
^
ReferenceError: fetch is not defined
at RPCServer.onMessage (file:///home/pm/Documents/arrpc/src/server.js:40:39)
at IPCServer.onMessage (file:///home/pm/Documents/arrpc/src/transports/ipc.js:241:10)
at Socket.emit (node:events:520:28)
at read (file:///home/pm/Documents/arrpc/src/transports/ipc.js:86:14)
at Socket.<anonymous> (file:///home/pm/Documents/arrpc/src/transports/ipc.js:184:9)
at Socket.emit (node:events:520:28)
at emitReadable_ (node:internal/streams/readable:578:12)
at processTicksAndRejections (node:internal/process/task_queues:82:21)
I'm not tech-savy to know if that error message is just due to a miss-configuration or just one of the features not yet implemented
Tried natively on Linux, with Ryujinx with a modified arrpc Discord stable client, with Vencord installed.
How do I do this shit
currently stays stuck on when an app disconnects
For some reason BG3/Steam is not getting detected - doesn't matter if it's skipping launcher or not.
I've checked the repo and can't seem to find any issues based on valorant. The RPC isn't picking it up. Any ideas?
please react/comment if wanted!
AUTHORIZE
, etc
I know it's way out of the scope of this project probably, but I haven't found anything from web (how to do it). Basically I have two systems, one has all my programs (including Discord) and one only has games. I'd love to be able to send those games as RPC to the main computer via SSH. I saw one blog, but it was mainly just generic & for VIM.
I'm certain that this can be done, as there's clients for hosting locally (RPC clients, like MAL), and you can send that "signal" via SSH surely. I know. Out of this "project's scope", but I'm out of options. This project is the closest thing I've found to solving my problem.
A simple Python script/application could do. Just not my "expertise".
Possible? The obvious advantage being that it is convenient and you don't need to have Node installed (or maybe you can provide prebuilt binaries)
The detectable.json database includes my game but it's not detected with arRPC server running
I found my game and it has os
set to win32
I have not looked at source code, but I assume they are only being detected if the server runs on windows.
Expected behavior: windows games are detected on linux, even if os
key is set to win32
Windows games are runnable on linux through wine and proton, so I don't see a reason to not detect them on linux.
i use vesktop, but i don't think that should have anything to do with it, since it seems to work in every other way, and WOULD clear on SOME occasions, although very inconsistent and not very commonly. the status can change to something else but just doesn't clear.
im using the discordbee plugin with musicbee to get the custom rpc for it to work.
looking through dev tools in the console, im seeing no errors. related to arrpc
again, it works like normal if running normal desktop discord. (i also dont think this issue is related to vesktop, though im not 100% sure)
regardless im leaving this here incase it isnt in fact a vesktop spesific issue.
Would you mind tagging release commits?
I am packaging arrpc for NixOS and it would make it easier for myself and others to update it in the future.
helpful for alternative clients like armcord
Would you mind adding the "bin" field to package.json?
I am packaging arrpc for NixOS and it would make it significantly more convenient to install it.
I am aware that building a binary for arrpc is not an option (as per #23), so I would like to clarify just in case that despite its name, it would not build a binary. It would essentially just create a symlink with the same name as the package pointing to whatever script you specify when the package is installed so that it can be run as a standalone executable. However, it would also require adding a shebang line to the script that points to node.
In the normal Discord client, there is a menu in Settings called "Registered Games" where, among other things, the user has the ability to choose a program out of the running programs on their computer to be recognized as a game according to RPC. Of course, since RPC is officially only for the desktop app, this menu is not in the web-based version of Discord.
As far as I can tell, arRPC does not add this menu back to web-based clients (i.e. Armcord), so users cannot add custom games. I propose that arRPC re-enables this menu if possible or adds its own for custom games.
so other projects can use it as a lib properly
send the last message sent to new connections? maybe only if currently connected to an app.
The Rust discord-sdk crate assumes all messages have a nonce
field. However, arrpc's initial READY
event does not include this field, resulting in this error:
2024-01-15 22:18:20,122 DEBUG [discord_sdk::io] connected to /run/user/1000/discord-ipc-0!
2024-01-15 22:18:20,133 WARN [discord_sdk::handler] Failed to deserialize message: missing field `nonce` at line 1 column 301 {"cmd":"DISPATCH","evt":"READY","data":{"v":1,"user":{"id":"1045800378228281345","username":"arRPC","discriminator":"0000","avatar":"cfefa4d9839fb4bdf030f91c2a13e95c","flags":0,"premium_type":0},"config":{"api_endpoint":"//discord.com/api","cdn_host":"cdn.discordapp.com","environment":"production"}}}
2024-01-15 22:18:20,133 ERROR [mpdiscord::discord] discord error: missing field `nonce` at line 1 column 301
I'm curious whether supporting the Discord RPC voice events (SPEAKING_START
, SPEAKING_STOP
) would be possible. These are used by https://reactive.fugi.tech/ to display voice activity with user PNGs, and it's what most VTubers use for group calls and things like that (when not doing full video sharing or for people with just a PNG), but right now it only works with the official Discord client.
I'd be happy to look into adding support myself, but I have no idea whether it's even possible for arRPC/ArmCord, so I'd love to hear some guidance ^^
(Aside: right now connections from that site are outright rejected with [arRPC > websocket] disallowed origin https://reactive.fugi.tech
. I assume that's something that could be changed but might need some authentication flow...)
some missing image issues for some images, seem like special things
Currently, Windows games running via Wine or Proton don't seem to be detected on Linux. I imagine this can be solved by scanning for all the Wine and Proton processes and looking at their arguments for the EXEs running. However, I'm not well versed with this project enough to fix it myself yet.
Steam api has option to see what game user currently playing
It requires steam account id (easily obtainable) and API key. This key is accessible here for any logged in user and accepts any string in "domain" field. It's not unreasonable to ask user to get their own, since target audience already nerds would be able download, compile and run this project
http://api.steampowered.com/ISteamUser/GetPlayerSummaries/ returns JSON containing gameid - steam id of game and
gameextrainfo - name of the game.
By altering searching of DetectableDB it is possible to search by steam id if provided or by game name, which are commonly same between Steam and Discord Verified games list
If game not found in this list it still can be used as custom activity
Con of this process is not having pid of game process, which is part of existing code base, but I hope it can be turned off and replaced with gameid field not existing or analyzing child processes of steam.
I understand it's not easy not implement, but without this arrpc on linux is kinda useless, cause detectable.json contains 5 linux executables: csgo ,terraria and 3 nonames, not even Dota2
undecided on whether to add or not as it isn't really RPC but loosely related (not in discord_rpc
but in discord_game_utils
for Discord's own Native modules, for example). would expand the scope quite a bit but might be worth it. please react/comment if you want! it would be optional/disableable if added to eliminate privacy/etc concerns.
GUILD_TEMPLATE_BROWSER
DEEP_LINK
Maybe add a way to enter a custom activity in console, example below:
[arRPC > bridge] web connected
custom-activity on
[arRPC] custom activity is now on
custom-activity set name a-sus-game-or-smth-idk-and-this-is-a-long-name-lmao
[arRPC] name of custom activity has been set to a-sus-game-or-smth-idk-and-this-is-a-long-name-lmao
custom-activity set icon [base64 encoded image here or imgur link]
[arRPC] icon of custom activity has been set
custom-activity reset time
[arRPC] time has been reset to 00:00
...
or add a configuration file to make custom activity
i know it is possible by modifying src/process/detectable.json to add a process and enter a custom description or smth.
Provide prebuilt binaries so that I do not need to build it myself
C:\Users\miqumi\arrpc>node src
(node:3012) ExperimentalWarning: Import assertions are not a stable feature of the JavaScript language. Avoid relying on their current behavior and syntax as those might change in a future version of Node.js.
(Use `node --trace-warnings ...` to show where the warning was created)
(node:3012) ExperimentalWarning: Importing JSON modules is an experimental feature and might change at any time
[arRPC] arRPC v3.1.0
node:events:492
throw er; // Unhandled 'error' event
^
Error: listen EADDRINUSE: address already in use :::1337
at Server.setupListenHandle [as _listen2] (node:net:1872:16)
at listenInCluster (node:net:1920:12)
at Server.listen (node:net:2008:7)
at new WebSocketServer (C:\Users\miqumi\arrpc\node_modules\ws\lib\websocket-server.js:97:20)
at file:///C:/Users/miqumi/arrpc/src/bridge.js:14:13
at ModuleJob.run (node:internal/modules/esm/module_job:192:25)
at async DefaultModuleLoader.import (node:internal/modules/esm/loader:228:24)
at async loadESM (node:internal/process/esm_loader:40:7)
at async handleMainPromise (node:internal/modules/run_main:66:12)
Emitted 'error' event on WebSocketServer instance at:
at Server.emit (node:events:514:28)
at emitErrorNT (node:net:1899:8)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
code: 'EADDRINUSE',
errno: -4091,
syscall: 'listen',
address: '::',
port: 1337
}
Node.js v20.5.0
I use a Raspberry OS (64-bit) on my Raspberry Pi 4 Model B (8 GB RAM), and on it I use https://github.com/RiiConnect24/RiiTag-RPC.
Instead of emulating the Discord client (linux x64), I thought it would be better to run a more native instance (https://github.com/ArmCord/ArmCord, which uses arRPC), but it appears that doing so causes issues with freezing and exiting for RiiTag-RPC.
From what I understand, it's because of a lack of support for newer features in rich presence?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.