From e90fca5ab1693dcefaa39849260cd9a37347fecd Mon Sep 17 00:00:00 2001 From: liuyuanchuang Date: Wed, 25 Feb 2026 15:47:23 +0800 Subject: [PATCH] feat: add robots --- deploy_dev.sh | 47 ++++++------ index.html | 35 +++++++-- public/en/index.html | 167 +++++++++++++++++++++++++++++++++++++++++++ public/llms.txt | 14 ++++ public/robots.txt | 7 ++ public/sitemap.xml | 15 ++++ 6 files changed, 257 insertions(+), 28 deletions(-) create mode 100644 public/en/index.html create mode 100644 public/llms.txt create mode 100644 public/robots.txt create mode 100644 public/sitemap.xml diff --git a/deploy_dev.sh b/deploy_dev.sh index af8605f..3818436 100755 --- a/deploy_dev.sh +++ b/deploy_dev.sh @@ -16,9 +16,6 @@ NC='\033[0m' # No Color ubuntu_HOST="ubuntu" DEPLOY_PATH="/var/www" DEPLOY_NAME="app.cloud" -# Sudo 密码(如果需要,建议配置无密码 sudo 更安全) -# 配置无密码 sudo: 在服务器上运行: echo "username ALL=(ALL) NOPASSWD: ALL" | sudo tee /etc/sudoers.d/username -SUDO_PASSWORD="1231" # 打印带颜色的消息 print_info() { @@ -62,15 +59,13 @@ deploy_to_server() { return 1 fi - # SSH 执行部署操作 + # SSH 执行部署操作(非交互模式) print_info "在 ${server} 上执行部署操作..." print_info "部署路径: ${DEPLOY_PATH}/${DEPLOY_NAME}" - # 注意:密码通过环境变量传递,避免在命令行中暴露 - ssh_output=$(SSH_SUDO_PASSWORD="${SUDO_PASSWORD}" ssh ${server} bash << SSH_EOF + ssh_output=$(ssh ${server} bash << SSH_EOF set -e DEPLOY_PATH="${DEPLOY_PATH}" DEPLOY_NAME="${DEPLOY_NAME}" - SUDO_PASSWORD="\${SSH_SUDO_PASSWORD}" # 检查部署目录是否存在 if [ ! -d "\${DEPLOY_PATH}" ]; then @@ -78,35 +73,35 @@ deploy_to_server() { exit 1 fi - # 检查是否有权限写入(尝试创建测试文件) + # 检查是否有权限写入,若无则尝试免密 sudo(sudo -n) + SUDO_CMD="" if ! touch "\${DEPLOY_PATH}/.deploy_test" 2>/dev/null; then - echo "提示:没有直接写入权限,将使用 sudo 执行操作" - USE_SUDO=1 + if sudo -n true 2>/dev/null; then + echo "提示:没有直接写入权限,使用 sudo -n 执行部署操作" + SUDO_CMD="sudo -n" + else + echo "错误:没有写入权限,且 sudo 需要密码(非交互部署无法输入)" + echo "请执行以下任一方案后重试:" + echo " 1) 将部署目录改为当前用户可写目录(例如 /home/\$USER/www)" + echo " 2) 为当前用户配置免密 sudo(NOPASSWD)" + exit 1 + fi else rm -f "\${DEPLOY_PATH}/.deploy_test" - USE_SUDO=0 + echo "提示:检测到部署目录可直接写入" fi # 备份旧版本(如果存在) if [ -d "\${DEPLOY_PATH}/\${DEPLOY_NAME}" ]; then echo "备份旧版本..." - if [ "\$USE_SUDO" = "1" ]; then - echo "\${SUDO_PASSWORD}" | sudo -S rm -rf "\${DEPLOY_PATH}/\${DEPLOY_NAME}_bak" 2>/dev/null || true - echo "\${SUDO_PASSWORD}" | sudo -S mv "\${DEPLOY_PATH}/\${DEPLOY_NAME}" "\${DEPLOY_PATH}/\${DEPLOY_NAME}_bak" || { echo "错误:备份失败,权限不足"; exit 1; } - else - rm -rf "\${DEPLOY_PATH}/\${DEPLOY_NAME}_bak" 2>/dev/null || true - mv "\${DEPLOY_PATH}/\${DEPLOY_NAME}" "\${DEPLOY_PATH}/\${DEPLOY_NAME}_bak" || { echo "错误:备份失败"; exit 1; } - fi + \$SUDO_CMD rm -rf "\${DEPLOY_PATH}/\${DEPLOY_NAME}_bak" 2>/dev/null || true + \$SUDO_CMD mv "\${DEPLOY_PATH}/\${DEPLOY_NAME}" "\${DEPLOY_PATH}/\${DEPLOY_NAME}_bak" || { echo "错误:备份失败,权限不足"; exit 1; } fi # 移动新版本到部署目录(覆盖现有目录) if [ -d ~/\${DEPLOY_NAME} ]; then echo "移动新版本到部署目录..." - if [ "\$USE_SUDO" = "1" ]; then - echo "\${SUDO_PASSWORD}" | sudo -S mv ~/\${DEPLOY_NAME} "\${DEPLOY_PATH}/" || { echo "错误:移动文件失败,权限不足"; exit 1; } - else - mv ~/\${DEPLOY_NAME} "\${DEPLOY_PATH}/" || { echo "错误:移动文件失败"; exit 1; } - fi + \$SUDO_CMD mv ~/\${DEPLOY_NAME} "\${DEPLOY_PATH}/" || { echo "错误:移动文件失败,权限不足"; exit 1; } echo "部署完成!" else echo "错误:找不到 ~/\${DEPLOY_NAME} 目录" @@ -116,7 +111,11 @@ deploy_to_server() { # 重新加载 nginx(如果配置了) if command -v nginx &> /dev/null; then echo "重新加载 nginx..." - echo "\${SUDO_PASSWORD}" | sudo -S nginx -t && echo "\${SUDO_PASSWORD}" | sudo -S nginx -s reload || echo "警告:nginx 重新加载失败,请手动检查" + if [ -n "\$SUDO_CMD" ]; then + \$SUDO_CMD nginx -t && \$SUDO_CMD nginx -s reload || echo "警告:nginx 重新加载失败,请手动检查" + else + nginx -t && nginx -s reload || echo "警告:nginx 重新加载失败,请手动检查" + fi fi SSH_EOF ) diff --git a/index.html b/index.html index 8c623d6..9a71eef 100644 --- a/index.html +++ b/index.html @@ -5,10 +5,9 @@ - - + - + @@ -41,6 +40,34 @@ + + + + - \ No newline at end of file + diff --git a/public/en/index.html b/public/en/index.html new file mode 100644 index 0000000..7f89661 --- /dev/null +++ b/public/en/index.html @@ -0,0 +1,167 @@ + + + + + + TexPixel - Formula Recognition Tool for LaTeX, MathML, and Markdown + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+

Formula Recognition for Real Math Workflows

+

TexPixel converts formulas from screenshots, photos, and PDF pages into editable text formats for researchers, students, and engineering teams.

+ Open TexPixel App +

The app opens at the main product URL and defaults to English for this entry point.

+
+ +
+

Core Capabilities

+
    +
  • Recognize printed and handwritten formulas from image or PDF input.
  • +
  • Export to LaTeX for papers, MathML for web workflows, and Markdown for docs.
  • +
  • Use the browser-based workflow without local software installation.
  • +
+
+ +
+

FAQ

+

Is TexPixel browser-based?
Yes. You can upload files and get output directly in the web app.

+

What content type works best?
Clean scans and high-contrast screenshots improve recognition quality.

+

Can I reuse output in technical documents?
Yes. LaTeX and Markdown outputs are intended for editing and reuse.

+
+
+ + + + diff --git a/public/llms.txt b/public/llms.txt new file mode 100644 index 0000000..d16bb59 --- /dev/null +++ b/public/llms.txt @@ -0,0 +1,14 @@ +# TexPixel + +TexPixel is a web tool for converting images and PDFs into editable mathematical formats such as LaTeX, MathML, and Markdown. + +Canonical URL: https://texpixel.com/ +Primary languages: zh-CN, en + +## Preferred page for citation +- https://texpixel.com/ +- https://texpixel.com/en/ + +## Crawl guidance +- Public product content is allowed for indexing. +- Avoid API and authenticated/private areas. diff --git a/public/robots.txt b/public/robots.txt new file mode 100644 index 0000000..ea3c706 --- /dev/null +++ b/public/robots.txt @@ -0,0 +1,7 @@ +User-agent: * +Allow: / +Disallow: /api/ +Disallow: /auth/ +Disallow: /admin/ + +Sitemap: https://texpixel.com/sitemap.xml diff --git a/public/sitemap.xml b/public/sitemap.xml new file mode 100644 index 0000000..63dd25f --- /dev/null +++ b/public/sitemap.xml @@ -0,0 +1,15 @@ + + + + https://texpixel.com/ + 2026-02-25 + weekly + 1.0 + + + https://texpixel.com/en/ + 2026-02-25 + weekly + 0.9 + +