Update arrpc to 2.2.0

This commit is contained in:
smartfridge 2022-11-22 15:03:54 +01:00
parent afa83c782d
commit d7a318d5c3
19 changed files with 965 additions and 160 deletions

572
log.txt Normal file
View File

@ -0,0 +1,572 @@
> 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 src/**/**/*.js 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] mods: vencord
[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
[Config manager] noBundleUpdates: undefined
[Config manager] mobileMode: false
Downloading mod bundle
[Config manager] mods: vencord
[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
[arRPC] arRPC v1.1.0-beta ArmCord
[arRPC > ipc] checking /run/user/1000/discord-ipc-0
[arRPC > bridge] listening on 1337
[arRPC > ipc] checked if socket is available: true
[arRPC > ipc] listening at /run/user/1000/discord-ipc-0
[arRPC > websocket] trying port 6463
[arRPC > websocket] listening on 6463
[Config manager] channel: stable
[Config manager] mods: vencord
[Config manager] automaticPatches: false
[Config manager] channel: stable
[Window state manager] width: 1920
[Window state manager] height: 1048
[Window state manager] isMaximized: true
[Config manager] channel: stable
[Config manager] mods: vencord
[Config manager] automaticPatches: false
[Config manager] channel: stable
[Config manager] mobileMode: false
[arRPC > ipc] new connection!
[arRPC > ipc] handshake: { v: 1, client_id: '383226320970055681' }
[arRPC > ipc] sending { cmd: 'DISPATCH', evt: 'READY', data: { v: 1 } }
[arRPC > ipc] message {
cmd: 'SET_ACTIVITY',
args: {
pid: 5707,
activity: {
state: 'Workspace: ArmCord',
details: 'Editing log.txt',
timestamps: [Object],
assets: [Object],
buttons: [Array],
instance: false
}
},
nonce: '4d2717f7-8fae-4339-222a-800a0e43f023'
}
[arRPC > ipc] message {
cmd: 'SET_ACTIVITY',
args: {
pid: 5707,
activity: {
state: 'Workspace: ArmCord',
details: 'Editing log.txt',
timestamps: [Object],
assets: [Object],
buttons: [Array],
instance: false
}
},
nonce: 'ed60da61-58bc-4e12-0fc3-c628a710cf7d'
}
[arRPC > bridge] fetched app info for 383226320970055681 {
id: '383226320970055681',
name: 'Visual Studio Code',
icon: 'bc45e1c85351ce0bafcb9245b3762e75',
description: '',
summary: '',
type: null,
cover_image: 'f1794a9f863d86c4a80aa51c3738fe58',
hook: true,
verify_key: 'd9fda69a8c8a9168d7fc41738822738eb31a4975a261d3172835df3595203f99',
flags: 0,
assets: [
{ id: '565944082250334228', type: 1, name: 'applescript' },
{ id: '565944082258722817', type: 1, name: 'arduino' },
{ id: '565944082266849297', type: 1, name: 'cshtml' },
{ id: '565944082271305778', type: 1, name: 'ahk' },
{ id: '565944082317312000', type: 1, name: 'assembly' },
{ id: '565944082321637386', type: 1, name: 'android' },
{ id: '565944082329763843', type: 1, name: 'csharp' },
{ id: '565944082384551955', type: 1, name: 'cmake' },
{ id: '565944082392940584', type: 1, name: 'autoit' },
{ id: '565944082401198090', type: 1, name: 'c' },
{ id: '565944082409455626', type: 1, name: 'angular' },
{ id: '565944082417975296', type: 1, name: 'asp' },
{ id: '565944082501861376', type: 1, name: 'appveyor' },
{ id: '565944082506055681', type: 1, name: 'crystal' },
{ id: '565944082510249984', type: 1, name: 'cpp' },
{ id: '565944082522963968', type: 1, name: 'cargo' },
{ id: '565944082573295616', type: 1, name: 'cssmap' },
{ id: '565944082585878538', type: 1, name: 'css' },
{ id: '565944082816565284', type: 1, name: 'bower' },
{ id: '565944082833342465', type: 1, name: 'clojure' },
{ id: '565944082858377220', type: 1, name: 'circleci' },
{ id: '565944082992726027', type: 1, name: 'as' },
{ id: '565944083021955093', type: 1, name: 'coffee' },
{ id: '565944083088932884', type: 1, name: 'bat' },
{ id: '565944083441516564', type: 1, name: 'brainfuck' },
{ id: '565944476732882948', type: 1, name: 'dart' },
{ id: '565944476829351967', type: 1, name: 'elixir' },
{ id: '565944476879683585', type: 1, name: 'eslint' },
{ id: '565944477068296243', type: 1, name: 'haskell' },
{ id: '565944477076684801', type: 1, name: 'go' },
{ id: '565944477085073418', type: 1, name: 'dm' },
{ id: '565944477122822179', type: 1, name: 'flowconfig' },
{ id: '565944477152444416', type: 1, name: 'fsharp' },
{ id: '565944477202645033', type: 1, name: 'erlang' },
{ id: '565944477215358986', type: 1, name: 'gemfile' },
{ id: '565944477232136192', type: 1, name: 'd' },
{ id: '565944477232136202', type: 1, name: 'git' },
{ id: '565944477278142465', type: 1, name: 'haxe' },
{ id: '565944477286531072', type: 1, name: 'graphql' },
{ id: '565944477328343040', type: 1, name: 'docker' },
{ id: '565944477336993822', type: 1, name: 'firebase' },
{ id: '565944477340926001', type: 1, name: 'editorconfig' },
{ id: '565944477647241228', type: 1, name: 'delphi' },
{ id: '565944477684989977', type: 1, name: 'handlebars' },
{ id: '565944477752098836', type: 1, name: 'gulp' },
{ id: '565944477961814016', type: 1, name: 'cuda' },
{ id: '565944478142169089', type: 1, name: 'gatsbyjs' },
{ id: '565944478418993152', type: 1, name: 'gradle' },
{ id: '565944478549016577', type: 1, name: 'env' },
{ id: '565944478557274142', type: 1, name: 'ejs' },
{ id: '565944478792155136', type: 1, name: 'elm' },
{ id: '565944479194808320', type: 1, name: 'gruntfile' },
{ id: '565944799245369386', type: 1, name: 'makefile' },
{ id: '565944799312740364', type: 1, name: 'less' },
{ id: '565944799446827009', type: 1, name: 'julia' },
{ id: '565944799450890240', type: 1, name: 'jar' },
{ id: '565944799455346703', type: 1, name: 'html' },
{ id: '565944799459278879', type: 1, name: 'jsmap' },
{ id: '565944799492964353', type: 1, name: 'kotlin' },
{ id: '565944799538970634', type: 1, name: 'heroku' },
{ id: '565944799576719366', type: 1, name: 'js' },
{ id: '565944799618662400', type: 1, name: 'livescript' },
{ id: '565944799707004929', type: 1, name: 'log' },
{ id: '565944799761268737', type: 1, name: 'json' },
{ id: '565944799761268766', type: 1, name: 'jest' },
{ id: '565944799996411914', type: 1, name: 'http' },
{ id: '565944800021446707', type: 1, name: 'java' },
{ id: '565944800021577729', type: 1, name: 'lisp' },
{ id: '565944800105332777', type: 1, name: 'lua' },
{ id: '565944802462531603', type: 1, name: 'jsx' },
{ id: '565945077252489228', type: 1, name: 'nim' },
{ id: '565945077260746763', type: 1, name: 'pascal' },
{ id: '565945077277655043', type: 1, name: 'perl' },
{ id: '565945077323792386', type: 1, name: 'postcss' },
{ id: '565945077348958236', type: 1, name: 'marko' },
{ id: '565945077411741717', type: 1, name: 'prisma' },
{ id: '565945077487108099', type: 1, name: 'nodemon' },
{ id: '565945077491433494', type: 1, name: 'markdown' },
{ id: '565945077524987927', type: 1, name: 'markdownx' },
{ id: '565945077554479114', type: 1, name: 'manifest' },
{ id: '565945077575319552', type: 1, name: 'pawn' },
{ id: '565945077583839243', type: 1, name: 'npm' },
{ id: '565945077625651200', type: 1, name: 'pug' },
{ id: '565945077642559498', type: 1, name: 'ocaml' },
{ id: '565945077709406209', type: 1, name: 'prettier' },
{ id: '565945078166716458', type: 1, name: 'powershell' },
{ id: '565945078359785494', type: 1, name: 'objc' },
{ id: '565945078833741834', type: 1, name: 'php' },
{ id: '565945350532104193', type: 1, name: 'tex' },
{ id: '565945350641418270', type: 1, name: 'reasonml' },
{ id: '565945350645481492', type: 1, name: 'python' },
{ id: '565945350670647298', type: 1, name: 'swift' },
{ id: '565945350695813133', type: 1, name: 'scala' },
{ id: '565945350766985216', type: 1, name: 'svg' },
{ id: '565945350771441676', type: 1, name: 'rust' },
{ id: '565945350792151064', type: 1, name: 'toml' },
{ id: '565945350838419490', type: 1, name: 'sql' },
{ id: '565945350846939145', type: 1, name: 'text' },
{ id: '565945350851002389', type: 1, name: 'shell' },
{ id: '565945350897008640', type: 1, name: 'scss' },
... 50 more items
]
}
[arRPC > bridge] fetched app info for 383226320970055681 {
id: '383226320970055681',
name: 'Visual Studio Code',
icon: 'bc45e1c85351ce0bafcb9245b3762e75',
description: '',
summary: '',
type: null,
cover_image: 'f1794a9f863d86c4a80aa51c3738fe58',
hook: true,
verify_key: 'd9fda69a8c8a9168d7fc41738822738eb31a4975a261d3172835df3595203f99',
flags: 0,
assets: [
{ id: '565944082250334228', type: 1, name: 'applescript' },
{ id: '565944082258722817', type: 1, name: 'arduino' },
{ id: '565944082266849297', type: 1, name: 'cshtml' },
{ id: '565944082271305778', type: 1, name: 'ahk' },
{ id: '565944082317312000', type: 1, name: 'assembly' },
{ id: '565944082321637386', type: 1, name: 'android' },
{ id: '565944082329763843', type: 1, name: 'csharp' },
{ id: '565944082384551955', type: 1, name: 'cmake' },
{ id: '565944082392940584', type: 1, name: 'autoit' },
{ id: '565944082401198090', type: 1, name: 'c' },
{ id: '565944082409455626', type: 1, name: 'angular' },
{ id: '565944082417975296', type: 1, name: 'asp' },
{ id: '565944082501861376', type: 1, name: 'appveyor' },
{ id: '565944082506055681', type: 1, name: 'crystal' },
{ id: '565944082510249984', type: 1, name: 'cpp' },
{ id: '565944082522963968', type: 1, name: 'cargo' },
{ id: '565944082573295616', type: 1, name: 'cssmap' },
{ id: '565944082585878538', type: 1, name: 'css' },
{ id: '565944082816565284', type: 1, name: 'bower' },
{ id: '565944082833342465', type: 1, name: 'clojure' },
{ id: '565944082858377220', type: 1, name: 'circleci' },
{ id: '565944082992726027', type: 1, name: 'as' },
{ id: '565944083021955093', type: 1, name: 'coffee' },
{ id: '565944083088932884', type: 1, name: 'bat' },
{ id: '565944083441516564', type: 1, name: 'brainfuck' },
{ id: '565944476732882948', type: 1, name: 'dart' },
{ id: '565944476829351967', type: 1, name: 'elixir' },
{ id: '565944476879683585', type: 1, name: 'eslint' },
{ id: '565944477068296243', type: 1, name: 'haskell' },
{ id: '565944477076684801', type: 1, name: 'go' },
{ id: '565944477085073418', type: 1, name: 'dm' },
{ id: '565944477122822179', type: 1, name: 'flowconfig' },
{ id: '565944477152444416', type: 1, name: 'fsharp' },
{ id: '565944477202645033', type: 1, name: 'erlang' },
{ id: '565944477215358986', type: 1, name: 'gemfile' },
{ id: '565944477232136192', type: 1, name: 'd' },
{ id: '565944477232136202', type: 1, name: 'git' },
{ id: '565944477278142465', type: 1, name: 'haxe' },
{ id: '565944477286531072', type: 1, name: 'graphql' },
{ id: '565944477328343040', type: 1, name: 'docker' },
{ id: '565944477336993822', type: 1, name: 'firebase' },
{ id: '565944477340926001', type: 1, name: 'editorconfig' },
{ id: '565944477647241228', type: 1, name: 'delphi' },
{ id: '565944477684989977', type: 1, name: 'handlebars' },
{ id: '565944477752098836', type: 1, name: 'gulp' },
{ id: '565944477961814016', type: 1, name: 'cuda' },
{ id: '565944478142169089', type: 1, name: 'gatsbyjs' },
{ id: '565944478418993152', type: 1, name: 'gradle' },
{ id: '565944478549016577', type: 1, name: 'env' },
{ id: '565944478557274142', type: 1, name: 'ejs' },
{ id: '565944478792155136', type: 1, name: 'elm' },
{ id: '565944479194808320', type: 1, name: 'gruntfile' },
{ id: '565944799245369386', type: 1, name: 'makefile' },
{ id: '565944799312740364', type: 1, name: 'less' },
{ id: '565944799446827009', type: 1, name: 'julia' },
{ id: '565944799450890240', type: 1, name: 'jar' },
{ id: '565944799455346703', type: 1, name: 'html' },
{ id: '565944799459278879', type: 1, name: 'jsmap' },
{ id: '565944799492964353', type: 1, name: 'kotlin' },
{ id: '565944799538970634', type: 1, name: 'heroku' },
{ id: '565944799576719366', type: 1, name: 'js' },
{ id: '565944799618662400', type: 1, name: 'livescript' },
{ id: '565944799707004929', type: 1, name: 'log' },
{ id: '565944799761268737', type: 1, name: 'json' },
{ id: '565944799761268766', type: 1, name: 'jest' },
{ id: '565944799996411914', type: 1, name: 'http' },
{ id: '565944800021446707', type: 1, name: 'java' },
{ id: '565944800021577729', type: 1, name: 'lisp' },
{ id: '565944800105332777', type: 1, name: 'lua' },
{ id: '565944802462531603', type: 1, name: 'jsx' },
{ id: '565945077252489228', type: 1, name: 'nim' },
{ id: '565945077260746763', type: 1, name: 'pascal' },
{ id: '565945077277655043', type: 1, name: 'perl' },
{ id: '565945077323792386', type: 1, name: 'postcss' },
{ id: '565945077348958236', type: 1, name: 'marko' },
{ id: '565945077411741717', type: 1, name: 'prisma' },
{ id: '565945077487108099', type: 1, name: 'nodemon' },
{ id: '565945077491433494', type: 1, name: 'markdown' },
{ id: '565945077524987927', type: 1, name: 'markdownx' },
{ id: '565945077554479114', type: 1, name: 'manifest' },
{ id: '565945077575319552', type: 1, name: 'pawn' },
{ id: '565945077583839243', type: 1, name: 'npm' },
{ id: '565945077625651200', type: 1, name: 'pug' },
{ id: '565945077642559498', type: 1, name: 'ocaml' },
{ id: '565945077709406209', type: 1, name: 'prettier' },
{ id: '565945078166716458', type: 1, name: 'powershell' },
{ id: '565945078359785494', type: 1, name: 'objc' },
{ id: '565945078833741834', type: 1, name: 'php' },
{ id: '565945350532104193', type: 1, name: 'tex' },
{ id: '565945350641418270', type: 1, name: 'reasonml' },
{ id: '565945350645481492', type: 1, name: 'python' },
{ id: '565945350670647298', type: 1, name: 'swift' },
{ id: '565945350695813133', type: 1, name: 'scala' },
{ id: '565945350766985216', type: 1, name: 'svg' },
{ id: '565945350771441676', type: 1, name: 'rust' },
{ id: '565945350792151064', type: 1, name: 'toml' },
{ id: '565945350838419490', type: 1, name: 'sql' },
{ id: '565945350846939145', type: 1, name: 'text' },
{ id: '565945350851002389', type: 1, name: 'shell' },
{ id: '565945350897008640', type: 1, name: 'scss' },
... 50 more items
]
}
[arRPC > ipc] message {
cmd: 'SET_ACTIVITY',
args: {
pid: 5707,
activity: {
state: 'Workspace: ArmCord',
details: 'Editing log.txt',
timestamps: [Object],
assets: [Object],
buttons: [Array],
instance: false
}
},
nonce: 'b3d5dd03-d425-40ae-132e-8acf53b18497'
}
[arRPC > ipc] message {
cmd: 'SET_ACTIVITY',
args: {
pid: 5707,
activity: {
state: 'Workspace: ArmCord',
details: 'Editing log.txt',
timestamps: [Object],
assets: [Object],
buttons: [Array],
instance: false
}
},
nonce: 'a81c11d1-60e8-4c23-2af3-6626c0791f1a'
}
[arRPC > ipc] message {
cmd: 'SET_ACTIVITY',
args: {
pid: 5707,
activity: {
state: 'Workspace: ArmCord',
details: 'Editing log.txt',
timestamps: [Object],
assets: [Object],
buttons: [Array],
instance: false
}
},
nonce: '3230ba41-4874-460a-1689-9b9ff1663a7f'
}
[arRPC > ipc] message {
cmd: 'SET_ACTIVITY',
args: {
pid: 5707,
activity: {
state: 'Workspace: ArmCord',
details: 'Editing log.txt',
timestamps: [Object],
assets: [Object],
buttons: [Array],
instance: false
}
},
nonce: 'f6d973b1-1e75-4dd6-2e93-b65a9ef3be0b'
}
[arRPC > ipc] message {
cmd: 'SET_ACTIVITY',
args: {
pid: 5707,
activity: {
state: 'Workspace: ArmCord',
details: 'Editing log.txt',
timestamps: [Object],
assets: [Object],
buttons: [Array],
instance: false
}
},
nonce: 'b8843cb1-aa6e-437d-3da0-1e08cd44cfb5'
}
[arRPC > ipc] message {
cmd: 'SET_ACTIVITY',
args: {
pid: 5707,
activity: {
state: 'Workspace: ArmCord',
details: 'Editing log.txt',
timestamps: [Object],
assets: [Object],
buttons: [Array],
instance: false
}
},
nonce: 'd6a257e0-fa89-449f-38b1-44fa71811fb7'
}
[arRPC > ipc] message {
cmd: 'SET_ACTIVITY',
args: {
pid: 5707,
activity: {
state: 'Workspace: ArmCord',
details: 'Editing log.txt',
timestamps: [Object],
assets: [Object],
buttons: [Array],
instance: false
}
},
nonce: 'ac9e04a8-52c3-4614-04b2-1779e10e263f'
}
[arRPC > ipc] message {
cmd: 'SET_ACTIVITY',
args: {
pid: 5707,
activity: {
details: 'Idling',
timestamps: [Object],
assets: [Object],
buttons: [Array],
instance: false
}
},
nonce: 'f0e4d6e4-7aa8-4f5b-1264-ac76680cfd24'
}
[arRPC > ipc] message {
cmd: 'SET_ACTIVITY',
args: {
pid: 5707,
activity: {
state: 'Workspace: ArmCord',
details: 'Editing server.js',
timestamps: [Object],
assets: [Object],
buttons: [Array],
instance: false
}
},
nonce: '3cc9be1b-338f-4867-1cf0-cba574084c45'
}
[arRPC > ipc] message {
cmd: 'SET_ACTIVITY',
args: {
pid: 5707,
activity: {
state: 'Workspace: ArmCord',
details: 'Editing server.js',
timestamps: [Object],
assets: [Object],
buttons: [Array],
instance: false
}
},
nonce: 'd4965762-a25b-4b8b-2891-11a1ed78289d'
}
[arRPC > ipc] message {
cmd: 'SET_ACTIVITY',
args: {
pid: 5707,
activity: {
state: 'Workspace: ArmCord',
details: 'Editing log.txt',
timestamps: [Object],
assets: [Object],
buttons: [Array],
instance: false
}
},
nonce: '92243961-65fb-48a2-26d1-1d8980a376f3'
}
[arRPC > ipc] message {
cmd: 'SET_ACTIVITY',
args: {
pid: 5707,
activity: {
state: 'Workspace: ArmCord',
details: 'Editing log.txt',
timestamps: [Object],
assets: [Object],
buttons: [Array],
instance: false
}
},
nonce: '4d1001fa-6d04-4b0a-0d0d-4ceefd1c79f0'
}
[arRPC > ipc] message {
cmd: 'SET_ACTIVITY',
args: {
pid: 5707,
activity: {
state: 'Workspace: ArmCord',
details: 'Editing log.txt',
timestamps: [Object],
assets: [Object],
buttons: [Array],
instance: false
}
},
nonce: '1cb43f39-5cd6-40aa-385b-16fd9fe70d4f'
}
[arRPC > ipc] message {
cmd: 'SET_ACTIVITY',
args: {
pid: 5707,
activity: {
state: 'Workspace: ArmCord',
details: 'Editing log.txt',
timestamps: [Object],
assets: [Object],
buttons: [Array],
instance: false
}
},
nonce: '1b139214-f410-48bc-24d4-2835d2d49f02'
}
[arRPC > ipc] message {
cmd: 'SET_ACTIVITY',
args: {
pid: 5707,
activity: {
state: 'Workspace: ArmCord',
details: 'Editing log.txt',
timestamps: [Object],
assets: [Object],
buttons: [Array],
instance: false
}
},
nonce: '442a6b6a-126d-435d-2a85-296ec86c36a8'
}
[arRPC > ipc] message {
cmd: 'SET_ACTIVITY',
args: {
pid: 5707,
activity: {
state: 'Workspace: ArmCord',
details: 'Editing log.txt',
timestamps: [Object],
assets: [Object],
buttons: [Array],
instance: false
}
},
nonce: 'a0517d56-4927-4761-2642-699fd091dc0c'
}
[arRPC > ipc] message {
cmd: 'SET_ACTIVITY',
args: {
pid: 5707,
activity: {
state: 'Workspace: ArmCord',
details: 'Editing log.txt',
timestamps: [Object],
assets: [Object],
buttons: [Array],
instance: false
}
},
nonce: '8c63a412-f861-49e9-288e-e31765f7c36b'
}
[Config manager] minimizeToTray: true

View File

@ -4,7 +4,7 @@
"description": "ArmCord is a custom client designed to enhance your Discord experience while keeping everything lightweight.",
"main": "ts-out/main.js",
"scripts": {
"build": "tsc && copyfiles -u 1 src/**/*.html src/**/**/*.css ts-out/ && copyfiles package.json ts-out/ && copyfiles assets/**/** ts-out/",
"build": "tsc && copyfiles -u 1 src/**/*.html src/**/**/*.css src/**/**/*.js ts-out/ && copyfiles package.json ts-out/ && copyfiles assets/**/** ts-out/",
"watch": "tsc -w",
"start": "npm run build && electron ./ts-out/main.js",
"startNoSandbox": "npm run build && electron ./ts-out/main.js --no-sandbox",

View File

@ -1,2 +0,0 @@
node_modules
package-lock.json

View File

@ -1,10 +1,21 @@
# 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.**
<div align="center">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://user-images.githubusercontent.com/19228318/202900211-95e8474b-edbb-4048-ba0b-a581a6d57fc4.png" width=300>
<img alt="arRPC" src="https://user-images.githubusercontent.com/19228318/203024061-064fc015-9096-40c3-9786-ad23d90414a6.png" width=300>
</picture> <br>
<a href="https://choosealicense.com/licenses/mit/l"><img alt="License: MIT" src="https://img.shields.io/badge/License-MIT-blue.svg"></a>
<a href="https://github.com/sponsors/CanadaHonk"><img alt="GitHub Sponsors" src="https://img.shields.io/github/sponsors/CanadaHonk?label=Sponsors&logo=github"></a>
<h3>An open implementation of Discord's local RPC servers</h3>
<h4>Allowing RPC where it was otherwise impossible, like Discord Web and custom clients</h4>
</div>
<br>
Rich Presence (RPC) is the name for how some apps can talk to Discord desktop on your PC via localhost servers to display detailed info about the app's state. This usually works via parts of Discord desktop natively doing things + parts of Discord web interpreting that and setting it as your status. arRPC is an open source implementation of the local RPC servers on your PC, allowing apps to talk to it thinking it was just normal Discord. It can then send that info to apps which usually don't get RPC, like Discord Web, Armcord, etc. which can then set that as your status. This would otherwise not be possible, as web apps/browsers/etc can't just use Discord's already existing code and version.
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. **arRPC is experimental and a work in progress, so expect bugs, etc.**
<br>
Rich Presence (RPC) is the name for how some apps can talk to Discord desktop on your PC via localhost servers to display detailed info about the app's state. This usually works via parts of Discord desktop natively doing things + parts of Discord web interpreting that and setting it as your status. arRPC is an open source implementation of the local RPC servers on your PC, allowing apps to talk to it thinking it was just normal Discord. It can then send that info to apps which usually don't get RPC, like Discord Web, ArmCord, etc. which can then set that as your status. This would otherwise not be possible, as web apps/browsers/etc can't just use Discord's already existing code and version.
- App with Discord RPC
- ~~Discord Desktop's native server~~ arRPC
@ -12,14 +23,44 @@ Rich Presence (RPC) is the name for how some apps can talk to Discord desktop on
<br>
### How to try
## Usage
1. Clone repo
2. Run server with `node src` (use new Node)
3. Open Discord in browser
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 :)
### Server (**REQUIRED**)
1. Have latest (>=18) Node installed
2. Clone GitHub repo
3. `npm install`
4. Run server with `node src`
### Web
#### No Mods
1. Get [the arRPC server running](#server-required)
2. With Discord open, run the content of [`examples/bridge_mod.js`](examples/bridge_mod.js) in Console (Ctrl+Shift+I).
#### Vencord
1. Get [the arRPC server running](#server-required)
2. Just enable the `WebRichPresence (arRPC)` Vencord plugin!
### Custom Clients
#### ArmCord
ArmCord has arRPC specially integrated, just enable the option in it's settings (server not required)!
#### Webcord
1. Get [the arRPC server running](#server-required)
2. Disable the `Use built-in Content Security Policy` option in Advanced settings: ![image](https://user-images.githubusercontent.com/19228318/202926723-93b772fc-f37d-47d4-81fd-b11c5d4051e8.png)
3. With Webcord open, run the content of [`examples/bridge_mod.js`](examples/bridge_mod.js) in the DevTools Console (Ctrl+Shift+I).
---
Then just use apps with Discord RPC like normal and they _should_ work!
<br>
## Supported
@ -36,3 +77,5 @@ Rich Presence (RPC) is the name for how some apps can talk to Discord desktop on
- [x] DISPATCH
- [x] SET_ACTIVITY
- [x] INVITE_BROWSER
- [x] GUILD_TEMPLATE_BROWSER
- [x] DEEP_LINK

20
src/arrpc/changelog.md Normal file
View File

@ -0,0 +1,20 @@
# arRPC Changelog
## v2.2.0 [20-11-2022]
- Server: Move all looking up/fetching to client
## v2.1.0 [20-11-2022]
- Server: Stop activites when app disconnects
- Server: Added support for several apps shown at once (added `socketId`)
- Bridge: Catchup newly connected clients with last message by socket id
- Transports: Rewrote internal API to use handlers object
- API: Added parsing for GUILD_TEMPLATE_BROWSER
- API: Added parsing for DEEP_LINK
## v2.0.0 [20-11-2022]
- feat (breaking): moved asset lookup to client
- feat: add examples
- feat: add changelog

View File

@ -0,0 +1,9 @@
# arRPC Examples
## [Bridge Mod](bridge_mod.js)
Simple mod for using the arRPC Bridge WebSocket server for setting RPC status (to be used with just Web).
## [Electron](electron)
Example usage for within an Electron client.

View File

@ -0,0 +1,78 @@
(() => {
let Dispatcher,
lookupAsset,
lookupApp,
apps = {};
const ws = new WebSocket("ws://127.0.0.1:1337"); // connect to arRPC bridge websocket
ws.onmessage = async (x) => {
msg = JSON.parse(x.data);
console.log(msg);
if (!Dispatcher) {
const wpRequire = window.webpackChunkdiscord_app.push([[Symbol()], {}, (x) => x]);
const cache = wpRequire.c;
window.webpackChunkdiscord_app.pop();
for (const id in cache) {
let mod = cache[id].exports;
mod = mod && (mod.Z ?? mod.ZP);
if (mod && mod.register && mod.wait) {
Dispatcher = mod;
break;
}
}
const factories = wpRequire.m;
for (const id in factories) {
if (factories[id].toString().includes("getAssetImage: size must === [number, number] for Twitch")) {
const mod = wpRequire(id);
const _lookupAsset = Object.values(mod).find(
(e) => typeof e === "function" && e.toString().includes("apply(")
);
lookupAsset = async (appId, name) => (await _lookupAsset(appId, [name, undefined]))[0];
break;
}
}
for (const id in factories) {
if (factories[id].toString().includes(`e.application={`)) {
const mod = wpRequire(id);
const _lookupApp = Object.values(mod).find(
(e) => typeof e === "function" && e.toString().includes(`e.application={`)
);
lookupApp = async (appId) => {
let socket = {};
await _lookupApp(socket, appId);
return socket.application;
};
break;
}
}
}
if (msg.activity?.assets?.large_image)
msg.activity.assets.large_image = await lookupAsset(
msg.activity.application_id,
msg.activity.assets.large_image
);
if (msg.activity?.assets?.small_image)
msg.activity.assets.small_image = await lookupAsset(
msg.activity.application_id,
msg.activity.assets.small_image
);
const appId = msg.activity.application_id;
if (!apps[appId]) apps[appId] = await lookupApp(appId);
const app = apps[appId];
if (!msg.activity.name) msg.activity.name = app.name;
Dispatcher.dispatch({type: "LOCAL_ACTIVITY_UPDATE", ...msg}); // set RPC status
};
})();

View File

@ -0,0 +1,9 @@
// myWindow = your discord.com BrowserWindow
import Server from "./path/to/arrpc/server.js";
const arrpc = await new Server();
arrpc.on("activity", (data) => myWindow.webContents.send("rpc", data));
arrpc.on("invite", (code) => {
// your invite code handling here
});

View File

@ -0,0 +1,73 @@
import {ipcRenderer} from "electron";
let Dispatcher,
lookupAsset,
lookupApp,
apps = {};
ipcRenderer.on("rpc", async (event, data) => {
if (!Dispatcher) {
const wpRequire = window.webpackChunkdiscord_app.push([[Symbol()], {}, (x) => x]);
const cache = wpRequire.c;
window.webpackChunkdiscord_app.pop();
for (const id in cache) {
let mod = cache[id].exports;
mod = mod && (mod.Z ?? mod.ZP);
if (mod && mod.register && mod.wait) {
Dispatcher = mod;
break;
}
}
const factories = wpRequire.m;
for (const id in factories) {
if (factories[id].toString().includes("getAssetImage: size must === [number, number] for Twitch")) {
const mod = wpRequire(id);
const _lookupAsset = Object.values(mod).find(
(e) => typeof e === "function" && e.toString().includes("apply(")
);
lookupAsset = async (appId, name) => (await _lookupAsset(appId, [name, undefined]))[0];
break;
}
}
for (const id in factories) {
if (factories[id].toString().includes(`e.application={`)) {
const mod = wpRequire(id);
const _lookupApp = Object.values(mod).find(
(e) => typeof e === "function" && e.toString().includes(`e.application={`)
);
lookupApp = async (appId) => {
let socket = {};
await _lookupApp(socket, appId);
return socket.application;
};
break;
}
}
}
if (data.activity?.assets?.large_image)
data.activity.assets.large_image = await lookupAsset(
data.activity.application_id,
data.activity.assets.large_image
);
if (data.activity?.assets?.small_image)
data.activity.assets.small_image = await lookupAsset(
data.activity.application_id,
data.activity.assets.small_image
);
const appId = data.activity.application_id;
if (!apps[appId]) apps[appId] = await lookupApp(appId);
const app = apps[appId];
if (!data.activity.name) data.activity.name = app.name;
Dispatcher.dispatch({type: "LOCAL_ACTIVITY_UPDATE", ...data}); // set RPC status
});

View File

@ -1,10 +1,10 @@
{
"name": "arrpc",
"version": "1.1.0",
"version": "2.2.0",
"description": "Open Discord RPC server for atypical setups",
"main": "src/index.js",
"main": "src/index.cjs",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"start": "node src"
},
"repository": {
"type": "git",

View File

@ -1,24 +0,0 @@
let Dispatcher;
const ws = new WebSocket("ws://127.0.0.1:1337"); // connect to arRPC bridge
ws.onmessage = (x) => {
msg = JSON.parse(x.data);
console.log(msg);
if (!Dispatcher) {
const cache = window.webpackChunkdiscord_app.push([[Symbol()], {}, (x) => x]).c;
window.webpackChunkdiscord_app.pop();
for (const id in cache) {
let mod = cache[id].exports;
mod = mod && (mod.Z ?? mod.ZP);
if (mod && mod.register && mod.wait) {
Dispatcher = mod;
break;
}
}
}
Dispatcher.dispatch({type: "LOCAL_ACTIVITY_UPDATE", ...msg}); // set RPC status
};

View File

@ -1,22 +0,0 @@
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 {WebSocketServer} = require("ws");
// basic bridge to pass info onto webapp
const send = (msg) => {
wss.clients.forEach((x) => x.send(JSON.stringify(msg)));
};
const port = 1337;
const wss = new WebSocketServer({port});
wss.on("connection", (socket) => {
log("web connected");
socket.on("close", () => {
log("web disconnected");
});
});
wss.on("listening", () => log("listening on", port));
module.exports = {send};

View File

@ -1,13 +1,10 @@
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")}]`, ...args);
log("arRPC v1.1.0-beta ArmCord");
log("arRPC v2.2.0 [ArmCord]");
const Bridge = require("./bridge.js");
const {RPCServer} = require("./server.js");
const fetch = require("cross-fetch");
const {mainWindow} = require("../../../ts-out/window.js");
const {sleep} = require("../../../ts-out/utils.js");
async function run() {
const server = await new RPCServer();
@ -24,4 +21,3 @@ async function run() {
});
}
run();
//server.on('activity', data => Bridge.send(data));

View File

@ -1,23 +1,28 @@
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 {EventEmitter} = require("events");
const {IPCServer} = require("./transports/ipc.js");
const {WSServer} = require("./transports/websocket.js");
const Bridge = require("./bridge.js");
const fetch = require("cross-fetch");
const lookupAsset = (name, assets) => {
return assets.find((x) => x.name === name)?.id;
};
let socketId = 0;
class RPCServer extends EventEmitter {
constructor() {
super();
return (async () => {
this.onConnection = this.onConnection.bind(this);
this.onMessage = this.onMessage.bind(this);
this.onClose = this.onClose.bind(this);
this.ipc = await new IPCServer(this.onMessage, this.onConnection);
this.ws = await new WSServer(this.onMessage, this.onConnection);
const handlers = {
connection: this.onConnection,
message: this.onMessage,
close: this.onClose
};
this.ipc = await new IPCServer(handlers);
this.ws = await new WSServer(handlers);
return this;
})();
@ -33,28 +38,31 @@ class RPCServer extends EventEmitter {
}
});
socket.socketId = socketId++;
this.emit("connection", socket);
}
onClose(socket) {
this.emit("activity", {
activity: null,
pid: socket.lastPid,
socketId: socket.socketId.toString()
});
this.emit("close", socket);
}
async onMessage(socket, {cmd, args, nonce}) {
this.emit("message", {socket, cmd, args, nonce});
switch (cmd) {
case "SET_ACTIVITY":
if (!socket.application) {
// fetch info about 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; // translate given parameters into what discord dispatch expects
const {buttons, timestamps, instance} = activity;
socket.lastPid = pid ?? socket.lastPid;
const metadata = {};
const extra = {};
if (buttons) {
@ -70,27 +78,22 @@ class RPCServer extends EventEmitter {
timestamps[x] = Math.floor(1000 * timestamps[x]);
}
// lookup assets to ids
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);
this.emit("activity", {
activity: {
name: socket.application.name,
application_id: socket.application.id,
application_id: socket.clientId,
type: 0,
metadata,
flags: instance ? 1 << 0 : 0,
...activity,
...extra
},
pid
pid,
socketId: socket.socketId.toString()
});
break;
case "GUILD_TEMPLATE_BROWSER":
case "INVITE_BROWSER":
const {code} = args;
socket.send({
@ -101,7 +104,11 @@ class RPCServer extends EventEmitter {
nonce
});
this.emit("invite", code);
this.emit(cmd === "INVITE_BROWSER" ? "invite" : "guild_template", code);
break;
case "DEEP_LINK":
this.emit("link", args.params);
break;
}
}

View File

@ -4,9 +4,7 @@ const log = (...args) => console.log(`[${rgb(88, 101, 242, "arRPC")} > ${rgb(254
const {join} = require("path");
const {platform, env} = require("process");
const {unlinkSync} = require("fs");
const {createServer, createConnection} = require("net");
const SOCKET_PATH =
platform === "win32"
? "\\\\?\\pipe\\discord-ipc"
@ -167,10 +165,9 @@ const getAvailableSocket = async (tries = 0) => {
};
class IPCServer {
constructor(messageHandler, connectionHandler) {
constructor(handers) {
return new Promise(async (res) => {
this.messageHandler = messageHandler;
this.connectionHandler = connectionHandler;
this.handlers = handers;
this.onConnection = this.onConnection.bind(this);
this.onMessage = this.onMessage.bind(this);
@ -237,6 +234,7 @@ class IPCServer {
socket.on("close", (e) => {
log("socket closed", e);
this.handlers.close(socket);
});
socket.on("request", this.onMessage.bind(this, socket));
@ -249,13 +247,13 @@ class IPCServer {
socket.clientId = clientId;
this.connectionHandler(socket);
this.handlers.connection(socket);
});
}
onMessage(socket, msg) {
log("message", msg);
this.messageHandler(socket, msg);
this.handlers.message(socket, msg);
}
}
module.exports = {IPCServer};

View File

@ -4,14 +4,13 @@ const log = (...args) => console.log(`[${rgb(88, 101, 242, "arRPC")} > ${rgb(235
const {WebSocketServer} = require("ws");
const {createServer} = require("http");
const {parse} = require("querystring");
var exportPort = 0000;
const portRange = [6463, 6472]; // ports available/possible: 6463-6472
class WSServer {
constructor(messageHandler, connectionHandler) {
constructor(handlers) {
return (async () => {
this.messageHandler = messageHandler;
this.connectionHandler = connectionHandler;
this.handlers = handlers;
this.onConnection = this.onConnection.bind(this);
this.onMessage = this.onMessage.bind(this);
@ -43,7 +42,7 @@ class WSServer {
http.listen(port, "127.0.0.1", () => {
log("listening on", port);
exportPort = port;
this.http = http;
this.wss = wss;
@ -108,7 +107,8 @@ class WSServer {
});
socket.on("close", (e, r) => {
log("socket closed", e);
log("socket closed", e, r);
this.handlers.close(socket);
});
socket.on("message", this.onMessage.bind(this, socket));
@ -119,12 +119,12 @@ class WSServer {
socket._send(JSON.stringify(msg));
};
this.connectionHandler(socket);
this.handlers.connection(socket);
}
onMessage(socket, msg) {
log("message", JSON.parse(msg));
this.messageHandler(socket, JSON.parse(msg));
this.handlers.message(socket, JSON.parse(msg));
}
}
module.exports = {WSServer, exportPort};
module.exports = {WSServer};

79
src/content/js/rpc.js Normal file
View File

@ -0,0 +1,79 @@
(() => {
let Dispatcher,
lookupAsset,
lookupApp,
apps = {};
ArmCordRPC.listen(async (data) => {
msg = data; //already parsed
console.log(msg);
if (!Dispatcher) {
const wpRequire = window.webpackChunkdiscord_app.push([[Symbol()], {}, (x) => x]);
const cache = wpRequire.c;
window.webpackChunkdiscord_app.pop();
for (const id in cache) {
let mod = cache[id].exports;
mod = mod && (mod.Z ?? mod.ZP);
if (mod && mod.register && mod.wait) {
Dispatcher = mod;
break;
}
}
const factories = wpRequire.m;
for (const id in factories) {
if (factories[id].toString().includes("getAssetImage: size must === [number, number] for Twitch")) {
const mod = wpRequire(id);
const _lookupAsset = Object.values(mod).find(
(e) => typeof e === "function" && e.toString().includes("apply(")
);
lookupAsset = async (appId, name) => (await _lookupAsset(appId, [name, undefined]))[0];
break;
}
}
for (const id in factories) {
if (factories[id].toString().includes(`e.application={`)) {
const mod = wpRequire(id);
const _lookupApp = Object.values(mod).find(
(e) => typeof e === "function" && e.toString().includes(`e.application={`)
);
lookupApp = async (appId) => {
let socket = {};
await _lookupApp(socket, appId);
return socket.application;
};
break;
}
}
}
if (msg.activity?.assets?.large_image)
msg.activity.assets.large_image = await lookupAsset(
msg.activity.application_id,
msg.activity.assets.large_image
);
if (msg.activity?.assets?.small_image)
msg.activity.assets.small_image = await lookupAsset(
msg.activity.application_id,
msg.activity.assets.small_image
);
if (msg.activity) {
const appId = msg.activity.application_id;
if (!apps[appId]) apps[appId] = await lookupApp(appId);
const app = apps[appId];
if (!msg.activity.name) msg.activity.name = app.name;
}
Dispatcher.dispatch({type: "LOCAL_ACTIVITY_UPDATE", ...msg}); // set RPC status
});
})();

View File

@ -42,38 +42,23 @@ if (window.location.href.indexOf("splash.html") > -1) {
injectMobileStuff();
}
sleep(5000).then(async () => {
// dirty hack to make clicking notifications focus ArmCord
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);
};
})();
ArmCordRPC.listen((data) => {
console.log(data)
dispatch({ type: "LOCAL_ACTIVITY_UPDATE", ...data });
})
(() => {
const originalSetter = Object.getOwnPropertyDescriptor(Notification.prototype, "onclick").set;
Object.defineProperty(Notification.prototype, "onclick", {
set(onClick) {
originalSetter.call(this, function() {
onClick.apply(this, arguments);
armcord.window.show();
})
},
configurable: true
});
})();
`);
addScript(fs.readFileSync(path.join(__dirname, "../", "/content/js/rpc.js"), "utf8"));
const cssPath = path.join(__dirname, "../", "/content/css/discord.css");
addStyle(fs.readFileSync(cssPath, "utf8"));
await updateLang();
@ -114,19 +99,3 @@ setInterval(() => {
el.onclick = () => ipcRenderer.send("openSettingsWindow");
host.append(el);
}, 2000);
// dirty hack to make clicking notifications focus ArmCord
addScript(`
(() => {
const originalSetter = Object.getOwnPropertyDescriptor(Notification.prototype, "onclick").set;
Object.defineProperty(Notification.prototype, "onclick", {
set(onClick) {
originalSetter.call(this, function() {
onClick.apply(this, arguments);
armcord.window.show();
})
},
configurable: true
});
})();
`);

View File

@ -206,7 +206,7 @@ async function doAfterDefiningTheWindow() {
console.log(contentPath);
if ((await getConfig("inviteWebsocket")) == true) {
//@ts-ignore
import("arrpc");
require("arrpc");
//await startServer();
}
if (firstRun) {