Browse Source

fixed mothership id encoding

epsylon 4 years ago
parent
commit
7d4e801e45
1 changed files with 5 additions and 2 deletions
  1. 5 2
      core/main.py

+ 5 - 2
core/main.py

@@ -40,7 +40,7 @@ from core.mods.nuke import NUKE
 from core.mods.tachyon import TACHYON
 from core.mods.monlist import MONLIST
 
-DEBUG = False # switch to 'True' for detailed traceback errors 
+DEBUG = False # use 'True' for detailed traceback
 
 class UFONet(object):
     def __init__(self):
@@ -148,7 +148,10 @@ class UFONet(object):
             for ship in motherships:
                 ship = ship.encode("utf-8")
                 self.mothership_ids.append(base64.urlsafe_b64encode(ship))
-            self.mothership_id = str(base64.b64decode(random.choice(self.mothership_ids).strip()), 'utf-8')
+            try:
+                self.mothership_id = str(base64.b64decode(random.choice(self.mothership_ids).strip()), 'utf-8')
+            except:
+                self.mothership_id = str(base64.b64decode(random.choice(self.mothership_ids).strip()), 'latin-1')+"\n" # id (hack&slash!) creation ;-)
             m = open(self.mothershipname, "w") # write mothership name to a static file as a baptism
             m.write(str(self.mothership_id.upper()))
             m.close()