Versiion 0.2.3 - Ajout Handle Case Discriminator
This commit is contained in:
parent
f567c23ecc
commit
5284c1fadd
@ -5,7 +5,7 @@
|
|||||||
"access_token": "jY17lCWaOpTdPQCnz50kfNm7ABpsGz",
|
"access_token": "jY17lCWaOpTdPQCnz50kfNm7ABpsGz",
|
||||||
"expires_in": 604800,
|
"expires_in": 604800,
|
||||||
"refresh_token": "3TronknZ7j5kVSDBjI3OechmCYF8ck",
|
"refresh_token": "3TronknZ7j5kVSDBjI3OechmCYF8ck",
|
||||||
"scope": "guilds guilds.members.read identify"
|
"scope": "identify guilds guilds.members.read"
|
||||||
},
|
},
|
||||||
"avatar": null,
|
"avatar": null,
|
||||||
"communication_disabled_until": null,
|
"communication_disabled_until": null,
|
||||||
@ -34,6 +34,6 @@
|
|||||||
"deaf": false,
|
"deaf": false,
|
||||||
"bio": "",
|
"bio": "",
|
||||||
"banner": null,
|
"banner": null,
|
||||||
"token": "289373d4-8733-484b-b674-2230e0afc6ae"
|
"token": "7149b971-4595-496c-a541-4c687a37ffd6"
|
||||||
}
|
}
|
||||||
]
|
]
|
2
package-lock.json
generated
2
package-lock.json
generated
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "subsonics-web",
|
"name": "subsonics-web",
|
||||||
"version": "0.2.2",
|
"version": "0.2.3",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "subsonics-web",
|
"name": "subsonics-web",
|
||||||
"author": "Raphix",
|
"author": "Raphix",
|
||||||
"version": "0.2.2",
|
"version": "0.2.3",
|
||||||
"nodemonConfig": {
|
"nodemonConfig": {
|
||||||
"ext": "js, html",
|
"ext": "js, html",
|
||||||
"ignore": [
|
"ignore": [
|
||||||
|
@ -40,7 +40,7 @@ module.exports.getDiscordUser = function (code, session) {
|
|||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
|
|
||||||
alog.log("Récupération de l'autorisation de récupération des informations de l'utilisateur associé à la session : " + session + "[ETAPE 2]")
|
alog.log("Récupération de l'autorisation de récupération des informations de l'utilisateur associé à la session : " + session + " [ETAPE 2]")
|
||||||
|
|
||||||
|
|
||||||
var link = "https://subsonics.raphix.fr"
|
var link = "https://subsonics.raphix.fr"
|
||||||
@ -64,7 +64,7 @@ module.exports.getDiscordUser = function (code, session) {
|
|||||||
}, body : params
|
}, body : params
|
||||||
}).then(resp1 => resp1.json()).then(authorizationKey => {
|
}).then(resp1 => resp1.json()).then(authorizationKey => {
|
||||||
|
|
||||||
alog.log("Récupération des informations de l'utilisateur associé à l'autorisation : '" + authorizationKey.access_token + "' et associé à la session : " + session + "[ETAPE 3]")
|
alog.log("Récupération des informations de l'utilisateur associé à l'autorisation : '" + authorizationKey.access_token + "' et associé à la session : " + session + " [ETAPE 3]")
|
||||||
|
|
||||||
fetch('https://discord.com/api/users/@me/guilds/137291455336022018/member', {
|
fetch('https://discord.com/api/users/@me/guilds/137291455336022018/member', {
|
||||||
headers: {
|
headers: {
|
||||||
@ -74,6 +74,11 @@ module.exports.getDiscordUser = function (code, session) {
|
|||||||
|
|
||||||
var user = {}
|
var user = {}
|
||||||
|
|
||||||
|
if(userInfo.user.discriminator) {
|
||||||
|
reject("MIGRATE_ACCOUNT_ONLY")
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
user.auth = authorizationKey
|
user.auth = authorizationKey
|
||||||
Object.assign(user, userInfo)
|
Object.assign(user, userInfo)
|
||||||
|
|
||||||
|
@ -19,8 +19,8 @@ router.get('/redirect', function(req, res, next) {
|
|||||||
|
|
||||||
if(req.query.code) {
|
if(req.query.code) {
|
||||||
|
|
||||||
alog.step.init("get_discord_info_" + req.cookies.session , "Récupération des informations de l'utilisateur associé à l'autorisation : '" + req.cookies.sessionn + "'")
|
alog.step.init("get_discord_info_" + req.cookies.session , "Récupération des informations de l'utilisateur associé à l'autorisation : '" + req.cookies.session + "'")
|
||||||
|
|
||||||
const user = auth.getDiscordUser(req.query.code, req.cookies.session)
|
const user = auth.getDiscordUser(req.query.code, req.cookies.session)
|
||||||
|
|
||||||
user.then(data => {
|
user.then(data => {
|
||||||
@ -43,7 +43,17 @@ router.get('/redirect', function(req, res, next) {
|
|||||||
|
|
||||||
alog.step.error("get_discord_info_" + req.cookies.session)
|
alog.step.error("get_discord_info_" + req.cookies.session)
|
||||||
console.log(error)
|
console.log(error)
|
||||||
res.redirect('/login?error=CANCEL_LOGIN')
|
|
||||||
|
if(error == "MIGRATE_ACCOUNT_ONLY") {
|
||||||
|
|
||||||
|
res.redirect('/login?error=MIGRATE_ACCOUNT_ONLY')
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
res.redirect('/login?error=CANCEL_LOGIN')
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user