Commit Graph

132 Commits

Author SHA1 Message Date
Mia
5512e76866 Ladder: Add GXE filtering for ladders with a max elo above 1500 2024-09-05 15:51:06 -05:00
Guangcong Luo
21de8d92c6 Remove old action.php and replays
Our new API replacement for action.php is in
https://github.com/smogon/pokemon-showdown-loginserver

I haven't completely deleted the old-replays folder because there
are some things we haven't replaced that I don't know what to do
with... I guess that'll come in a future commit.
2023-11-14 11:32:59 +00:00
adrivrie
e7f54bad08
Ladder: Set current gen to 9 for decay purposes (#2130) 2023-07-18 15:40:18 -07:00
Starmind
2ef97f83f1
Upgrade Wikimedia CSS parser (#2126)
Fixes #2119
2023-06-16 11:33:53 -07:00
Mia
c6c6eb4044
Support changing namecolors through the loginserver (#2034)
* Support changing namecolors through the loginserver

* Update lib/dispatcher.lib.php
2022-11-30 16:32:25 -08:00
Guangcong Luo
0db27ee2d6 Improve documentation of $outPrefix 2021-11-15 18:38:20 -05:00
Mia
5458936f2e
ntbb-database: Don't leak partial passwords in errors (#1838) 2021-07-12 16:24:09 -04:00
Guangcong Luo
66238a9ee0 Refactor ntbb-session with auth checking
Auth checking was done relatively sporadically in the past, but this
change adds $users->isSysop/isAdmin/isLeader for more centralized
auth checking.
2021-07-05 18:25:35 -04:00
Guangcong Luo
6fc353cbe3 Remove bad code
This part doesn't do anything because it's below
`else if ($elo > 1300)`.

Maybe we'll update the Elo formula some other time... :S
2021-03-18 13:36:48 -04:00
Guangcong Luo
4df93cd077 Fix /users/0
The website API now reports userid '0' as an unregistered user.

Apparently PHP treats the string '0' as falsy. In the interests of
not overhauling literally all our APIs, I've decided to only change
the code in the website API. The rest doesn't need to be changed
because number-only userids haven't been allowed for a very long
time.

Fixes https://github.com/smogon/pokemon-showdown/pull/7704
2020-11-17 20:53:41 -05:00
Mia
d5c2cf40d6
Remove friends list code (#1646) 2020-10-28 12:52:42 -07:00
Annika
a33e8d247f
Loginserver: Only autoconfirm users who have won a battle (#1608) 2020-08-29 18:52:38 -07:00
Annika
7361473511
Support configurable URLs in the website (#1575) 2020-07-27 18:06:39 -07:00
Guangcong Luo
55b57799c0 Finish migrating website repository
This fixes up the last few remaining issues; from here on out,
pokemonshowdown.com should be served from `website/` with no
known problems.
2020-07-27 21:03:31 -04:00
Guangcong Luo
0bda3daa80 Update include paths and merge config.inc.php 2020-07-27 17:03:58 -07:00
Guangcong Luo
3988c4d726 Update paths for caches
This specifically moves `customcss/`, `userbitscache.html`, and
`news.inc.php` from `website/config/` to `config/`.
2020-07-27 16:56:19 -07:00
Annika
367ed82e56
Support configurable URLs (#1543) 2020-07-21 15:27:21 -07:00
Annika
b47c143b79
Add database schema for loginthrottle table (#1561)
Co-authored-by: Kirk Scheibelhut <kjs@google.com>

Co-authored-by: Kirk Scheibelhut <kjs@google.com>
2020-07-19 15:38:12 -07:00
Annika
1717e14d53
Update database schemas (#1546) 2020-07-09 04:59:45 -07:00
Guangcong Luo
00a877333f Stop autodetecting serverid for loginserver rqs
The automatic server detection just loops through all registered
servers and tries each of them to find the correct one. This process
will hang if any registered server isn't responding to DNS queries,
which at the number we currently have, makes all servers not sending
serverid fail.

We now hard-require the Config.serverid setting, to prevent this
problem.
2020-06-27 12:46:38 -04:00
Guangcong Luo
7c708d7167 Support ports other than 443 for HTTPS
To support running Smogtours on HTTPS, we now support non-443 ports.

We also now set SameSite=None headers for the SID cookie, so it's once
again possible to stay logged in on servers other than Main.
2020-03-29 02:10:02 -04:00
HoeenHero
a4cc5f2d8f Update main server name (#1425) 2019-12-19 07:33:20 +09:00
The Immortal
34e36bf406
Update decay for Random Battle & OU 2019-12-02 05:36:47 +04:00
Konrad Borowski
b0533dc872 Make session lengths consistently 2 weeks (#1386) 2019-10-22 17:18:42 +10:30
Konrad Borowski
eaacf54741 Improve error handling in prepared statements 2019-10-21 17:26:11 +02:00
whales
3efb099c56 Don't error out for ladder ranks with a long input name (#1374) 2019-09-27 13:46:22 +09:30
Guangcong Luo
8ca9916bdc Fix bugs in ladder prefix search
- `$prefix` needs to be initialized
- `$_REQUEST['prefix']` was misspelled as `$_REQUEST['format']`
- prefix argument in `getTop` not correctly marked as optional
- fix missing `FROM`, `AS alias`, and extraneous `)` in query
- `LIMIT` apparently can't be parameterized in MySQL?
2019-07-19 16:36:43 -04:00
Kirk Scheibelhut
80aaab1ef1 Support filtering ladder by username prefix (for OLT) (#1326) 2019-07-18 14:02:06 -05:00
Guangcong Luo
029b691be1
Add replay database code to version control (#1301)
This required a new architecture for serving replays from inside the
client repository, because that seems like a better call than
introducing yet another PS repository.

(Experience gives me the impression that separating repositories wasn't
a good idea, and we should be working to make PS more mono-repo-like,
rather than less.)

License for replay code is tentatively AGPLv3, although feel free to ask
for a more permissive license if you have plans to use it in an
open-source project that requires it.
2019-06-14 17:48:34 +09:00
Guangcong Luo
189a987526 Allow CORS actions with a POSTed sid
This is mostly useful for the testclient, which otherwise can't interact
with the login server without huge hacks like the iframe copy/paste.

Requiring an external sid resolves any security issues; sid being the
only cookie we use for security-sensitive things, and also being our
CSRF token.

In theory, this is also useful for clients that don't support cookies,
although I'm unsure how they'd get their hands on an sid in the first
place. I guess just run login actions?
2019-02-27 05:16:17 -05:00
Guangcong Luo
fdad94ba7f Support server-side autolock IPs 2019-02-27 05:16:17 -05:00
Guangcong Luo
86a55ee61e Fix minor bug in dispatcher 2019-01-05 04:04:10 -05:00
Guangcong Luo
5b21cce99a Improve action.php
POSTing JSON data is now supported, since apparently Axios does that by
default: #1160

In addition, error messages should be more informative, for anyone else
trying to write a third-party client.
2018-11-14 21:49:40 -05:00
Guangcong Luo
a133ee8c5e Fix some bugs caught by LGTM 2018-09-05 16:48:27 -05:00
Guangcong Luo
8562b2f090 Fix misc bugs 2018-08-26 16:18:06 -04:00
Guangcong Luo
6e7b3b6d5c Update Google Auth Library dependency 2018-05-19 19:30:51 -04:00
The Immortal
db0b7b3684
Update decay for Random Battle and OU 2018-03-22 00:33:38 +08:00
Guangcong Luo
f07fad8aaa Improve login session ID system 2017-11-23 01:31:37 -05:00
Guangcong Luo
2dc0f28e78 Use Node library for Google token validation
After lots of tries, the PHP code just couldn't be made to work...
2017-11-17 20:21:24 -05:00
Guangcong Luo
9e35550fc8 Try to fix Google login
Honestly, I have no clue at this point, but setting the PHP timezone to
UTC seems to fix most of the login bugs I've been seeing.
2017-10-29 21:16:05 -04:00
Guangcong Luo
a0570290a8 Fix timezone for Google login validation 2017-10-21 13:10:44 -04:00
Guangcong Luo
6f841a70a3 Fix crash in Google login verification 2017-10-10 23:05:42 -04:00
Guangcong Luo
ab657d2511 Include server ID in replay data
This is to help the replay server determine how much to trust the info
uploaded.
2017-10-10 23:04:51 -04:00
Guangcong Luo
644d5ccf91 Support Google login (two-factor auth) (#999)
This doesn't support setting accounts up for Google login: that still
has to be manually done via the database by setting the email field to
`username@gmail.com@`, where the second `@` denotes that it's using
Gmail login.

If the email field does end in `@`, `getassertion` will note this by
sending `;;@gmail`, to convey that the server is expecting a Google
login token rather than a password.

Upon receiving `;;@gmail`, the client will replace the password box will
with a Google login button, and then send the resulting Google login
token to the server in the `password` field. The server will validate
the "password" using the Google server libraries, and otherwise handle
the login as normal.

Note that Google login requires various features that a paranoid person
might disable; most notably 3rd-party cookies.

Fixes Zarel/Pokemon-Showdown#3394
2017-09-13 16:20:38 -04:00
Guangcong Luo
fceb63c0ee Ladder: Support "both players lose"
Send -1 as the score to mean "both players lose"
2017-07-28 23:09:10 -04:00
Guangcong Luo
0b153268e9 Clarify disabled account message 2017-07-20 20:59:33 -04:00
Sacha Reinert
a6e7db9b89 Use Wikimedia's css sanitizer for custom css parsing (#919) 2017-06-13 23:26:15 -05:00
Guangcong Luo
c0efe4e0a3 Update sim server URL 2017-05-15 05:55:08 -04:00
Guangcong Luo
c5bc304522 Fix style in session library 2017-03-25 14:15:30 -04:00
Guangcong Luo
a7b45d7430 Fix security vulnerability in register 2017-03-13 02:29:09 -04:00