From 693b5321fd9e62924d08faedc60eaa71062fd34e Mon Sep 17 00:00:00 2001 From: dsh-go Date: Wed, 18 Nov 2026 01:03:07 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=80=E9=94=AE=E5=AE=89=E8=A3=85=E6=94=B9?= =?UTF-8?q?=E6=8C=87=E5=90=91=20Gitea=EF=BC=9A=E7=A7=81=E6=9C=89=E5=BA=93?= =?UTF-8?q?=E7=94=A8=20--token=20=E6=8B=89=E4=BB=A3=E7=A0=81=EF=BC=8C?= =?UTF-8?q?=E6=96=87=E6=A1=A3=E4=B8=8E=E6=88=AA=E5=9B=BE=E5=90=8C=E6=AD=A5?= =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 由 dsh-go 自动上传 · 2026/11/18 01:03:07 --- INSTALL.md | 255 +++++++++++++++++++++++++--------------------- README.md | 21 +++- index.html | 2 +- install.sh | 45 +++++--- js/tools-extra.js | 6 +- 5 files changed, 193 insertions(+), 136 deletions(-) diff --git a/INSTALL.md b/INSTALL.md index d8bc5ea..ea6ae1f 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -1,158 +1,183 @@ -# DevBox 服务器部署 +# DevBox 部署说明 -一条命令搞定,跟宝塔面板的安装方式一样:SSH 连上服务器,粘一行,回车。 +DevBox 是纯静态页面:一个目录丢到任何能跑 HTTP 的地方就能用。想在自己的服务器上装成服务,用根目录的 `install.sh`,一条命令搞定。 + +> 仓库在自建 Gitea 上,**默认是私有库**,所以拉脚本要带令牌。令牌在 Gitea 右上角头像 → 设置 → 应用 → 生成令牌,勾上「写: 仓库」就够。 + +## 一条命令 ```bash -curl -fsSL https://raw.githubusercontent.com/syc65535/devbox/main/install.sh | sudo bash +export GT=你的Gitea令牌 + +curl -fsSL -H "Authorization: token $GT" \ + http://110.42.217.133:3000/gitea/devbox/raw/branch/main/install.sh \ + | sudo bash -s -- --token "$GT" ``` 跑完会打印访问地址,默认 `http://服务器IP:8090/`。 -> 想换端口、换目录,在后面加参数(见下方「参数」)。 -> 没装 sudo 的机器用 `su -` 切到 root 再跑,或者把 `sudo bash` 换成 `bash`。 - -## 它做了什么 - -1. 检查 root,缺 `git` / `curl` / `python3` 就用 apt / dnf / yum / apk 自动装 -2. 把仓库浅克隆到 `/opt/devbox`(已存在就 `fetch + reset --hard` 更新) -3. 写 `systemd` 服务 `devbox.service`,用 Python 自带的静态服务器跑,`Restart=always` -4. `curl` 健康检查,确认页面能打开 -5. 可选:写一份 Nginx 站点配置并 reload - -装完这些命令都能用: - -```bash -systemctl status devbox # 看状态 -journalctl -u devbox -f # 看日志 -systemctl restart devbox # 重启 -``` - -## 参数 - -```bash -curl -fsSL https://raw.githubusercontent.com/syc65535/devbox/main/install.sh | sudo bash -s -- [参数] -``` - -| 参数 | 说明 | 默认 | -| --- | --- | --- | -| `--port 8080` | HTTP 端口 | `8090` | -| `--dir /srv/devbox` | 安装目录 | `/opt/devbox` | -| `--nginx box.example.com` | 同时写 Nginx 站点并 reload(`_` 表示默认站点) | 不写 | -| `--no-service` | 只拉代码,不装 systemd(容器、没 systemd 的机器) | 关 | -| `--update` | 更新到最新代码并重启 | — | -| `--uninstall` | 停服务、删 unit 和 Nginx 配置(保留代码目录) | — | -| `-h` | 帮助 | — | - -例子: +常用变体(都是同一条命令后面加参数): ```bash # 换端口 -curl -fsSL https://raw.githubusercontent.com/syc65535/devbox/main/install.sh | sudo bash -s -- --port 8080 +… | sudo bash -s -- --token "$GT" --port 8080 -# 装到 /www/wwwroot/devbox,并挂一个域名 -curl -fsSL https://raw.githubusercontent.com/syc65535/devbox/main/install.sh | sudo bash -s -- \ - --dir /www/wwwroot/devbox --port 8080 --nginx box.example.com +# 顺便写一份 Nginx 站点 +… | sudo bash -s -- --token "$GT" --nginx box.example.com -# 更新 -curl -fsSL https://raw.githubusercontent.com/syc65535/devbox/main/install.sh | sudo bash -s -- --update - -# 卸载 -curl -fsSL https://raw.githubusercontent.com/syc65535/devbox/main/install.sh | sudo bash -s -- --uninstall +# 更新 / 卸载 +… | sudo bash -s -- --token "$GT" --update +… | sudo bash -s -- --token "$GT" --uninstall ``` +如果哪天把仓库改成公开的,命令可以退化成不带令牌: + +```bash +curl -fsSL http://110.42.217.133:3000/gitea/devbox/raw/branch/main/install.sh | sudo bash +``` + +## 脚本做了什么 + +1. 检查 root、识别发行版(apt / dnf / yum / apk),缺 `git` `python3` 自动装 +2. 拉代码到 `/opt/devbox`:目录里已有 `.git` 就 `fetch + reset --hard`(更新),否则浅克隆(首次) +3. 写 `/etc/systemd/system/devbox.service`:`python3 -m http.server <端口> --bind 0.0.0.0 --directory /opt/devbox`,`Restart=always`,开机自启 +4. 给 `--nginx` 时写 `/etc/nginx/conf.d/devbox.conf`,`nginx -t` 通过才 reload +5. 健康检查:轮询 `http://127.0.0.1:<端口>/` 直到返回 `DevBox` 标题(最多 15 秒) +6. 打印地址、更新/卸载命令、放行端口的提醒 + +令牌只在一次性的克隆 URL 里用一下,拉完会把 `origin` 改回干净地址,**不会留在 `.git/config`**。 + +## 参数 + +| 参数 | 默认 | 说明 | +| --- | --- | --- | +| `--dir <路径>` | `/opt/devbox` | 装到哪里 | +| `--port <端口>` | `8090` | HTTP 监听端口 | +| `--nginx <域名>` | 无 | 额外写 Nginx 站点并 reload;写 `_` 表示默认站点 | +| `--token <令牌>` | 环境变量 `GITEA_TOKEN` / `GIT_TOKEN` | 私有库拉代码用 | +| `--user <用户名>` | `gitea` | 令牌对应的用户名 | +| `--repo <地址>` | 脚本里写死的 Gitea 地址 | 换 fork / 换仓库 | +| `--no-service` | 关 | 只拉代码,不装 systemd(容器、没有 systemd 的机器) | +| `--update` | — | 更新到最新代码并重启服务 | +| `--uninstall` | — | 停服务、删 unit 和 nginx 配置,**保留代码目录** | +| `-h, --help` | — | 帮助 | + +环境变量也行:`DEVBOX_DIR`、`DEVBOX_PORT`、`DEVBOX_REPO`、`GITEA_TOKEN`、`GITEA_USER`。 + ## 宝塔面板 -两种都行: +两种做法,选一种: -**A. 用面板自带的终端(推荐)** +**A. 面板终端里跑同一条命令**(推荐,和服务化安装一样) -面板 → 终端(或 SSH 工具),直接粘上面那条一键命令。脚本和宝塔不冲突,走的是 `systemd`,不占面板的站点。 - -**B. 用面板建个纯静态站点** - -1. 面板 → 网站 → 添加站点,域名填你的域名,PHP 版本选「纯静态」 -2. 把仓库代码放进站点根目录(面板 → 文件 → 上传,或终端执行): - ```bash - cd /www/wwwroot/你的域名 && git clone --depth=1 https://github.com/syc65535/devbox.git . - ``` -3. 面板 → 网站 → 设置 → 网站目录,确认根目录对上,保存 -4. 需要 HTTPS 就在面板 → SSL 里申请 Let's Encrypt 证书,一键部署 - -纯静态站点不需要 Node、不需要数据库,也不吃 CPU。 - -## Nginx + HTTPS(不用宝塔时) - -脚本带 `--nginx 域名` 会自动写好 `/etc/nginx/conf.d/devbox.conf`。之后: +面板 → 终端,粘: ```bash -sudo apt install -y certbot python3-certbot-nginx # Debian/Ubuntu -sudo certbot --nginx -d box.example.com --redirect +export GT=你的Gitea令牌 +curl -fsSL -H "Authorization: token $GT" \ + http://110.42.217.133:3000/gitea/devbox/raw/branch/main/install.sh \ + | sudo bash -s -- --token "$GT" --nginx 你的域名 ``` -不用 Nginx 也能跑:脚本起的 8090 端口本身就是 HTTP 服务,直接访问 IP 即可。 +脚本会自己写 Nginx 站点,面板的「网站」里能看到。 + +**B. 当纯静态站点** + +```bash +export GT=你的Gitea令牌 +cd /www/wwwroot/你的域名 +git clone --depth=1 "http://gitea:$GT@110.42.217.133:3000/gitea/devbox.git" . +git remote set-url origin http://110.42.217.133:3000/gitea/devbox.git # 别把令牌留在配置里 +``` + +然后在面板里建「HTML 项目 / 纯静态」,根目录指向这个目录。 + +> `python3 -m http.server` 只适合内部小工具:没有并发优化、没有 gzip。PV 上来以后请交给 Nginx 直接吐静态文件(上面的 B 方案就是)。 + +## HTTPS + +```bash +sudo dnf install -y certbot python3-certbot-nginx # Debian/Ubuntu: apt install +sudo certbot --nginx -d box.example.com +``` + +证书续期是 certbot 的 timer 自动管的,`systemctl list-timers | grep certbot` 能看到。 ## 手动部署(不用脚本) -DevBox 是纯静态页面,任何静态托管都能放: - ```bash -git clone --depth=1 https://github.com/syc65535/devbox.git -cd devbox -python3 -m http.server 8090 -# 打开 http://127.0.0.1:8090 +export GT=你的Gitea令牌 +git clone --depth=1 "http://gitea:$GT@110.42.217.133:3000/gitea/devbox.git" /opt/devbox +cd /opt/devbox && git remote set-url origin http://110.42.217.133:3000/gitea/devbox.git ``` -也可以丢给 GitHub Pages、Cloudflare Pages、Vercel,或者公司内网的 Nginx / Caddy,指向目录即可,不用构建。 +Nginx: + +```nginx +server { + listen 80; + server_name box.example.com; + root /opt/devbox; + index index.html; + location / { try_files $uri $uri/ /index.html; } + location ~* \.(js|css|png|jpg|jpeg|webp|svg|woff2?)$ { + expires 7d; + add_header Cache-Control "public"; + } +} +``` + +## Docker + +```dockerfile +FROM nginx:alpine +COPY . /usr/share/nginx/html +``` + +```bash +docker build -t devbox . +docker run -d --name devbox -p 8090:80 devbox +``` ## 常见问题 -**打不开 / 一直在转** +**克隆报 `could not read Username` / 303** +仓库是私有的,忘了 `--token`。带上令牌,或者先把仓库改成公开。 -- 云服务器要在「安全组」里放行端口,本机防火墙也要放行:`ufw allow 8090/tcp` -- 看服务活着没:`systemctl status devbox`;看报错:`journalctl -u devbox -n 50 --no-pager` -- 端口被占用:换 `--port 8081` 再装一遍,脚本是幂等的 +**403 / 401** +令牌没勾「写: 仓库」以外其实也够用——读取只要 `read:repository`;主要是别过期、别贴错(多复制一个空格就会 401)。 -**想用 80 端口** +**装完打不开** +1. 服务器本机 `curl -I http://127.0.0.1:8090/` 通不通 +2. 防火墙:`ufw allow 8090/tcp` 或 `firewall-cmd --add-port=8090/tcp --permanent && firewall-cmd --reload` +3. 云服务器还要在**安全组**里放行同一个端口 -加 `--nginx 域名`,用 Nginx 反代/静态托管到 80/443,脚本自己的 8090 只监听本机也行(把 unit 里的 `0.0.0.0` 改成 `127.0.0.1`)。 +**80 端口被占** +`--nginx` 那条要求 80 空闲;被宝塔/其他站点占着就换端口或先腾出来。 -**服务器是 Docker / 没 systemd** +**更新后页面没变** +浏览器缓存;硬刷新(Ctrl+Shift+R)。静态文件带 7 天缓存头,这是正常的。 -用 `--no-service` 只拉代码,然后自己起: +**没有 systemd(容器里)** +加 `--no-service`,脚本只拉代码,启动命令自己定:`python3 -m http.server 8090 --directory /opt/devbox`。 + +**想彻底删干净** ```bash -docker run -d --name devbox -p 8090:80 \ - -v /opt/devbox:/usr/share/nginx/html:ro nginx:alpine +sudo bash -s -- --uninstall # 停服务、删 unit 和 nginx 配置 +sudo rm -rf /opt/devbox # 代码目录单独删 ``` -**怎么更新到最新版** - -```bash -curl -fsSL https://raw.githubusercontent.com/syc65535/devbox/main/install.sh | sudo bash -s -- --update -``` - -**私有仓库** - -把 `REPO_URL` 换掉再跑: - -```bash -curl -fsSL https://raw.githubusercontent.com/syc65535/devbox/main/install.sh | \ - sudo DEVBOX_REPO=https://@github.com/你/仓库.git bash -``` - -**会不会收集数据** - -不会。页面全在浏览器里算,服务端只是个静态文件服务器。 - -## 目录 - -装完之后是这些文件,升级只会覆盖代码,不动配置: +## 目录说明 ``` -/opt/devbox/ -├── index.html -├── css/ js/ preview/ -└── README.md -/etc/systemd/system/devbox.service # 服务 -/etc/nginx/conf.d/devbox.conf # 只有加了 --nginx 才有 +devbox/ +├── index.html # 入口 +├── css/style.css # 全部样式 +├── js/ # app.js + util.js + 各工具模块(经典 script,无构建) +├── install.sh # 一键装 / 更新 / 卸载 +├── INSTALL.md # 这份说明 +└── preview/ # 截图 ``` + +跑起来不需要 Node,也不需要打包;`index.html` 双击(file://)也能用,只是剪贴板 API 在 file:// 下会受限,建议用 HTTP。 diff --git a/README.md b/README.md index 861f50a..fc4fe98 100644 --- a/README.md +++ b/README.md @@ -6,14 +6,24 @@ ## 装到服务器 -一条命令,跟宝塔面板的装法一样(SSH 里粘进去回车): +仓库在自建 Gitea 上(**私有库**,拉脚本要带令牌)。SSH 里粘进去回车: ```bash -curl -fsSL https://raw.githubusercontent.com/syc65535/devbox/main/install.sh | sudo bash +# 1) 有 Gitea 的地方:设置 → 应用 → 生成令牌(勾「写: 仓库」) +export GT=你的Gitea令牌 + +# 2) 一条命令装 +curl -fsSL -H "Authorization: token $GT" \ + http://110.42.217.133:3000/gitea/devbox/raw/branch/main/install.sh \ + | sudo bash -s -- --token "$GT" ``` 跑完打印地址,默认 `http://服务器IP:8090/`。脚本会自动装 git / python3、拉到 `/opt/devbox`、注册 `systemd` 服务、做健康检查;要换端口就加 `--port 8080`,要 Nginx 站点就加 `--nginx 你的域名`。 +要是哪天把这个仓库改成公开的,命令就退化成不带令牌的:curl -fsSL http://110.42.217.133:3000/gitea/devbox/raw/branch/main/install.sh | sudo bash + +跑完打印地址,默认 `http://服务器IP:8090/`。脚本会自动装 git / python3、拉到 `/opt/devbox`、注册 `systemd` 服务、做健康检查;要换端口就加 `--port 8080`,要 Nginx 站点就加 `--nginx 你的域名`。 + 更新、卸载、宝塔面板用法、HTTPS、Docker 部署都在 **[INSTALL.md](INSTALL.md)**。 ## 特点 @@ -60,11 +70,14 @@ curl -fsSL https://raw.githubusercontent.com/syc65535/devbox/main/install.sh | s DevBox 是纯静态页面,丢到任何静态托管都能用;想在自己的服务器上装成服务,用根目录的 `install.sh`: ```bash -curl -fsSL https://raw.githubusercontent.com/syc65535/devbox/main/install.sh | sudo bash +curl -fsSL -H "Authorization: token $GT" \ + http://110.42.217.133:3000/gitea/devbox/raw/branch/main/install.sh \ + | sudo bash -s -- --token "$GT" ``` - 默认装到 `/opt/devbox`,端口 `8090`,注册 `systemd` 服务 `devbox` -- `--port` / `--dir` / `--nginx 域名` / `--no-service` / `--update` / `--uninstall` 都能调 +- `--port` / `--dir` / `--nginx 域名` / `--token` / `--no-service` / `--update` / `--uninstall` 都能调 +- 私有库靠 `--token` 拉代码;令牌只在一次性的克隆 URL 里,不会留在 `.git/config` - 宝塔面板:面板自带终端里跑同一条命令,或者建个「纯静态」站点把目录指过去——两种做法都写在 [INSTALL.md](INSTALL.md) ## 跑起来 diff --git a/index.html b/index.html index 0a9498e..04cf199 100644 --- a/index.html +++ b/index.html @@ -66,7 +66,7 @@ diff --git a/install.sh b/install.sh index ad23852..ccbe471 100755 --- a/install.sh +++ b/install.sh @@ -1,22 +1,32 @@ #!/usr/bin/env bash # DevBox 一键安装 / 更新 / 卸载 # -# 装: -# curl -fsSL https://raw.githubusercontent.com/syc65535/devbox/main/install.sh | sudo bash -# 换端口: -# curl -fsSL https://raw.githubusercontent.com/syc65535/devbox/main/install.sh | sudo bash -s -- --port 8080 -# 更新 / 卸载: -# curl -fsSL https://raw.githubusercontent.com/syc65535/devbox/main/install.sh | sudo bash -s -- --update -# curl -fsSL https://raw.githubusercontent.com/syc65535/devbox/main/install.sh | sudo bash -s -- --uninstall +# 仓库在自己搭的 Gitea 上(默认私有库,所以拉脚本要带令牌): +# GT=你的Gitea令牌 +# curl -fsSL -H "Authorization: token $GT" \ +# http://110.42.217.133:3000/gitea/devbox/raw/branch/main/install.sh \ +# | sudo bash -s -- --token "$GT" +# 换端口 / 更新 / 卸载:在后面加 --port 8080、--update、--uninstall set -euo pipefail -REPO_URL="${DEVBOX_REPO:-https://github.com/syc65535/devbox.git}" +REPO_URL="${DEVBOX_REPO:-http://110.42.217.133:3000/gitea/devbox.git}" +RAW_URL="${REPO_URL%.git}/raw/branch/main" APP_DIR="${DEVBOX_DIR:-/opt/devbox}" PORT="${DEVBOX_PORT:-8090}" SERVICE="devbox" NGINX_DOMAIN="" MODE="install" NO_SERVICE=0 +GIT_USER="${GITEA_USER:-gitea}" +TOKEN="${GITEA_TOKEN:-${GIT_TOKEN:-}}" +REPO_HOST="$(printf '%s' "$REPO_URL" | sed -E 's#^https?://##; s#/.*$##')" + +# 私有库拉代码:把用户名/令牌临时拼进 URL 用一次,用完把 origin 改回干净地址, +# 令牌不会留在 .git/config 里,也不会进 ps(只在这一次参数里)。 +cred_url() { + if [ -z "$TOKEN" ]; then printf '%s' "$REPO_URL"; return; fi + printf '%s' "$REPO_URL" | sed -E "s#^(https?://)#\1${GIT_USER}:${TOKEN}@#" +} c_reset=$'\033[0m'; c_dim=$'\033[2m'; c_cyan=$'\033[36m'; c_green=$'\033[32m'; c_red=$'\033[31m'; c_bold=$'\033[1m' log() { printf '%s▸%s %s\n' "$c_cyan" "$c_reset" "$*"; } @@ -32,6 +42,9 @@ DevBox 一键安装脚本 --port <端口> HTTP 端口,默认 8090 --nginx <域名> 额外写一份 Nginx 站点配置并 reload(域名可写 _ 表示默认站点) --no-service 只拉代码,不装 systemd 服务(容器 / 没 systemd 时用) + --token <令牌> Gitea 访问令牌(私有库必填;也可用环境变量 GITEA_TOKEN) + --user <用户名> Gitea 用户名,默认 gitea + --repo <地址> 换一个仓库地址(默认脚本里写死的那个) --update 更新到最新代码并重启服务 --uninstall 停服务、删 unit(不删代码目录) -h, --help 显示这份帮助 @@ -43,6 +56,10 @@ while [ $# -gt 0 ]; do --dir) APP_DIR="${2:?缺少目录}"; shift 2 ;; --port) PORT="${2:?缺少端口}"; shift 2 ;; --nginx) NGINX_DOMAIN="${2:-_}"; shift 2 ;; + --token) TOKEN="${2:?缺少令牌}"; shift 2 ;; + --user) GIT_USER="${2:?缺少用户名}"; shift 2 ;; + --repo) REPO_URL="${2:?缺少仓库地址}"; shift 2 + REPO_HOST="$(printf '%s' "$REPO_URL" | sed -E 's#^https?://##; s#/.*$##')" ;; --no-service) NO_SERVICE=1; shift ;; --update) MODE="update"; shift ;; --uninstall) MODE="uninstall"; shift ;; @@ -55,7 +72,7 @@ case "$PORT" in ''|*[!0-9]*) die "端口要填数字:$PORT" ;; esac [ "$PORT" -ge 1 ] && [ "$PORT" -le 65535 ] || die "端口范围 1-65535:$PORT" if [ "$(id -u)" -ne 0 ]; then - die "需要 root:curl -fsSL https://raw.githubusercontent.com/syc65535/devbox/main/install.sh | sudo bash" + die "需要 root:把这条命令前面加上 sudo 再跑(curl … | sudo bash -s -- --token <令牌>)" fi pm_install() { @@ -151,13 +168,15 @@ pull_code() { need curl curl if [ -d "${APP_DIR}/.git" ]; then log "更新 ${APP_DIR}" - git -C "$APP_DIR" fetch --depth=1 origin main + GIT_TERMINAL_PROMPT=0 git -C "$APP_DIR" fetch --depth=1 "$(cred_url)" main git -C "$APP_DIR" reset --hard FETCH_HEAD else log "克隆仓库到 ${APP_DIR}" mkdir -p "$(dirname "$APP_DIR")" rm -rf "$APP_DIR" - git clone --depth=1 "$REPO_URL" "$APP_DIR" + GIT_TERMINAL_PROMPT=0 git clone --depth=1 "$(cred_url)" "$APP_DIR" \ + || die "拉代码失败。私有库要带令牌:--token <令牌>(或先 export GITEA_TOKEN=…)" + git -C "$APP_DIR" remote set-url origin "$REPO_URL" fi [ -f "${APP_DIR}/index.html" ] || die "拉下来的目录里没有 index.html,仓库地址对吗?" } @@ -183,8 +202,8 @@ summary() { printf ' 地址 http://%s:%s/\n' "${ip:-服务器IP}" "$PORT" printf ' 目录 %s\n' "$APP_DIR" printf ' 命令 systemctl status %s / journalctl -u %s -f\n' "$SERVICE" "$SERVICE" - printf ' 更新 curl -fsSL https://raw.githubusercontent.com/syc65535/devbox/main/install.sh | sudo bash -s -- --update\n' - printf ' 卸载 curl -fsSL https://raw.githubusercontent.com/syc65535/devbox/main/install.sh | sudo bash -s -- --uninstall\n' + printf ' 更新 curl -fsSL -H "Authorization: token $GITEA_TOKEN" %s/install.sh | sudo bash -s -- --token "$GITEA_TOKEN" --update\n' "$RAW_URL" + printf ' 卸载 curl -fsSL -H "Authorization: token $GITEA_TOKEN" %s/install.sh | sudo bash -s -- --uninstall\n' "$RAW_URL" echo printf '%s如果外面访问不到,记得放行端口:ufw allow %s/tcp(云服务器还要在安全组里放行)%s\n' "$c_dim" "$PORT" "$c_reset" [ -n "$NGINX_DOMAIN" ] && printf '%sHTTPS:certbot --nginx -d %s%s\n' "$c_dim" "$NGINX_DOMAIN" "$c_reset" diff --git a/js/tools-extra.js b/js/tools-extra.js index a102243..2d526b1 100644 --- a/js/tools-extra.js +++ b/js/tools-extra.js @@ -225,9 +225,9 @@ keywords: ['curl', 'fetch', 'axios', 'requests', 'http', '请求', '转换'], mount(root) { const input = area('粘贴 cURL,例如:curl https://api.example.com/v1/items -H "Authorization: Bearer xxx"', 8) - input.value = `curl 'https://api.github.com/repos/syc65535/devbox' \\ - -H 'Accept: application/vnd.github+json' \\ - -H 'Authorization: Bearer ghp_xxx'` + input.value = `curl 'http://your-gitea:3000/api/v1/user/repos' \\ + -H 'Accept: application/json' \\ + -H 'Authorization: token 你的令牌'` const out = output() const err = el('div', { class: 'err' }) const tabsHost = el('div', { class: 'row' })