patched discord rpc for refresh token
This commit is contained in:
@@ -22,5 +22,11 @@
|
||||
"@types/node": "^25.0.10",
|
||||
"tsx": "^4.21.0",
|
||||
"typescript": "^5.9.3"
|
||||
},
|
||||
"pnpm": {
|
||||
"patchedDependencies": {
|
||||
"discord-rpc@4.0.1": "patches/discord-rpc@4.0.1.patch",
|
||||
"@types/discord-rpc@4.0.10": "patches/@types__discord-rpc@4.0.10.patch"
|
||||
}
|
||||
}
|
||||
}
|
||||
14
patches/@types__discord-rpc@4.0.10.patch
Normal file
14
patches/@types__discord-rpc@4.0.10.patch
Normal file
@@ -0,0 +1,14 @@
|
||||
diff --git a/index.d.ts b/index.d.ts
|
||||
index 04480d88d0cd2e21f8a7e2ef9878d6984b14fff5..81285e7e54381362925cc93ccd3f51ff087b5763 100644
|
||||
--- a/index.d.ts
|
||||
+++ b/index.d.ts
|
||||
@@ -52,6 +52,9 @@ export class BaseClient extends EventEmitter {}
|
||||
* The main hub for interacting with Discord RPC
|
||||
*/
|
||||
export class Client extends BaseClient {
|
||||
+ accessToken: string | null;
|
||||
+ refreshToken: string | null;
|
||||
+ accessTokenExpiresAt: number | null;
|
||||
/**
|
||||
* @param options Options for the client.
|
||||
* You must provide a transport
|
||||
27
patches/discord-rpc@4.0.1.patch
Normal file
27
patches/discord-rpc@4.0.1.patch
Normal file
@@ -0,0 +1,27 @@
|
||||
diff --git a/src/client.js b/src/client.js
|
||||
index 0ff29daa9ac1cd4f406944b3e195738d520b2c57..90ef5dc7228e8b1678f72e2573b42bd222a527c1 100644
|
||||
--- a/src/client.js
|
||||
+++ b/src/client.js
|
||||
@@ -32,6 +32,8 @@ class RPCClient extends EventEmitter {
|
||||
this.options = options;
|
||||
|
||||
this.accessToken = null;
|
||||
+ this.refreshToken = null;
|
||||
+ this.accessTokenExpiresAt = null;
|
||||
this.clientId = null;
|
||||
|
||||
/**
|
||||
@@ -222,6 +224,13 @@ class RPCClient extends EventEmitter {
|
||||
}),
|
||||
});
|
||||
|
||||
+ const {
|
||||
+ access_token, refresh_token, expires_in
|
||||
+ } = response;
|
||||
+
|
||||
+ this.refreshToken = refresh_token;
|
||||
+ this.accessTokenExpiresAt = Date.now() + (expires_in * 1000);
|
||||
+
|
||||
return response.access_token;
|
||||
}
|
||||
|
||||
16
pnpm-lock.yaml
generated
16
pnpm-lock.yaml
generated
@@ -4,6 +4,14 @@ settings:
|
||||
autoInstallPeers: true
|
||||
excludeLinksFromLockfile: false
|
||||
|
||||
patchedDependencies:
|
||||
'@types/discord-rpc@4.0.10':
|
||||
hash: jkq6l3q3zsza22tiqsryj6war4
|
||||
path: patches/@types__discord-rpc@4.0.10.patch
|
||||
discord-rpc@4.0.1:
|
||||
hash: sqrsp2dfxm56uqm2hxrxu3bbpi
|
||||
path: patches/discord-rpc@4.0.1.patch
|
||||
|
||||
importers:
|
||||
|
||||
.:
|
||||
@@ -13,14 +21,14 @@ importers:
|
||||
version: 1.13.2
|
||||
discord-rpc:
|
||||
specifier: ^4.0.1
|
||||
version: 4.0.1
|
||||
version: 4.0.1(patch_hash=sqrsp2dfxm56uqm2hxrxu3bbpi)
|
||||
dotenv:
|
||||
specifier: ^17.2.3
|
||||
version: 17.2.3
|
||||
devDependencies:
|
||||
'@types/discord-rpc':
|
||||
specifier: ^4.0.10
|
||||
version: 4.0.10
|
||||
version: 4.0.10(patch_hash=jkq6l3q3zsza22tiqsryj6war4)
|
||||
'@types/node':
|
||||
specifier: ^25.0.10
|
||||
version: 25.0.10
|
||||
@@ -450,7 +458,7 @@ snapshots:
|
||||
'@esbuild/win32-x64@0.27.2':
|
||||
optional: true
|
||||
|
||||
'@types/discord-rpc@4.0.10':
|
||||
'@types/discord-rpc@4.0.10(patch_hash=jkq6l3q3zsza22tiqsryj6war4)':
|
||||
dependencies:
|
||||
'@types/events': 3.0.3
|
||||
|
||||
@@ -486,7 +494,7 @@ snapshots:
|
||||
|
||||
delayed-stream@1.0.0: {}
|
||||
|
||||
discord-rpc@4.0.1:
|
||||
discord-rpc@4.0.1(patch_hash=sqrsp2dfxm56uqm2hxrxu3bbpi):
|
||||
dependencies:
|
||||
node-fetch: 2.7.0
|
||||
ws: 7.5.10
|
||||
|
||||
Reference in New Issue
Block a user