From d678c25cfb8688a8ad73a06e559a57dc19df1884 Mon Sep 17 00:00:00 2001 From: shumengya Date: Wed, 24 Jun 2026 22:10:25 +0800 Subject: [PATCH] chore: sync local changes to Gitea --- api-docs/geoip-api.json | 87 +++++++++++++++++++++++++++++++++++++++++ wrangler.toml | 2 +- 2 files changed, 88 insertions(+), 1 deletion(-) create mode 100644 api-docs/geoip-api.json diff --git a/api-docs/geoip-api.json b/api-docs/geoip-api.json new file mode 100644 index 0000000..597ebd1 --- /dev/null +++ b/api-docs/geoip-api.json @@ -0,0 +1,87 @@ +{ + "info": { + "name": "geoip-api", + "_postman_id": "c4f8a1e2-9b7d-4e3c-a1f0-2d8e6b4c9a10", + "description": "Postman Collection v2.1 — Cloudflare Workers 访客公网 IP 与 `request.cf` 地理/网络信息。\n\n导入:Postman「Import」或 Apifox「导入」→ Postman 格式。\n仅使用集合变量 `baseUrl`(默认生产),不附带环境文件,避免与环境变量叠用冲突。\n`GET /api`、`/ipv4`、`/ipv6` 可查 `pretty=1` 美化 JSON。", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" + }, + "variable": [ + { + "key": "baseUrl", + "value": "https://geoip.api.smyhub.com", + "type": "string" + } + ], + "item": [ + { + "name": "page", + "item": [ + { + "name": "GET /", + "request": { + "method": "GET", + "header": [], + "url": "{{baseUrl}}/", + "description": "首页 HTML(含 `/api?pretty=1` 示例脚本)。" + }, + "response": [] + } + ] + }, + { + "name": "api", + "item": [ + { + "name": "GET /api", + "request": { + "method": "GET", + "header": [], + "url": "{{baseUrl}}/api", + "description": "JSON:`ip`、`ipVersion`、`userAgent`、`geo`、`network`、`ts`。" + }, + "response": [] + }, + { + "name": "GET /api?pretty=1", + "request": { + "method": "GET", + "header": [], + "url": "{{baseUrl}}/api?pretty=1", + "description": "同上,缩进格式化输出。" + }, + "response": [] + }, + { + "name": "GET /ipv4", + "request": { + "method": "GET", + "header": [], + "url": "{{baseUrl}}/ipv4", + "description": "仅当连接经 IPv4 到达边缘时 `ok: true`,否则 400。可 `?pretty=1`。" + }, + "response": [] + }, + { + "name": "GET /ipv6", + "request": { + "method": "GET", + "header": [], + "url": "{{baseUrl}}/ipv6", + "description": "仅当连接经 IPv6 到达边缘时 `ok: true`,否则 400。可 `?pretty=1`。" + }, + "response": [] + }, + { + "name": "OPTIONS /api", + "request": { + "method": "OPTIONS", + "header": [], + "url": "{{baseUrl}}/api", + "description": "CORS 预检;响应 204 + `Access-Control-*`。" + }, + "response": [] + } + ] + } + ] +} diff --git a/wrangler.toml b/wrangler.toml index eeec19b..6c5243f 100644 --- a/wrangler.toml +++ b/wrangler.toml @@ -1,3 +1,3 @@ -name = "cf-ip-geo" +name = "geoip-api" main = "worker.js" compatibility_date = "2026-03-05"