This commit is contained in:
parent
b18703d760
commit
84cba5fdd4
43
src/main.js
43
src/main.js
@ -191,9 +191,9 @@ function startServer(client) {
|
|||||||
|
|
||||||
log.server("DEV MOD ENABLED")
|
log.server("DEV MOD ENABLED")
|
||||||
link = "http://localhost:4000" //DEV
|
link = "http://localhost:4000" //DEV
|
||||||
discordlink = "https://discord.com/api/oauth2/authorize?client_id=1094727789682380922&redirect_uri=http%3A%2F%2Flocalhost%3A4000%2Fredirect&response_type=code&scope=guilds%20identify" //DEV
|
discordlink = "https://discord.com/api/oauth2/authorize?client_id=1094727789682380922&redirect_uri=http%3A%2F%2Flocalhost%3A4000%2Fredirect&response_type=code&scope=identify%20guilds%20guilds.members.read" //DEV
|
||||||
} else {
|
} else {
|
||||||
discordlink = "https://discord.com/api/oauth2/authorize?client_id=1094727789682380922&redirect_uri=https%3A%2F%2Fsubsonics.raphix.fr%2Fredirect&response_type=code&scope=identify%20guilds" //OFFICIEL
|
discordlink = "https://discord.com/api/oauth2/authorize?client_id=1094727789682380922&redirect_uri=https%3A%2F%2Fsubsonics.raphix.fr%2Fredirect&response_type=code&scope=identify%20guilds%20guilds.members.read" //OFFICIEL
|
||||||
link = "https://subsonics.raphix.fr"
|
link = "https://subsonics.raphix.fr"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -752,7 +752,7 @@ function startServer(client) {
|
|||||||
params.append('grant_type', 'authorization_code');
|
params.append('grant_type', 'authorization_code');
|
||||||
params.append('code', code);
|
params.append('code', code);
|
||||||
params.append('redirect_uri', link + "/redirect");
|
params.append('redirect_uri', link + "/redirect");
|
||||||
params.append('scope', 'identify guild');
|
params.append('scope', 'identify guilds');
|
||||||
|
|
||||||
fetch('https://discord.com/api/oauth2/token', {
|
fetch('https://discord.com/api/oauth2/token', {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
@ -798,12 +798,45 @@ function startServer(client) {
|
|||||||
|
|
||||||
log.server("Discord Auth : REQUESTING DATA - TOKEN : " + token + " - DISCORD_ACCESS_TOKEN : " + response.access_token)
|
log.server("Discord Auth : REQUESTING DATA - TOKEN : " + token + " - DISCORD_ACCESS_TOKEN : " + response.access_token)
|
||||||
|
|
||||||
fetch('https://discord.com/api/users/@me', {
|
fetch('https://discord.com/api/users/@me/guilds/137291455336022018/member', {
|
||||||
headers: {
|
headers: {
|
||||||
authorization: `${response.token_type} ${response.access_token}`,
|
authorization: `${response.token_type} ${response.access_token}`,
|
||||||
},
|
},
|
||||||
}).then(resp => resp.json()).then(resp => addIdentity(resp, token, socket)).catch(error => log.server.error(error))
|
}).then(resp => resp.json()).then(resp => checkIdentity(resp, token, socket, response)).catch(error => log.server.error(error))
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
async function checkIdentity(servers, token, socket, creditentials) {
|
||||||
|
|
||||||
|
var checked = false
|
||||||
|
|
||||||
|
if(servers.message) {
|
||||||
|
|
||||||
|
checked = false
|
||||||
|
} else {
|
||||||
|
|
||||||
|
for(var role of servers.roles) {
|
||||||
|
|
||||||
|
if(role == "397725552968204288") {
|
||||||
|
|
||||||
|
checked = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if(checked == true) {
|
||||||
|
|
||||||
|
fetch('https://discord.com/api/users/@me', {
|
||||||
|
headers: {
|
||||||
|
authorization: `${creditentials.token_type} ${creditentials.access_token}`,
|
||||||
|
},
|
||||||
|
}).then(resp => resp.json()).then(resp => addIdentity(resp, token, socket)).catch(error => log.server.error(error))
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
socket.emit("checkFailed")
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
237
src/tokens.json
237
src/tokens.json
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"68e45a4a-0f46-4a0c-b4aa-efac9439b0cc": {
|
"2780dd1a-9993-4b96-b495-98f970a624ab": {
|
||||||
"id": "486943594893017119",
|
"id": "486943594893017119",
|
||||||
"username": "Raphix",
|
"username": "Raphix",
|
||||||
"global_name": null,
|
"global_name": null,
|
||||||
@ -16,7 +16,7 @@
|
|||||||
"premium_type": 0,
|
"premium_type": 0,
|
||||||
"avatar_decoration": null
|
"avatar_decoration": null
|
||||||
},
|
},
|
||||||
"d13687de-adcd-454b-8f82-d5a67f1aefda": {
|
"e2ceb6a4-d49c-4f27-b7a1-8c42966551eb": {
|
||||||
"id": "486943594893017119",
|
"id": "486943594893017119",
|
||||||
"username": "Raphix",
|
"username": "Raphix",
|
||||||
"global_name": null,
|
"global_name": null,
|
||||||
@ -33,7 +33,92 @@
|
|||||||
"premium_type": 0,
|
"premium_type": 0,
|
||||||
"avatar_decoration": null
|
"avatar_decoration": null
|
||||||
},
|
},
|
||||||
"3410460a-ff5c-4075-901c-13660ffd496d": {
|
"92107510-a256-4522-9d32-d30edf95fcfb": {
|
||||||
|
"id": "582966873201704960",
|
||||||
|
"username": "RaphX",
|
||||||
|
"global_name": null,
|
||||||
|
"display_name": null,
|
||||||
|
"avatar": "d7292780a2f481a80413201ddeacb956",
|
||||||
|
"discriminator": "9459",
|
||||||
|
"public_flags": 0,
|
||||||
|
"flags": 0,
|
||||||
|
"banner": null,
|
||||||
|
"banner_color": "#ff0000",
|
||||||
|
"accent_color": 16711680,
|
||||||
|
"locale": "fr",
|
||||||
|
"mfa_enabled": false,
|
||||||
|
"premium_type": 0,
|
||||||
|
"avatar_decoration": null
|
||||||
|
},
|
||||||
|
"bb63b529-c234-4328-b47c-ab1dd28b6c2c": {
|
||||||
|
"id": "582966873201704960",
|
||||||
|
"username": "RaphX",
|
||||||
|
"global_name": null,
|
||||||
|
"display_name": null,
|
||||||
|
"avatar": "d7292780a2f481a80413201ddeacb956",
|
||||||
|
"discriminator": "9459",
|
||||||
|
"public_flags": 0,
|
||||||
|
"flags": 0,
|
||||||
|
"banner": null,
|
||||||
|
"banner_color": "#ff0000",
|
||||||
|
"accent_color": 16711680,
|
||||||
|
"locale": "fr",
|
||||||
|
"mfa_enabled": false,
|
||||||
|
"premium_type": 0,
|
||||||
|
"avatar_decoration": null
|
||||||
|
},
|
||||||
|
"45c7f6d8-dc2f-4feb-a710-976f935425bb": {
|
||||||
|
"id": "582966873201704960",
|
||||||
|
"username": "RaphX",
|
||||||
|
"global_name": null,
|
||||||
|
"display_name": null,
|
||||||
|
"avatar": "d7292780a2f481a80413201ddeacb956",
|
||||||
|
"discriminator": "9459",
|
||||||
|
"public_flags": 0,
|
||||||
|
"flags": 0,
|
||||||
|
"banner": null,
|
||||||
|
"banner_color": "#ff0000",
|
||||||
|
"accent_color": 16711680,
|
||||||
|
"locale": "fr",
|
||||||
|
"mfa_enabled": false,
|
||||||
|
"premium_type": 0,
|
||||||
|
"avatar_decoration": null
|
||||||
|
},
|
||||||
|
"1fee2fdf-fdfb-4790-a231-cb2ead01afe0": {
|
||||||
|
"id": "582966873201704960",
|
||||||
|
"username": "RaphX",
|
||||||
|
"global_name": null,
|
||||||
|
"display_name": null,
|
||||||
|
"avatar": "d7292780a2f481a80413201ddeacb956",
|
||||||
|
"discriminator": "9459",
|
||||||
|
"public_flags": 0,
|
||||||
|
"flags": 0,
|
||||||
|
"banner": null,
|
||||||
|
"banner_color": "#ff0000",
|
||||||
|
"accent_color": 16711680,
|
||||||
|
"locale": "fr",
|
||||||
|
"mfa_enabled": false,
|
||||||
|
"premium_type": 0,
|
||||||
|
"avatar_decoration": null
|
||||||
|
},
|
||||||
|
"1514184b-ff27-4034-bbc6-aacc93825f9e": {
|
||||||
|
"id": "582966873201704960",
|
||||||
|
"username": "RaphX",
|
||||||
|
"global_name": null,
|
||||||
|
"display_name": null,
|
||||||
|
"avatar": "d7292780a2f481a80413201ddeacb956",
|
||||||
|
"discriminator": "9459",
|
||||||
|
"public_flags": 0,
|
||||||
|
"flags": 0,
|
||||||
|
"banner": null,
|
||||||
|
"banner_color": "#ff0000",
|
||||||
|
"accent_color": 16711680,
|
||||||
|
"locale": "fr",
|
||||||
|
"mfa_enabled": false,
|
||||||
|
"premium_type": 0,
|
||||||
|
"avatar_decoration": null
|
||||||
|
},
|
||||||
|
"7a1bb160-eb45-4bdb-9f31-a2c0f49753a0": {
|
||||||
"id": "486943594893017119",
|
"id": "486943594893017119",
|
||||||
"username": "Raphix",
|
"username": "Raphix",
|
||||||
"global_name": null,
|
"global_name": null,
|
||||||
@ -50,7 +135,7 @@
|
|||||||
"premium_type": 0,
|
"premium_type": 0,
|
||||||
"avatar_decoration": null
|
"avatar_decoration": null
|
||||||
},
|
},
|
||||||
"af09802f-fa3a-4ebe-8b34-51a6375408d1": {
|
"8b77d1fc-0d7f-4883-ac6c-a78ecbe1dba7": {
|
||||||
"id": "486943594893017119",
|
"id": "486943594893017119",
|
||||||
"username": "Raphix",
|
"username": "Raphix",
|
||||||
"global_name": null,
|
"global_name": null,
|
||||||
@ -67,7 +152,7 @@
|
|||||||
"premium_type": 0,
|
"premium_type": 0,
|
||||||
"avatar_decoration": null
|
"avatar_decoration": null
|
||||||
},
|
},
|
||||||
"5be82e44-2ecf-4f1c-8850-37886e15937b": {
|
"cd6a0f1b-ab01-4e2f-b868-0dc799857d59": {
|
||||||
"id": "486943594893017119",
|
"id": "486943594893017119",
|
||||||
"username": "Raphix",
|
"username": "Raphix",
|
||||||
"global_name": null,
|
"global_name": null,
|
||||||
@ -84,7 +169,7 @@
|
|||||||
"premium_type": 0,
|
"premium_type": 0,
|
||||||
"avatar_decoration": null
|
"avatar_decoration": null
|
||||||
},
|
},
|
||||||
"1c62461d-7cc9-44e2-a42a-6fae79baabb6": {
|
"ad59b8e1-0a90-44fc-9af6-b64ade21e035": {
|
||||||
"id": "486943594893017119",
|
"id": "486943594893017119",
|
||||||
"username": "Raphix",
|
"username": "Raphix",
|
||||||
"global_name": null,
|
"global_name": null,
|
||||||
@ -101,7 +186,7 @@
|
|||||||
"premium_type": 0,
|
"premium_type": 0,
|
||||||
"avatar_decoration": null
|
"avatar_decoration": null
|
||||||
},
|
},
|
||||||
"cdba02f4-3473-4c76-8567-ef8965e0c211": {
|
"f4dd1141-cdae-493d-a165-69da5fa062fe": {
|
||||||
"id": "486943594893017119",
|
"id": "486943594893017119",
|
||||||
"username": "Raphix",
|
"username": "Raphix",
|
||||||
"global_name": null,
|
"global_name": null,
|
||||||
@ -118,143 +203,7 @@
|
|||||||
"premium_type": 0,
|
"premium_type": 0,
|
||||||
"avatar_decoration": null
|
"avatar_decoration": null
|
||||||
},
|
},
|
||||||
"73f031a3-6280-4836-89d1-09080d1a74c2": {
|
"17e0433d-071a-457e-a71c-81a2434bf34a": {
|
||||||
"id": "486943594893017119",
|
|
||||||
"username": "Raphix",
|
|
||||||
"global_name": null,
|
|
||||||
"display_name": null,
|
|
||||||
"avatar": "883ec1a7136b0aa3c22e4bdc33e278e5",
|
|
||||||
"discriminator": "8434",
|
|
||||||
"public_flags": 4194368,
|
|
||||||
"flags": 4194368,
|
|
||||||
"banner": null,
|
|
||||||
"banner_color": "#ff4d4d",
|
|
||||||
"accent_color": 16731469,
|
|
||||||
"locale": "fr",
|
|
||||||
"mfa_enabled": true,
|
|
||||||
"premium_type": 0,
|
|
||||||
"avatar_decoration": null
|
|
||||||
},
|
|
||||||
"c3b40227-5112-421d-8f2b-46a30a87cbca": {
|
|
||||||
"id": "486943594893017119",
|
|
||||||
"username": "Raphix",
|
|
||||||
"global_name": null,
|
|
||||||
"display_name": null,
|
|
||||||
"avatar": "883ec1a7136b0aa3c22e4bdc33e278e5",
|
|
||||||
"discriminator": "8434",
|
|
||||||
"public_flags": 4194368,
|
|
||||||
"flags": 4194368,
|
|
||||||
"banner": null,
|
|
||||||
"banner_color": "#ff4d4d",
|
|
||||||
"accent_color": 16731469,
|
|
||||||
"locale": "fr",
|
|
||||||
"mfa_enabled": true,
|
|
||||||
"premium_type": 0,
|
|
||||||
"avatar_decoration": null
|
|
||||||
},
|
|
||||||
"599c640c-b8bd-44b1-9b27-d87a5ab68cf7": {
|
|
||||||
"id": "486943594893017119",
|
|
||||||
"username": "Raphix",
|
|
||||||
"global_name": null,
|
|
||||||
"display_name": null,
|
|
||||||
"avatar": "883ec1a7136b0aa3c22e4bdc33e278e5",
|
|
||||||
"discriminator": "8434",
|
|
||||||
"public_flags": 4194368,
|
|
||||||
"flags": 4194368,
|
|
||||||
"banner": null,
|
|
||||||
"banner_color": "#ff4d4d",
|
|
||||||
"accent_color": 16731469,
|
|
||||||
"locale": "fr",
|
|
||||||
"mfa_enabled": true,
|
|
||||||
"premium_type": 0,
|
|
||||||
"avatar_decoration": null
|
|
||||||
},
|
|
||||||
"a078d4ab-28c5-4b01-b3f8-c6b29f4c4141": {
|
|
||||||
"id": "486943594893017119",
|
|
||||||
"username": "Raphix",
|
|
||||||
"global_name": null,
|
|
||||||
"display_name": null,
|
|
||||||
"avatar": "883ec1a7136b0aa3c22e4bdc33e278e5",
|
|
||||||
"discriminator": "8434",
|
|
||||||
"public_flags": 4194368,
|
|
||||||
"flags": 4194368,
|
|
||||||
"banner": null,
|
|
||||||
"banner_color": "#ff4d4d",
|
|
||||||
"accent_color": 16731469,
|
|
||||||
"locale": "fr",
|
|
||||||
"mfa_enabled": true,
|
|
||||||
"premium_type": 0,
|
|
||||||
"avatar_decoration": null
|
|
||||||
},
|
|
||||||
"5283c6a7-11b2-4454-b6a5-afecb7169d7f": {
|
|
||||||
"id": "486943594893017119",
|
|
||||||
"username": "Raphix",
|
|
||||||
"global_name": null,
|
|
||||||
"display_name": null,
|
|
||||||
"avatar": "883ec1a7136b0aa3c22e4bdc33e278e5",
|
|
||||||
"discriminator": "8434",
|
|
||||||
"public_flags": 4194368,
|
|
||||||
"flags": 4194368,
|
|
||||||
"banner": null,
|
|
||||||
"banner_color": "#ff4d4d",
|
|
||||||
"accent_color": 16731469,
|
|
||||||
"locale": "fr",
|
|
||||||
"mfa_enabled": true,
|
|
||||||
"premium_type": 0,
|
|
||||||
"avatar_decoration": null
|
|
||||||
},
|
|
||||||
"8e4dec3f-82c0-4bd2-a9fb-9ecf64f8aac3": {
|
|
||||||
"id": "486943594893017119",
|
|
||||||
"username": "Raphix",
|
|
||||||
"global_name": null,
|
|
||||||
"display_name": null,
|
|
||||||
"avatar": "883ec1a7136b0aa3c22e4bdc33e278e5",
|
|
||||||
"discriminator": "8434",
|
|
||||||
"public_flags": 4194368,
|
|
||||||
"flags": 4194368,
|
|
||||||
"banner": null,
|
|
||||||
"banner_color": "#ff4d4d",
|
|
||||||
"accent_color": 16731469,
|
|
||||||
"locale": "fr",
|
|
||||||
"mfa_enabled": true,
|
|
||||||
"premium_type": 0,
|
|
||||||
"avatar_decoration": null
|
|
||||||
},
|
|
||||||
"629133a4-f205-4401-a026-639aee65695d": {
|
|
||||||
"id": "486943594893017119",
|
|
||||||
"username": "Raphix",
|
|
||||||
"global_name": null,
|
|
||||||
"display_name": null,
|
|
||||||
"avatar": "883ec1a7136b0aa3c22e4bdc33e278e5",
|
|
||||||
"discriminator": "8434",
|
|
||||||
"public_flags": 4194368,
|
|
||||||
"flags": 4194368,
|
|
||||||
"banner": null,
|
|
||||||
"banner_color": "#ff4d4d",
|
|
||||||
"accent_color": 16731469,
|
|
||||||
"locale": "fr",
|
|
||||||
"mfa_enabled": true,
|
|
||||||
"premium_type": 0,
|
|
||||||
"avatar_decoration": null
|
|
||||||
},
|
|
||||||
"002e5b9d-4b23-4444-97f0-4bd46ac6f36e": {
|
|
||||||
"id": "486943594893017119",
|
|
||||||
"username": "Raphix",
|
|
||||||
"global_name": null,
|
|
||||||
"display_name": null,
|
|
||||||
"avatar": "883ec1a7136b0aa3c22e4bdc33e278e5",
|
|
||||||
"discriminator": "8434",
|
|
||||||
"public_flags": 4194368,
|
|
||||||
"flags": 4194368,
|
|
||||||
"banner": null,
|
|
||||||
"banner_color": "#ff4d4d",
|
|
||||||
"accent_color": 16731469,
|
|
||||||
"locale": "fr",
|
|
||||||
"mfa_enabled": true,
|
|
||||||
"premium_type": 0,
|
|
||||||
"avatar_decoration": null
|
|
||||||
},
|
|
||||||
"4a94dd0d-d022-499e-acdf-396d9a1c3291": {
|
|
||||||
"id": "486943594893017119",
|
"id": "486943594893017119",
|
||||||
"username": "Raphix",
|
"username": "Raphix",
|
||||||
"global_name": null,
|
"global_name": null,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user