mirror of
https://github.com/smogon/pokemon-showdown-loginserver.git
synced 2026-03-21 17:34:38 -05:00
Add replays/check-login endpoint
Some checks failed
Node.js CI / build (22.x) (push) Has been cancelled
Some checks failed
Node.js CI / build (22.x) (push) Has been cancelled
This commit is contained in:
parent
ca6d979e5a
commit
dd4c773553
|
|
@ -11,7 +11,7 @@ import * as url from 'url';
|
|||
import { Config } from './config-loader';
|
||||
import { Ladder, type LadderEntry } from './ladder';
|
||||
import { Replays } from './replays';
|
||||
import { ActionError, type QueryHandler, Server } from './server';
|
||||
import { ActionError, type QueryHandler, Server, DISPATCH_PREFIX} from './server';
|
||||
import { Session } from './user';
|
||||
import {
|
||||
toID, updateserver, bash, time, escapeHTML, signAsync, TimeSorter,
|
||||
|
|
@ -1038,6 +1038,12 @@ export const actions: { [k: string]: QueryHandler } = {
|
|||
this.allowCORS();
|
||||
return Replays.recent();
|
||||
},
|
||||
'replays/check-login'(params) {
|
||||
return (
|
||||
DISPATCH_PREFIX + `${this.user.id},` +
|
||||
`${Config.sysops.includes(this.user.id) ? 1 : ''}`
|
||||
);
|
||||
},
|
||||
async 'replays/search'(params) {
|
||||
this.allowCORS();
|
||||
if (params.sort && params.sort !== 'rating' && params.sort !== 'date') {
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ import IPTools from './ip-tools';
|
|||
* Adding `]` to the beginning makes sure that the output is a syntax
|
||||
* error in JS, so treating it as a JS file will simply crash and fail.
|
||||
*/
|
||||
const DISPATCH_PREFIX = ']';
|
||||
export const DISPATCH_PREFIX = ']';
|
||||
|
||||
/**
|
||||
* Throw this to end a request with an `actionerror` message.
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user