Jump to content

Elfo

Legendary Member
  • Posts

    2,009
  • Credits

  • Joined

  • Last visited

  • Days Won

    51
  • Feedback

    0%

Everything posted by Elfo

  1. It's using ApiKey auth. It's not client facing auth where you get credentials and return a key. You can do that with Basic auth but you have to enable it.
  2. Added api key based authentication as requested. Requests will only be served when the x-api-key header is set with the configured value.
  3. I mean...acis is a better project and free...
  4. Changed the way handlers are registered. Now they will be scanned automatically during server startup and they will be registered based on their annotation. This means that all you have to do to add a new endpoint is to create a request handler and add the Get, Post etc annotation.
  5. The problem with having multiple points of truth is that you don't have a single one you can fully trust, that's why i trust nothing but the database and the World class. I also don't wanna touch the core at all so if I do any caching it will happen in the API level.
  6. The problem is that the offline players are not loaded in memory so the dB call is inevitable. Everything that is loaded in the in memory cache will be served by the cache when possible. If the endpoint was get online players only then yeah it would be coming from the World class. Auth is very simple to add. It’s basically a simple middleware. originally when I started this it was to actually make a new ACP but it’s too much work and I don’t really wanna do front end anymore so I just created the api. If people wanna make their front end that’s fine by me. EDIT: Oh I now see what you mean, I read it wrong the first time. Yes it would make sense to get that info from the cache if the player is online. I will add that.
  7. So I was bored again... L2jRest is a RESTful API for L2j It is created for latest aCis but you should be able to adapt it is you wanna use it for other projects. L2jRest is an open source project licensed under MIT. You can find the source here: https://github.com/Elfocrash/L2jRest Why use it? You can use the data of your server in your website You can create an account control panel with it You can expose data to your community to allow them to make third party apps Technical stuff It is written in Kotlin. It is using the Ktor framework. Ktor is using coroutines to achieve asynchronous request handling. It is very efficient and very fast. It is using Netty as the underlying server. It is written in a CQRS manner with query handlers for get endpoints and command handlers for post, put, patch, delete etc. It is using Koin as the IoC framework. How to setup Download and install Intellij IDEA Git clone the project and open it with Intellij Run the build Gradle task. It is configured to create a fat jar with all the dependencies included Paste the jar in your project, add it in your classpath and add the following line at the bottom of your Gameserver.java: L2jRestApi.INSTANCE.start(); Running the gameserver will also run the api. It is running under port 6969 How to extend it All you need to do if you wanna add more endpoints is to add a new handler and then add the Get, Post etc annotation depending on what endpoint you want this to be. Current endpoints: http://localhost:6969/api/players http://localhost:6969/api/players/{id} A couple of endpoint examples Endpoints: http://localhost:6969/api/players Response: { players: [ { "id": 268480927, "name": "Test", "level": 1, "isOnline": false, "pvpKills": 0, "pkKills": 0, "isNobless": false }, { "id": 268480924, "name": "Test2", "level": 1, "isOnline": true, "pvpKills": 0, "pkKills": 0, "isNobless": false } ] } Endpoint: http://localhost:6969/api/players/268480927 Response: { "id": 268480927, "name": "Test", "level": 1, "isOnline": false, "pvpKills": 0, "pkKills": 0, "isNobless": false } Currently it just supports two endpoints and no authentication. I am planning to add more endpoints and ApiKey based auth tomorrow. If you can't be arsed to build the project yourself but you wanna take a look anyway you can download the jar here
  8. That’s what you call proof? I guess you don’t do programming for a living. The single request response times with a single db query for microframeworks and full web frameworks with a combination of different databases such as postgres and MySQL with no proof that a cp is configured to be used is what you call proof? On top of that the Spring framework in this example is configured to work with Postgres not MySQL and there is no clarity on which cp is used or how it’s configured. ALSO you can see that the leading Microframeworks have better performance because: 1. They are not using an ORM and they are executing their DB queries raw so OFC they will have optimal performance 2. They have the 1/1000 of the codebase that Spring has and they can do a very limited amount of things. i also find it very funny that you choose to know single query (which doesn’t even make sense for the CP) and not multiple because in multiple is the top most performing full web framework. Seriously i am wasting my time with this joker. I would be ashamed if I were you.
  9. The client can handle bypass packets fine at this stage. aCis acks the packet only as a packet you can send while INGAME so you need to add the exception in the packet handler to accept the bypass
  10. I thought compiled packs are not allowed to be shared.
×
×
  • Create New...