使用 MitM 加代理工具实现 OpenAI API 请求全局重定向
- 在 Surge 中安装 CA 证书并使用
AIProxy.sgmodule模块。
| #!/usr/bin/env sh | |
| HOST="overleaf.cipsup.cn" | |
| PROJECT_ID="627220cc14ecd4008b9ae727" | |
| DIRECTORY="$HOME/Library/CloudStorage/OneDrive-Personal/Backups/Overleaf/$PROJECT_ID" | |
| OUTPUT="main_`date +"%Y-%m-%dT%H%M"`.zip" | |
| COOKIE="$OVERLEAF_COOKIE" | |
| curl "http://$HOST/project/$PROJECT_ID/download/zip" \ | |
| -H "User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.0 Safari/605.1.15" \ |
| #!/usr/bin/env python | |
| import itertools | |
| import json | |
| import logging | |
| import os | |
| import re | |
| import shutil | |
| import sys | |
| import zlib |
| #!/usr/bin/env bash | |
| set -euo pipefail | |
| # Initialize linked worktrees once. | |
| if [[ -f .git && ! -d .git ]]; then | |
| gitdir="$(git rev-parse --git-dir)" | |
| marker="$gitdir/worktree-initialized" | |
| if [[ ! -f "$marker" ]]; then | |
| COMMON_DIR="$(dirname "$(git rev-parse --git-common-dir)")" |