- Flask 框架搭建的多功能工具平台 - 包含 base64编解码、Excel合并、文件转换、图片压缩、JSON工具 - 邮件通知、智能数据、临时文本、URL编解码、文本比对等功能 - uWSGI 部署配置main
parent
899ea7a111
commit
c686e18776
@ -1,162 +1,42 @@
|
||||
# ---> Python
|
||||
# Byte-compiled / optimized / DLL files
|
||||
# OS files
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
ehthumbs.db
|
||||
Desktop.ini
|
||||
|
||||
# IDE
|
||||
.idea/
|
||||
*.swp
|
||||
*.swo
|
||||
*~
|
||||
|
||||
# Python
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
*$py.class
|
||||
|
||||
# C extensions
|
||||
*.so
|
||||
|
||||
# Distribution / packaging
|
||||
.Python
|
||||
build/
|
||||
develop-eggs/
|
||||
dist/
|
||||
downloads/
|
||||
eggs/
|
||||
.eggs/
|
||||
lib/
|
||||
lib64/
|
||||
parts/
|
||||
sdist/
|
||||
var/
|
||||
wheels/
|
||||
share/python-wheels/
|
||||
*.egg-info/
|
||||
.installed.cfg
|
||||
dist/
|
||||
build/
|
||||
*.egg
|
||||
MANIFEST
|
||||
|
||||
# PyInstaller
|
||||
# Usually these files are written by a python script from a template
|
||||
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
||||
*.manifest
|
||||
*.spec
|
||||
|
||||
# Installer logs
|
||||
pip-log.txt
|
||||
pip-delete-this-directory.txt
|
||||
|
||||
# Unit test / coverage reports
|
||||
htmlcov/
|
||||
.tox/
|
||||
.nox/
|
||||
.coverage
|
||||
.coverage.*
|
||||
.cache
|
||||
nosetests.xml
|
||||
coverage.xml
|
||||
*.cover
|
||||
*.py,cover
|
||||
.hypothesis/
|
||||
.pytest_cache/
|
||||
cover/
|
||||
|
||||
# Translations
|
||||
*.mo
|
||||
*.pot
|
||||
|
||||
# Django stuff:
|
||||
*.log
|
||||
local_settings.py
|
||||
db.sqlite3
|
||||
db.sqlite3-journal
|
||||
|
||||
# Flask stuff:
|
||||
instance/
|
||||
.webassets-cache
|
||||
|
||||
# Scrapy stuff:
|
||||
.scrapy
|
||||
|
||||
# Sphinx documentation
|
||||
docs/_build/
|
||||
|
||||
# PyBuilder
|
||||
.pybuilder/
|
||||
target/
|
||||
|
||||
# Jupyter Notebook
|
||||
.ipynb_checkpoints
|
||||
|
||||
# IPython
|
||||
profile_default/
|
||||
ipython_config.py
|
||||
|
||||
# pyenv
|
||||
# For a library or package, you might want to ignore these files since the code is
|
||||
# intended to run in multiple environments; otherwise, check them in:
|
||||
# .python-version
|
||||
|
||||
# pipenv
|
||||
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
||||
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
||||
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
||||
# install all needed dependencies.
|
||||
#Pipfile.lock
|
||||
|
||||
# poetry
|
||||
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
||||
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
||||
# commonly ignored for libraries.
|
||||
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
||||
#poetry.lock
|
||||
|
||||
# pdm
|
||||
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
||||
#pdm.lock
|
||||
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
||||
# in version control.
|
||||
# https://pdm.fming.dev/#use-with-ide
|
||||
.pdm.toml
|
||||
|
||||
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
||||
__pypackages__/
|
||||
|
||||
# Celery stuff
|
||||
celerybeat-schedule
|
||||
celerybeat.pid
|
||||
|
||||
# SageMath parsed files
|
||||
*.sage.py
|
||||
|
||||
# Environments
|
||||
.env
|
||||
.venv
|
||||
env/
|
||||
# Virtualenv
|
||||
venv/
|
||||
ENV/
|
||||
env.bak/
|
||||
venv.bak/
|
||||
|
||||
# Spyder project settings
|
||||
.spyderproject
|
||||
.spyproject
|
||||
|
||||
# Rope project settings
|
||||
.ropeproject
|
||||
|
||||
# mkdocs documentation
|
||||
/site
|
||||
|
||||
# mypy
|
||||
.mypy_cache/
|
||||
.dmypy.json
|
||||
dmypy.json
|
||||
env/
|
||||
.env
|
||||
|
||||
# Pyre type checker
|
||||
.pyre/
|
||||
# Logs
|
||||
logs/
|
||||
*.log
|
||||
|
||||
# pytype static type analyzer
|
||||
.pytype/
|
||||
# Uploads
|
||||
uploads/
|
||||
|
||||
# Cython debug symbols
|
||||
cython_debug/
|
||||
# Output
|
||||
output/
|
||||
|
||||
# PyCharm
|
||||
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
||||
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
||||
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
||||
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
||||
#.idea/
|
||||
# Config
|
||||
config.json
|
||||
|
||||
# Git
|
||||
*.orig
|
||||
|
||||
@ -0,0 +1,135 @@
|
||||
import os
|
||||
import time
|
||||
import shutil
|
||||
from datetime import datetime
|
||||
|
||||
from common.logger import system_logger
|
||||
|
||||
|
||||
# ==========================
|
||||
# 项目路径
|
||||
# ==========================
|
||||
|
||||
BASE_DIR = os.path.dirname(
|
||||
os.path.abspath(__file__)
|
||||
)
|
||||
|
||||
# 需要清理的目录
|
||||
CLEAN_DIRS = [
|
||||
os.path.join(BASE_DIR, "uploads"),
|
||||
os.path.join(BASE_DIR, "uploads", "temp")
|
||||
]
|
||||
|
||||
|
||||
# ==========================
|
||||
# 清理函数
|
||||
# ==========================
|
||||
|
||||
def clear_dir(path):
|
||||
|
||||
if not os.path.exists(path):
|
||||
|
||||
system_logger.error(
|
||||
f"[Cleanup] path not exist: {path}"
|
||||
)
|
||||
return
|
||||
|
||||
deleted_count = 0
|
||||
|
||||
for filename in os.listdir(path):
|
||||
|
||||
file_path = os.path.join(path, filename)
|
||||
|
||||
try:
|
||||
|
||||
if os.path.isfile(file_path):
|
||||
os.remove(file_path)
|
||||
deleted_count += 1
|
||||
|
||||
elif os.path.isdir(file_path):
|
||||
shutil.rmtree(file_path)
|
||||
deleted_count += 1
|
||||
|
||||
except Exception as e:
|
||||
|
||||
system_logger.exception(
|
||||
f"[Cleanup] delete failed: {file_path}"
|
||||
)
|
||||
|
||||
system_logger.info(
|
||||
f"[Cleanup] done path={path} deleted={deleted_count}"
|
||||
)
|
||||
|
||||
|
||||
# ==========================
|
||||
# 总清理入口
|
||||
# ==========================
|
||||
|
||||
def clear_all():
|
||||
|
||||
system_logger.info(
|
||||
"[Cleanup] task started"
|
||||
)
|
||||
|
||||
for path in CLEAN_DIRS:
|
||||
clear_dir(path)
|
||||
|
||||
system_logger.info(
|
||||
"[Cleanup] task finished"
|
||||
)
|
||||
|
||||
|
||||
# ==========================
|
||||
# 定时调度
|
||||
# ==========================
|
||||
TTL_SECONDS = 3600 # 1小时
|
||||
|
||||
def scheduler():
|
||||
|
||||
system_logger.info("[Cleanup] TTL scheduler started")
|
||||
|
||||
while True:
|
||||
|
||||
now = time.time()
|
||||
|
||||
for path in CLEAN_DIRS:
|
||||
|
||||
if not os.path.exists(path):
|
||||
continue
|
||||
|
||||
deleted = 0
|
||||
|
||||
for filename in os.listdir(path):
|
||||
|
||||
file_path = os.path.join(path, filename)
|
||||
|
||||
try:
|
||||
if not os.path.isfile(file_path):
|
||||
continue
|
||||
|
||||
# 文件创建时间
|
||||
file_time = os.path.getmtime(file_path)
|
||||
|
||||
if now - file_time > TTL_SECONDS:
|
||||
os.remove(file_path)
|
||||
deleted += 1
|
||||
|
||||
except Exception as e:
|
||||
system_logger.exception(f"[Cleanup] failed: {file_path}")
|
||||
|
||||
if deleted > 0:
|
||||
system_logger.info(f"[Cleanup] path={path} deleted={deleted}")
|
||||
|
||||
time.sleep(300) # 每5分钟检查一次
|
||||
|
||||
# ==========================
|
||||
# main
|
||||
# ==========================
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
system_logger.info(
|
||||
"[Cleanup] service started"
|
||||
)
|
||||
|
||||
scheduler()
|
||||
@ -0,0 +1,62 @@
|
||||
import logging
|
||||
import os
|
||||
from logging.handlers import TimedRotatingFileHandler
|
||||
|
||||
|
||||
BASE_DIR = os.path.dirname(
|
||||
os.path.dirname(os.path.abspath(__file__))
|
||||
)
|
||||
|
||||
LOG_DIR = os.path.join(BASE_DIR, "logs")
|
||||
os.makedirs(LOG_DIR, exist_ok=True)
|
||||
|
||||
|
||||
def create_logger(name, filename):
|
||||
|
||||
logger = logging.getLogger(name)
|
||||
|
||||
if logger.handlers:
|
||||
return logger
|
||||
|
||||
logger.setLevel(logging.INFO)
|
||||
|
||||
log_path = os.path.join(LOG_DIR, filename)
|
||||
|
||||
handler = TimedRotatingFileHandler(
|
||||
log_path,
|
||||
when="midnight",
|
||||
interval=1,
|
||||
backupCount=30,
|
||||
encoding="utf-8"
|
||||
)
|
||||
|
||||
handler.suffix = "%Y-%m-%d.log"
|
||||
|
||||
formatter = logging.Formatter(
|
||||
"[%(asctime)s] "
|
||||
"[%(levelname)s] "
|
||||
"%(message)s"
|
||||
)
|
||||
|
||||
handler.setFormatter(formatter)
|
||||
|
||||
logger.addHandler(handler)
|
||||
|
||||
return logger
|
||||
|
||||
|
||||
# 直接可用
|
||||
system_logger = create_logger(
|
||||
"system_logger",
|
||||
"system.log"
|
||||
)
|
||||
|
||||
tool_logger = create_logger(
|
||||
"tool_logger",
|
||||
"tool.log"
|
||||
)
|
||||
|
||||
error_logger = create_logger(
|
||||
"error_logger",
|
||||
"error.log"
|
||||
)
|
||||
@ -0,0 +1,16 @@
|
||||
flask
|
||||
flask-cors
|
||||
pandas
|
||||
openpyxl
|
||||
xlrd
|
||||
xlsxwriter
|
||||
python-dotenv
|
||||
tqdm
|
||||
chardet
|
||||
requests
|
||||
httpx
|
||||
orjson
|
||||
pydantic
|
||||
werkzeug
|
||||
loguru
|
||||
rich
|
||||
@ -0,0 +1,202 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Base64 编解码</title>
|
||||
<style>
|
||||
* { box-sizing: border-box; margin: 0; padding: 0; }
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 24px 16px;
|
||||
background: #0b0f14;
|
||||
color: #e5e7eb;
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
.box {
|
||||
max-width: 860px;
|
||||
margin: auto;
|
||||
background: rgba(255,255,255,0.04);
|
||||
padding: 24px;
|
||||
border-radius: 16px;
|
||||
border: 1px solid rgba(255,255,255,0.08);
|
||||
}
|
||||
|
||||
.card {
|
||||
background: rgba(255,255,255,0.04);
|
||||
border: 1px solid rgba(255,255,255,0.08);
|
||||
border-radius: 14px;
|
||||
padding: 18px;
|
||||
margin-bottom: 14px;
|
||||
}
|
||||
|
||||
.card-title {
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
margin-bottom: 12px;
|
||||
color: #f3f4f6;
|
||||
}
|
||||
|
||||
.tool-label {
|
||||
font-size: 13px;
|
||||
color: #9ca3af;
|
||||
margin-bottom: 8px;
|
||||
display: block;
|
||||
}
|
||||
|
||||
textarea {
|
||||
width: 100%;
|
||||
background: #111827;
|
||||
border: 1px solid rgba(255,255,255,0.12);
|
||||
border-radius: 10px;
|
||||
color: #e5e7eb;
|
||||
font-size: 14px;
|
||||
font-family: "SF Mono", "Fira Code", Consolas, monospace;
|
||||
padding: 12px;
|
||||
resize: vertical;
|
||||
outline: none;
|
||||
transition: border-color 0.2s;
|
||||
}
|
||||
|
||||
textarea:focus { border-color: rgba(59,130,246,0.6); }
|
||||
textarea::placeholder { color: #6b7280; }
|
||||
textarea.result-textarea {
|
||||
background: rgba(0,0,0,0.3);
|
||||
border-color: rgba(34,197,94,0.3);
|
||||
color: #4ade80;
|
||||
}
|
||||
|
||||
.btn-row { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
|
||||
|
||||
.btn {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
padding: 10px 18px;
|
||||
font-size: 14px;
|
||||
border-radius: 10px;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
font-weight: 500;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
|
||||
.btn-primary { background: #2563eb; color: white; }
|
||||
.btn-primary:hover { background: #1d4ed8; }
|
||||
.btn-secondary { background: rgba(255,255,255,0.08); color: #e5e7eb; border: 1px solid rgba(255,255,255,0.1); }
|
||||
.btn-secondary:hover { background: rgba(255,255,255,0.12); }
|
||||
|
||||
.result-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
|
||||
|
||||
.copy-btn {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 5px;
|
||||
padding: 6px 12px;
|
||||
font-size: 12px;
|
||||
border-radius: 8px;
|
||||
background: rgba(34,197,94,0.15);
|
||||
color: #22c55e;
|
||||
border: 1px solid rgba(34,197,94,0.3);
|
||||
cursor: pointer;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
|
||||
.copy-btn:hover { background: rgba(34,197,94,0.25); }
|
||||
.copy-btn.copied { background: rgba(34,197,94,0.4); color: #4ade80; }
|
||||
|
||||
.toast {
|
||||
position: fixed;
|
||||
right: 16px;
|
||||
bottom: 16px;
|
||||
background: rgba(17,24,39,0.95);
|
||||
color: #e5e7eb;
|
||||
padding: 10px 16px;
|
||||
border-radius: 10px;
|
||||
border: 1px solid rgba(34,197,94,0.3);
|
||||
font-size: 13px;
|
||||
opacity: 0;
|
||||
transform: translateY(10px);
|
||||
transition: all 0.25s ease;
|
||||
z-index: 9999;
|
||||
}
|
||||
|
||||
.toast.show { opacity: 1; transform: translateY(0); }
|
||||
|
||||
@media (max-width: 600px) {
|
||||
body { padding: 16px 12px; }
|
||||
.box { padding: 18px 14px; }
|
||||
.btn-row { flex-direction: column; }
|
||||
.btn { width: 100%; justify-content: center; }
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="box">
|
||||
<div class="card">
|
||||
<div class="card-title">🔐 Base64 编解码</div>
|
||||
<label class="tool-label">输入内容</label>
|
||||
<textarea id="inputText" rows="4" placeholder="输入要编码或解码的文本...">{{ input_text or '' }}</textarea>
|
||||
<div class="btn-row">
|
||||
<button class="btn btn-primary" onclick="doEncode()">编码 Encode</button>
|
||||
<button class="btn btn-secondary" onclick="doDecode()">解码 Decode</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if result %}
|
||||
<div class="card">
|
||||
<div class="result-header">
|
||||
<span class="tool-label" style="margin:0">处理结果</span>
|
||||
<button class="copy-btn" id="copyBtn" onclick="copyResult()">
|
||||
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
||||
<rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect>
|
||||
<path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path>
|
||||
</svg>
|
||||
<span id="copyText">复制</span>
|
||||
</button>
|
||||
</div>
|
||||
<textarea id="resultText" class="result-textarea" rows="4" readonly>{{ result }}</textarea>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div class="toast" id="toast"></div>
|
||||
|
||||
<script>
|
||||
function doEncode() {
|
||||
const text = document.getElementById('inputText').value;
|
||||
if (!text.trim()) { showToast('请输入内容'); return; }
|
||||
window.location.href = '/tool/base64?action=encode_text&text=' + encodeURIComponent(text);
|
||||
}
|
||||
|
||||
function doDecode() {
|
||||
const text = document.getElementById('inputText').value;
|
||||
if (!text.trim()) { showToast('请输入内容'); return; }
|
||||
window.location.href = '/tool/base64?action=decode_text&text=' + encodeURIComponent(text);
|
||||
}
|
||||
|
||||
function copyResult() {
|
||||
const result = document.getElementById('resultText').value;
|
||||
if (!result) return;
|
||||
navigator.clipboard.writeText(result).then(() => {
|
||||
const btn = document.getElementById('copyBtn');
|
||||
const text = document.getElementById('copyText');
|
||||
btn.classList.add('copied');
|
||||
text.textContent = '已复制!';
|
||||
showToast('已复制到剪贴板');
|
||||
setTimeout(() => { btn.classList.remove('copied'); text.textContent = '复制'; }, 2000);
|
||||
}).catch(() => showToast('复制失败,请手动选择复制'));
|
||||
}
|
||||
|
||||
function showToast(msg) {
|
||||
const t = document.getElementById('toast');
|
||||
t.innerText = msg;
|
||||
t.classList.add('show');
|
||||
setTimeout(() => t.classList.remove('show'), 2000);
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@ -0,0 +1,138 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Excel Merge</title>
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<style>
|
||||
* { box-sizing: border-box; }
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 32px 24px;
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial;
|
||||
background: radial-gradient(circle at top, #111827, #0b0f14);
|
||||
color: #e5e7eb;
|
||||
}
|
||||
|
||||
.card-box {
|
||||
max-width: 1200px;
|
||||
margin: auto;
|
||||
background: rgba(255,255,255,0.04);
|
||||
border: 1px solid rgba(255,255,255,0.08);
|
||||
padding: 32px 28px;
|
||||
border-radius: 18px;
|
||||
backdrop-filter: blur(10px);
|
||||
}
|
||||
|
||||
h3 { color: #f3f4f6; margin-bottom: 22px; font-size: 20px; }
|
||||
|
||||
label { color: #cbd5e1; font-size: 13px; display: block; margin-bottom: 6px; }
|
||||
|
||||
input, select, textarea {
|
||||
background: rgba(255,255,255,0.06) !important;
|
||||
border: 1px solid rgba(255,255,255,0.12) !important;
|
||||
color: #e5e7eb !important;
|
||||
border-radius: 10px !important;
|
||||
}
|
||||
|
||||
input::placeholder, textarea::placeholder { color: rgba(229,231,235,0.45) !important; }
|
||||
input:focus, select:focus, textarea:focus {
|
||||
outline: none;
|
||||
border-color: rgba(59,130,246,0.8) !important;
|
||||
box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
|
||||
}
|
||||
|
||||
select option { background: #111827; color: #e5e7eb; }
|
||||
|
||||
.btn { margin-right: 10px; margin-top: 8px; }
|
||||
.btn-primary { background: #2563eb; border: none; }
|
||||
.btn-primary:hover { background: #1d4ed8; }
|
||||
.btn-secondary { background: rgba(255,255,255,0.1); border: none; color: #e5e7eb; }
|
||||
.btn-secondary:hover { background: rgba(255,255,255,0.15); }
|
||||
.btn-success { background: #16a34a; border: none; }
|
||||
.btn-success:hover { background: #15803d; }
|
||||
|
||||
.file-box {
|
||||
background: rgba(255,255,255,0.03);
|
||||
padding: 14px;
|
||||
border-radius: 12px;
|
||||
border: 1px solid rgba(255,255,255,0.06);
|
||||
margin-bottom: 14px;
|
||||
}
|
||||
|
||||
.preview-box {
|
||||
max-height: 700px;
|
||||
overflow: auto;
|
||||
margin-top: 20px;
|
||||
border-radius: 12px;
|
||||
border: 1px solid rgba(255,255,255,0.08);
|
||||
}
|
||||
|
||||
.preview-table { background: #ffffff; color: #111827; border-radius: 10px; overflow: hidden; min-width: 600px; }
|
||||
.preview-table thead th { position: sticky; top: 0; background: #f3f4f6; color: #111827; font-size: 13px; padding: 10px 12px; }
|
||||
.preview-table tbody td { font-size: 13px; padding: 9px 12px; }
|
||||
|
||||
.h1c { background: #ffe8e8 !important; }
|
||||
.h2c { background: #f7e8ff !important; }
|
||||
|
||||
.alert { border-radius: 10px; margin-top: 16px; }
|
||||
|
||||
@media (max-width: 768px) {
|
||||
body { padding: 20px 14px; }
|
||||
.card-box { padding: 22px 18px; }
|
||||
h3 { font-size: 18px; }
|
||||
.preview-box { max-height: 450px; }
|
||||
.btn { width: 100%; margin-right: 0; }
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="card-box">
|
||||
<h3>📊 Excel / CSV 文件整合工具</h3>
|
||||
<form method="post" action="{{ url_for('tool', name='excel') }}" enctype="multipart/form-data">
|
||||
<div class="row">
|
||||
<div class="col-md-6 file-box">
|
||||
<label>文件1 {% if file1_name %}<span style="color:#f87171">✔ {{file1_name}}</span>{% endif %}</label>
|
||||
<input type="file" name="file1" class="form-control" accept=".xlsx,.xls,.csv">
|
||||
</div>
|
||||
<div class="col-md-6 file-box">
|
||||
<label>文件2 {% if file2_name %}<span style="color:#c084fc">✔ {{file2_name}}</span>{% endif %}</label>
|
||||
<input type="file" name="file2" class="form-control" accept=".xlsx,.xls,.csv">
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<div class="row">
|
||||
<div class="col-md-4"><input name="key1" value="{{key1}}" placeholder="文件1关联字段" class="form-control" required></div>
|
||||
<div class="col-md-4"><input name="key2" value="{{key2}}" placeholder="文件2关联字段" class="form-control" required></div>
|
||||
<div class="col-md-4"><select name="join_type" class="form-select"><option value="left" {% if join_type=='left' %}selected{% endif %}>左连接</option><option value="inner" {% if join_type=='inner' %}selected{% endif %}>内连接</option><option value="outer" {% if join_type=='outer' %}selected{% endif %}>外连接</option></select></div>
|
||||
</div>
|
||||
<br>
|
||||
<button class="btn btn-primary">开始整合</button>
|
||||
<a href="{{ url_for('reset') }}" class="btn btn-secondary">重新开始</a>
|
||||
</form>
|
||||
|
||||
{% if message %}
|
||||
<div class="alert {% if '错误' in message %}alert-danger{% else %}alert-success{% endif %}">{{message}}</div>
|
||||
{% endif %}
|
||||
|
||||
{% if preview_data %}
|
||||
<div class="preview-box">{{preview_data|safe}}</div>
|
||||
<a href="{{ url_for('download', filename=download_file) }}" class="btn btn-success mt-3">下载Excel</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
window.onload=function(){
|
||||
const table=document.getElementById('previewTable');
|
||||
if(!table)return;
|
||||
const k1='{{key1}}',k2='{{key2}}';
|
||||
let i1=-1,i2=-1;
|
||||
table.querySelectorAll('thead th').forEach((th,i)=>{const t=th.innerText.trim();if(t===k1){i1=i;th.classList.add('h1c')}if(t===k2){i2=i;th.classList.add('h2c')}});
|
||||
table.querySelectorAll('tbody tr').forEach(r=>{const tds=r.querySelectorAll('td');if(i1>=0) tds[i1]?.classList.add('h1c');if(i2>=0) tds[i2]?.classList.add('h2c')}});
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@ -0,0 +1,136 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>文件转换工具</title>
|
||||
<style>
|
||||
* { box-sizing: border-box; margin: 0; padding: 0; }
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 24px 16px;
|
||||
background: #0b0f14;
|
||||
color: #e5e7eb;
|
||||
font-family: Arial, -apple-system, sans-serif;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
.box {
|
||||
max-width: 1400px;
|
||||
margin: auto;
|
||||
background: rgba(255,255,255,0.04);
|
||||
padding: 24px;
|
||||
border-radius: 16px;
|
||||
border: 1px solid rgba(255,255,255,0.08);
|
||||
}
|
||||
|
||||
h2 {
|
||||
margin: 0 0 14px 0;
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
input, select {
|
||||
width: 100%;
|
||||
padding: 10px 12px;
|
||||
margin: 8px 0;
|
||||
background: #111827;
|
||||
border: 1px solid rgba(255,255,255,0.12);
|
||||
color: #e5e7eb;
|
||||
border-radius: 10px;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
button {
|
||||
padding: 10px 16px;
|
||||
background: #2563eb;
|
||||
border: none;
|
||||
color: white;
|
||||
border-radius: 10px;
|
||||
cursor: pointer;
|
||||
font-weight: 600;
|
||||
font-size: 14px;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
button:hover { background: #1d4ed8; }
|
||||
|
||||
.preview {
|
||||
margin-top: 18px;
|
||||
background: rgba(255,255,255,0.03);
|
||||
border: 1px solid rgba(255,255,255,0.08);
|
||||
border-radius: 12px;
|
||||
padding: 12px;
|
||||
overflow-x: auto;
|
||||
}
|
||||
|
||||
.preview table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
min-width: 700px;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.preview thead th {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
background: #111827;
|
||||
color: #f9fafb;
|
||||
padding: 10px;
|
||||
text-align: left;
|
||||
border-bottom: 1px solid rgba(255,255,255,0.08);
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.preview tbody td {
|
||||
padding: 8px 10px;
|
||||
border-bottom: 1px solid rgba(255,255,255,0.05);
|
||||
color: #d1d5db;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.preview tbody tr:hover { background: rgba(59,130,246,0.08); }
|
||||
|
||||
.download {
|
||||
display: inline-block;
|
||||
margin-top: 14px;
|
||||
padding: 10px 14px;
|
||||
background: #22c55e;
|
||||
color: #0b0f14;
|
||||
border-radius: 10px;
|
||||
text-decoration: none;
|
||||
font-weight: 600;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.download:hover { background: #16a34a; }
|
||||
|
||||
@media (max-width: 600px) {
|
||||
body { padding: 16px 12px; }
|
||||
.box { padding: 18px 14px; }
|
||||
h2 { font-size: 18px; }
|
||||
input, select { font-size: 16px; }
|
||||
button { width: 100%; }
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="box">
|
||||
<h2>📁 文件格式转换工具</h2>
|
||||
<form method="post" enctype="multipart/form-data">
|
||||
<input type="file" name="file" required>
|
||||
<select name="target">
|
||||
<option value="excel">转 Excel</option>
|
||||
<option value="csv">转 CSV</option>
|
||||
<option value="txt">转 TXT</option>
|
||||
</select>
|
||||
<button>开始转换</button>
|
||||
</form>
|
||||
{% if message %}<p>{{message}}</p>{% endif %}
|
||||
{% if preview %}<div class="preview">{{ preview|safe }}</div>{% endif %}
|
||||
{% if download_file %}
|
||||
<a class="download" href="{{ url_for('file_convert_download_route', filename=download_file) }}">⬇ 下载文件</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@ -0,0 +1,261 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Tool Hub</title>
|
||||
|
||||
<link rel="icon" type="image/svg+xml"
|
||||
href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Crect width='100' height='100' fill='%230b0f14'/%3E%3Crect x='20' y='20' width='20' height='20' fill='%232563eb'/%3E%3Crect x='60' y='20' width='20' height='20' fill='%232563eb'/%3E%3Crect x='20' y='60' width='20' height='20' fill='%232563eb'/%3E%3Crect x='60' y='60' width='20' height='20' fill='%232563eb'/%3E%3C/svg%3E">
|
||||
|
||||
<style>
|
||||
* { box-sizing: border-box; margin: 0; padding: 0; }
|
||||
|
||||
body {
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial;
|
||||
background: radial-gradient(circle at top, #111827, #0b0f14);
|
||||
color: #e5e7eb;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
.container {
|
||||
max-width: 1080px;
|
||||
margin: 0 auto;
|
||||
padding: 56px 24px 60px;
|
||||
}
|
||||
|
||||
.header {
|
||||
text-align: center;
|
||||
padding: 0 0 48px;
|
||||
}
|
||||
|
||||
.header h1 {
|
||||
font-size: 44px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 2px;
|
||||
margin-bottom: 10px;
|
||||
background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 50%, #818cf8 100%);
|
||||
-webkit-background-clip: text;
|
||||
-webkit-text-fill-color: transparent;
|
||||
background-clip: text;
|
||||
}
|
||||
|
||||
.header p {
|
||||
color: #6b7280;
|
||||
font-size: 15px;
|
||||
letter-spacing: 0.5px;
|
||||
}
|
||||
|
||||
.grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
gap: 20px;
|
||||
}
|
||||
|
||||
.card {
|
||||
display: block;
|
||||
background: rgba(255,255,255,0.03);
|
||||
border: 1px solid rgba(255,255,255,0.08);
|
||||
border-radius: 16px;
|
||||
padding: 26px 24px;
|
||||
transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
|
||||
backdrop-filter: blur(10px);
|
||||
text-decoration: none;
|
||||
color: inherit;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.card::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 2px;
|
||||
background: linear-gradient(90deg, transparent, rgba(59,130,246,0.6), transparent);
|
||||
opacity: 0;
|
||||
transition: opacity 0.25s ease;
|
||||
}
|
||||
|
||||
.card:hover {
|
||||
transform: translateY(-5px);
|
||||
border-color: rgba(59,130,246,0.4);
|
||||
box-shadow: 0 16px 40px rgba(0,0,0,0.45), 0 0 0 1px rgba(59,130,246,0.1);
|
||||
}
|
||||
|
||||
.card:hover::before {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.card-icon {
|
||||
font-size: 20px;
|
||||
margin-right: 8px;
|
||||
}
|
||||
|
||||
.card h3 {
|
||||
font-size: 17px;
|
||||
font-weight: 600;
|
||||
color: #f3f4f6;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.card p {
|
||||
font-size: 13px;
|
||||
color: #6b7280;
|
||||
line-height: 1.6;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.btn {
|
||||
display: inline-block;
|
||||
padding: 7px 14px;
|
||||
font-size: 13px;
|
||||
border-radius: 8px;
|
||||
background: rgba(37,99,235,0.2);
|
||||
color: #60a5fa;
|
||||
border: 1px solid rgba(37,99,235,0.3);
|
||||
font-weight: 500;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
|
||||
.btn:hover {
|
||||
background: rgba(37,99,235,0.35);
|
||||
color: #93c5fd;
|
||||
}
|
||||
|
||||
.toast {
|
||||
position: fixed;
|
||||
right: 24px;
|
||||
bottom: 24px;
|
||||
background: rgba(17,24,39,0.95);
|
||||
color: #e5e7eb;
|
||||
padding: 12px 18px;
|
||||
border-radius: 12px;
|
||||
border: 1px solid rgba(255,255,255,0.1);
|
||||
font-size: 14px;
|
||||
opacity: 0;
|
||||
transform: translateY(10px);
|
||||
transition: all 0.25s ease;
|
||||
z-index: 9999;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.toast.show { opacity: 1; transform: translateY(0); }
|
||||
|
||||
/* ---- 响应式 ---- */
|
||||
|
||||
/* 平板横屏 */
|
||||
@media (max-width: 900px) {
|
||||
.grid { grid-template-columns: repeat(2, 1fr); }
|
||||
.container { padding: 40px 20px 50px; }
|
||||
.header h1 { font-size: 36px; }
|
||||
.card { padding: 22px 20px; }
|
||||
}
|
||||
|
||||
/* 手机 */
|
||||
@media (max-width: 540px) {
|
||||
.grid { grid-template-columns: 1fr; gap: 14px; }
|
||||
.container { padding: 30px 16px 40px; }
|
||||
.header { padding-bottom: 36px; }
|
||||
.header h1 { font-size: 28px; }
|
||||
.header p { font-size: 13px; }
|
||||
.card { padding: 20px 18px; }
|
||||
.card-icon { font-size: 24px; }
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="container">
|
||||
|
||||
<div class="header">
|
||||
<h1>Tool Hub</h1>
|
||||
<p>Minimal Engineering Tools · Lightweight · Extensible</p>
|
||||
</div>
|
||||
|
||||
<div class="grid">
|
||||
|
||||
<a class="card" href="{{ url_for('tool', name='excel') }}" target="_blank" rel="noopener noreferrer">
|
||||
<h3><span class="card-icon">📊</span> Excel 合并工具</h3>
|
||||
<p>CSV / XLSX 数据合并分析</p>
|
||||
<span class="btn">进入</span>
|
||||
</a>
|
||||
|
||||
<a class="card" href="{{ url_for('tool', name='temp_upload') }}" target="_blank" rel="noopener noreferrer">
|
||||
<h3><span class="card-icon">📂</span> 临时文件工具</h3>
|
||||
<p>上传 / 暂存 / 下载</p>
|
||||
<span class="btn">进入</span>
|
||||
</a>
|
||||
|
||||
<a class="card" href="{{ url_for('tool', name='smart_data_v2') }}" target="_blank" rel="noopener noreferrer">
|
||||
<h3><span class="card-icon">🧠</span> 数据对比 / 去重 / 筛选</h3>
|
||||
<p>多格式数据解析,自动识别字段结构与关联键</p>
|
||||
<span class="btn">进入</span>
|
||||
</a>
|
||||
|
||||
<a class="card" href="{{ url_for('tool', name='file_convert') }}" target="_blank" rel="noopener noreferrer">
|
||||
<h3><span class="card-icon">📁</span> 文件格式转换工具</h3>
|
||||
<p>Excel / CSV / TXT 格式互转,一键导出</p>
|
||||
<span class="btn">进入</span>
|
||||
</a>
|
||||
|
||||
<a class="card" href="{{ url_for('tool', name='weekly_permission') }}" target="_blank" rel="noopener noreferrer">
|
||||
<h3><span class="card-icon">📌</span> 每周动态授权工具</h3>
|
||||
<p>中心 + 工号 → 自动生成权限 SQL</p>
|
||||
<span class="btn">进入</span>
|
||||
</a>
|
||||
|
||||
<!--
|
||||
<a class="card" href="{{ url_for('tool', name='mail_notify') }}" target="_blank" rel="noopener noreferrer">
|
||||
<h3><span class="card-icon">📧</span> 邮件群发工具</h3>
|
||||
<p>TXT 解析账号列表 + SMTP 批量通知发送</p>
|
||||
<span class="btn">进入</span>
|
||||
</a>
|
||||
-->
|
||||
|
||||
<a class="card" href="{{ url_for('tool', name='base64') }}" target="_blank" rel="noopener noreferrer">
|
||||
<h3><span class="card-icon">🔐</span> Base64 编解码</h3>
|
||||
<p>文本 Base64 编码解码,一键复制结果</p>
|
||||
<span class="btn">进入</span>
|
||||
</a>
|
||||
|
||||
<a class="card" href="{{ url_for('tool', name='json') }}" target="_blank" rel="noopener noreferrer">
|
||||
<h3><span class="card-icon">📋</span> JSON 格式化工具</h3>
|
||||
<p>格式化 / 压缩 / 校验,一键复制</p>
|
||||
<span class="btn">进入</span>
|
||||
</a>
|
||||
|
||||
<a class="card" href="{{ url_for('tool', name='url') }}" target="_blank" rel="noopener noreferrer">
|
||||
<h3><span class="card-icon">🔗</span> URL 编解码</h3>
|
||||
<p>URL 编码解码,开发者刚需工具</p>
|
||||
<span class="btn">进入</span>
|
||||
</a>
|
||||
|
||||
<a class="card" href="{{ url_for('tool', name='image_compress') }}" target="_blank" rel="noopener noreferrer">
|
||||
<h3><span class="card-icon">🖼️</span> 图片压缩工具</h3>
|
||||
<p>JPG/PNG/WEBP 图片压缩,保持清晰度</p>
|
||||
<span class="btn">进入</span>
|
||||
</a>
|
||||
|
||||
<a class="card" href="{{ url_for('tool', name='text_diff') }}" target="_blank" rel="noopener noreferrer">
|
||||
<h3><span class="card-icon">📝</span> 文本差异对比</h3>
|
||||
<p>两段文本对比,高亮显示差异</p>
|
||||
<span class="btn">进入</span>
|
||||
</a>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="toast" id="toast"></div>
|
||||
|
||||
<script>
|
||||
function showToast(msg) {
|
||||
const t = document.getElementById('toast');
|
||||
t.innerText = msg;
|
||||
t.classList.add('show');
|
||||
setTimeout(() => t.classList.remove('show'), 1800);
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@ -0,0 +1,223 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>JSON 格式化工具</title>
|
||||
<style>
|
||||
* { box-sizing: border-box; margin: 0; padding: 0; }
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 36px 24px;
|
||||
background: radial-gradient(circle at top, #111827, #0b0f14);
|
||||
color: #e5e7eb;
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
.box {
|
||||
max-width: 960px;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
.page-title {
|
||||
font-size: 22px;
|
||||
font-weight: 600;
|
||||
color: #f3f4f6;
|
||||
margin-bottom: 20px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.card {
|
||||
background: rgba(255,255,255,0.03);
|
||||
border: 1px solid rgba(255,255,255,0.08);
|
||||
border-radius: 16px;
|
||||
padding: 24px;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.section-label {
|
||||
font-size: 12px;
|
||||
color: #6b7280;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 1px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
textarea {
|
||||
width: 100%;
|
||||
background: #0d1117;
|
||||
border: 1px solid rgba(255,255,255,0.1);
|
||||
border-radius: 12px;
|
||||
color: #e6edf3;
|
||||
font-family: "SF Mono", "Fira Code", Consolas, monospace;
|
||||
font-size: 13.5px;
|
||||
line-height: 1.7;
|
||||
padding: 16px;
|
||||
outline: none;
|
||||
transition: border-color 0.2s;
|
||||
}
|
||||
|
||||
textarea:focus { border-color: rgba(59,130,246,0.5); }
|
||||
textarea::placeholder { color: #484f58; }
|
||||
|
||||
textarea.input-area {
|
||||
border-color: rgba(59,130,246,0.2);
|
||||
min-height: 280px;
|
||||
}
|
||||
|
||||
textarea.result-area {
|
||||
border-color: rgba(34,197,94,0.25);
|
||||
color: #7ee787;
|
||||
min-height: 260px;
|
||||
}
|
||||
|
||||
.btn-row {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
margin-top: 14px;
|
||||
}
|
||||
|
||||
.btn {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
padding: 10px 20px;
|
||||
font-size: 13px;
|
||||
border-radius: 10px;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
font-weight: 500;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
|
||||
.btn-primary { background: #2563eb; color: white; }
|
||||
.btn-primary:hover { background: #1d4ed8; transform: translateY(-1px); }
|
||||
.btn-secondary { background: rgba(255,255,255,0.06); color: #9ca3af; border: 1px solid rgba(255,255,255,0.1); }
|
||||
.btn-secondary:hover { background: rgba(255,255,255,0.1); }
|
||||
.btn-green { background: rgba(34,197,94,0.12); color: #4ade80; border: 1px solid rgba(34,197,94,0.25); }
|
||||
.btn-green:hover { background: rgba(34,197,94,0.2); }
|
||||
|
||||
.result-bar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.result-title {
|
||||
font-size: 12px;
|
||||
color: #6b7280;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 1px;
|
||||
}
|
||||
|
||||
.copy-btn {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 5px;
|
||||
padding: 5px 12px;
|
||||
font-size: 12px;
|
||||
border-radius: 8px;
|
||||
background: rgba(34,197,94,0.12);
|
||||
color: #4ade80;
|
||||
border: 1px solid rgba(34,197,94,0.25);
|
||||
cursor: pointer;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
|
||||
.copy-btn:hover { background: rgba(34,197,94,0.22); }
|
||||
.copy-btn.copied { background: rgba(34,197,94,0.35); }
|
||||
|
||||
.toast {
|
||||
position: fixed;
|
||||
right: 24px;
|
||||
bottom: 24px;
|
||||
background: rgba(17,24,39,0.96);
|
||||
color: #e5e7eb;
|
||||
padding: 10px 16px;
|
||||
border-radius: 10px;
|
||||
border: 1px solid rgba(34,197,94,0.3);
|
||||
font-size: 13px;
|
||||
opacity: 0;
|
||||
transform: translateY(8px);
|
||||
transition: all 0.25s ease;
|
||||
z-index: 9999;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.toast.show { opacity: 1; transform: translateY(0); }
|
||||
|
||||
@media (max-width: 768px) {
|
||||
body { padding: 24px 16px; }
|
||||
.card { padding: 18px 16px; }
|
||||
textarea.input-area, textarea.result-area { min-height: 200px; }
|
||||
.btn-row { flex-wrap: wrap; }
|
||||
.btn { flex: 1; justify-content: center; }
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="box">
|
||||
<div class="page-title">📋 JSON 格式化工具</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="section-label">输入</div>
|
||||
<textarea class="input-area" id="jsonInput" placeholder="粘贴 JSON 内容至此处...">{{ text or '' }}</textarea>
|
||||
<div class="btn-row">
|
||||
<button class="btn btn-primary" onclick="doAction('format')">✨ 格式化</button>
|
||||
<button class="btn btn-secondary" onclick="doAction('minify')">⏱ 压缩</button>
|
||||
<button class="btn btn-green" onclick="doAction('validate')">✅ 校验</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if result %}
|
||||
<div class="card">
|
||||
<div class="result-bar">
|
||||
<span class="result-title">输出</span>
|
||||
<button class="copy-btn" id="copyBtn" onclick="copyResult()">
|
||||
<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
||||
<rect x="9" y="9" width="13" height="13" rx="2"></rect>
|
||||
<path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path>
|
||||
</svg>
|
||||
<span id="copyText">复制</span>
|
||||
</button>
|
||||
</div>
|
||||
<textarea class="result-area" id="resultText" readonly>{{ result }}</textarea>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div class="toast" id="toast"></div>
|
||||
|
||||
<script>
|
||||
function doAction(action) {
|
||||
const text = document.getElementById('jsonInput').value;
|
||||
if (!text.trim()) { showToast('请输入 JSON'); return; }
|
||||
window.location.href = '/tool/json?action=' + action + '&text=' + encodeURIComponent(text);
|
||||
}
|
||||
|
||||
function copyResult() {
|
||||
const result = document.getElementById('resultText').value;
|
||||
if (!result) return;
|
||||
navigator.clipboard.writeText(result).then(() => {
|
||||
const btn = document.getElementById('copyBtn');
|
||||
document.getElementById('copyText').textContent = '已复制!';
|
||||
btn.classList.add('copied');
|
||||
showToast('已复制到剪贴板');
|
||||
setTimeout(() => { btn.classList.remove('copied'); document.getElementById('copyText').textContent = '复制'; }, 2000);
|
||||
}).catch(() => showToast('复制失败'));
|
||||
}
|
||||
|
||||
function showToast(msg) {
|
||||
const t = document.getElementById('toast');
|
||||
t.innerText = msg;
|
||||
t.classList.add('show');
|
||||
setTimeout(() => t.classList.remove('show'), 2000);
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@ -0,0 +1,219 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>智能数据匹配引擎</title>
|
||||
<style>
|
||||
* { box-sizing: border-box; margin: 0; padding: 0; }
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 24px 16px;
|
||||
background: #0b0f14;
|
||||
color: #e5e7eb;
|
||||
font-family: Arial, -apple-system, sans-serif;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
.container { max-width: 1400px; margin: auto; }
|
||||
|
||||
.card {
|
||||
background: rgba(255,255,255,0.04);
|
||||
border: 1px solid rgba(255,255,255,0.08);
|
||||
border-radius: 14px;
|
||||
padding: 22px;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
h2 { margin: 0 0 10px 0; font-size: 20px; }
|
||||
h3 { margin: 0 0 12px 0; font-size: 16px; }
|
||||
|
||||
.badge {
|
||||
display: inline-block;
|
||||
padding: 4px 10px;
|
||||
font-size: 12px;
|
||||
border-radius: 999px;
|
||||
background: rgba(34,197,94,0.12);
|
||||
border: 1px solid rgba(34,197,94,0.35);
|
||||
color: #22c55e;
|
||||
}
|
||||
|
||||
.upload-grid {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 14px;
|
||||
margin-top: 12px;
|
||||
}
|
||||
|
||||
input[type="file"] {
|
||||
width: 100%;
|
||||
padding: 12px;
|
||||
background: #111827;
|
||||
border: 1px solid rgba(255,255,255,0.12);
|
||||
border-radius: 10px;
|
||||
color: #e5e7eb;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
button {
|
||||
margin-top: 14px;
|
||||
padding: 10px 16px;
|
||||
background: #2563eb;
|
||||
border: none;
|
||||
border-radius: 10px;
|
||||
color: white;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
button:hover { background: #1d4ed8; }
|
||||
|
||||
.info { margin-top: 10px; color: #60a5fa; font-size: 13px; }
|
||||
.info-title { font-size: 14px; color: #93c5fd; margin-bottom: 8px; font-weight: 600; }
|
||||
.info-main { font-size: 13px; color: #e5e7eb; margin-bottom: 12px; }
|
||||
|
||||
.info-grid { display: flex; gap: 12px; }
|
||||
|
||||
.info-item {
|
||||
flex: 1;
|
||||
padding: 10px 12px;
|
||||
border-radius: 10px;
|
||||
background: rgba(255,255,255,0.04);
|
||||
border: 1px solid rgba(255,255,255,0.08);
|
||||
}
|
||||
|
||||
.info-item .label { font-size: 12px; color: #9ca3af; }
|
||||
.info-item .value { font-size: 18px; font-weight: 700; }
|
||||
.info-item.success .value { color: #22c55e; }
|
||||
.info-item.warn .value { color: #f59e0b; }
|
||||
|
||||
.preview-wrapper {
|
||||
margin-top: 10px;
|
||||
padding: 12px;
|
||||
background: rgba(255,255,255,0.03);
|
||||
border: 1px solid rgba(255,255,255,0.08);
|
||||
border-radius: 12px;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.preview-wrapper table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
font-size: 13px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.preview-wrapper thead th {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
background: #111827;
|
||||
color: #f9fafb;
|
||||
padding: 10px 12px;
|
||||
text-align: left;
|
||||
border-bottom: 1px solid rgba(255,255,255,0.08);
|
||||
}
|
||||
|
||||
.preview-wrapper tbody td {
|
||||
padding: 9px 12px;
|
||||
color: #d1d5db;
|
||||
border-bottom: 1px solid rgba(255,255,255,0.05);
|
||||
}
|
||||
|
||||
.preview-wrapper tbody tr:hover { background: rgba(59,130,246,0.08); }
|
||||
|
||||
.key1 { background: rgba(59,130,246,0.25) !important; color: #93c5fd !important; font-weight: 600; }
|
||||
.key2 { background: rgba(168,85,247,0.25) !important; color: #d8b4fe !important; font-weight: 600; }
|
||||
|
||||
.download-btn {
|
||||
display: inline-block;
|
||||
margin-top: 12px;
|
||||
padding: 8px 12px;
|
||||
background: #22c55e;
|
||||
color: #0b0f14;
|
||||
border-radius: 10px;
|
||||
text-decoration: none;
|
||||
font-weight: 600;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.download-btn:hover { background: #16a34a; }
|
||||
|
||||
@media (max-width: 768px) {
|
||||
body { padding: 20px 12px; }
|
||||
.upload-grid { grid-template-columns: 1fr; }
|
||||
.card { padding: 18px 14px; }
|
||||
h2 { font-size: 18px; }
|
||||
.info-grid { flex-direction: column; gap: 8px; }
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<div class="card">
|
||||
<h2>🧠 智能数据匹配引擎 <span class="badge">Auto Join · Schema Detect</span></h2>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<h3>📂 上传数据文件</h3>
|
||||
<form method="post" enctype="multipart/form-data">
|
||||
<div class="upload-grid">
|
||||
<input type="file" name="file1" required>
|
||||
<input type="file" name="file2" required>
|
||||
</div>
|
||||
<button>开始智能匹配</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
{% if message %}
|
||||
<div class="card"><div class="info">{{ message }}</div></div>
|
||||
{% endif %}
|
||||
|
||||
{% if match_info %}
|
||||
<div class="card">
|
||||
<div class="info-title">🧠 匹配分析结果</div>
|
||||
<div class="info-main">{{ match_info }}</div>
|
||||
<div class="info-grid">
|
||||
<div class="info-item success">
|
||||
<div class="label">成功匹配</div>
|
||||
<div class="value">{{ matched_count or 0 }}</div>
|
||||
</div>
|
||||
<div class="info-item warn">
|
||||
<div class="label">未匹配</div>
|
||||
<div class="value">{{ unmatched_count or 0 }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if preview %}
|
||||
<div class="card">
|
||||
<h3>📊 预览结果</h3>
|
||||
<div class="preview-wrapper">{{ preview|safe }}</div>
|
||||
<a class="download-btn" href="{{ url_for('smart_data_v2_download', filename=download_file) }}">下载结果</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<script>
|
||||
window.onload = function () {
|
||||
const table = document.querySelector("table");
|
||||
if (!table) return;
|
||||
const k1 = "{{ match_info.split('↔')[0] if match_info else '' }}";
|
||||
const k2 = "{{ match_info.split('↔')[1] if match_info else '' }}";
|
||||
let i1 = -1, i2 = -1;
|
||||
table.querySelectorAll("thead th").forEach((th, i) => {
|
||||
const t = th.innerText.trim();
|
||||
if (t.includes(k1.trim())) { i1 = i; th.classList.add("key1"); }
|
||||
if (t.includes(k2.trim())) { i2 = i; th.classList.add("key2"); }
|
||||
});
|
||||
table.querySelectorAll("tbody tr").forEach(row => {
|
||||
const tds = row.querySelectorAll("td");
|
||||
if (i1 >= 0) tds[i1]?.classList.add("key1");
|
||||
if (i2 >= 0) tds[i2]?.classList.add("key2");
|
||||
});
|
||||
};
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@ -0,0 +1,77 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>临时文本中转</title>
|
||||
<style>
|
||||
* { box-sizing: border-box; margin: 0; padding: 0; }
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 24px 16px;
|
||||
background: #0b0f14;
|
||||
color: #e5e7eb;
|
||||
font-family: Arial, -apple-system, sans-serif;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
.box {
|
||||
max-width: 900px;
|
||||
margin: auto;
|
||||
background: rgba(255,255,255,0.04);
|
||||
border: 1px solid rgba(255,255,255,0.08);
|
||||
padding: 20px;
|
||||
border-radius: 14px;
|
||||
}
|
||||
|
||||
textarea {
|
||||
width: 100%;
|
||||
height: 280px;
|
||||
padding: 12px;
|
||||
background: #111827;
|
||||
border: 1px solid rgba(255,255,255,0.12);
|
||||
border-radius: 10px;
|
||||
color: #e5e7eb;
|
||||
font-family: monospace;
|
||||
font-size: 14px;
|
||||
resize: vertical;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
textarea:focus { border-color: #2563eb; }
|
||||
|
||||
button {
|
||||
margin-top: 10px;
|
||||
padding: 10px 14px;
|
||||
background: #2563eb;
|
||||
border: none;
|
||||
color: white;
|
||||
border-radius: 10px;
|
||||
cursor: pointer;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
button:hover { background: #1d4ed8; }
|
||||
|
||||
.msg { margin-top: 10px; color: #60a5fa; font-size: 13px; }
|
||||
.link { margin-top: 10px; font-size: 13px; color: #22c55e; word-break: break-all; }
|
||||
|
||||
@media (max-width: 600px) {
|
||||
body { padding: 16px 12px; }
|
||||
textarea { height: 200px; font-size: 16px; }
|
||||
button { width: 100%; }
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="box">
|
||||
<form method="post">
|
||||
<textarea name="content" placeholder="输入或粘贴文本内容...">{{ content or '' }}</textarea>
|
||||
<button type="submit">提交</button>
|
||||
</form>
|
||||
{% if msg %}<div class="msg">{{msg}}</div>{% endif %}
|
||||
{% if link %}<div class="link">📄 访问地址:<a href="{{link}}" target="_blank" style="color:#22c55e;">{{link}}</a></div>{% endif %}
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@ -0,0 +1,79 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>临时文本</title>
|
||||
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
|
||||
<style>
|
||||
* { box-sizing: border-box; margin: 0; padding: 0; }
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 24px 16px;
|
||||
background: #0b0f14;
|
||||
color: #e5e7eb;
|
||||
font-family: Arial, -apple-system, sans-serif;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
.container { max-width: 960px; margin: auto; }
|
||||
|
||||
.card {
|
||||
background: rgba(255,255,255,0.04);
|
||||
border: 1px solid rgba(255,255,255,0.08);
|
||||
border-radius: 14px;
|
||||
padding: 18px;
|
||||
margin-bottom: 14px;
|
||||
}
|
||||
|
||||
.header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.btn {
|
||||
padding: 6px 10px;
|
||||
font-size: 12px;
|
||||
background: #22c55e;
|
||||
border: none;
|
||||
border-radius: 8px;
|
||||
cursor: pointer;
|
||||
color: #0b0f14;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.btn:hover { background: #16a34a; }
|
||||
|
||||
.content { margin-top: 12px; }
|
||||
.content pre { background: #111827; padding: 12px; border-radius: 10px; overflow: auto; font-size: 14px; }
|
||||
|
||||
@media (max-width: 600px) {
|
||||
body { padding: 16px 12px; }
|
||||
.card { padding: 14px; }
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<div class="card header">
|
||||
<div>📄 临时文本内容</div>
|
||||
<button class="btn" onclick="copyText()">一键复制</button>
|
||||
</div>
|
||||
<div class="card content" id="md"></div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
const content = `{{ content|replace('\n','\\n')|safe }}`;
|
||||
document.getElementById("md").innerHTML = marked.parse(content);
|
||||
|
||||
function copyText(){
|
||||
navigator.clipboard.writeText(content)
|
||||
.then(() => alert("复制成功"))
|
||||
.catch(() => alert("复制失败"));
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@ -0,0 +1,101 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>临时文件上传</title>
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<style>
|
||||
* { box-sizing: border-box; }
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 24px 16px;
|
||||
background: radial-gradient(circle at top, #111827, #0b0f14);
|
||||
color: #e5e7eb;
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
.card-box {
|
||||
max-width: 960px;
|
||||
margin: auto;
|
||||
background: rgba(255,255,255,0.04);
|
||||
border: 1px solid rgba(255,255,255,0.08);
|
||||
border-radius: 18px;
|
||||
padding: 28px;
|
||||
backdrop-filter: blur(10px);
|
||||
}
|
||||
|
||||
h3 { margin-bottom: 18px; font-size: 18px; }
|
||||
|
||||
.form-control {
|
||||
background: rgba(255,255,255,0.06) !important;
|
||||
border: 1px solid rgba(255,255,255,0.12) !important;
|
||||
color: #e5e7eb !important;
|
||||
}
|
||||
|
||||
.table { margin-top: 18px; border-radius: 10px; overflow: hidden; }
|
||||
.table-dark { --bs-table-bg: #111827; }
|
||||
.table td, .table th { font-size: 13px; }
|
||||
|
||||
.btn-primary { background: #2563eb; border: none; }
|
||||
.btn-primary:hover { background: #1d4ed8; }
|
||||
.btn-success { background: #16a34a; border: none; }
|
||||
|
||||
.auto-clean-badge {
|
||||
display: inline-block;
|
||||
margin-left: 8px;
|
||||
padding: 3px 8px;
|
||||
font-size: 11px;
|
||||
font-weight: 500;
|
||||
color: #f59e0b;
|
||||
background: rgba(245,158,11,0.12);
|
||||
border: 1px solid rgba(245,158,11,0.35);
|
||||
border-radius: 999px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
@media (max-width: 600px) {
|
||||
body { padding: 16px 12px; }
|
||||
.card-box { padding: 18px 14px; }
|
||||
h3 { font-size: 16px; }
|
||||
.col-md-3 { margin-top: 10px; }
|
||||
.btn { width: 100%; }
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="card-box">
|
||||
<h3>📂 临时文件上传工具 <span class="auto-clean-badge">零点自动清空</span></h3>
|
||||
<form method="post" enctype="multipart/form-data">
|
||||
<div class="row">
|
||||
<div class="col-12 col-md-9">
|
||||
<input type="file" name="file" class="form-control" required>
|
||||
</div>
|
||||
<div class="col-12 col-md-3">
|
||||
<button class="btn btn-primary w-100">上传文件</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
{% if message %}
|
||||
<div class="alert alert-info mt-3">{{message}}</div>
|
||||
{% endif %}
|
||||
|
||||
<h5 class="mt-4">已上传文件</h5>
|
||||
<table class="table table-dark table-hover">
|
||||
<thead><tr><th>文件名</th><th>大小(KB)</th><th>操作</th></tr></thead>
|
||||
<tbody>
|
||||
{% for file in files %}
|
||||
<tr>
|
||||
<td>{{ file.name }}</td>
|
||||
<td>{{ file.size }}</td>
|
||||
<td><a href="{{ url_for('temp_download', filename=file.name) }}" class="btn btn-success btn-sm">下载</a></td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@ -0,0 +1,216 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>文本差异对比</title>
|
||||
<style>
|
||||
* { box-sizing: border-box; margin: 0; padding: 0; }
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 36px 24px;
|
||||
background: radial-gradient(circle at top, #111827, #0b0f14);
|
||||
color: #e5e7eb;
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
.box {
|
||||
max-width: 1200px;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
.page-title {
|
||||
font-size: 22px;
|
||||
font-weight: 600;
|
||||
color: #f3f4f6;
|
||||
margin-bottom: 20px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.card {
|
||||
background: rgba(255,255,255,0.03);
|
||||
border: 1px solid rgba(255,255,255,0.08);
|
||||
border-radius: 16px;
|
||||
padding: 24px;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.section-label {
|
||||
font-size: 12px;
|
||||
color: #6b7280;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 1px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
textarea {
|
||||
width: 100%;
|
||||
background: #0d1117;
|
||||
border: 1px solid rgba(255,255,255,0.1);
|
||||
border-radius: 12px;
|
||||
color: #e6edf3;
|
||||
font-family: "SF Mono", "Fira Code", Consolas, monospace;
|
||||
font-size: 13.5px;
|
||||
line-height: 1.7;
|
||||
padding: 16px;
|
||||
outline: none;
|
||||
transition: border-color 0.2s;
|
||||
resize: vertical;
|
||||
}
|
||||
|
||||
textarea:focus { border-color: rgba(59,130,246,0.5); }
|
||||
textarea::placeholder { color: #484f58; }
|
||||
|
||||
.grid-inputs {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 16px;
|
||||
margin-bottom: 14px;
|
||||
}
|
||||
|
||||
.input-area {
|
||||
min-height: 240px;
|
||||
border-color: rgba(59,130,246,0.15);
|
||||
}
|
||||
|
||||
.btn {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
padding: 10px 20px;
|
||||
font-size: 13px;
|
||||
border-radius: 10px;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
font-weight: 500;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
|
||||
.btn-primary { background: #2563eb; color: white; }
|
||||
.btn-primary:hover { background: #1d4ed8; transform: translateY(-1px); }
|
||||
|
||||
/* diff result */
|
||||
.diff-card {
|
||||
background: rgba(255,255,255,0.02);
|
||||
border: 1px solid rgba(255,255,255,0.08);
|
||||
border-radius: 14px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.diff-header-bar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 14px 18px;
|
||||
background: rgba(255,255,255,0.03);
|
||||
border-bottom: 1px solid rgba(255,255,255,0.06);
|
||||
}
|
||||
|
||||
.diff-header-bar span {
|
||||
font-size: 12px;
|
||||
color: #6b7280;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 1px;
|
||||
}
|
||||
|
||||
.diff-wrapper {
|
||||
overflow: auto;
|
||||
max-height: 500px;
|
||||
}
|
||||
|
||||
.diff-wrapper table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
font-size: 13px;
|
||||
font-family: "SF Mono", "Fira Code", Consolas, monospace;
|
||||
}
|
||||
|
||||
.diff-wrapper table td {
|
||||
padding: 10px 16px;
|
||||
border-bottom: 1px solid rgba(255,255,255,0.04);
|
||||
vertical-align: top;
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
.diff-wrapper .diff-header { background: #0d1117; color: #6b7280; font-size: 11px; }
|
||||
.diff-wrapper .diff-equal { background: transparent; color: #8b949e; }
|
||||
.diff-wrapper .diff-remove { background: rgba(248,81,73,0.12); color: #ffa198; }
|
||||
.diff-wrapper .diff-add { background: rgba(63,185,80,0.12); color: #7ee787; }
|
||||
|
||||
.diff-wrapper .diff-equal:hover { background: rgba(255,255,255,0.03); }
|
||||
.diff-wrapper .diff-remove:hover { background: rgba(248,81,73,0.2); }
|
||||
.diff-wrapper .diff-add:hover { background: rgba(63,185,80,0.2); }
|
||||
|
||||
.toast {
|
||||
position: fixed;
|
||||
right: 24px;
|
||||
bottom: 24px;
|
||||
background: rgba(17,24,39,0.96);
|
||||
color: #e5e7eb;
|
||||
padding: 10px 16px;
|
||||
border-radius: 10px;
|
||||
border: 1px solid rgba(34,197,94,0.3);
|
||||
font-size: 13px;
|
||||
opacity: 0;
|
||||
transform: translateY(8px);
|
||||
transition: all 0.25s ease;
|
||||
z-index: 9999;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.toast.show { opacity: 1; transform: translateY(0); }
|
||||
|
||||
@media (max-width: 900px) {
|
||||
.grid-inputs { grid-template-columns: 1fr; }
|
||||
body { padding: 24px 16px; }
|
||||
.card { padding: 18px 16px; }
|
||||
.input-area { min-height: 180px; }
|
||||
.btn { width: 100%; justify-content: center; }
|
||||
.diff-wrapper { max-height: 350px; }
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="box">
|
||||
<div class="page-title">📝 文本差异对比</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="section-label">输入文本</div>
|
||||
<form method="get">
|
||||
<div class="grid-inputs">
|
||||
<div>
|
||||
<textarea class="input-area" name="text1" placeholder="输入第一段文本(原始版本)...">{{ text1 or '' }}</textarea>
|
||||
</div>
|
||||
<div>
|
||||
<textarea class="input-area" name="text2" placeholder="输入第二段文本(对比版本)...">{{ text2 or '' }}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
<button class="btn btn-primary">🔍 开始对比</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
{% if diff_result %}
|
||||
<div class="diff-card">
|
||||
<div class="diff-header-bar">
|
||||
<span>📊 对比结果</span>
|
||||
</div>
|
||||
<div class="diff-wrapper">{{ diff_result|safe }}</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div class="toast" id="toast"></div>
|
||||
|
||||
<script>
|
||||
function showToast(msg) {
|
||||
const t = document.getElementById('toast');
|
||||
t.innerText = msg;
|
||||
t.classList.add('show');
|
||||
setTimeout(() => t.classList.remove('show'), 2000);
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@ -0,0 +1,186 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>URL 编解码</title>
|
||||
<style>
|
||||
* { box-sizing: border-box; margin: 0; padding: 0; }
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 28px 20px;
|
||||
background: #0b0f14;
|
||||
color: #e5e7eb;
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
.box {
|
||||
max-width: 1000px;
|
||||
margin: auto;
|
||||
background: rgba(255,255,255,0.04);
|
||||
padding: 26px;
|
||||
border-radius: 16px;
|
||||
border: 1px solid rgba(255,255,255,0.08);
|
||||
}
|
||||
|
||||
.card {
|
||||
background: rgba(255,255,255,0.04);
|
||||
border: 1px solid rgba(255,255,255,0.08);
|
||||
border-radius: 14px;
|
||||
padding: 18px;
|
||||
margin-bottom: 14px;
|
||||
}
|
||||
|
||||
.card-title { font-size: 16px; font-weight: 600; margin-bottom: 12px; color: #f3f4f6; }
|
||||
.tool-label { font-size: 13px; color: #9ca3af; margin-bottom: 8px; display: block; }
|
||||
|
||||
textarea {
|
||||
width: 100%;
|
||||
background: #111827;
|
||||
border: 1px solid rgba(255,255,255,0.12);
|
||||
border-radius: 10px;
|
||||
color: #e5e7eb;
|
||||
font-family: "SF Mono", "Fira Code", Consolas, monospace;
|
||||
font-size: 13px;
|
||||
padding: 12px;
|
||||
resize: vertical;
|
||||
outline: none;
|
||||
transition: border-color 0.2s;
|
||||
}
|
||||
|
||||
textarea:focus { border-color: rgba(59,130,246,0.6); }
|
||||
textarea::placeholder { color: #6b7280; }
|
||||
textarea.result-textarea { border-color: rgba(34,197,94,0.3); color: #4ade80; }
|
||||
|
||||
.btn-row { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
|
||||
|
||||
.btn {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
padding: 10px 18px;
|
||||
font-size: 14px;
|
||||
border-radius: 10px;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
font-weight: 500;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
|
||||
.btn-primary { background: #2563eb; color: white; }
|
||||
.btn-primary:hover { background: #1d4ed8; }
|
||||
.btn-secondary { background: rgba(255,255,255,0.08); color: #e5e7eb; border: 1px solid rgba(255,255,255,0.1); }
|
||||
.btn-secondary:hover { background: rgba(255,255,255,0.12); }
|
||||
|
||||
.result-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
|
||||
|
||||
.copy-btn {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 5px;
|
||||
padding: 6px 12px;
|
||||
font-size: 12px;
|
||||
border-radius: 8px;
|
||||
background: rgba(34,197,94,0.15);
|
||||
color: #22c55e;
|
||||
border: 1px solid rgba(34,197,94,0.3);
|
||||
cursor: pointer;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
|
||||
.copy-btn:hover { background: rgba(34,197,94,0.25); }
|
||||
.copy-btn.copied { background: rgba(34,197,94,0.4); color: #4ade80; }
|
||||
|
||||
.toast {
|
||||
position: fixed;
|
||||
right: 20px;
|
||||
bottom: 20px;
|
||||
background: rgba(17,24,39,0.95);
|
||||
color: #e5e7eb;
|
||||
padding: 10px 16px;
|
||||
border-radius: 10px;
|
||||
border: 1px solid rgba(34,197,94,0.3);
|
||||
font-size: 13px;
|
||||
opacity: 0;
|
||||
transform: translateY(10px);
|
||||
transition: all 0.25s ease;
|
||||
z-index: 9999;
|
||||
}
|
||||
|
||||
.toast.show { opacity: 1; transform: translateY(0); }
|
||||
|
||||
@media (max-width: 600px) {
|
||||
body { padding: 20px 12px; }
|
||||
.box { padding: 18px 14px; }
|
||||
.btn-row { flex-direction: column; }
|
||||
.btn { width: 100%; justify-content: center; }
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="box">
|
||||
<div class="card">
|
||||
<div class="card-title">🔗 URL 编解码工具</div>
|
||||
<label class="tool-label">输入内容</label>
|
||||
<textarea id="inputText" rows="4" placeholder="输入要编码或解码的 URL...">{{ input_text or '' }}</textarea>
|
||||
<div class="btn-row">
|
||||
<button class="btn btn-primary" onclick="doEncode()">🔒 编码 Encode</button>
|
||||
<button class="btn btn-secondary" onclick="doDecode()">🔓 解码 Decode</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if result %}
|
||||
<div class="card">
|
||||
<div class="result-header">
|
||||
<span class="tool-label" style="margin:0">处理结果</span>
|
||||
<button class="copy-btn" id="copyBtn" onclick="copyResult()">
|
||||
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
||||
<rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect>
|
||||
<path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path>
|
||||
</svg>
|
||||
<span id="copyText">复制</span>
|
||||
</button>
|
||||
</div>
|
||||
<textarea id="resultText" class="result-textarea" rows="4" readonly>{{ result }}</textarea>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div class="toast" id="toast"></div>
|
||||
|
||||
<script>
|
||||
function doEncode() {
|
||||
const text = document.getElementById('inputText').value;
|
||||
if (!text.trim()) { showToast('请输入内容'); return; }
|
||||
window.location.href = '/tool/url?action=encode&text=' + encodeURIComponent(text);
|
||||
}
|
||||
|
||||
function doDecode() {
|
||||
const text = document.getElementById('inputText').value;
|
||||
if (!text.trim()) { showToast('请输入内容'); return; }
|
||||
window.location.href = '/tool/url?action=decode&text=' + encodeURIComponent(text);
|
||||
}
|
||||
|
||||
function copyResult() {
|
||||
const result = document.getElementById('resultText').value;
|
||||
if (!result) return;
|
||||
navigator.clipboard.writeText(result).then(() => {
|
||||
const btn = document.getElementById('copyBtn');
|
||||
document.getElementById('copyText').textContent = '已复制!';
|
||||
btn.classList.add('copied');
|
||||
showToast('已复制到剪贴板');
|
||||
setTimeout(() => { btn.classList.remove('copied'); document.getElementById('copyText').textContent = '复制'; }, 2000);
|
||||
}).catch(() => showToast('复制失败'));
|
||||
}
|
||||
|
||||
function showToast(msg) {
|
||||
const t = document.getElementById('toast');
|
||||
t.innerText = msg;
|
||||
t.classList.add('show');
|
||||
setTimeout(() => t.classList.remove('show'), 2000);
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@ -0,0 +1,31 @@
|
||||
import base64 as b64
|
||||
|
||||
def encode_text(text):
|
||||
"""Base64 编码"""
|
||||
return b64.b64encode(text.encode('utf-8')).decode('utf-8')
|
||||
|
||||
def decode_text(text):
|
||||
"""Base64 解码"""
|
||||
try:
|
||||
return b64.b64decode(text.encode('utf-8')).decode('utf-8')
|
||||
except Exception:
|
||||
return "解码失败,请检查输入是否合法"
|
||||
|
||||
|
||||
def page():
|
||||
"""工具页面"""
|
||||
from flask import render_template, request
|
||||
|
||||
result = None
|
||||
input_text = ""
|
||||
action = request.args.get("action")
|
||||
raw_text = request.args.get("text", "")
|
||||
|
||||
if raw_text:
|
||||
input_text = raw_text
|
||||
if action == "encode_text":
|
||||
result = encode_text(raw_text)
|
||||
elif action == "decode_text":
|
||||
result = decode_text(raw_text)
|
||||
|
||||
return render_template("base64.html", result=result, input_text=input_text)
|
||||
@ -0,0 +1,42 @@
|
||||
import json, re
|
||||
|
||||
def format_json(text):
|
||||
try:
|
||||
obj = json.loads(text)
|
||||
return json.dumps(obj, indent=2, ensure_ascii=False)
|
||||
except Exception:
|
||||
return "JSON 格式错误,请检查输入"
|
||||
|
||||
def minify_json(text):
|
||||
try:
|
||||
obj = json.loads(text)
|
||||
return json.dumps(obj, separators=(',', ':'))
|
||||
except Exception:
|
||||
return "JSON 格式错误,请检查输入"
|
||||
|
||||
def validate_json(text):
|
||||
try:
|
||||
json.loads(text)
|
||||
return "✅ 有效的 JSON"
|
||||
except Exception as e:
|
||||
return f"❌ 格式错误: {str(e)}"
|
||||
|
||||
def page():
|
||||
from flask import render_template, request
|
||||
result = None
|
||||
action = request.args.get("action")
|
||||
text = request.args.get("text", "").strip()
|
||||
|
||||
if text:
|
||||
if action == "format":
|
||||
result = format_json(text)
|
||||
elif action == "minify":
|
||||
result = minify_json(text)
|
||||
elif action == "validate":
|
||||
result = validate_json(text)
|
||||
else:
|
||||
result = format_json(text)
|
||||
else:
|
||||
result = None
|
||||
|
||||
return render_template("json.html", result=result, text=text)
|
||||
@ -0,0 +1,185 @@
|
||||
import os
|
||||
import time
|
||||
from flask import render_template, request, send_from_directory
|
||||
from werkzeug.utils import secure_filename
|
||||
|
||||
from common.logger import system_logger
|
||||
|
||||
|
||||
# ==========================
|
||||
# 路径配置
|
||||
# ==========================
|
||||
|
||||
BASE_DIR = os.path.dirname(
|
||||
os.path.dirname(os.path.abspath(__file__))
|
||||
)
|
||||
|
||||
TEMP_FOLDER = os.path.join(
|
||||
BASE_DIR,
|
||||
"uploads",
|
||||
"temp"
|
||||
)
|
||||
|
||||
os.makedirs(TEMP_FOLDER, exist_ok=True)
|
||||
|
||||
|
||||
# ==========================
|
||||
# 限制配置
|
||||
# ==========================
|
||||
|
||||
MAX_FILE_SIZE = 50 * 1024 * 1024 # 50MB
|
||||
|
||||
UPLOAD_LIMIT = 5 # 次数
|
||||
LIMIT_WINDOW = 60 * 60 # 10分钟
|
||||
|
||||
|
||||
UPLOAD_RECORD = {} # IP限流记录
|
||||
|
||||
|
||||
# ==========================
|
||||
# 工具函数
|
||||
# ==========================
|
||||
|
||||
def get_client_ip():
|
||||
forwarded = request.headers.get("X-Forwarded-For")
|
||||
if forwarded:
|
||||
return forwarded.split(",")[0].strip()
|
||||
return request.remote_addr
|
||||
|
||||
|
||||
def check_rate_limit(ip):
|
||||
now = time.time()
|
||||
|
||||
if ip not in UPLOAD_RECORD:
|
||||
UPLOAD_RECORD[ip] = []
|
||||
|
||||
# 清理过期记录
|
||||
UPLOAD_RECORD[ip] = [
|
||||
t for t in UPLOAD_RECORD[ip]
|
||||
if now - t < LIMIT_WINDOW
|
||||
]
|
||||
|
||||
if len(UPLOAD_RECORD[ip]) >= UPLOAD_LIMIT:
|
||||
remain = int(LIMIT_WINDOW - (now - UPLOAD_RECORD[ip][0]))
|
||||
|
||||
system_logger.info(
|
||||
f"[TempUpload] rate limited ip={ip} remain={remain}s"
|
||||
)
|
||||
|
||||
raise Exception(f"上传过于频繁,请 {remain} 秒后重试")
|
||||
|
||||
UPLOAD_RECORD[ip].append(now)
|
||||
|
||||
|
||||
# ==========================
|
||||
# 页面主逻辑
|
||||
# ==========================
|
||||
|
||||
def temp_upload_page():
|
||||
|
||||
message = None
|
||||
ip = get_client_ip()
|
||||
|
||||
if request.method == "POST":
|
||||
|
||||
try:
|
||||
|
||||
file = request.files.get("file")
|
||||
|
||||
if not file or not file.filename:
|
||||
|
||||
system_logger.info(
|
||||
f"[TempUpload] upload rejected (no file) ip={ip}"
|
||||
)
|
||||
|
||||
raise Exception("请选择文件")
|
||||
|
||||
# 文件大小检测
|
||||
file.seek(0, os.SEEK_END)
|
||||
file_size = file.tell()
|
||||
file.seek(0)
|
||||
|
||||
if file_size > MAX_FILE_SIZE:
|
||||
|
||||
system_logger.info(
|
||||
f"[TempUpload] file too large ip={ip} size={file_size}"
|
||||
)
|
||||
|
||||
raise Exception("文件超过50MB限制")
|
||||
|
||||
# IP限流
|
||||
check_rate_limit(ip)
|
||||
|
||||
filename = secure_filename(file.filename)
|
||||
|
||||
save_path = os.path.join(
|
||||
TEMP_FOLDER,
|
||||
filename
|
||||
)
|
||||
|
||||
file.save(save_path)
|
||||
|
||||
message = f"上传成功:{filename}"
|
||||
|
||||
system_logger.info(
|
||||
f"[TempUpload] upload success "
|
||||
f"file={filename} ip={ip} size={file_size}"
|
||||
)
|
||||
|
||||
except Exception as e:
|
||||
|
||||
message = str(e)
|
||||
|
||||
system_logger.info(
|
||||
f"[TempUpload] upload failed ip={ip} err={e}"
|
||||
)
|
||||
|
||||
# ==========================
|
||||
# 文件列表
|
||||
# ==========================
|
||||
|
||||
files = []
|
||||
|
||||
for filename in os.listdir(TEMP_FOLDER):
|
||||
|
||||
file_path = os.path.join(TEMP_FOLDER, filename)
|
||||
|
||||
if os.path.isfile(file_path):
|
||||
|
||||
size = os.path.getsize(file_path)
|
||||
|
||||
files.append({
|
||||
"name": filename,
|
||||
"size": round(size / 1024 / 1024, 2)
|
||||
})
|
||||
|
||||
files.sort(key=lambda x: x["name"], reverse=True)
|
||||
|
||||
system_logger.info(
|
||||
f"[TempUpload] list files ip={ip} count={len(files)}"
|
||||
)
|
||||
|
||||
return render_template(
|
||||
"temp_upload.html",
|
||||
files=files,
|
||||
message=message
|
||||
)
|
||||
|
||||
|
||||
# ==========================
|
||||
# 下载
|
||||
# ==========================
|
||||
|
||||
def download_temp_file(filename):
|
||||
|
||||
ip = get_client_ip()
|
||||
|
||||
system_logger.info(
|
||||
f"[TempUpload] download file={filename} ip={ip}"
|
||||
)
|
||||
|
||||
return send_from_directory(
|
||||
TEMP_FOLDER,
|
||||
filename,
|
||||
as_attachment=True
|
||||
)
|
||||
@ -0,0 +1,17 @@
|
||||
import difflib
|
||||
|
||||
def text_diff(text1, text2):
|
||||
d = difflib.HtmlDiff()
|
||||
html = d.make_table(text1.splitlines(), text2.splitlines(), context=True)
|
||||
return html
|
||||
|
||||
def page():
|
||||
from flask import render_template, request
|
||||
diff_result = None
|
||||
text1 = request.args.get("text1", "").strip()
|
||||
text2 = request.args.get("text2", "").strip()
|
||||
|
||||
if text1 and text2:
|
||||
diff_result = text_diff(text1, text2)
|
||||
|
||||
return render_template("text_diff.html", diff_result=diff_result, text1=text1, text2=text2)
|
||||
@ -0,0 +1,26 @@
|
||||
from urllib.parse import quote, unquote
|
||||
|
||||
def encode_url(text):
|
||||
return quote(text, safe='')
|
||||
|
||||
def decode_url(text):
|
||||
try:
|
||||
return unquote(text)
|
||||
except Exception:
|
||||
return "解码失败"
|
||||
|
||||
def page():
|
||||
from flask import render_template, request
|
||||
result = None
|
||||
input_text = ""
|
||||
action = request.args.get("action")
|
||||
text = request.args.get("text", "").strip()
|
||||
|
||||
if text:
|
||||
input_text = text
|
||||
if action == "decode":
|
||||
result = decode_url(text)
|
||||
else:
|
||||
result = encode_url(text)
|
||||
|
||||
return render_template("url.html", result=result, input_text=input_text)
|
||||
@ -0,0 +1,57 @@
|
||||
[uwsgi]
|
||||
uid = uwsgi
|
||||
gid = uwsgi
|
||||
|
||||
# 监听地址和端口
|
||||
http-socket = 0.0.0.0:8209
|
||||
|
||||
# 虚拟环境
|
||||
virtualenv = /opt/service/python_prj/pictoHub.env
|
||||
|
||||
# Flask 应用入口
|
||||
wsgi-file = /opt/service/python_prj/toolHub/app.py
|
||||
callable = app
|
||||
|
||||
# 静态文件
|
||||
static-map = /static=/opt/service/python_prj/toolHub/static/
|
||||
|
||||
# 日志
|
||||
logto = /var/log/uwsgi/tool-project.log
|
||||
|
||||
# 进程
|
||||
processes = 4
|
||||
|
||||
# 虚拟环境路径
|
||||
home = /opt/service/python_prj/pictoHub.env
|
||||
|
||||
# ========== 冷启动优化 ==========
|
||||
|
||||
# worker 预加载应用,不在请求时懒加载
|
||||
lazy-apps = false
|
||||
|
||||
# 单实例模式,避免重复加载 Python 解释器
|
||||
single-interpreter = true
|
||||
|
||||
# 启用线程
|
||||
enable-threads = true
|
||||
|
||||
# 最后一个 worker 不会在所有请求完成后退出,保持热状态
|
||||
max-worker-lifetime = 3600
|
||||
reload-mercy = 8
|
||||
|
||||
# 内存超过 256MB 时自动回收 worker
|
||||
reload-on-rss = 256
|
||||
evil-reload-on-rss = 512
|
||||
|
||||
# 碰后的平滑重启
|
||||
honour-stdin = false
|
||||
|
||||
# 定时触发,保持至少一个 worker 热载
|
||||
# cheaper-algo = busyness
|
||||
# cheaper = 1
|
||||
# cheaper-initial = 1
|
||||
# cheaper-step = 1
|
||||
# cheaper-busy-timeout = 30
|
||||
|
||||
# 热更新
|
||||
touch-reload = /opt/service/python_prj/toolHub/app.py
|
||||
Loading…
Reference in new issue