Fix EVE API proxy to "handle" new style keys BODGE FIX HOOOO

This commit is contained in:
2011-09-27 23:00:00 +01:00
parent 684b0131f9
commit e6b939a274
3 changed files with 12 additions and 4 deletions

View File

@@ -19,6 +19,7 @@ from gargoyle import gargoyle
from api.models import AuthAPIKey, AuthAPILog from api.models import AuthAPIKey, AuthAPILog
from eve_proxy.models import CachedDocument from eve_proxy.models import CachedDocument
from eve_proxy.exceptions import * from eve_proxy.exceptions import *
from eve_api.app_defines import *
from eve_api.models import EVEAccount, EVEPlayerCharacter from eve_api.models import EVEAccount, EVEPlayerCharacter
from sso.models import ServiceAccount, Service from sso.models import ServiceAccount, Service
from hr.app_defines import * from hr.app_defines import *
@@ -128,8 +129,15 @@ class EveAPIProxyHandler(BaseHandler):
for key, value in request.GET.items(): for key, value in request.GET.items():
params[key.lower()] = value params[key.lower()] = value
if 'userid' in params: if 'userid' in params or 'keyid' in params:
obj = get_object_or_404(EVEAccount, pk=params['userid']) obj = get_object_or_404(EVEAccount, pk=params['userid'])
# "Fix" new style keys
if obj.api_keytype >= 3:
params['keyid'] = params['userid']
del params['userid']
params['vcode'] = obj.api_key
else:
params['apikey'] = obj.api_key params['apikey'] = obj.api_key
try: try:

View File

@@ -13,7 +13,7 @@ DATABASES = {
## EVE Proxy ## EVE Proxy
EVE_API_URL = "https://apitest.eveonline.com" EVE_API_URL = "https://api.eveonline.com"
EVE_PROXY_KEEP_LOGS = 30 EVE_PROXY_KEEP_LOGS = 30
## SSO ## SSO

2
fabfile.py vendored
View File

@@ -19,7 +19,7 @@ def production():
env.uwsgiconfig = os.path.join(env.path, '..', 'etc', 'uwsgi', 'dreddit-auth.ini') env.uwsgiconfig = os.path.join(env.path, '..', 'etc', 'uwsgi', 'dreddit-auth.ini')
env.password = sha1('%s-%s' % (env.user, env.vhost)).hexdigest() env.password = sha1('%s-%s' % (env.user, env.vhost)).hexdigest()
env.celeryconf = '-l INFO --settings=%(config)s --pidfile=logs/%%n.pid --logfile=logs/%%n.log -n auth.pleaseignore.com bulk default fastresponse -Q:bulk bulk -Q:fastresponse fastresponse -c 5 -c:bulk 3 -c:fastresponse 3 -B --scheduler=djcelery.schedulers.DatabaseScheduler' % env env.celeryconf = '-l INFO --settings=%(config)s --pidfile=logs/%%n.pid --logfile=logs/%%n.log -n auth.pleaseignore.com bulk default fastresponse -Q:bulk bulk -Q:fastresponse fastresponse -c 5 -c:bulk 3 -c:fastresponse 3 -B:default --scheduler=djcelery.schedulers.DatabaseScheduler' % env
def test(): def test():