Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
V4NSH4J
GitHub Repository: V4NSH4J/discord-mass-DM-GO
Path: blob/main/instance/headers.go
310 views
1
// Copyright (C) 2021 github.com/V4NSH4J
2
//
3
// This source code has been released under the GNU Affero General Public
4
// License v3.0. A copy of this license is available at
5
// https://www.gnu.org/licenses/agpl-3.0.en.html
6
7
package instance
8
9
import (
10
"fmt"
11
12
http "github.com/Danny-Dasilva/fhttp"
13
)
14
15
func (in *Instance) cookieHeaders(req *http.Request) *http.Request {
16
if in.Config.OtherSettings.Mode == 2 {
17
for k, v := range map[string]string{
18
"Host": "discord.com",
19
"User-Agent": "Discord/125.0 (iPad; iOS 15.4.1; Scale/2.00)",
20
"Accept-Language": "en-US;q=1",
21
"Accept": "*/*",
22
} {
23
req.Header.Set(k, v)
24
}
25
} else {
26
for k, v := range map[string]string{
27
"accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
28
"accept-language": "en-US,en;q=0.9",
29
"sec-ch-ua-mobile": "?0",
30
"sec-fetch-dest": "document",
31
"sec-fetch-mode": "navigate",
32
"sec-fetch-site": "none",
33
"sec-fetch-user": "?1",
34
"upgrade-insecure-requests": "1",
35
"user-agent": in.UserAgent,
36
} {
37
req.Header.Set(k, v)
38
}
39
}
40
41
return req
42
}
43
44
func (in *Instance) cfBmHeaders(req *http.Request, cookie string) *http.Request {
45
for k, v := range map[string]string{
46
"accept": "*/*",
47
"accept-language": "en-US,en;q=0.9",
48
"content-type": "application/json",
49
"cookie": cookie,
50
"origin": "https://discord.com",
51
"referer": "https://discord.com/",
52
"sec-fetch-mode": "cors",
53
"sec-fetch-site": "same-origin",
54
"user-agent": in.UserAgent,
55
} {
56
req.Header.Set(k, v)
57
}
58
return req
59
}
60
61
func (in *Instance) inviteHeaders(req *http.Request, cookie, xcontext string) *http.Request {
62
if in.Config.OtherSettings.Mode == 2 {
63
for k, v := range map[string]string{
64
"Host": "discord.com",
65
"Cookie": cookie,
66
"Content-Type": "application/json",
67
"X-Debug-Options": "bugReporterEnabled",
68
"Accept": "*/*",
69
"Authorization": in.Token,
70
"X-Discord-Locale": "en-US",
71
"Accept-Language": "en-US",
72
"X-Context-Properties": xcontext,
73
"User-Agent": in.UserAgent,
74
"X-Super-Properties": in.XSuper,
75
} {
76
req.Header.Set(k, v)
77
}
78
} else {
79
for k, v := range map[string]string{
80
"accept": "*/*",
81
"accept-language": "en-US,en;q=0.9",
82
"authorization": in.Token,
83
"content-type": "application/json",
84
"cookie": cookie,
85
"origin": "https://discord.com",
86
"referer": "https://discord.com/channels/@me",
87
"sec-fetch-dest": "empty",
88
"sec-fetch-mode": "cors",
89
"sec-fetch-site": "same-origin",
90
"user-agent": in.UserAgent,
91
"x-context-properties": xcontext,
92
"x-debug-options": "bugReporterEnabled",
93
"x-discord-locale": "en-US",
94
"x-super-properties": in.XSuper,
95
} {
96
req.Header.Set(k, v)
97
}
98
}
99
100
return req
101
}
102
103
func (in *Instance) xContextPropertiesHeaders(req *http.Request, cookie string) *http.Request {
104
if in.Config.OtherSettings.Mode == 2 {
105
for k, v := range map[string]string{
106
"Host": "discord.com",
107
"Cookie": cookie,
108
"X-Debug-Options": "bugReporterEnabled",
109
"Accept": "*/*",
110
"X-Discord-Locale": "en-US",
111
"X-Super-Properties": in.XSuper,
112
"Authorization": in.Token,
113
"User-Agent": in.UserAgent,
114
"Accept-Language": "en-US",
115
} {
116
req.Header.Set(k, v)
117
}
118
} else {
119
for k, v := range map[string]string{
120
"accept": "*/*",
121
"accept-language": "en-US,en;q=0.9",
122
"authorization": in.Token,
123
"cookie": cookie,
124
"referer": "https://discord.com/channels/@me",
125
"sec-fetch-dest": "empty",
126
"sec-fetch-mode": "cors",
127
"sec-fetch-site": "same-origin",
128
"user-agent": in.UserAgent,
129
"x-debug-options": "bugReporterEnabled",
130
"x-discord-locale": "en-US",
131
"x-super-properties": in.XSuper,
132
} {
133
req.Header.Set(k, v)
134
}
135
}
136
137
return req
138
}
139
140
func (in *Instance) OpenChannelHeaders(req *http.Request, cookie string) *http.Request {
141
if in.Config.OtherSettings.Mode == 2 {
142
for k, v := range map[string]string{
143
"Host": "discord.com",
144
"Cookie": cookie,
145
"Content-Type": "application/json",
146
"X-Debug-Options": "bugReporterEnabled",
147
"Accept": "*/*",
148
"Authorization": in.Token,
149
"X-Discord-Locale": "en-US",
150
"Accept-Language": "en-US",
151
"X-Context-Properties": "e30=",
152
"User-Agent": in.UserAgent,
153
"X-Super-Properties": in.XSuper,
154
} {
155
req.Header.Set(k, v)
156
}
157
} else {
158
for k, v := range map[string]string{
159
"accept": "*/*",
160
161
"accept-language": "en-US,en;q=0.9",
162
"authorization": in.Token,
163
"content-type": "application/json",
164
"cookie": cookie,
165
"origin": "https://discord.com",
166
"referer": "https://discord.com/channels/@me",
167
"sec-fetch-dest": "empty",
168
"sec-fetch-mode": "cors",
169
"sec-fetch-site": "same-origin",
170
"user-agent": in.UserAgent,
171
"x-context-properties": "e30=",
172
"x-debug-options": "bugReporterEnabled",
173
"x-discord-locale": "en-US",
174
"x-super-properties": in.XSuper,
175
} {
176
req.Header.Set(k, v)
177
}
178
}
179
return req
180
}
181
182
func (in *Instance) SendMessageHeaders(req *http.Request, cookie, recipient string) *http.Request {
183
if in.Config.OtherSettings.Mode == 2 {
184
for k, v := range map[string]string{
185
"Host": "discord.com",
186
"Cookie": cookie,
187
"Content-Type": "application/json",
188
"X-Debug-Options": "bugReporterEnabled",
189
"Accept": "*/*",
190
"Authorization": in.Token,
191
"X-Discord-Locale": "en-US",
192
"Accept-Language": "en-US",
193
"User-Agent": in.UserAgent,
194
"X-Super-Properties": in.XSuper,
195
} {
196
req.Header.Set(k, v)
197
}
198
} else {
199
for k, v := range map[string]string{
200
"accept": "*/*",
201
202
"accept-language": "en-US,en;q=0.9",
203
"authorization": in.Token,
204
"content-type": "application/json",
205
"cookie": cookie,
206
"origin": "https://discord.com",
207
"referer": fmt.Sprintf("https://discord.com/channels/@me/%s", recipient),
208
"sec-fetch-dest": "empty",
209
"sec-fetch-mode": "cors",
210
"sec-fetch-site": "same-origin",
211
"user-agent": in.UserAgent,
212
"x-context-properties": "e30=",
213
"x-debug-options": "bugReporterEnabled",
214
"x-discord-locale": "en-US",
215
"x-super-properties": in.XSuper,
216
} {
217
req.Header.Set(k, v)
218
}
219
}
220
return req
221
}
222
223
func (in *Instance) TypingHeaders(req *http.Request, cookie, snowflake string) *http.Request {
224
if in.Config.OtherSettings.Mode == 2 {
225
for k, v := range map[string]string{
226
"Host": "discord.com",
227
"User-Agent": in.UserAgent,
228
"Accept": "*/*",
229
"Accept-Language": "en-US,en;q=0.5",
230
"Authorization": in.Token,
231
"X-Super-Properties": in.XSuper,
232
"X-Discord-Locale": "en-US",
233
"Cookie": cookie,
234
} {
235
req.Header.Set(k, v)
236
}
237
} else {
238
for k, v := range map[string]string{
239
"accept": "*/*",
240
"accept-language": "en-US,en;q=0.9",
241
"authorization": in.Token,
242
"content-type": "application/json",
243
"cookie": cookie,
244
"origin": "https://discord.com",
245
"referer": fmt.Sprintf("https://discord.com/channels/@me/%s", snowflake),
246
"sec-fetch-dest": "empty",
247
"sec-fetch-mode": "cors",
248
"sec-fetch-site": "same-origin",
249
"user-agent": in.UserAgent,
250
"x-context-properties": "e30=",
251
"x-debug-options": "bugReporterEnabled",
252
"x-discord-locale": "en-US",
253
"x-super-properties": in.XSuper,
254
} {
255
req.Header.Set(k, v)
256
}
257
}
258
259
return req
260
}
261
262
func (in *Instance) AtMeHeaders(req *http.Request, cookie string) *http.Request {
263
if in.Config.OtherSettings.Mode == 2 {
264
for k, v := range map[string]string{
265
"Host": "discord.com",
266
"Cookie": cookie,
267
"Content-Type": "application/json",
268
"X-Debug-Options": "bugReporterEnabled",
269
"Accept": "*/*",
270
"Authorization": in.Token,
271
"X-Discord-Locale": "en-US",
272
"Accept-Language": "en-US",
273
"User-Agent": in.UserAgent,
274
"X-Super-Properties": in.XSuper,
275
} {
276
req.Header.Set(k, v)
277
}
278
} else {
279
for k, v := range map[string]string{
280
"accept": "*/*",
281
"accept-language": "en-US,en;q=0.9",
282
"authorization": in.Token,
283
"content-type": "application/json",
284
"cookie": cookie,
285
"origin": "https://discord.com",
286
"sec-fetch-dest": "empty",
287
"sec-fetch-mode": "cors",
288
"sec-fetch-site": "same-origin",
289
"user-agent": in.UserAgent,
290
"x-context-properties": "e30=",
291
"x-debug-options": "bugReporterEnabled",
292
"x-discord-locale": "en-US",
293
"x-super-properties": in.XSuper,
294
} {
295
req.Header.Set(k, v)
296
}
297
}
298
return req
299
}
300
301
func CommonHeaders(req *http.Request) *http.Request {
302
303
for k, v := range map[string]string{
304
"Host": "discord.com",
305
"Content-Type": "application/json",
306
"X-Debug-Options": "bugReporterEnabled",
307
"Accept": "*/*",
308
"X-Discord-Locale": "en-US",
309
"Accept-Language": "en-US",
310
"User-Agent": "Discord/32114 CFNetwork/1331.0.7 Darwin/21.4.0",
311
"X-Super-Properties": "eyJvcyI6ImlPUyIsImJyb3dzZXIiOiJEaXNjb3JkIGlPUyIsImRldmljZSI6ImlQYWQxMywxNiIsInN5c3RlbV9sb2NhbGUiOiJlbi1JTiIsImNsaWVudF92ZXJzaW9uIjoiMTI0LjAiLCJyZWxlYXNlX2NoYW5uZWwiOiJzdGFibGUiLCJkZXZpY2VfYWR2ZXJ0aXNlcl9pZCI6IjAwMDAwMDAwLTAwMDAtMDAwMC0wMDAwLTAwMDAwMDAwMDAwMCIsImRldmljZV92ZW5kb3JfaWQiOiJBMTgzNkNFRC1BRDI5LTRGRTAtQjVDNC0zODQ0NDU0MEFFQTciLCJicm93c2VyX3VzZXJfYWdlbnQiOiIiLCJicm93c2VyX3ZlcnNpb24iOiIiLCJvc192ZXJzaW9uIjoiMTUuNC4xIiwiY2xpZW50X2J1aWxkX251bWJlciI6MzIyNDcsImNsaWVudF9ldmVudF9zb3VyY2UiOm51bGx9",
312
} {
313
req.Header.Set(k, v)
314
}
315
return req
316
}
317
318
func (in *Instance) UserInfoHeaders(req *http.Request, cookie string) *http.Request {
319
if in.Config.OtherSettings.Mode == 2 {
320
for k, v := range map[string]string{
321
"Host": "discord.com",
322
"Cookie": cookie,
323
"Content-Type": "application/json",
324
"X-Debug-Options": "bugReporterEnabled",
325
"Accept": "*/*",
326
"Authorization": in.Token,
327
"X-Discord-Locale": "en-US",
328
"Accept-Language": "en-US",
329
"User-Agent": in.UserAgent,
330
"X-Super-Properties": in.XSuper,
331
} {
332
req.Header.Set(k, v)
333
}
334
} else {
335
for k, v := range map[string]string{
336
"accept": "*/*",
337
"accept-language": "en-US,en;q=0.9",
338
"authorization": in.Token,
339
"content-type": "application/json",
340
"cookie": cookie,
341
"origin": "https://discord.com",
342
"sec-fetch-dest": "empty",
343
"sec-fetch-mode": "cors",
344
"sec-fetch-site": "same-origin",
345
"user-agent": in.UserAgent,
346
"x-context-properties": "e30=",
347
"x-debug-options": "bugReporterEnabled",
348
"x-discord-locale": "en-US",
349
"x-super-properties": in.XSuper,
350
} {
351
req.Header.Set(k, v)
352
}
353
}
354
return req
355
}
356
357