Commit Graph

1627 Commits

Author SHA1 Message Date
Aurora Lahtela
776fa3327f Fixed issues with peak player count query optimization 2023-02-13 18:23:38 +02:00
Aurora Lahtela
226bc20e3f Speed up /v1/network/servers by 66%
Benchmark: endpoint (fetchPeakPlayerCount is the highest contributor)
- Before: 10 seconds (1s * server count)
- Before: 3 seconds (332ms * server count)
2023-02-12 10:37:52 +02:00
Aurora Lahtela
09279cbb66
React html customization / public_html folder (#2862)
* Add public_html folder, configuration and access methods to it
* Make Frontend BETA static resource resolution prefer public_html
* Add resolver for getting any file in public_html from webserver
* Test customized bundle loading from public_html
* Update gradle wrapper to 7.6
* Wrote scripts to React build or run dev server through gradle
* Disable cyclomatic-complexity check on PublicHtmlResolver
* Throw bad request exception on IllegalPathException
* Throw bad request exception on bad chars in URI query
2023-02-05 12:08:29 +02:00
Aurora Lahtela
8dccb060c0 Skip javascript translation on React bundle files
Affects issues:
- Fixed #2799
2023-01-22 14:50:42 +02:00
Aurora Lahtela
63350a4fea Fix PlayerTableRowPatch is applied check 2023-01-22 14:31:10 +02:00
Aurora Lahtela
acf9d92b1d Refactor duplicate code: command confirmation 2023-01-22 13:45:47 +02:00
Aurora Lahtela
88b4191f6b
Implement http caching (#2840)
* Implement first response parts of http caching
* Implement cached response for static resources
* Implement HTTP caching for json responses
* Fix last seen value for online players
* Implement http caching for pages (.html)
* Use placeholder cache even with async requests.

Affects issues:
- Close #2813
2023-01-22 10:18:14 +02:00
Aurora Lahtela
0ddda27384 Implement a date formatter for Last-Modified header
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Last-Modified
2023-01-21 15:22:04 +02:00
Aurora Lahtela
0bce7880cd Add support for getting last modified date to Resource
- Use AssetVersions.yml for jar files
- Use File#lastModified for regular files
2023-01-21 15:03:29 +02:00
Aurora Lahtela
d3be0e9f89 Optimized server latest join addresses query
Original benchmark: 19 seconds
Improved benchmark: 150 milliseconds
-> 120x faster
2023-01-21 12:47:13 +02:00
Aurora Lahtela
987fb7b56a Optimized server player list table query
Original benchmark: 4 seconds
Improved benchmark: 500 milliseconds
-> 8x faster
2023-01-21 12:17:46 +02:00
Aurora Lahtela
1b0942c988 Unit test Benchmark utility 2023-01-21 12:04:58 +02:00
Aurora Lahtela
dda7199a1a Fix more sonar smells 2023-01-20 22:54:54 +02:00
Aurora Lahtela
9e11d9f484 Removed untrusted data from exception messages in case they end up on the webpage 2023-01-15 10:04:10 +02:00
Aurora Lahtela
f20a04809c Test against and identify path traversal vulnerability in other methods 2023-01-15 09:30:30 +02:00
Aurora Lahtela
b0a1bc1fb1 Prevent malicious join address packet from breaking session serialization 2023-01-15 09:01:28 +02:00
Aurora Lahtela
38785a9505 Added Untrusted-annotation to be more careful around user given data
- Fixed SQL-injection vulnerability in an endpoint
- Fixed XSS on Whitelist deny 403 page
- Fixed XSS on Internal Error 500 page if untrusted data ends up in exception message
2023-01-14 23:25:35 +02:00
Aurora Lahtela
bd85f10c55 Fix customized resource lookup Path Traversal vulnerability
Affects issues:
- Fixed #2830
2023-01-13 23:23:12 +02:00
Aurora Lahtela
5ba6e0dc9f Fix concurrency issues with json cache and database 2023-01-07 11:45:58 +02:00
Aurora Lahtela
9622f6a614
Disable BadAFKThresholdValuePatch 2023-01-06 23:06:17 +02:00
Aurora Lahtela
97b9a18cea Catch session deserialization errors during enable 2023-01-06 19:40:04 +02:00
Aurora Lahtela
aa897fe8de Implemented support for reverse-proxy subdirectory addresses
Reverse proxied version of React website now works
when subdirectory address is used (eg. /plan/...)

The functionality was unit tested to ensure things work
2023-01-06 14:24:18 +02:00
Aurora Lahtela
5082f80030 Implemented support for subdirectory addresses
Export of React version of frontend now supports exporting to a subdirectory
So now you can access exported site at /plan/... if it is hosted there.

This might impact reverse proxy setups positively, but that has not yet been tested.
The hypothetical positive impact is the inclusion of subdirectory in the React-router
configuration, since now it can handle the reverse-proxy subdirectory in URL.
2023-01-06 12:12:45 +02:00
AuroraLS3
8e88b3a9a6 Make undefined join address id guesstimate based on existing data 2022-12-30 13:26:53 +02:00
AuroraLS3
a8dbc3288e Fix checkstyle 2022-12-29 21:06:52 +02:00
AuroraLS3
bf63b29f72 Set bad join address ids as unknown 2022-12-29 20:54:23 +02:00
AuroraLS3
d0030fc6e3 Fix BadJoinAddressDataCorrectionPatch 2022-12-29 20:31:23 +02:00
Aurora Lahtela
626d63a87d Optimized BadJoinAddressDataCorrectionPatch using INSTR 2022-12-20 19:32:09 +02:00
Aurora Lahtela
0fdd12e61f Patch bad join address data if it is in database 2022-12-18 21:32:08 +02:00
Aurora Lahtela
9e44000d21 Fix setting boolean parameters dynamically
Affects issues:
- Fixed #2784
2022-12-14 19:33:44 +02:00
Aurora Lahtela
155910554f Fixed exported page constantly updating data in the background 2022-12-11 21:35:31 +02:00
Aurora Lahtela
34318be5c3 Add missing timezone offset to line graphs
Affects issues:
- Fixed #2780
2022-12-10 10:16:27 +02:00
Aurora Lahtela
d4798f1303 Fix React export when static directory doesn't exist yet 2022-12-06 12:41:50 +02:00
Aurora Lahtela
8fadcc3afb Delete old static bundle files with React export 2022-12-06 11:52:10 +02:00
Aurora Lahtela
f7176b3d47 Export redirection index.html files in case someone refreshes browser 2022-12-05 17:10:51 +02:00
Aurora Lahtela
ad6abacf7f Fix issues of the exported pages
- Fixed / opening "Redirecting.." view due to wrong whoAmI replacement
- Fixed page not opening because sidebar contained undefined items (static site can't have everything)
- Fixed some sidebar links being anchors instead of react-router links
- Fixed network page not opening due to missing extensionData json
- Fixed server page not opening due to missing extensionData and serverIdentifier json
- Added visual icon to the page when it is exported rather than dynamic for my own sanity
- Removed query page links from exported pages
2022-12-04 11:06:05 +02:00
Aurora Lahtela
11b188d146 Test TabCompleteCache to increase test coverage 2022-12-03 10:49:47 +02:00
Aurora Lahtela
2cc6a1eb60 Detect local private network addresses in geolocations
Detects IPs from the local network that were previously set as 'Not Found'
https://en.wikipedia.org/wiki/Private_network

Affects issues:
- Close #2658
2022-12-03 10:24:01 +02:00
Aurora Lahtela
059d4553aa Implemented react side of export for frontend BETA 2022-11-27 09:48:55 +02:00
Aurora Lahtela
362105cf98 Wrote an Exporter to export react bundle files 2022-11-26 09:01:41 +02:00
Aurora Lahtela
f36ed678a3 Implemented register page in react 2022-11-25 16:49:06 +02:00
Aurora Lahtela
f6d8b618eb Fix checkstyle 2022-11-25 16:01:03 +02:00
Aurora Lahtela
022a690446 Implemented parameterized array Sql generation
This bit of code allows passing lists of data in parameterized queries,
which is useful for defining WHERE x IN (?,?,?,?) in a dynamic way.

- Adds AccessControlTest cases for a valid /v1/query call
2022-11-23 17:31:04 +02:00
Aurora Lahtela
e3bea9ee77 Add online player names to player tab completion
Affects issues:
- Close #2216
2022-11-22 13:25:12 +02:00
Aurora Lahtela
86f6cffc66 Enable query page in Frontend BETA 2022-11-22 10:30:02 +02:00
Aurora Lahtela
ce3f2cde6d Fix SQLITE_CONSTRAINT_NOTNULL when request uri is null 2022-11-21 12:19:02 +02:00
Aurora Lahtela
e7afb243f9 Changed "Database can't keep up with transactions" to less dire message 2022-11-20 20:01:04 +02:00
Aurora Lahtela
bacde53781 Fix RemoveUsernameFromAccessLogPatch applying every time 2022-11-20 19:56:32 +02:00
Aurora Lahtela
7a582c3b6e Fix removal of expired cookies
Cookies that expired during server downtime failed to be
removed from the database.

This occurred because the cookie removal method did a lookup
to the in-memory active cookies, but the startup method does
not load expired cookies to memory.

Because the expired cookies were never loaded to memory this
did not pose a security vulnerability.

Fixed by always deleting a cookie from database if requested.
2022-11-20 19:50:48 +02:00
Aurora Lahtela
a9d89b88e7 Remove equals from PlayerKill.Victim 2022-11-13 16:35:54 +02:00