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.
Previously, it was only doing 5, which was hardcoded. I made this a top-level variable for future changes because this one took a while (finding all the references took a bit, numbers are not easily searched in this file.)
Replays must be at their end before downloading replays works as
expected.
Before, fast-forwarding a battle would synchronously place replays
at their end, but it's now an async process as of
fc00e68231
Telling the user to click the Download button again is very hacky,
but this is a very rare situation not really worth the effort to
make it more elegant.
The FCCDCF cookie frequently goes oversize, and has recently
been causing people to be unable to access PS because their total
cookie size is going over 8KB, above Apache's default maximum.
https://business.safety.google/adscookies/
It looks like this cookie is set by Google and, according to the
internet, sometimes gets filled with junk? I don't know of an
easy way to fix this, but I'm hoping this does it.
Also makes sure Speed doesn't get desynced when switching between
battles.
I'm not particularly happy with how much UI space this gets, but
I guess it's a net positive.
This should make Google search results and Discord link previews
for replays work correctly.
This actually involved a ton of work, but at least this work also
makes replays load faster.
The idea is to eventually move all client parts to their domain name
subdirectory, for clarity and better organization. New Replays is
just first.
Anyway, yeah, minor updates to New Replays, but otherwise it's just
getting deployed as-is, straight to
https://replay.pokemonshowdown.com/
The old URLs are getting taken down; they were only used for
development anyway.
PR #2162 removed the CSS on downloaded replays without any
explanation. I think it was intended to save space and/or make
things bigger? But it came with a number of bugs.
- downloaded replay logs are much wider than intended
- downloaded replays now have a "battle options" button that does
nothing
- downloaded replays have some unstyled text in e.g. popups
- MOST IMPORTANTLY: downloaded replays are no longer styled when
you don't have an internet connection
Anyway, reverting that change fixes all these issues, and doesn't
seem to cause any new ones? This is a temporary measure while
waiting for Karthik to explain why the CSS removal was done in
the first place.
Refs #2165
PR #2164 added duplicate copies of these functions to battle.ts
which is already quite overloaded. This temporarily relocates them
to battle-dex, in preparation for a longer-term deduplication
probably involving moving the storage.js implementation there.
The API has been revised slightly, to match the server's
sim/teams.ts.
Fixes#1991
(Removing a move by clicking on it in search didn't actually
remove it from the set.)
Fixes#2134
(Sorting and clicking on a filter would clear the currently
selected pokemon/move textbox, but this was only supposed to
happen when searching for a filter.)
This also includes some refactors. Polyfills are now gone from
utils.ts (I'm not sure why they were ever there; they're redundant
with ps-polyfill.js) and there's a new Net.decodeQuery.
New Replays now supports adding `?p2` to the end of a replay
URL, to see the replay from the opposing viewpoint.
Search results will now automatically be from the viewpoint of
the player you're searching for.
Viewpoint is now a selector rather than a "Switch sides" button,
which should hopefully be clearer about what it's doing.
Old Replays's two column support was the Panel system most notably
shown off by PSDex. It was definitely very nice but a bit hard to
port to Preact.
This new one, written from scratch, has a few niceities:
- topbar can scroll offscreen
- only one scrollable area (scroll wheel works everywhere, and
the PageUp/PageDown/Spacebar keys are unambiguous)
- uses very little JavaScript when resizing; most of the layout
work is done by CSS
With the drawbacks:
- no animation
- only two columns supported (not relevant to Replays which has
never used over two columns)
- uses a lot of modern CSS (overflow: sticky, and flexbox) but
should degrade gracefully
The headline feature here is that we now support being logged in and
searching for private replays. We also have a new button to instantly
find your own replays.
Also here is the basics of HTML5 history support. It's the first step
to having the two-column layout up and running!
The main difference is that the main search screen should look
much nicer now.
https://pokemonshowdown.com/replays/
Putting search/featured/recent in separate sections makes the new
design look much nicer. And dark mode is now fully supported.
New Replays isn't done yet but I've done a lot of work on it and
probably it deserves a commit.
Why rewrite Replays:
- I redesigned pokemonshowdown.com to look more modern and support
dark mode, and rejiggering Old Replays would be a lot of work
anyway.
- It'd be nice to actually deploy some of PS's whole Preact
infrastructure somewhere, instead of it just being in development
hell.
- Nice to get a second look at the relevant code, leading to fixes
like fc00e68231 and f28b1e9bf3.
- Replays is due for a migration from JS/PHP to TS anyway.
Anyway, feel free to try out New Replays, it's live in:
https://pokemonshowdown.com/replays/
Old Replays will stick around until we hit feature parity, but
that shouldn't be too long (I know, famous last words).
In the distant past, Lobby was open by default, so people linking
to Lobby usually meant to link to PS itself, so links to Lobby
would just open PS.
This is no longer necessary, now that we no longer open Lobby by
default.
This commit also cleans up a bunch of other .htaccess entries,
for style/readability.