vasl-developers / vasl

Virtual Advanced Squad Leader
http://vasl.info/
GNU Lesser General Public License v2.1
66 stars 27 forks source link

API to Random.org is broken #1631

Closed derimmer closed 8 months ago

derimmer commented 8 months ago

It is clear that the api (?) that we use to connect with Random.org is broken and needs to be replaced.

As far as I can see this is handled in a method in ASLDiceBot.java:

private BufferedReader GetRemoteDataReader() throws Exception { URL l_Url = new URL("https://www.random.org/integers/?num=" + String.valueOf(m_iMAXNUM) + "&min=1&max=6&col=1&base=10&format=plain&rnd=new"); HttpURLConnection l_Conn = (HttpURLConnection)l_Url.openConnection();

    l_Conn.setConnectTimeout(60000);
    l_Conn.setReadTimeout(60000);
    l_Conn.setRequestMethod("GET");
    l_Conn.setRequestProperty("User-Agent", "Mozilla/5.0");

    return new BufferedReader(new InputStreamReader(l_Conn.getInputStream()));
}

Does anybody know how we are supposed to fix this? With respect, referring me to the Random.org website is NOT a useful answer to the question. I can find it and I can go through an api learning curve but frankly, I'd rather not. Got other bugs to fix. If someone knows how to do this, I would appreciate the help.

zgrose commented 8 months ago

I only looked at it briefly but I believe we need to sign up for an account and get an APIKey to send with the request.

Until I dig deeper the main issue may be with updated Terms of Use since VASL is not a development or testing product.

I'll be at a gaming tournament for the next four days but I'll try to figure out the legalese and the new headers/parameters when I get some free time, if someone doesn't jump in first.

uckelman commented 8 months ago

The "Commercial" API key license is the one applicable here, so you'll have to pay for it as well as find a solution for not shipping the API key as part of VASL---i.e., you will have to build a service hosted somewhere which has the API key and call that service from VASL.

The V4 server will provide rolls, but don't expect that before Q3.

derimmer commented 8 months ago

a service hosted somewhere which has the API key and call that service from VASL.

That seems like a solution worth avoiding. I don't like the idea of being at the mercy of one service that then calls another. Lots of potential for things not to work and makes debugging harder.

We have a perfectly serviceable dicebot in VASL and if there is another one coming in VASSAL then I am leaning toward Goodbye Charlie Brown as far as Random.org is concerned.

Views?

uckelman commented 8 months ago

What's the actual error?

derimmer commented 8 months ago

The error was that Random.org could not be reached. We have received this reply from them and normal service has resumed. I am going to close this issue.

"Thank you for your email.

We were the target of some request floodings yesterday and had to raise our protection levels in response, which I think is why your client has stopped working.

The floodings have now ceased and we have restored our usual protection levels. This means that your client should work again as normal. If you are still experiencing problems, please send me further details and we'll be happy to help.

Thanks again for reaching out, and my apologies for the inconvenience."

I suspect that we may have to revisit this again if Random.org make the changes we thought were causing this. But for now we are OK.