def dl_skelenox():
"""
Generate a Zip file wich contains both the Skelenox script
and the associated config file.
"""
try:
ip_addr, _ = request.host.split(":")
except ValueError:
ip_addr = request.host
zipout = io.BytesIO()
with ZipFile(zipout, "w") as myzip:
myzip.write("skelenox.py")
skel_config = {}
skel_config["username"] = g.user.nickname
skel_config["edit_flag"] = True
skel_config["initial_sync"] = True
skel_config["poli_server"] = ip_addr
skel_config["poli_port"] = app.config['SERVER_PORT']
skel_config["poli_remote_path"] = app.config['API_PATH'] + "/"
skel_config["debug_http"] = app.config['HTTP_DEBUG']
skel_config["poli_apikey"] = g.user.api_key
skel_config["save_timeout"] = 10 * 60
skel_config["sync_frequency"] = 1.0 * 100
skel_config["debug_level"] = "info"
skel_config["notepad_font_name"] = "Courier New"
skel_config["notepad_font_size"] = 9
skel_json = json.dumps(skel_config, sort_keys=True, indent=4)
myzip.writestr("skelsettings.json", skel_json)
myzip.close()
response = make_response(zipout.getvalue())
response.headers["Content-type"] = "application/octet-stream"
response.headers[
"Content-Disposition"] = "attachment; filename=skelenox.zip"
return response
评论列表
文章目录