Commit Graph

134 Commits

Author SHA1 Message Date
Aurora Lahtela bc4aef8b2b Add some missing javadocs to not generate warnings 2024-01-06 18:01:50 +02:00
Aurora Lahtela 9c9058eda9 Add API to tell Plan what permissions an endpoint uses. 2023-10-18 17:28:23 +03:00
Aurora Lahtela 01d904c7d1
2905/remove old web files (#3225)
* Removed Plugin.Use_Legacy_Frontend feature flag
* Remove version modal html generation in Java
* Remove contributor list html generation in Java
* Remove more html generation in Java
* Delete old web file bundle
* Removed locale html/js translation from backend
* Move Html#swapColorsToSpan to the React side
* Reimplement datatables and backend for preferences
* Load preferences from backend
* Usability fixes to the players table
* Delete WebAssetVersionCheckTask
* Add new locale to locale files
* Export defaultPreferences as json on react export

Affects issues:
- Close #2905
2023-09-23 22:24:34 +03:00
Aurora Lahtela 5061439d14
1623/access control (#3173)
* Add web authorization permission based on groups
  * Access and parts of website are limited by permissions
* Add group management in /manage page
  * Higher level permissions grant lower level permissions similar to Sponge
* Add command /plan setgroup, which uses plan.setgroup.other permission
* Add command /plan groups, which uses plan.setgroup.other permission
* Add more navigation based on permissions
* API modifications
  * User#hasPermission now returns true if user has parent permission in the tree
  * ResolverService#registerPermissions and ResolverService#registerPermission methods for adding new permissions
* Update locale with new lines
* Various unrelated fixes to CSS and code

Affects issues:
- Close #1623
2023-08-20 11:56:13 +03:00
Aurora Lahtela e736055898 Fix page extension api not loading scripts 2023-03-04 10:56:56 +02:00
Aurora Lahtela b92e886a39
React PageExtension Javascript APIs (#2894)
* Page extension api javascript file
* Add support for extending rows with pageExtensionApi
Tested it
* Support javascript snippets in react index.html
* Add context to pageExtensionApi calls
* Fix redirect text overlapping with sidebar
* Add new API for registering custom javascript and css
2023-02-25 13:57:12 +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 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
Henri Schubin 96a14a24f5
Component DataExtension API (#2686)
* Component DataExtension API

* Finish up component extension data, add react-mcjsonchat library to the react dashboard in preparation for the rewrite

* Update Plan/common/src/main/java/com/djrapitops/plan/extension/implementation/results/ExtensionComponentData.java

* Update Plan/common/src/test/java/com/djrapitops/plan/storage/database/queries/ExtensionsDatabaseTest.java

* Update Plan/common/src/main/java/com/djrapitops/plan/extension/implementation/providers/gathering/DataValueGatherer.java

Co-authored-by: Aurora Lahtela <24460436+AuroraLS3@users.noreply.github.com>
2022-10-29 08:23:16 +03:00
Aurora Lahtela f0a5b43f02 Fix Javadoc errors 2022-10-22 11:45:01 +03:00
Henri Schubin c49276369f
Component API by Vankka (#2665)
Adds a new Component API that allows converting between color code representations in Strings
2022-10-16 13:21:49 +03:00
Aurora Lahtela a095eb2178 Javadocs for Table column formats 2022-09-04 09:05:06 +03:00
Aurora Lahtela 6f6b4f149f Fix gzip support for Jetty 2022-08-31 19:44:38 +03:00
Aurora Lahtela 6aae823850 Implement Access log functionality to Plan
- Store access log in database, clean logs after 30 days by default
- Add Webserver.Security.Access_log.Print_to_console setting
- Add Webserver.Security.Access_log.Remove_logs_after_days setting

Affects issues:
- Close #2328
2022-06-24 11:09:14 +03:00
Aurora Lahtela c93317d0c7 Bump version to 5.5 2022-06-18 11:45:59 +03:00
Aurora Lahtela 92910d647a Revert API jar to Java 8 and update to Java 11 APIs 2022-06-18 11:31:53 +03:00
Aurora Lahtela 71424fa2ec Fixing IDEA code inspection issues
- Removed MethodAnnotations use in ExtensionExtractor
- Refactored duplicate code in
  - BaseUserQueries
  - GeoInfoQueries
  - JoinAddressQueries
  - KillQueries
  - NicknameQueries
  - WebUserQueries
  - TopListQueries
2022-06-05 16:59:35 +03:00
Aurora Lahtela b74e338721
Query optimizations (#2320)
* Optimized network ping table query
* Removed icon id selection subqueries

- Take the icon ID into memory when the icons are stored

* Fix typos in the optimized ping table query
* Optimize server ping table query
* Attempt to optimize /v1/servers tps data query
* Optimize ping and geolocations tables uuid -> user_id foreign key
* Prevent Plan from crashing if patching takes too long

- HikariCP auto commit was true for some reason even though all transactions have commit mechanism built-in.
- The setting was reset during connection recreation and that could cause an index out of bounds error.

* Reduce try-nesting in ExecStatement
* Use user_id and server_id instead of uuid for plan_world_times table
* Use user_id and server_id instead of uuid for plan_sessions and plan_user_info table
* Fix more issues and test queries used by Query Filters
* Use deferRender for data tables to load data into the table faster
* Swap uuids to user ids for query page filters

Fixes an issue where SQL is too big to execute

Affects issues:
- #2196
2022-04-09 20:52:29 +03:00
Aurora Lahtela 3822155b40
Frontend BETA: Rewrite Player page with React (#2312)
* Add extension data to /v1/player endpoint
* Use node gradle plugin for building with yarn
* Add /v1/whoami endpoint
* Add back button to sidebar
* Selenium Tests for locale related js errors
* Convert locale system to use YAML-based storage
* Added a conversion process that runs on startup
* Replace cravatar.eu with crafatar.com for skins (more reliable)
* Add the Header made by Kopo to React

Co-authored-by: Antti Koponen <koponen942@outlook.com>

Affected issues:
- Resolve #1733
- Fixed #1092
- Resolve #1895
- Resolve #1965
- Partial #2260 
- Partial #2099
2022-04-06 17:37:23 +03:00
Risto Lahtela a8e6ef2944 Add support for table row formats and hex color codes
- Table rows are now formatted with chat colors by default if § character is in them.
- Hex color codes §x§f§f§f§f§f§f are now supported by chat color to html translator.

Affects issues:
- Fix #2220
2022-02-02 17:36:20 +02:00
Antti Koponen 2293760e7f
Add user & version JSON endpoints (#2131) 2021-10-18 19:25:25 +03:00
Aurora Lahtela 7d8b797b42
Fix CompositeResolver using its own isAuthRequired method (#2124)
Fixes CompositeResolver using its own isAuthRequired method instead of the child resolver, leading NoAuthResolver to need authentication in some cases.
2021-10-11 20:24:39 +03:00
Risto Lahtela 78209e99a6
Sonar cleanup for new smells (#1996)
* Rename "byKey" which hides the field declared at line 36.
* Define a constant instead of duplicating this literal "isStopped" 3 times.
* Remove this assignment of "pingMethodAvailable".
* Invoke method(s) only conditionally. Use the built-in formatting to construct this argument.
* Rename "getHandleMethod" which hides the field declared at line 36.

Make the enclosing method "static" or remove this set.
* Refactored some ping method things
* Rename "files" which hides the field declared at line 41.
* Add at least one assertion to this test case.
2021-07-10 14:52:24 +03:00
Risto Lahtela c523e40b7f Refactored the request body PR stuff
- Made sure to not break compatibility with discord bots that use the old
  authentication via query parameters
- Query parameters now accept no-value keys
- Added access control checks for the errors endpoints
2021-07-10 09:11:39 +03:00
Emilia Dreamer 7a51ad9f15
Use POST method in requests such as login (#1988)
- Adds Request#getRequestBody method to the API
- Moves login and register parameters to request body

Co-authored-by: Risto Lahtela <24460436+AuroraLS3@users.noreply.github.com>
Co-authored-by: Henri S <vankka.main@gmail.com>
2021-07-09 20:31:04 +03:00
Risto Lahtela e90606b68a
5.4: Java 16 support, remove H2 (#1932)
* Stop downloading dependencies at startup, include them instead
* 5.4: Removed H2
* Platform Abstraction Layer 5.0.0, delete dependency downloading
* Removed some unnecessary native sqlite drivers
* Serve jquery via CDN

Affects issues:
- Fixes #1886
- Close #1908 (No longer relevant, library no longer included)
2021-06-12 10:21:38 +03:00
Risto Lahtela fa4a2e6595
Gradle 7 Update by Kopo (#1931)
Updates gradle to version 7 and sorts out all the deprecated stuff

Affects issues:
- Clsoe #1871

Co-authored-by: Antti Koponen <koponen942@outlook.com>
2021-06-12 08:24:24 +03:00
Risto Lahtela 99a13dfb04 Bump version to 5.3 2021-04-25 11:27:57 +03:00
Risto Lahtela d3c4fd1f92 Made Caller more resilient to null player identifiers
It is now possible to call Caller#updatePlayerData with only one of the parameters
2021-04-25 11:25:30 +03:00
Risto Lahtela bd7336b411 Plan API 5.2-R0.9: Fixed access issue with package private classes
Affects issues:
- Fixed #1862
2021-04-23 08:56:11 +03:00
Risto Lahtela 2247b9099c Plan API 5.2-R0.8: Reduced builder compiler errors 2021-04-17 09:40:07 +03:00
Risto Lahtela 9bf0838026 Plan API 5.2-R0.7: Group method databuilders & reduced builder compiler errors 2021-04-17 09:35:18 +03:00
Risto Lahtela af858b8455 Plan API 5.2-R0.6: InvalidateMethod equivalent to ExtensionDataBuilder 2021-04-13 11:57:38 +03:00
Risto Lahtela ab31f8a074 Plan API 5.2-R0.5: More lenient TabInfo annotation usage
- No more warning when TabInfo is defined without Tab annotations.
  This is because builders can define tabs regardless.
2021-04-11 11:53:44 +03:00
Risto Lahtela c3ce37bfa9 Plan API 5.2-R0.4: SchedulerService
Allows scheduling async tasks for platforms that don't have static
accessors for registering tasks, such as Velocity
2021-04-11 10:28:08 +03:00
Risto Lahtela 9302067a49 Plan API 5.2-R0.3: ListenerService
Allows registering listeners for platforms that don't have static
accessors for registering listeners, such as Velocity
2021-04-11 10:16:37 +03:00
Risto Lahtela 1fafd303d3 Publish Plan API 5.2-R0.2 with DataExtension Builder API 2021-04-09 11:00:53 +03:00
Risto Lahtela 9466dc3e9d Added a valueBuilder convenience method to DataExtension 2021-04-07 20:11:59 +03:00
Risto Lahtela 113d46669b
DataExtension Builder API (#1833)
* Rewrote annotated extension method extraction
* Enclose annotation based methods into a single ExtensionDataBuilder

All of the reflection related to extension annotation was difficult,
so now it's all dealt with in one place and it's abstracted away with the
upcoming builder based API.

Some odd additions had to be made to the interface, but they are mostly harmless,
as the annotations are used as method parameters where necessary. This way the
users of the API are unable to give weird values.

It was possible to reuse MethodWrapper and Parameters classes for calling the methods.

* Refactored server value storage to use builder data
* Refactored player value storage to use builder data
* Refactored table gathering to use builders
* Handle extension errors properly
* Javadocs for DataExtension builder API
* Removed DataProviders based implementation

- Renamed ProviderValueGatherer to DataValueGatherer
2021-04-07 19:09:38 +03:00
Risto Lahtela 2997e882a5 Fixed a bunch of IntelliJ inspection issues and typos 2021-03-23 11:57:01 +02:00
Risto Lahtela 9ee2a15008 Wrote tests for ElementOrder serialization 2021-03-20 17:34:58 +02:00
Risto Lahtela 2e753516e2 Revert changes to URIPathTest.java 2021-03-16 11:36:45 +02:00
Risto Lahtela 1c8fa4c18e Removed parameterized test names 2021-03-16 11:29:55 +02:00
Risto Lahtela ebffd886fe Fixed parameterized test errors 2021-03-16 10:51:46 +02:00
Risto Lahtela baab6e5f88 Fixing sonarcloud bugs and smells
Bugs fixed:
- LinkCommands: The return value of "orElseThrow" must be used.
- RegistrationCommands: Optional isPresent not same instance as Optional get

Smells fixed:
- Plan: "logger" is the name of a field in "JavaPlugin"
- PlayersTableJSONCreator: Reduce the total number of break and continue statements in this loop to use at most one.
- BukkitAFKListener, SpongeAFKListener, NukkitAFKListener, PlanAPI, CapabilityService: match the regular expression '^[a-z][a-zA-Z0-9]*$'
- TaskSystem: Reorder the modifiers to comply with the Java Language Specification.
- EntityNameFormatter: StringUtils.removeAll moved to RegExUtils.removeAll
- FiltersJSONResolver: fulfill compareTo contract
- ExportTask: Removed duplicate string literal
- FinishedSession.Id: Rename field "id"
2021-03-16 10:41:17 +02:00
Risto Lahtela bdcd84749b Added some package-info files for javadocs 2021-03-10 11:38:48 +02:00
Risto Lahtela e1bffbcc1f
Swap Abstract Plugin Framework for Platform Abstraction Layer library (#1787)
Replaced Abstract Plugin Framework with Platform Abstraction Layer

Large amount of changes due to removal of features from the library,
and change of the way the abstraction is achieved.
Removes features from Plan:

    Removed debug logging (Considered useless when debugging issues)
    Removed /debug page (Considered useless when debugging issues)
    Removed enable timing (Benchmarking utility was removed from the library)
2021-03-09 11:36:07 +02:00
Risto Lahtela b7af2a5717 Moved to using the new repository
- Updated some extensions
- Removed GriefPreventionPlus extension since it was no longer
  available anywhere for installing

Affects issues:
- Close #1779
2021-03-05 14:27:30 +02:00
Risto Lahtela 92cefaafa3 Publish plan-api with Github Packages instead
Affects issues:
- #1779
2021-03-04 09:41:12 +02:00
Rsl1122 94c9dd3f95 Username change Rsl1122 -> AuroraLS3 2021-02-13 15:16:03 +02:00