razaqq / PotatoAlert

A statistics companion app for World Of Warships
MIT License
36 stars 5 forks source link

Add support for chinese server #24

Open shangguansb opened 3 years ago

shangguansb commented 3 years ago

When can this tool support Chinese servers? This is really a great tool, thanks to the developers.

shangguansb commented 3 years ago

Or can you provide the java or python language version of this tool? I can develop java language or python language

razaqq commented 3 years ago

As far as I know there are EU, NA, RU and ASIA servers. I have never heard of a chinese server. The WoWs API, which this entire tool relies on only has those servers too, so no clue what you mean. So unless you can show me a documented API endpoint for this server, i really cant do anything.

Also this is only the frontend, the entire backend is written in Go and is not publicly available. The frontend would need no changes to support a new server, only the backend.

So if you want to contribute to this tool you will need to know Go or C++.

I will never do a java version, there exists an old python version for the frontend https://github.com/razaqq/PotatoAlertpy (some code is very questionable), but i will not update it, maintain it or help in any other way to get it to work. This is the only supported frontend which I intend to maintain.

shangguansb commented 3 years ago

First of all, thank you very much. This is the user record query URL of the Chinese server: https://wowsgame.cn/zh-cn/community/accounts/search?search=%E6%97%A0%E6%95%8C%E8 %88%B0%E9%98%9F You can try to open it. After querying this page, the data in XML format will be returned. I hope you can support the Chinese server in your plug-in. Thank you again, you are really a very good people~

razaqq commented 3 years ago

that wont work, i need a REST api like this https://developers.wargaming.net/reference/all/wows/account/list/?r_realm=eu I cannot read anything on any of these sites so you need to find that for me please

shangguansb commented 3 years ago

Understand, I think I can write code in GO language. I have 5 years of back-end development experience in Alibaba. You can upload the back-end code to github, and then I use GO to write the data conversion part of the code.

razaqq commented 3 years ago

There are two problems i have with your idea:

  1. That site is EXTREMELY slow here in europe, its impossible that it could keep up with the traffic
  2. The backend would require MAJOR restructuring which im not sure i want to do.

What i would instead suggest is to try to find the endpoints used by the site. You can sniff around on that site and find a bunch of undocumented api endpoints like

What I could not find in the 5 minutes i searched was the following:

It should be possible to find the rest of them aswell with something like fiddler and proxifier and then implement the backend API this way, which is the much better solution. I will search again later today, feel free to do the same and let me know if you find something.

shangguansb commented 3 years ago

ok thanks,i got it

shangguansb commented 3 years ago

I found an API to query user id by user name, https://wowsgame.cn/zh-cn/community/accounts/search/?search=zhanjia&pjax=1, But it is not a rest Api.

razaqq commented 3 years ago

you can get something usable with

import requests

response = requests.get("https://wowsgame.cn/zh-cn/community/accounts/autocomplete/", params={"query": "zhanjia"}, headers={"X-Requested-With": "XMLHttpRequest"})
print(response.json())

to get

{
  'query': 'zhanjia',
  'suggestions': [
    {
      'data': 7051804109,
      'value': 'ZHANJIAM  FGD'
    },
    {
      'data': 7053570594,
      'value': 'ZHANJIAN1'
    },
    {
      'data': 7050769212,
      'value': 'zhanjian2020'
    },
    {
      'data': 7051330667,
      'value': 'zhanjian777888'
    },
    {
      'data': 7051283914,
      'value': 'zhanjian8888'
    },
    {
      'data': 7051443460,
      'value': 'zhanjian_20'
    },
    {
      'data': 7051418135,
      'value': 'ZHANJIAN_2020'
    },
    {
      'data': 7051462707,
      'value': 'zhanjian_妖妖'
    },
    {
      'data': 7051306734,
      'value': 'zhanjianshijie'
    },
    {
      'data': 7051817482,
      'value': 'zhanjianzhiwan'
    }
  ]
}

i will do some more advancted search with fiddler and proxifier later today there has to be some underlying rest apis for sure

Would be a lot easier if they made the apis public like on all the other servers...

shangguansb commented 3 years ago

Yes, the technology of the Chinese server operator is relatively backward, and there is no public release of the api...

razaqq commented 3 years ago

ill finish the next update of the client and then start implementing this in the backend

shangguansb commented 3 years ago

thank u !!!!

shangguansb commented 2 years ago

Hi , have you update PotatoAlert for the china server? the latst veersion is?

razaqq commented 2 years ago

No i havent finished the 3.1.0 update (https://github.com/razaqq/PotatoAlert/tree/3.1.0) yet, only then will i start with smth like this

shangguansb commented 2 years ago

Great, looking forward to your work~

shangguansb commented 2 years ago

So, when do you plan to update the version that runs through the server?

razaqq commented 2 years ago

as i previously said, first i want to finisht the 3.1.0 update, then i will have a look at this if this was as simple as adding a few api endpoints, then i would have done it already the chinese server simply doesnt have a public api so this is only possible by major restructuring of the backend server

shangguansb commented 2 years ago

So, when will the Chinese server version be released? I really need it

shangguansb commented 2 years ago

Approximately when can you expect to start?

razaqq commented 2 years ago

As i said previously: when the next update is finished. I only work on this when i have the time and motivation to do so, im not getting paid.

If you want it faster, you can write a backend implementation for the chinese server yourself. Since this project is entirely open source you can see the api here yourself https://github.com/razaqq/PotatoAlert/blob/3.1.0/Client/StatsParser.cpp

If you provide me with a working and tested implementation of an api for the chinese server (preferrably in go) i am happy to merge it with the existing one. Another option is that i give you access to the backend code and you fork and work on it directly, your call.

I simply dont have the motivation right now to implement some hacky solution for the chinese server specifically, because its quite frankly not my fault they dont have a proper working api.

HenryQuan commented 2 years ago

@razaqq I can offer my help on this one if you are still interested. We need to call the vortex API and create an adaptor to return in the format of the official Wargaming API. My organisation is working a new desktop and mobile client so that you can mirror the stats on your phone via WIFI or USB (Android only). It is a companion app which I will publish to the AppStore when it is completed. Anyway, I will include your tool in my app in the upcoming update.

razaqq commented 2 years ago

I need two things for this: a) a replay played on the chinese server (can literally be any) b) the preferences.xml from game files from the chinese client (there is a tag like <active_server> WOWS EU </active_server>) in there and i need to know how the tag looks like for the chinese server

HenryQuan commented 2 years ago

a), 20220819_191907_PBSB002-Warspite-1941_37_Ridge.zip, this is a recent replay. I have larger replays if needed. b), it is <active_server> WOWS 360 </active_server>. 360 is name of the current partner company with Wargaming. It is known for its security software on Windows.

For the game folder detection, the key is also different. It is using WOWS.CN.PRODUCTION instead of WOWS.WW.PRODUCTION. There is also a seperate gamecenter for it. Now, this may introduce a slight problem. I have both the global client and the Chinese client installed on the machine. How to know which one is running?