Coder Social home page Coder Social logo

arrpc's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

arrpc's Issues

arrpc no longer works as of latest discord update (Linux)

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]: }

letting arRPC run in the background on linux

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

Please add the ability to disable logging

arrpc is absolutely spamming the console

image

This is not a problem when running it manually, but when embedded as library, this is a nuisance. Please add the ability to suppress logging

[arRPC > websocket] disallowed origin https://streamkit.discord.com

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.
Screenshot_20240112_055745

Not working in freebsd

i'm using firefox and bridge_mod.js
image
It detects the apps fine, but nothing is shown in the profile
image
i get this errors in the console
image
image

Prebuilt package for arrpc

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.

Is Linux not supported yet... ?

Screenshot_20230118_094232

Based on that one red-colored report there, it seems to say such, though I haven't truly tried any RPC-compliant software yet. I'm on ArmCord.

How to make prebuilt packages [NOT AN ISSUE]

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

  1. Install esbuild and pkg:
npm i -g esbuild pkg
  1. Wrap that async statement in async function and call it
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();
  1. Bundle to single file via esbuild (node โ‰ค 18, node19 is not supported yet by pkg):
esbuild --bundle --platform=node --target=node18 --outdir=dist .\src\index.js
  1. Build executable:
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
  1. Voila!
    Screenshot guyes look

  2. It works perfectly fine (for now), but might require further testing

Uncaught (in promise) TypeError: Illegal invocation

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:

const candidate = mod[prop];

I believe that ArmCord utilizes this script (https://github.com/ArmCord/ArmCord/blob/dev/src/content/js/rpc.js), possibly explaining why arRPC is still not functioning, as mentioned in ArmCord/ArmCord#520.

not working

Even though its running, the Vencord Web Client says it cannot connect to it
image
image

Running without any discord client

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

pin package-lock.json

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?

[README] Add quick launch tip

People can set an alias to the start command and get it running easily

Example made for PowerShell :

  1. Enter notepad $PROFILE
    if this prompts an error, run New-Item -Path $PROFILE -Type File -Force before
  2. Add the following to the bottom of this file :
    function 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
    make sure to change the path to arrpc with the actual path on your computer, and do npm install on the folder if you run it for the first time
  3. Save the file, exit the notepad and run . $PROFILE

How to use :

  • Start : arrpc
  • See the output : Receive-Job -Name "arrpc"
  • Stop : Stop-Job -Name "arrpc"

How it plays :
image

ReferenceError: fetch is not defined

[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.

Valorant isn't being detected

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?

RPC via SSH?

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".

Allow windows games to be detected on linux

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.

music bee status does not stop / clear when pausing music (works on normal discord client)

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.

Tagging releases

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.

Add "bin" field to package.json

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.

Ability to register custom games

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.

Wrong game

I was only playing Roblox but it says im playing a game called Last Man Standing while i was not playing anything else except Roblox.
Terminal logs and in-app view is included below.

image
image

Incompatible with (unofficial) Rust discord-sdk

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

Support for voice activity? (SPEAKING_START/STOP)

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...)

Wine game detection on Linux

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.

Grabing activity from Steam

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

add process scanning?

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.

[Enchantment] add ways to enter custom activity in console

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.

doesnt work (output)

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

Doesn't play nicely with RiiTag-RPC (missing RPC features?)

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?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.