diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..1080305 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,31 @@ +name: ci + +on: + push: + branches: + - 'main' + +jobs: + docker: + runs-on: ubuntu-latest + steps: + - + name: Set up QEMU + uses: docker/setup-qemu-action@v1 + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + - + name: Login to DockerHub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - + name: Build and push + id: docker_build + uses: docker/build-push-action@v2 + with: + push: true + file: Dockerfile + tags: ${{ github.repository_owner }}/mobaxterm-genkey:latest diff --git a/Dockerfile b/Dockerfile index 72d9e9d..df3159f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.6 +FROM python:3.6-slim MAINTAINER malaohu diff --git a/README.md b/README.md index 5a0acde..32bfb93 100644 --- a/README.md +++ b/README.md @@ -16,20 +16,8 @@ docker run -d -p 5000:5000 malaohu/mobaxterm-genkey ## 使用方法 -### 生成LC - -name -- 自定义用户名 -ver -- 软件版本 - -访问:IP:5000/gen/?name=malaohu&ver=21.0 -接口返回一串字符串 - -### 下载文件 -访问:IP:5000/download/xxxxxxx -xxxxxxx 为上面生成的字符串 - -### 生成&下载 -IP:5000/?name=malaohu&ver=21.0 +访问:IP:5000 +![image](https://user-images.githubusercontent.com/8140841/116803404-e94c8300-ab49-11eb-83db-ad0246ebedd3.png) ### 激活方式 直接放到软件目录即可! diff --git a/app.py b/app.py index c01a1bb..ddb5a7f 100644 --- a/app.py +++ b/app.py @@ -1,9 +1,7 @@ #/usr/bin/env python3 import os, sys, zipfile -from flask import Flask -from flask import request -from flask import send_file +from flask import Flask, request, send_file import os.path app = Flask(__name__) @@ -102,34 +100,44 @@ def GenerateLicense(Type : LicenseType, Count : int, UserName : str, MajorVersio return FileName -@app.route('/gen') +#@app.route('/gen') def get_lc(): name = request.args.get('name', '') version = request.args.get('ver', '') count = int(request.args.get('count', '1')) - - MajorVersion, MinorVersion = version.split('.')[0:2] + try: + MajorVersion, MinorVersion = version.split('.')[0:2] + except: + return MajorVersion = int(MajorVersion) MinorVersion = int(MinorVersion) lc = GenerateLicense(LicenseType.Professional, count, name, MajorVersion, MinorVersion) return lc -@app.route('/download/') +#@app.route('/download/') def download_lc(lc): if lc and len(lc) > 5 and os.path.exists('./' + lc): return send_file(lc, as_attachment=True, attachment_filename='Custom.mxtpro') else: - return "请确保生成成功后再来下载!检查用户名版本号是否正确!" + return "请检查用户名版本号是否正确!" -@app.route('/') +@app.route('/gen') def get(): lc = get_lc() return download_lc(lc) +@app.route('/') +def index(): + return send_file('index.html') + + + + if __name__ == '__main__': - app.run(host='0.0.0.0', port=5000, debug=True) + app.run(host='0.0.0.0', port=5000, debug=False) + diff --git a/index.html b/index.html new file mode 100644 index 0000000..9be8231 --- /dev/null +++ b/index.html @@ -0,0 +1,74 @@ + + + + MobaXterm Keygen + + + + +
+

MobaXterm Keygen

+
+
+
+ + + + +
+ +
+ + View on GitHub +
+ + +