diff --git a/dependencies/astron/databases/astrondb/.gitignore b/dependencies/astron/databases/astrondb/.gitignore old mode 100644 new mode 100755 index d6b7ef32..c96a04f0 --- a/dependencies/astron/databases/astrondb/.gitignore +++ b/dependencies/astron/databases/astrondb/.gitignore @@ -1,2 +1,2 @@ * -!.gitignore +!.gitignore \ No newline at end of file diff --git a/toontown/rpc/ToontownRPCHandler.py b/toontown/rpc/ToontownRPCHandler.py index c40c4850..737e1dcc 100755 --- a/toontown/rpc/ToontownRPCHandler.py +++ b/toontown/rpc/ToontownRPCHandler.py @@ -773,3 +773,48 @@ class ToontownRPCHandler(ToontownRPCHandlerBase): oldFields = {'setWishNameState': 'PENDING'} return self.rpc_updateObject( avId, 'DistributedToonUD', newFields, oldFields=oldFields) + + @rpcmethod(accessLevel=MODERATOR) + def rpc_getChatSettings(self, accId): + """ + Summary: + Retrieves the chat settings of the account associated with the provided + [accId]. + + Parameters: + [int accId] = The ID of the account whose chat settings + are to be retreived. + + Example response: + On success: [uint8[sp+, tf]] + On failure: False + """ + dclassName, fields = self.rpc_queryObject(int(accId)) + if dclassName == 'Account': + if 'CHAT_SETTINGS' in fields: + return fields['CHAT_SETTINGS'] + # The chat settings haven't been set yet, so we'll + # want to do that now. + self.rpc_setChatSettings(accId) + return [1, 1] + return False + + @rpcmethod(accessLevel=MODERATOR) + def rpc_setChatSettings(self, accId, speedChatPlus = 1, trueFriends = 1): + """ + Summary: + Sets the chat settings of the account associated with the provided + [accId]. + + Parameters: + [int accId] = The ID of the account whose chat settings + are to be changed. + [uint8[sp+, tf]] = The chat settings - SpeedChat Plus and + True Friends + + Example response: + On success: True + On failure: False + """ + return self.rpc_updateObject(accId, 'AccountUD', {'CHAT_SETTINGS': + [int(speedChatPlus), int(trueFriends)]}) diff --git a/toontown/toonbase/ToontownStartRemoteDB.py b/toontown/toonbase/ToontownStartRemoteDB.py index 2457ef3d..5ac9ce8e 100644 --- a/toontown/toonbase/ToontownStartRemoteDB.py +++ b/toontown/toonbase/ToontownStartRemoteDB.py @@ -7,16 +7,13 @@ from panda3d.core import * username = os.environ['ttsUsername'] password = os.environ['ttsPassword'] -accountServerEndpoint = 'http://www.toontownstride.com/api/' -session = requests.Session() -csrf_query = session.get(accountServerEndpoint + 'login/') -csrf = session.cookies.get_dict().get('csrftoken', '') -request = session.post( +accountServerEndpoint = 'https://toontownstride.com/api/' +request = requests.post( accountServerEndpoint + 'login/', - data={'username': username, 'password': password, 'csrfmiddlewaretoken': csrf}) + data={'username': username, 'password': password, 'distribution': 'qa'}) try: - response = json.loads('{'+request.text.split('{', 1)[1]) # so that we ignore the csrf token + response = json.loads(request.text) except ValueError: print "Couldn't verify account credentials." else: diff --git a/toontown/uberdog/ClientServicesManagerUD.py b/toontown/uberdog/ClientServicesManagerUD.py index 344a27dd..53903249 100755 --- a/toontown/uberdog/ClientServicesManagerUD.py +++ b/toontown/uberdog/ClientServicesManagerUD.py @@ -78,7 +78,8 @@ def executeHttpRequest(url, **extras): _data[k] = v signature = hashlib.sha512(json.dumps(_data) + apiSecret).hexdigest() data = urllib.urlencode({'data': json.dumps(_data), 'hmac': signature}) - req = urllib2.Request('http://www.toontownstride.com/api/' + url, data) + req = urllib2.Request('https://toontownstride.com/api/' + url, data, + headers={"Content-Type" : "application/x-www-form-urlencoded"}) req.get_method = lambda: "POST" try: return urllib2.urlopen(req).read()