From 2083932225e60a655aeaea388084a04d98f0abcb Mon Sep 17 00:00:00 2001 From: malaohu Date: Sat, 27 Mar 2021 14:17:37 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=86=E6=96=87=E4=BB=B6=E7=94=9F=E6=88=90?= =?UTF-8?q?=E7=9A=84=E4=B8=B4=E6=97=B6=E7=9B=AE=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/app.py b/app.py index efcde65..bd6c86f 100644 --- a/app.py +++ b/app.py @@ -96,12 +96,12 @@ 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(EncodedLicenseString, 'w') as f: + with zipfile.ZipFile('/tmp/' + EncodedLicenseString, 'w') as f: f.writestr('Pro.key', data = EncodedLicenseString) return EncodedLicenseString -@app.route('/') +@app.route('/gen') def get_lc(): name = request.args.get('name', '') version = request.args.get('ver', '') @@ -111,14 +111,22 @@ def get_lc(): lc = GenerateLicense(LicenseType.Professional, 1, name, MajorVersion, MinorVersion) return lc + @app.route('/download/') def download_lc(lc): if lc and len(lc) > 5 and os.path.exists('./' + lc): - return send_file('./' + lc, + return send_file('/tmp/' + lc, as_attachment=True, attachment_filename='Custom.mxtpro') else: return "请确保生成成功后再来下载!" + +@app.route('/') +def get(): + lc = get_lc() + return download_lc(lc) + + if __name__ == '__main__': app.run(host='0.0.0.0', port=5000, debug=False)