Fix loginInfo load
- Changed .xml -> .py because pack.Get does not allow .xml extension - Added production guard to not be able to run python code with it
This commit is contained in:
@@ -16,6 +16,7 @@ import time
|
|||||||
import serverCommandParser
|
import serverCommandParser
|
||||||
import ime
|
import ime
|
||||||
import uiScriptLocale
|
import uiScriptLocale
|
||||||
|
import debugInfo
|
||||||
|
|
||||||
# Multi-language hot-reload system
|
# Multi-language hot-reload system
|
||||||
from uilocaleselector import LocaleSelector
|
from uilocaleselector import LocaleSelector
|
||||||
@@ -200,7 +201,8 @@ class LoginWindow(ui.ScriptWindow):
|
|||||||
dbg.TraceError("SelectCharacterWindow.Open - __LoadScript Error")
|
dbg.TraceError("SelectCharacterWindow.Open - __LoadScript Error")
|
||||||
return
|
return
|
||||||
|
|
||||||
self.__LoadLoginInfo("loginInfo.xml")
|
# Changed .xml -> .py because pack.Get does not allow .xml extension
|
||||||
|
self.__LoadLoginInfo("loginInfo.py")
|
||||||
|
|
||||||
if app.loggined:
|
if app.loggined:
|
||||||
self.loginFailureFuncDict = {
|
self.loginFailureFuncDict = {
|
||||||
@@ -324,7 +326,7 @@ class LoginWindow(ui.ScriptWindow):
|
|||||||
|
|
||||||
def __LoadChannelInfo(self):
|
def __LoadChannelInfo(self):
|
||||||
try:
|
try:
|
||||||
with open("config/channel.inf") as file:
|
with open("config/channel.inf", "r") as file:
|
||||||
lines=file.readlines()
|
lines=file.readlines()
|
||||||
|
|
||||||
if len(lines)>0:
|
if len(lines)>0:
|
||||||
@@ -680,69 +682,72 @@ class LoginWindow(ui.ScriptWindow):
|
|||||||
self.serverInfo.SetText(name)
|
self.serverInfo.SetText(name)
|
||||||
|
|
||||||
def __LoadLoginInfo(self, loginInfoFileName):
|
def __LoadLoginInfo(self, loginInfoFileName):
|
||||||
|
# This should not work in production
|
||||||
|
if not debugInfo.IsDebugMode():
|
||||||
|
app.loggined = FALSE
|
||||||
|
else:
|
||||||
|
try:
|
||||||
|
loginInfo={}
|
||||||
|
exec(compile(open(loginInfoFileName, "rb").read(), loginInfoFileName, 'exec'), loginInfo)
|
||||||
|
except IOError:
|
||||||
|
print((\
|
||||||
|
"For automatic login, please create" + loginInfoFileName + "file\n"\
|
||||||
|
"\n"\
|
||||||
|
"Contents:\n"\
|
||||||
|
"================================================================\n"\
|
||||||
|
"addr=address\n"\
|
||||||
|
"port=port number\n"\
|
||||||
|
"id=user ID\n"\
|
||||||
|
"pwd=password\n"\
|
||||||
|
"slot=character selection index (if absent or -1, no auto-selection)\n"\
|
||||||
|
"autoLogin=enable auto login\n"
|
||||||
|
"autoSelect=enable auto select\n"
|
||||||
|
"locale=(ymir) works as ymir for LC_Ymir. Works as korea if not specified\n"
|
||||||
|
));
|
||||||
|
|
||||||
try:
|
id=loginInfo.get("id", "")
|
||||||
loginInfo={}
|
pwd=loginInfo.get("pwd", "")
|
||||||
exec(compile(open(loginInfoFileName, "rb").read(), loginInfoFileName, 'exec'), loginInfo)
|
|
||||||
except IOError:
|
|
||||||
print((\
|
|
||||||
"For automatic login, please create" + loginInfoFileName + "file\n"\
|
|
||||||
"\n"\
|
|
||||||
"Contents:\n"\
|
|
||||||
"================================================================\n"\
|
|
||||||
"addr=address\n"\
|
|
||||||
"port=port number\n"\
|
|
||||||
"id=user ID\n"\
|
|
||||||
"pwd=password\n"\
|
|
||||||
"slot=character selection index (if absent or -1, no auto-selection)\n"\
|
|
||||||
"autoLogin=enable auto login\n"
|
|
||||||
"autoSelect=enable auto select\n"
|
|
||||||
"locale=(ymir) works as ymir for LC_Ymir. Works as korea if not specified\n"
|
|
||||||
));
|
|
||||||
|
|
||||||
id=loginInfo.get("id", "")
|
addr=loginInfo.get("addr", "")
|
||||||
pwd=loginInfo.get("pwd", "")
|
port=loginInfo.get("port", 0)
|
||||||
|
account_addr=loginInfo.get("account_addr", addr)
|
||||||
|
account_port=loginInfo.get("account_port", port)
|
||||||
|
|
||||||
addr=loginInfo.get("addr", "")
|
locale = loginInfo.get("locale", "")
|
||||||
port=loginInfo.get("port", 0)
|
|
||||||
account_addr=loginInfo.get("account_addr", addr)
|
|
||||||
account_port=loginInfo.get("account_port", port)
|
|
||||||
|
|
||||||
locale = loginInfo.get("locale", "")
|
if addr and port:
|
||||||
|
net.SetMarkServer(addr, port)
|
||||||
|
|
||||||
if addr and port:
|
net.SetServerInfo(addr+":"+str(port))
|
||||||
net.SetMarkServer(addr, port)
|
self.serverInfo.SetText("K:"+addr+":"+str(port))
|
||||||
|
|
||||||
net.SetServerInfo(addr+":"+str(port))
|
slot=loginInfo.get("slot", 0)
|
||||||
self.serverInfo.SetText("K:"+addr+":"+str(port))
|
isAutoLogin=loginInfo.get("auto", 0)
|
||||||
|
isAutoLogin=loginInfo.get("autoLogin", 0)
|
||||||
|
isAutoSelect=loginInfo.get("autoSelect", 0)
|
||||||
|
|
||||||
slot=loginInfo.get("slot", 0)
|
self.stream.SetCharacterSlot(slot)
|
||||||
isAutoLogin=loginInfo.get("auto", 0)
|
self.stream.SetConnectInfo(addr, port, account_addr, account_port)
|
||||||
isAutoLogin=loginInfo.get("autoLogin", 0)
|
self.stream.isAutoLogin=isAutoLogin
|
||||||
isAutoSelect=loginInfo.get("autoSelect", 0)
|
self.stream.isAutoSelect=isAutoSelect
|
||||||
|
|
||||||
self.stream.SetCharacterSlot(slot)
|
self.id = None
|
||||||
self.stream.SetConnectInfo(addr, port, account_addr, account_port)
|
self.pwd = None
|
||||||
self.stream.isAutoLogin=isAutoLogin
|
self.loginnedServer = None
|
||||||
self.stream.isAutoSelect=isAutoSelect
|
self.loginnedChannel = None
|
||||||
|
app.loggined = FALSE
|
||||||
|
|
||||||
self.id = None
|
self.loginInfo = loginInfo
|
||||||
self.pwd = None
|
|
||||||
self.loginnedServer = None
|
|
||||||
self.loginnedChannel = None
|
|
||||||
app.loggined = FALSE
|
|
||||||
|
|
||||||
self.loginInfo = loginInfo
|
if self.id and self.pwd:
|
||||||
|
app.loggined = TRUE
|
||||||
|
|
||||||
if self.id and self.pwd:
|
if isAutoLogin:
|
||||||
app.loggined = TRUE
|
self.Connect(id, pwd)
|
||||||
|
|
||||||
if isAutoLogin:
|
print("==================================================================================")
|
||||||
self.Connect(id, pwd)
|
print(("Auto login: %s - %s:%d %s" % (loginInfoFileName, addr, port, id)))
|
||||||
|
print("==================================================================================")
|
||||||
print("==================================================================================")
|
|
||||||
print(("Auto login: %s - %s:%d %s" % (loginInfoFileName, addr, port, id)))
|
|
||||||
print("==================================================================================")
|
|
||||||
|
|
||||||
|
|
||||||
def PopupDisplayMessage(self, msg):
|
def PopupDisplayMessage(self, msg):
|
||||||
|
|||||||
Reference in New Issue
Block a user