From 88aaef48327bb7be9ab5488dab20f10c5ece32c3 Mon Sep 17 00:00:00 2001 From: Q01 Date: Sun, 2 May 2021 12:36:47 +0800 Subject: [PATCH 01/12] Add: Default route for index. --- app.py | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/app.py b/app.py index c01a1bb..4cbaa51 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, redirect, url_for 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) + From e5ca52516f72ac0119808075ef77958716430320 Mon Sep 17 00:00:00 2001 From: Q01 Date: Sun, 2 May 2021 12:37:25 +0800 Subject: [PATCH 02/12] Add: Web gen. --- index.html | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 index.html diff --git a/index.html b/index.html new file mode 100644 index 0000000..e3272fc --- /dev/null +++ b/index.html @@ -0,0 +1,74 @@ + + + + MobaXterm Keygen + + + + +
+

MobaXterm Keygen

+
+
+
+ + + + +
+ + + + From f62c8a7b2aa5320c257441f2bb678bd1476a84c8 Mon Sep 17 00:00:00 2001 From: Q01 Date: Sun, 2 May 2021 12:38:10 +0800 Subject: [PATCH 03/12] Mod: use slim image. --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From 4559b58936c31384c6b455b7aa0ceeb277b44e2a Mon Sep 17 00:00:00 2001 From: Q01 Date: Sun, 2 May 2021 12:50:31 +0800 Subject: [PATCH 04/12] Add: github link. --- index.html | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/index.html b/index.html index e3272fc..3067de7 100644 --- a/index.html +++ b/index.html @@ -43,18 +43,13 @@ } .container { padding: 16px 0; - text-align:left; + text-align: left; } - span.ver { - float: right; - padding-top: 0; - padding-right: 15px; + .github { + padding: 16px 0; + text-align: center; } @media screen and (max-width: 300px) { - span.psw { - display: block; - float: none; - } @@ -69,6 +64,11 @@
+
+ + View on GitHub +
From 3bfdc9d14d0e2e8a520fe311ae89c86fbbeeb2e1 Mon Sep 17 00:00:00 2001 From: Q01 Date: Sun, 2 May 2021 12:52:03 +0800 Subject: [PATCH 05/12] Remove: deps --- app.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app.py b/app.py index 4cbaa51..ddb5a7f 100644 --- a/app.py +++ b/app.py @@ -1,7 +1,7 @@ #/usr/bin/env python3 import os, sys, zipfile -from flask import Flask, request, send_file, redirect, url_for +from flask import Flask, request, send_file import os.path app = Flask(__name__) From 54cf06b33a0e195302f4bdf89e0d64de615876b3 Mon Sep 17 00:00:00 2001 From: Q01 Date: Sun, 2 May 2021 13:12:22 +0800 Subject: [PATCH 06/12] Add: github action. --- .github/workflows/main.yml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..666d4d7 --- /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 }}/${{ github.repository }}:latest From 6e82b32efb4c9db1824aeff06901f15314263eef Mon Sep 17 00:00:00 2001 From: Q01 Date: Sun, 2 May 2021 13:14:29 +0800 Subject: [PATCH 07/12] Update main.yml --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 666d4d7..c6cbc8b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -28,4 +28,4 @@ jobs: with: push: true file: dockerfile - tags: ${{ github.repository_owner }}/${{ github.repository }}:latest + tags: ${{ github.repository_owner }}/MobaXterm_GenKey:latest From b39d57adc7dbf64e17ae49243789e4b4d55e7861 Mon Sep 17 00:00:00 2001 From: Q01 Date: Sun, 2 May 2021 13:15:20 +0800 Subject: [PATCH 08/12] Update main.yml --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c6cbc8b..b0055ae 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -28,4 +28,4 @@ jobs: with: push: true file: dockerfile - tags: ${{ github.repository_owner }}/MobaXterm_GenKey:latest + tags: ${{ github.repository_owner }}/mobaxterm_genkey:latest From 1c3631a39deefc1ebd52337c86d34e3a5cb2ced6 Mon Sep 17 00:00:00 2001 From: Q01 Date: Sun, 2 May 2021 13:16:11 +0800 Subject: [PATCH 09/12] Update main.yml --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b0055ae..14825ef 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -27,5 +27,5 @@ jobs: uses: docker/build-push-action@v2 with: push: true - file: dockerfile + file: Dockerfile tags: ${{ github.repository_owner }}/mobaxterm_genkey:latest From 6cf8e48248cbdaa35dfbf63157f093faa8b891e3 Mon Sep 17 00:00:00 2001 From: Q01 Date: Sun, 2 May 2021 13:19:45 +0800 Subject: [PATCH 10/12] Update main.yml --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 14825ef..1080305 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -28,4 +28,4 @@ jobs: with: push: true file: Dockerfile - tags: ${{ github.repository_owner }}/mobaxterm_genkey:latest + tags: ${{ github.repository_owner }}/mobaxterm-genkey:latest From f5b535a67de8c9893f483d3e16b6cdc600bf4b4e Mon Sep 17 00:00:00 2001 From: Q01 Date: Sun, 2 May 2021 13:26:12 +0800 Subject: [PATCH 11/12] Update README.md --- README.md | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) 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) ### 激活方式 直接放到软件目录即可! From 3e8463ebbb1e8b0d3346183c2ad744cf88b32d61 Mon Sep 17 00:00:00 2001 From: Q01 Date: Sun, 2 May 2021 13:26:37 +0800 Subject: [PATCH 12/12] Update index.html --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index 3067de7..9be8231 100644 --- a/index.html +++ b/index.html @@ -61,7 +61,7 @@ - +