mirror of
https://github.com/smogon/pokemon-showdown-loginserver.git
synced 2026-03-21 17:34:38 -05:00
Sync box changes to remote
This commit is contained in:
parent
7f45fde4f7
commit
0ade3441e3
|
|
@ -744,14 +744,18 @@ export const actions: { [k: string]: QueryHandler } = {
|
|||
await tables.oauthTokens.delete(existing.id);
|
||||
return { success: false };
|
||||
} else {
|
||||
return { success: existing.id };
|
||||
return { success: existing.id, user: this.user.id };
|
||||
}
|
||||
}
|
||||
const id = crypto.randomBytes(16).toString('hex');
|
||||
await tables.oauthTokens.insert({
|
||||
id, owner: this.user.id, client: clientInfo.id, time: Date.now(),
|
||||
});
|
||||
return { success: id, expires: Date.now() + OAUTH_TOKEN_TIME };
|
||||
return {
|
||||
success: id,
|
||||
expires: Date.now() + OAUTH_TOKEN_TIME,
|
||||
user: this.user.id,
|
||||
};
|
||||
},
|
||||
|
||||
async 'oauth/api/refreshtoken'(params) {
|
||||
|
|
@ -884,6 +888,11 @@ export const actions: { [k: string]: QueryHandler } = {
|
|||
)`WHERE teamid = ${teamid}`;
|
||||
const owns = data?.ownerid === this.user.id;
|
||||
if (!data || (owns ? false : (data.private && (password !== toID(data.private))))) {
|
||||
if (!full) {
|
||||
void fs.appendFile(`./config/teams.log`, JSON.stringify({
|
||||
teamid, user: this.user.id, date: Date.now(),
|
||||
}));
|
||||
}
|
||||
return { team: null };
|
||||
}
|
||||
if ('views' in data && this.user.id !== data.ownerid) {
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@
|
|||
});
|
||||
}
|
||||
var redirect = new URL(params.get('redirect_uri'));
|
||||
redirect.search = new URLSearchParams({assertion: data.data, token: token});
|
||||
redirect.search = new URLSearchParams({assertion: data.data, token: token, user: data.user});
|
||||
location.replace(redirect);
|
||||
}));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -213,7 +213,7 @@ export class ActionContext {
|
|||
// account for shit like ::ffff:127.0.0.1
|
||||
const num = IPTools.ipToNumber(ip) || 0;
|
||||
return (
|
||||
ip === '::ffff:127.0.0.1' ||
|
||||
ip === '::ffff:127.0.0.1' || ip === '127.0.0.1' ||
|
||||
Config.trustedproxies.some(f => IPTools.checkPattern(f, ip)) ||
|
||||
IPTools.privateRelayIPs.some(f => f.minIP <= num && num <= f.maxIP)
|
||||
);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user