Skip to content

Commit

Permalink
fix bugs: default launcher config values, win32elevate for php_proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
xxnet committed Apr 11, 2015
1 parent 53fdb8c commit ab1d011
Show file tree
Hide file tree
Showing 10 changed files with 2,053 additions and 2,125 deletions.
4,119 changes: 2,020 additions & 2,099 deletions goagent/3.1.48/local/good_ip.txt

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion goagent/3.1.48/local/proxy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ port = 8084
[google_ip]
max_check_ip_thread_num = 5
max_good_ip_num = 3000
ip_connect_interval = 3
ip_connect_interval = 10

[connect_manager]
https_max_connect_thread = 6
Expand Down
21 changes: 12 additions & 9 deletions goagent/3.1.48/local/web_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ class User_config(object):
proxy_user = ""
proxy_passwd = ""

host_appengine = "gae"
host_appengine_mode = "gae"

ip_connect_interval = ""

def __init__(self):
self.host_appengine = "gae"
self.ip_connect_interval = 3
self.load()

def load(self):
Expand All @@ -80,7 +80,7 @@ def load(self):
pass

try:
self.host_appengine = CONFIG.get('hosts', 'appengine.google.com')
self.host_appengine_mode = CONFIG.get('hosts', 'appengine.google.com')
except:
pass

Expand Down Expand Up @@ -116,11 +116,12 @@ def save(self):
f.write("user = %s\n" % self.proxy_user)
f.write("passwd = %s\n\n" % self.proxy_passwd)

if self.host_appengine != "gae":
if self.host_appengine_mode != "gae":
f.write("[hosts]\n")
f.write("appengine.google.com = %s\n\n" % self.host_appengine)
f.write("appengine.google.com = %s\n\n" % self.host_appengine_mode)
f.write(".google.com = %s\n\n" % self.host_appengine_mode)

if self.ip_connect_interval != 10:
if self.ip_connect_interval != "":
f.write("[google_ip]\n")
f.write("ip_connect_interval = %d\n\n" % int(self.ip_connect_interval))

Expand Down Expand Up @@ -385,7 +386,9 @@ def req_status_handler(self):
"working_appid":"|".join(appid_manager.working_appid_list),
"out_of_quota_appids":"|".join(appid_manager.out_of_quota_appids),
"not_exist_appids":"|".join(appid_manager.not_exist_appids),
"pac_url":config.pac_url}
"pac_url":config.pac_url,
"ip_connect_interval":config.CONFIG.getint("google_ip", "ip_connect_interval")
}
data = json.dumps(res_arr)

self.send_response('application/json', data)
Expand All @@ -407,7 +410,7 @@ def req_config_handler(self):
user_config.proxy_port = self.postvars['proxy_port'][0]
user_config.proxy_user = self.postvars['proxy_user'][0]
user_config.proxy_passwd = self.postvars['proxy_passwd'][0]
user_config.host_appengine = self.postvars['host_appengine'][0]
user_config.host_appengine_mode = self.postvars['host_appengine'][0]
user_config.ip_connect_interval = self.postvars['ip_connect_interval'][0]
user_config.save()

Expand Down
2 changes: 1 addition & 1 deletion goagent/3.1.48/web_ui/config.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ <h2>配置GoAgent</h2>
</label>
</div>
<br>
google ip 使用频率限制:<input type="text" class="input-small" id="ip_connect_interval"><a href="https://github.com/XX-net/XX-Net/wiki/About-ip-connect-interval">帮助</a>
google ip 使用频率限制:<input type="text" class="input-small" placeholder="default 10" id="ip_connect_interval"><a href="https://github.com/XX-net/XX-Net/wiki/About-ip-connect-interval">帮助</a>
</p>
</details>

Expand Down
4 changes: 4 additions & 0 deletions goagent/3.1.48/web_ui/status.html
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ <h2>GoAgent状态信息</h2>
<tr>
<td>connected link</td><td id="connected_link"></td>
</tr>
<tr>
<td>ip_connect_interval</td><td id="ip_connect_interval"></td>
</tr>
</tbody>
</table>

Expand Down Expand Up @@ -95,6 +98,7 @@ <h2>GoAgent状态信息</h2>
$('#working_appid').html(data.working_appid);
$('#out_of_quota_appids').html(data.out_of_quota_appids);
$('#not_exist_appids').html(data.not_exist_appids);
$('#ip_connect_interval').html(data.ip_connect_interval);
});
}

Expand Down
2 changes: 1 addition & 1 deletion launcher/1.3.0/module_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def start(module):
logging.error("module %s is running", module)
return "module is running"

version = config.config["modules"][module]["current_version"]
version = config.get(["modules", module, "current_version"], "")
logging.info("use %s version:%s", module, version)

script_path = os.path.abspath( os.path.join(current_path, os.pardir, os.pardir, module, version, 'start.py'))
Expand Down
9 changes: 5 additions & 4 deletions launcher/1.3.0/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,11 @@ def get_new_new_config():
print "Error in configuration file:", exc

def process_data_files():
new_config = get_new_new_config()
config.load()
config.config["modules"]["goagent"]["current_version"] = new_config["modules"]["goagent"]["current_version"]
config.config["modules"]["launcher"]["current_version"] = new_config["modules"]["launcher"]["current_version"]
#TODO: fix bug
#new_config = get_new_new_config()
#config.load()
#config.config["modules"]["goagent"]["current_version"] = new_config["modules"]["goagent"]["current_version"]
#config.config["modules"]["launcher"]["current_version"] = new_config["modules"]["launcher"]["current_version"]
config.save()

def install_xxnet_files():
Expand Down
3 changes: 1 addition & 2 deletions launcher/1.3.0/setup_win_python.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,10 @@ def check_setup(): #40ms

def smart_check(): #400 ms
import uuid
node_id = uuid.getnode()
import config
#config.load()

if current_path != config.config["update"]["last_path"] or node_id != config.config["update"]["node_id"]:
if current_path != config.get(["update", "last_path"]):
check_setup()

if __name__ == "__main__":
Expand Down
16 changes: 8 additions & 8 deletions launcher/1.3.0/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def install_module(module, new_version):
return


config.config["modules"][module]["current_version"] = str(new_version)
config.set(["modules", module, "current_version"], str(new_version))
config.save()

if module == "launcher":
Expand Down Expand Up @@ -183,7 +183,7 @@ def download_module(module, new_version):
logging.warn("get goagent source fail, content:%s err:%s", update_content, e)

def ignore_module(module, new_version):
config.config["modules"][module]["ignore_version"] = str(new_version)
config.set(["modules", module, "ignore_version"], str(new_version))
config.save()

def general_gtk_callback(widget=None, data=None):
Expand All @@ -209,7 +209,7 @@ def check_update():
global update_content, update_dict
try:
#config.load()
if not config.config["update"]["check_update"]:
if not config.get(["update", "check_update"]):
return

req_url = update_url + "?uuid=" + get_uuid()
Expand All @@ -229,7 +229,7 @@ def check_update():
config.config["modules"][module] = {}
config.config["modules"][module]["current_version"] = '0.0.0'
else:
current_version = config.config["modules"][module]["current_version"]
current_version = config.get(["modules", module, "current_version"])
if "ignore_version" in config.config["modules"][module]:
ignore_version = config.config["modules"][module]["ignore_version"]
else:
Expand Down Expand Up @@ -295,8 +295,8 @@ def notify_install_tcpz_for_winXp():
def check_new_machine():

current_path = os.path.dirname(os.path.abspath(__file__))
if current_path != config.config["update"]["last_path"]:
config.config["update"]["last_path"] = current_path
if current_path != config.get(["update", "last_path"], ""):
config.set(["update", "last_path"], current_path)
config.save()

if sys.platform == "win32" and platform.release() == "XP":
Expand Down Expand Up @@ -331,7 +331,7 @@ def need_new_uuid():

def generate_new_uuid():
xx_net_uuid = str(uuid.uuid4())
config.config["update"]["uuid"] = xx_net_uuid
config.set(["update", "uuid"], xx_net_uuid)
logging.info("generate uuid:%s", xx_net_uuid)
config.save()

Expand All @@ -340,7 +340,7 @@ def get_uuid():
if need_new_uuid():
generate_new_uuid()

xx_net_uuid = config.config["update"]["uuid"]
xx_net_uuid = config.get(["update", "uuid"])
logging.info("get uuid:%s", xx_net_uuid)
return xx_net_uuid

Expand Down
File renamed without changes.

0 comments on commit ab1d011

Please sign in to comment.