-
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ce9ff14
commit 5aa4f73
Showing
5 changed files
with
32 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,27 @@ | ||
import { Client } from 'mishiro-core' | ||
import { Client, ServerResponse } from 'mishiro-core' | ||
import { remote } from 'electron' | ||
|
||
declare namespace window { | ||
export let decryptBody: typeof Client.decryptBody | ||
export namespace mishiro { | ||
export const encode: typeof Client.cryptoGrapher.encode | ||
export const decode: typeof Client.cryptoGrapher.decode | ||
export const _decryptBody: typeof Client.decryptBody | ||
export function decryptBody (body: string, udid: string): any | ||
export function getProfile (viewer: string | number): Promise<ServerResponse> | ||
} | ||
} | ||
|
||
window.decryptBody = Client.decryptBody | ||
window.mishiro = { | ||
encode: Client.cryptoGrapher.encode, | ||
decode: Client.cryptoGrapher.decode, | ||
_decryptBody: Client.decryptBody, | ||
decryptBody (body, udid) { | ||
if (!(/^[0-9a-f\-]{36}$/.test(udid))) { | ||
udid = Client.cryptoGrapher.decode(udid) | ||
} | ||
return Client.decryptBody(body, Buffer.from(udid.replace(/-/g, ''), 'hex')) | ||
}, | ||
getProfile (viewer) { | ||
return (remote.getGlobal('client') as Client).post('/profile/get_profile', { friend_id: viewer.toString() }) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters