feat: ✨ discord cookie
This commit is contained in:
parent
40600f8439
commit
7da7cc8b3a
|
@ -14,6 +14,7 @@ All settings for endpoints are configured in query parameters.
|
||||||
### `/discord`
|
### `/discord`
|
||||||
|
|
||||||
- `token`: Discord token
|
- `token`: Discord token
|
||||||
|
- `cookie`: Cookie header, b64-encoded
|
||||||
|
|
||||||
### `/misskey`
|
### `/misskey`
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,11 @@ import { z } from "zod"
|
||||||
import { translator } from "../lib/types.js"
|
import { translator } from "../lib/types.js"
|
||||||
import downloadAvatarForPayload from "../lib/downloadAvatarForPayload.js"
|
import downloadAvatarForPayload from "../lib/downloadAvatarForPayload.js"
|
||||||
export default translator({
|
export default translator({
|
||||||
query: z.object({ token: z.string().describe("Discord token") }),
|
query: z.object({
|
||||||
async execute(payload, { token }) {
|
token: z.string().describe("Discord token"),
|
||||||
|
cookie: z.string().describe(`Cookie header, b64-encoded`),
|
||||||
|
}),
|
||||||
|
async execute(payload, { token, cookie }) {
|
||||||
let avatar = await downloadAvatarForPayload(payload, [
|
let avatar = await downloadAvatarForPayload(payload, [
|
||||||
"png",
|
"png",
|
||||||
"jpeg",
|
"jpeg",
|
||||||
|
@ -30,15 +33,22 @@ export default translator({
|
||||||
"X-Super-Properties": Buffer.from(
|
"X-Super-Properties": Buffer.from(
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
os: "Windows",
|
os: "Windows",
|
||||||
browser: "Discord Client",
|
browser: "Chrome",
|
||||||
os_arch: "x64",
|
device: "",
|
||||||
system_locale: "en-US",
|
system_locale: "en-US",
|
||||||
os_version: "10.0.22621",
|
browser_user_agent: ua,
|
||||||
|
browser_version,
|
||||||
|
os_version: "10",
|
||||||
|
referrer: "",
|
||||||
|
referring_domain: "",
|
||||||
|
referrer_current: "",
|
||||||
|
referring_domain_current: "",
|
||||||
release_channel: "stable",
|
release_channel: "stable",
|
||||||
client_build_number,
|
client_build_number,
|
||||||
client_event_source: null,
|
client_event_source: null,
|
||||||
})
|
})
|
||||||
).toString("base64"),
|
).toString("base64"),
|
||||||
|
cookie: Buffer.from(cookie, "base64").toString(),
|
||||||
"X-Discord-Locale": "en-US",
|
"X-Discord-Locale": "en-US",
|
||||||
"X-Discord-Timezone": "America/Los_Angeles",
|
"X-Discord-Timezone": "America/Los_Angeles",
|
||||||
"X-Debug-Options": "bugReporterEnabled",
|
"X-Debug-Options": "bugReporterEnabled",
|
||||||
|
|
Loading…
Reference in a new issue