Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial support for web service for newer clients #5731

Merged
merged 53 commits into from
Aug 16, 2022

Conversation

vstumpf
Copy link
Member

@vstumpf vstumpf commented Feb 6, 2021

  • Addressed Issue(s): N/A

  • Server Mode: Both

  • Description of Pull Request: C++ Implementation of the Web Service required by newer clients.

Thanks @secretdataz for the athena-web-service, which I got the schemas from.

Using CMake

  • cmake -DENABLE_WEB_SERVER

Using Visual Studio

  • enable the web and httplib projects in visual studio

Features:

  • Supports bmp emblems
  • Supports gif emblems
  • Supports user configs (get rid of that pesky "Your account configs could not be loaded, please retry later"!)

Todos:

  • Test it (lmao)
  • Transparency check
  • Stop emblem change in WoE

Possible future extensions

  • Support multiple char servers (idk if needed)
  • Clean up sqllock
  • Support other emblem formats and convert it to correct size/bmp type.
  • Support the twitter integration

@LolyAll
Copy link

LolyAll commented Feb 7, 2021

Warnings:

11>F:\GitHub\rathena\src\common\cbasetypes.hpp(231,1): warning C4005: 'strcasecmp': macro redefinition
11>F:\GitHub\rathena\3rdparty\httplib\httplib.h(152): message : see previous definition of 'strcasecmp'
11>F:\GitHub\rathena\src\common\cbasetypes.hpp(231,1): warning C4005: 'strcasecmp': macro redefinition
11>F:\GitHub\rathena\3rdparty\httplib\httplib.h(152): message : see previous definition of 'strcasecmp'
11>F:\GitHub\rathena\src\web\emblem_controller.cpp(98,33): warning C4244: 'argument': conversion from 'std::streamoff' to 'size_t', possible loss of data
11>F:\GitHub\rathena\src\common\cbasetypes.hpp(231,1): warning C4005: 'strcasecmp': macro redefinition
11>F:\GitHub\rathena\3rdparty\httplib\httplib.h(152): message : see previous definition of 'strcasecmp'

and, are not working, its necessary configure something in lua files?

@vstumpf
Copy link
Member Author

vstumpf commented Feb 7, 2021

There's a lot of warnings in the http lib project, but since it's not our code (3rd party), I don't want to try to fix them.
Ideally, you're not building it every time too, just once.

You need to set up the External settings lua file and point it to the ip of your host and the port that's set in web_athena.conf

@eppc0330
Copy link
Contributor

image
I don't know what error is this... I have patched all but doesn't work.

Also web-server console cannot read Korean. How to do?

@reunite-ro
Copy link
Contributor

image
I got this log.

@vstumpf
Copy link
Member Author

vstumpf commented Feb 11, 2021

These logs are because I forgot to put a conf for logging the request/responses.

Also web-server console cannot read Korean. How to do?

I don't understand, what do you mean? It looks like the console logs correctly.
You can ignore the "not authorized, why?" error, I have to remove the message.

@vstumpf
Copy link
Member Author

vstumpf commented Feb 11, 2021

For emblems, you need to create the guild_emblem_dir yourself. I've added an error message in web-server startup. I can't do this automatically since there's no portable way to make directories in c++11.

I've created a config option for the full logging, print_res_req, it's off by default.
Removed the sql lock debug messages.

Added a nginx-like log message, it looks like this:
[Info]: 172.19.0.1 [POST /userconfig/load] 200

@reunite-ro
Copy link
Contributor

response status 404 is regarding what ya ?
I dont get any issue with user configs but emblems are still having 404.
The directory emblems warning also gone since ive create it.

@vstumpf
Copy link
Member Author

vstumpf commented Feb 11, 2021

What's your client version?
What were you doing that causes the error? A 404 is only when you try to download a guild emblem that hasn't been uploaded yet.

@reunite-ro
Copy link
Contributor

What's your client version?
What were you doing that causes the error? A 404 is only when you try to download a guild emblem that hasn't been uploaded yet.

Im using 20200304 RE client and also have Gepard included.

The guild_emblems warning will not be shown if I create the folder in rathena folder. But I dont think people can access it via http since its in rathena folder, not webserver.

@eppc0330
Copy link
Contributor

These logs are because I forgot to put a conf for logging the request/responses.

Also web-server console cannot read Korean. How to do?

I don't understand, what do you mean? It looks like the console logs correctly.
You can ignore the "not authorized, why?" error, I have to remove the message.

unknown

When I use Korean world name, it displayed weirdly.

@eppc0330
Copy link
Contributor

eppc0330 commented Feb 11, 2021

image

Is this packet error?

Pet gets guild emblem, too.

@vstumpf
Copy link
Member Author

vstumpf commented Feb 11, 2021

The guild_emblem_dir should be made in rathena folder, same level as web-server.exe, db, conf, etc.

Is this packet error?
Pet gets guild emblem, too.

I have no idea, that might be intended by the client

@admkakaroto
Copy link
Contributor

admkakaroto commented Feb 12, 2021

@vstumpf Congrats by the incredible work.

But uploading images in .gif is crashing the webserver, .bmp is working properly.

@vstumpf
Copy link
Member Author

vstumpf commented Feb 12, 2021

Ok, no meme, are .gifs supposed to work for guild emblems?

How big is the .gif? (can you just share it here or on discord, nitrous#0001)

@admkakaroto
Copy link
Contributor

Ok, no meme, are .gifs supposed to work for guild emblems?

How big is the .gif? (can you just share it here or on discord, nitrous#0001)

the maximum size I don't know, the dimensions are the same, 24x24px, since the client 2020 that gif is supported.

@admkakaroto
Copy link
Contributor

Im not at home, but in 2 hours i eill send to you more infos.

@attackjom
Copy link
Contributor

24x24 bmp / gif with less than 50 kbp

@vstumpf
Copy link
Member Author

vstumpf commented Feb 13, 2021

I've added support for gif emblems, and this requires a new column in the guild_emblems table. Unfortunately, you'll have to drop your tables.

I also start the http server on a separate thread, so the sql keepalives actually trigger.

@JosueWu
Copy link

JosueWu commented Feb 13, 2021

Do you happen to know if they will add this to the main emulator or add another solution to display the guild emblems?

@vstumpf
Copy link
Member Author

vstumpf commented Feb 13, 2021

Do you happen to know if they will add this to the main emulator?

That is the intention with this PR. If you would like a php version, you can use athena-web-service

@admkakaroto
Copy link
Contributor

@vstumpf after new commits web are not working anymore:
a11

after show this error, this window closes.

@admkakaroto
Copy link
Contributor

The problem is be caused by this commit: 5eed958

@vstumpf
Copy link
Member Author

vstumpf commented Feb 13, 2021

Are you on windows? It works fine on ubuntu20. I'll look into it.

@admkakaroto
Copy link
Contributor

Are you on windows? It works fine on ubuntu20. I'll look into it.

Yes, windows 10 x64, VS2019

@vstumpf vstumpf added component:core A fault that lies within the main framework of rAthena mode:renewal A fault that exists within the renewal mode mode:prerenewal A fault that exists within the pre-renewal mode status:code-review Pull Request that requires reviewing from other developers before being pushed to master labels Aug 7, 2022
src/web/web.cpp Outdated Show resolved Hide resolved
src/web/webutils.cpp Show resolved Hide resolved
@Lemongrass3110 Lemongrass3110 merged commit 0ac52d0 into rathena:master Aug 16, 2022
@Lemongrass3110 Lemongrass3110 removed the status:code-review Pull Request that requires reviewing from other developers before being pushed to master label Aug 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
component:core A fault that lies within the main framework of rAthena mode:prerenewal A fault that exists within the pre-renewal mode mode:renewal A fault that exists within the renewal mode
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet