Browse Source

生成到临时目录 出现权限错误 还原

pull/3/head
malaohu 4 years ago committed by GitHub
parent
commit
6450033999
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      app.py

8
app.py

@ -96,7 +96,7 @@ def GenerateLicense(Type : LicenseType, Count : int, UserName : str, MajorVersio
0, # No Games flag. 0 means "NoGames = false". But it does not work.
0) # No Plugins flag. 0 means "NoPlugins = false". But it does not work.
EncodedLicenseString = VariantBase64Encode(EncryptBytes(0x787, LicenseString.encode())).decode()
with zipfile.ZipFile('/tmp/' + EncodedLicenseString, 'w') as f:
with zipfile.ZipFile(EncodedLicenseString, 'w') as f:
f.writestr('Pro.key', data = EncodedLicenseString)
return EncodedLicenseString
@ -115,11 +115,11 @@ def get_lc():
@app.route('/download/<lc>')
def download_lc(lc):
if lc and len(lc) > 5 and os.path.exists('./' + lc):
return send_file('/tmp/' + lc,
return send_file(lc,
as_attachment=True,
attachment_filename='Custom.mxtpro')
else:
return "请确保生成成功后再来下载!"
return "请确保生成成功后再来下载!检查用户名版本号是否正确!"
@app.route('/')
@ -129,4 +129,4 @@ def get():
if __name__ == '__main__':
app.run(host='0.0.0.0', port=5000, debug=False)
app.run(host='0.0.0.0', port=5000, debug=True)

Loading…
Cancel
Save