commit
1260101175
|
@ -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
|
|
@ -1,4 +1,4 @@
|
|||
FROM python:3.6
|
||||
FROM python:3.6-slim
|
||||
|
||||
MAINTAINER malaohu <tua@live.cn>
|
||||
|
||||
|
|
16
README.md
16
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
|
||||

|
||||
|
||||
### 激活方式
|
||||
直接放到软件目录即可!
|
||||
|
|
28
app.py
28
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/<lc>')
|
||||
#@app.route('/download/<lc>')
|
||||
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)
|
||||
|
||||
|
|
|
@ -0,0 +1,74 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>MobaXterm Keygen</title>
|
||||
<link href="https://fonts.googleapis.cnpmjs.org/css?family=Roboto:300,400,500,700" rel="stylesheet">
|
||||
<style>
|
||||
html, body {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
font-family: Roboto, Arial, sans-serif;
|
||||
font-size: 15px;
|
||||
}
|
||||
form {
|
||||
border: 5px solid #f1f1f1;
|
||||
}
|
||||
input[type=text], input[type=text] {
|
||||
width: 100%;
|
||||
padding: 16px 8px;
|
||||
margin: 8px 0;
|
||||
display: inline-block;
|
||||
border: 1px solid #ccc;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
button {
|
||||
background-color: #8ebf42;
|
||||
color: white;
|
||||
padding: 14px 0;
|
||||
margin: 10px 0;
|
||||
border: none;
|
||||
cursor: grabbing;
|
||||
width: 100%;
|
||||
}
|
||||
h1 {
|
||||
text-align:center;
|
||||
fone-size:18;
|
||||
}
|
||||
button:hover {
|
||||
opacity: 0.8;
|
||||
}
|
||||
.formcontainer {
|
||||
text-align: left;
|
||||
margin: 24px 50px 12px;
|
||||
}
|
||||
.container {
|
||||
padding: 16px 0;
|
||||
text-align: left;
|
||||
}
|
||||
.github {
|
||||
padding: 16px 0;
|
||||
text-align: center;
|
||||
}
|
||||
@media screen and (max-width: 300px) {
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<form action="/gen" mothod="get">
|
||||
<h1>MobaXterm Keygen</h1>
|
||||
<div class="formcontainer">
|
||||
<hr/>
|
||||
<div class="container">
|
||||
<label for="name"><strong>Name</strong></label>
|
||||
<input type="text" placeholder="Enter name" name="name" required>
|
||||
<label for="ver"><strong>Version</strong></label>
|
||||
<input type="text" placeholder="Enter version: (21.1)" name="ver" required>
|
||||
</div>
|
||||
<button type="submit">Gen!</button>
|
||||
<div class="github">
|
||||
<label style="padding-left: 15px">
|
||||
</label>
|
||||
<span><a style="text-decoration: none;" href="https://github.com/malaohu/MobaXterm-GenKey">View on GitHub</a><img src="https://github.githubassets.com/favicons/favicon.svg" height="16px"></span>
|
||||
</div>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue