Added Access-Control-Allow-Origin to the players HTTPD module

This commit is contained in:
unknown 2013-12-18 14:45:59 +01:00
parent 6d48c90d16
commit 3e71286507
2 changed files with 11 additions and 9 deletions

View File

@ -1,3 +1,3 @@
#Build Number for ANT. Do not edit! #Build Number for ANT. Do not edit!
#Wed Dec 18 14:11:43 CET 2013 #Wed Dec 18 14:44:11 CET 2013
build.number=694 build.number=695

View File

@ -19,7 +19,7 @@ public class Module_players extends TFM_HTTPD_Module
@Override @Override
public NanoHTTPD.Response getResponse() public NanoHTTPD.Response getResponse()
{ {
final JSONObject response = new JSONObject(); final JSONObject responseObject = new JSONObject();
final JSONArray players = new JSONArray(); final JSONArray players = new JSONArray();
final JSONArray superadmins = new JSONArray(); final JSONArray superadmins = new JSONArray();
@ -68,13 +68,15 @@ public class Module_players extends TFM_HTTPD_Module
// Developers // Developers
developers.addAll(TFM_Util.DEVELOPERS); developers.addAll(TFM_Util.DEVELOPERS);
response.put("players", players); responseObject.put("players", players);
response.put("superadmins", superadmins); responseObject.put("superadmins", superadmins);
response.put("telnetadmins", telnetadmins); responseObject.put("telnetadmins", telnetadmins);
response.put("senioradmins", senioradmins); responseObject.put("senioradmins", senioradmins);
response.put("developers", developers); responseObject.put("developers", developers);
return new NanoHTTPD.Response(NanoHTTPD.Response.Status.OK, NanoHTTPD.MIME_JSON, response.toString()); final NanoHTTPD.Response response = new NanoHTTPD.Response(NanoHTTPD.Response.Status.OK, NanoHTTPD.MIME_JSON, responseObject.toString());
response.addHeader("Access-Control-Allow-Origin", "*");
return response;
} }
private String getName(String caseInsensitiveName) private String getName(String caseInsensitiveName)