Commit c3fa18d2 authored by Matt Souza's avatar Matt Souza Committed by GitHub

Merge pull request #8 from Red-M/master

Update cacher for RedServ changes…
parents 4aeb0f5a abf23d83
import json
import urllib2
import requests
def wget(url):
opener = urllib2.build_opener()
if "User-Agent" in cherrypy.request.headers:
opener.addheaders = [('User-Agent', cherrypy.request.headers["User-Agent"])]
response = opener.open(url, timeout=1)
content = response.read()
return(content)
......@@ -46,7 +49,15 @@ def forward_announce(master_servers,port,params,ip):
def index(params,site_data):
master_servers = [
"upstream server here"
"http://eldewrito-master-server.red-m.net/announce"
# "http://158.69.166.144:8080/announce"
#"http://192.99.124.162/announce",
#"http://kelly-master.halo.click/announce",
#"http://edms.qmarchi.cf/announce",
#"http://kyrluckechuck-dewrito-master-server-kyrluckechuck.c9.io/announce",
#"http://eldewrito-masterserver-1-thetwist84.c9.io/announce",
#"http://eldewrito-masterserver-thetwist84.c9.io/announce",
#"https://samantha-master.halo.click/announce"
]
cherrypy.response.headers["content-type"] = "application/json"
if not "port" in params:
......
......@@ -4,6 +4,8 @@ import urllib2
def wget(url):
opener = urllib2.build_opener()
if "User-Agent" in cherrypy.request.headers:
opener.addheaders = [('User-Agent', cherrypy.request.headers["User-Agent"])]
response = opener.open(url, timeout=0.7)
content = response.read()
return(content)
......@@ -95,9 +97,9 @@ def index(params,site_data):
output["result"]["servers"] = server_list
cherrypy.response.headers["content-type"] = "application/json"
cherrypy.response.headers["Access-Control-Allow-Credentials"] = "true"
cherrypy.response.headers["Access-Control-Allow-Headers"] = "Content-Type"
cherrypy.response.headers["Access-Control-Allow-Headers"] = "Content-Type,X-Player"
cherrypy.response.headers["Access-Control-Allow-Methods"] = "POST, GET"
cherrypy.response.headers["Access-Control-Allow-Origin"] = "*"
return(json.dumps(output))
datareturned,response = (index(params,site_data),200)
\ No newline at end of file
datareturned,response = (index(params,site_data),200)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment