Compare commits
63 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fe3e27561b | ||
|
|
bf2bea71eb | ||
|
|
77a61647dd | ||
|
|
813dd4431e | ||
|
|
d7116b8cf3 | ||
|
|
f5a7acc4e3 | ||
|
|
479933844a | ||
|
|
93046d7f03 | ||
|
|
e7ca31b710 | ||
|
|
87b99b0d16 | ||
|
|
e983b6f560 | ||
|
|
21ca7ab24f | ||
|
|
e7468644a4 | ||
|
|
2bca7d7d14 | ||
|
|
040c5f5836 | ||
|
|
4a86bbeeb4 | ||
|
|
68b7888a83 | ||
|
|
78dee025a7 | ||
|
|
17c2b4b243 | ||
|
|
2acb271f19 | ||
|
|
b688b67c26 | ||
|
|
3543615a69 | ||
|
|
24b0a5c09e | ||
|
|
5bbba05f69 | ||
|
|
72c95e4b4f | ||
|
|
8afd5df4ea | ||
|
|
a7a97b5621 | ||
|
|
e2e2ebc12e | ||
|
|
d131bccac0 | ||
|
|
d852bcff50 | ||
|
|
4c91525082 | ||
|
|
b565232ba6 | ||
|
|
5725a2b2f7 | ||
|
|
6ec6f8bdbf | ||
|
|
5c1bcff55a | ||
|
|
025c4e2ef3 | ||
|
|
6ac1294bee | ||
|
|
fb443592d3 | ||
|
|
c30a62b072 | ||
|
|
8bc509cccf | ||
|
|
9f814708d1 | ||
|
|
1889f9827a | ||
|
|
57d2d40e67 | ||
|
|
04fa6ee935 | ||
|
|
ed1e0f787e | ||
|
|
240716e45f | ||
|
|
35bbe6c93c | ||
|
|
fed50a31cc | ||
|
|
57ea4dd25a | ||
|
|
72eadfaf74 | ||
|
|
9521c0ce75 | ||
|
|
637f923c16 | ||
|
|
1cc93ffc22 | ||
|
|
887239d80c | ||
|
|
5d944fa3b1 | ||
|
|
654157b371 | ||
|
|
f4314cc6da | ||
|
|
1f29b2dbbe | ||
|
|
9c2b3f2fc8 | ||
|
|
8e20a0ed3d | ||
|
|
4122701468 | ||
|
|
1ee9813155 | ||
|
|
a9e4b3a5c6 |
50
.github/workflows/build.yml
vendored
@@ -6,7 +6,7 @@ on:
|
||||
version:
|
||||
description: 'Version number (e.g. 1.0.9)'
|
||||
required: true
|
||||
default: '1.0.9'
|
||||
default: '1.4.07'
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
@@ -18,10 +18,20 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0 # 获取所有标签
|
||||
|
||||
- name: Delete existing tag if exists
|
||||
run: |
|
||||
if git ls-remote --tags origin | grep -q "refs/tags/v${{ github.event.inputs.version }}"; then
|
||||
git push origin --delete "v${{ github.event.inputs.version }}" || true
|
||||
git tag -d "v${{ github.event.inputs.version }}" || true
|
||||
fi
|
||||
|
||||
- name: Create Tag
|
||||
run: |
|
||||
git tag v${{ github.event.inputs.version }}
|
||||
git push origin v${{ github.event.inputs.version }}
|
||||
git tag "v${{ github.event.inputs.version }}"
|
||||
git push origin "v${{ github.event.inputs.version }}"
|
||||
|
||||
build-windows:
|
||||
needs: create-tag
|
||||
@@ -53,7 +63,7 @@ jobs:
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: CursorFreeVIP_${{ env.VERSION }}_windows.exe
|
||||
path: dist/*
|
||||
path: dist/CursorFreeVIP_${{ env.VERSION }}_windows.exe
|
||||
|
||||
build-macos-arm64:
|
||||
needs: create-tag
|
||||
@@ -80,12 +90,13 @@ jobs:
|
||||
- name: Build MacOS ARM executable
|
||||
run: |
|
||||
pyinstaller build.spec
|
||||
mv "dist/CursorFreeVIP_${{ env.VERSION }}_mac" "dist/CursorFreeVIP_${{ env.VERSION }}_mac_arm64"
|
||||
|
||||
- name: Upload MacOS ARM artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: CursorFreeVIP_${{ env.VERSION }}_mac_arm64
|
||||
path: dist/*
|
||||
path: dist/CursorFreeVIP_${{ env.VERSION }}_mac_arm64
|
||||
|
||||
build-linux:
|
||||
needs: create-tag
|
||||
@@ -110,14 +121,18 @@ jobs:
|
||||
pip install -r requirements.txt
|
||||
|
||||
- name: Build Linux executable
|
||||
env:
|
||||
VERSION: ${{ env.VERSION }}
|
||||
run: |
|
||||
pyinstaller build.spec
|
||||
echo "Contents of dist directory:"
|
||||
ls -la dist/
|
||||
|
||||
- name: Upload Linux artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: CursorFreeVIP_${{ env.VERSION }}_linux
|
||||
path: dist/*
|
||||
path: dist/CursorFreeVIP_${{ env.VERSION }}_linux
|
||||
|
||||
|
||||
build-macos-intel:
|
||||
@@ -145,14 +160,16 @@ jobs:
|
||||
- name: Build MacOS Intel executable
|
||||
env:
|
||||
TARGET_ARCH: 'x86_64'
|
||||
VERSION: ${{ env.VERSION }}
|
||||
run: |
|
||||
arch -x86_64 python3 -m PyInstaller build.spec
|
||||
mv "dist/CursorFreeVIP_${{ env.VERSION }}_mac" "dist/CursorFreeVIP_${{ env.VERSION }}_mac_intel"
|
||||
|
||||
- name: Upload MacOS Intel artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: CursorFreeVIP_${{ env.VERSION }}_mac_intel
|
||||
path: dist/*
|
||||
path: dist/CursorFreeVIP_${{ env.VERSION }}_mac_intel
|
||||
|
||||
|
||||
create-release:
|
||||
@@ -169,19 +186,24 @@ jobs:
|
||||
with:
|
||||
path: artifacts
|
||||
|
||||
- name: List files
|
||||
run: ls -R artifacts/
|
||||
- name: Prepare release files
|
||||
run: |
|
||||
cd artifacts
|
||||
echo "Contents of artifacts directory:"
|
||||
ls -la
|
||||
echo "Contents of subdirectories:"
|
||||
ls -la */
|
||||
|
||||
- name: Create Release
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
tag_name: v${{ env.VERSION }}
|
||||
files: |
|
||||
artifacts/CursorFreeVIP_${{ env.VERSION }}_windows.exe/CursorFreeVIP.exe
|
||||
artifacts/CursorFreeVIP_${{ env.VERSION }}_mac_arm64/CursorFreeVIP
|
||||
artifacts/CursorFreeVIP_${{ env.VERSION }}_linux/CursorFreeVIP
|
||||
artifacts/CursorFreeVIP_${{ env.VERSION }}_mac_intel/CursorFreeVIP
|
||||
artifacts/CursorFreeVIP_${{ env.VERSION }}_windows.exe/CursorFreeVIP_${{ env.VERSION }}_windows.exe
|
||||
artifacts/CursorFreeVIP_${{ env.VERSION }}_mac_arm64/CursorFreeVIP_${{ env.VERSION }}_mac_arm64
|
||||
artifacts/CursorFreeVIP_${{ env.VERSION }}_linux/CursorFreeVIP_${{ env.VERSION }}_linux
|
||||
artifacts/CursorFreeVIP_${{ env.VERSION }}_mac_intel/CursorFreeVIP_${{ env.VERSION }}_mac_intel
|
||||
draft: false
|
||||
prerelease: false
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
47
.gitignore
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
__pycache__
|
||||
server/
|
||||
venv/
|
||||
check_license.py
|
||||
cursor_modifier.py
|
||||
reset_machine.py
|
||||
Run_Venv.bat
|
||||
token_monitor.py
|
||||
get_mac.py
|
||||
.gitignore
|
||||
build.bat
|
||||
build.mac.command
|
||||
build.py
|
||||
build.sh
|
||||
ENV/
|
||||
|
||||
install.bat
|
||||
run.bat
|
||||
|
||||
temp_account_info.txt
|
||||
|
||||
.env copy
|
||||
|
||||
# PyInstaller
|
||||
build/
|
||||
dist/
|
||||
*.spec2
|
||||
|
||||
credentials.txt
|
||||
cursor_accounts.txt
|
||||
recaptcha.py
|
||||
install_requirements.bat
|
||||
|
||||
# IDE
|
||||
.idea/
|
||||
.vscode/
|
||||
*.swp
|
||||
*.swo
|
||||
|
||||
# OS
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
|
||||
# Project specific
|
||||
*.log
|
||||
*.db
|
||||
*.sqlite3
|
||||
214
CHANGELOG.md
Normal file
@@ -0,0 +1,214 @@
|
||||
# Change Log
|
||||
|
||||
## v1.5.01
|
||||
1. Add: Check Latest Version | 增加檢查最新版本
|
||||
2. Add: Update Command | 增加更新命令
|
||||
|
||||
## v1.4.08
|
||||
1. Add: Print Some Account Info | 增加打印一些賬號信息
|
||||
|
||||
## v1.4.07
|
||||
1. Add Removed break statements after each operation | 修改結束event後的break暫停應用
|
||||
2. Added print_menu() calls to show the menu again | 添加print_menu()調用以再次顯示菜單
|
||||
3. Updated error handling to show menu instead of exiting | 更新錯誤處理以顯示菜單而不是退出
|
||||
|
||||
## v1.4.06
|
||||
|
||||
1. Add: Blocked Domains Loaded | 增加被屏蔽的域名加載
|
||||
2. Fix: Cleanup Error | 修復清理進程時出錯
|
||||
3. Fix: Blocked Domains Loaded Error | 修復被屏蔽的域名加載錯誤
|
||||
4. Fix: Available Domains Loaded Error | 修復可用域名加載錯誤
|
||||
5. Fix: Domains Filtered Error | 修復過濾後剩餘域名錯誤
|
||||
6. Fix: Domains Excluded Error | 修復排除域名錯誤
|
||||
|
||||
|
||||
## v1.4.05
|
||||
|
||||
1. Fix: macOS Language Detection | 修復macOS語言檢測
|
||||
|
||||
|
||||
## v1.4.04
|
||||
|
||||
1. Change Some Language Info to English | 更改一些語言信息為英文
|
||||
2. Add Auto Detect System Language | 增加自動檢測系統語言
|
||||
3. Fixed Some Issues | 修復一些問題
|
||||
|
||||
|
||||
## v1.4.03
|
||||
|
||||
1. Switch to API-based Registration System | 改用API註冊系統替代瀏覽器操作
|
||||
2. Add Support for Latest Cursor Version | 增加支持最新版本Cursor
|
||||
3. Enhance Translation System | 優化多語言翻譯系統
|
||||
4. Add Database Connection Status Messages | 增加數據庫連接狀態提示
|
||||
5. Improve Error Handling for Database Operations | 改進數據庫操作的錯誤處理
|
||||
6. Add New API Integration | 新增API集成
|
||||
7. Optimize Performance and Stability | 優化性能和穩定性
|
||||
|
||||
## v1.4.01
|
||||
|
||||
1. Add Disable Cursor Auto Upgrade | 增加禁用Cursor自動升級
|
||||
|
||||
## v1.3.02
|
||||
|
||||
1. Add Buy Me a Coffee | 增加請我喝杯咖啡
|
||||
2. Add PayPal | 增加PayPal
|
||||
3. Very Small Fix | 非常小的修復
|
||||
4. Fix main.py option number | 修復main.py選項數量
|
||||
|
||||
## v1.3.01
|
||||
|
||||
1. Add Manual Email Input | 增加手動輸入郵箱地址
|
||||
2. Add Manual Code Input | 增加手動輸入驗證碼
|
||||
3. Fix Cursor Options | 修復Cursor選項
|
||||
|
||||
|
||||
## v1.2.02
|
||||
|
||||
1. Add PBlock | 增加PBlock
|
||||
2. Remove uBlock0.chromium | 移除uBlock0.chromium
|
||||
3. Optimize the logic of the script | 優化腳本邏輯
|
||||
4. Optimize Size | 優化大小
|
||||
|
||||
|
||||
## v1.2.01
|
||||
|
||||
1. Fix Cursor Cloudflare Human Verification Problem | 修復Cursor Cloudflare人機驗證問題
|
||||
2. Change to automatic registration account | 全面改為自動註冊賬號
|
||||
3. Change Mail Site | 改變郵箱網站
|
||||
4. Fix Cursor Cloudflare Problem | 修復Cursor Cloudflare問題
|
||||
|
||||
|
||||
## v1.1.01
|
||||
|
||||
<p align="center">
|
||||
<img src="./images/cloudflare_2025-02-12_13-43-21.png" alt="free" width="400"/><br>
|
||||
</p>
|
||||
|
||||
1. Hot Fix Cursor Cloudflare Problem | 修復Cursor Cloudflare問題
|
||||
2. Fix Cursor Cloudflare Human Verification Problem | 修復Cursor Cloudflare人機驗證問題
|
||||
3. Remake signup logic | 重做註冊邏輯
|
||||
|
||||
|
||||
## v1.0.10
|
||||
|
||||
1. Hot Fix Mac Chrome Problem | 修復Mac Chrome問題
|
||||
2. Fix Linux Start Donet Problem | 修復Linux啟動開發者問題
|
||||
|
||||
|
||||
## v1.0.9
|
||||
|
||||
<p align="center">
|
||||
<img src="./images/cloudflare_2025-02-12_13-43-21.png" alt="free" width="400"/><br>
|
||||
</p>
|
||||
|
||||
1. Fixed New 0.45.x Version Reset Machine | 修復新0.45版本重置機器
|
||||
2. Fix Locale Language | 修復多語言
|
||||
3. Add Support Crypto Machine Regedit | 增加支持加密機器註冊
|
||||
4. Add Remake main.js | 重做main.js
|
||||
|
||||
|
||||
## v1.0.8
|
||||
|
||||
1. Fix New 0.45 Version Reset Machine | 修復新0.45版本重置機器
|
||||
2. Fix Locale Language | 修復多語言
|
||||
3. Add Support Crypto Machine Regedit | 增加支持加密機器註冊
|
||||
|
||||
|
||||
## v1.0.7 - HotFix
|
||||
|
||||
1. Fix Reset Machine | 修復重置機器
|
||||
2. Fix Locale Language | 修復多語言
|
||||
|
||||
|
||||
## v1.0.7
|
||||
|
||||
1. Add Locale Language Support | 增加多語言支持
|
||||
<p align="center">
|
||||
<img src="./images/locale_2025-01-15_13-40-08.png" alt="locale" width="400"/><br>
|
||||
</p>
|
||||
|
||||
|
||||
## v1.0.6
|
||||
|
||||
1. Add Quit Cursor Option | 增加退出Cursor選項
|
||||
2. Add Recaptcha Path Patch | 增加Recaptcha路徑修復
|
||||
3. Fix Admin Permission | 修復管理員權限問題
|
||||
4. Remove all need admin permission | 移除所有需要管理員權限
|
||||
|
||||
|
||||
## v1.0.5 - HotFix
|
||||
|
||||
1. Fix: Mac Browser Control | 修復Mac瀏覽器控制問題
|
||||
2. Fix: Verification Code Cant Patch | 修復驗證碼無法修復問題
|
||||
3. Add Linux Support | 增加Linux支持
|
||||
<p align="center">
|
||||
<img src="./images/fix_2025-01-14_21-30-43.png" alt="fix" width="400"/><br>
|
||||
</p>
|
||||
|
||||
|
||||
## v1.0.5
|
||||
|
||||
1. Remove MachineID | 移除機器碼ID
|
||||
2. Change to automatic registration account | 全面改為自動註冊賬號
|
||||
3. Use your own exclusive new account | 使用自己獨享的新賬號
|
||||
4. Fully automatic reset machine configuration | 全面自動化重置機器配置
|
||||
<p align="center">
|
||||
<img src="./images/pro_2025-01-14_14-40-37.png" alt="Why" width="400"/><br>
|
||||
</p>
|
||||
|
||||
|
||||
## v1.0.4
|
||||
|
||||
1. Fix: Cursor's configuration | 修復Cursor的配置問題
|
||||
2. Fix Cloud Lame | 修復雲端慢速模式
|
||||
|
||||
|
||||
## v1.0.3
|
||||
|
||||
1. Fix: Cursor's configuration | 修復Cursor的配置問題
|
||||
2. Add Manual Reset Machine | 增加手動重置機器
|
||||
3. Add CDN Cloud Control WatchDog | 增加CDN雲端控制WatchDog
|
||||
4. Add Mac OS Support | 增加Mac OS支持
|
||||
5. 759 ++ People use , but star only a few | 759 ++人使用,但只有幾個人點贊
|
||||
<p align="center">
|
||||
<img src="./images/what_2025-01-13_13-32-54.png" alt="Why" width="400"/><br>
|
||||
</p>
|
||||
|
||||
|
||||
## v1.0.2
|
||||
|
||||
1. Fix: Some known issues | 修復了一些已知問題
|
||||
2. Add cloud control device code | 增加雲端控制設備碼
|
||||
3. Cloud reset device code | 雲端重置設備碼
|
||||
4. Remove official WatchDog monitoring | 移除官方WatchDog監控
|
||||
5. Remove Proxy official prompt | 移除Proxy 官方提示
|
||||
6. Fix: Too Many Computer | 修復Too Many Computer 問題
|
||||
7. Fix Billing Issue | 修復計費問題
|
||||
8. Fix: Cursor's configuration | 修復Cursor的配置問題
|
||||
9. Fix cursor-slow mode | 修復cursor-slow模式
|
||||
|
||||
|
||||
## v1.0.1
|
||||
|
||||
1. Fix: Reset machine ID | 修復了重置機器ID的問題
|
||||
2. Fix: Bypass membership check | 修復了 繞過會員檢查的問題
|
||||
3. Fix: Auto upgrade to "pro" membership | 修復了 自動升級為pro會員的問題
|
||||
4. Fix: Real-time send Token request | 修復了 實時發送Token請求的問題
|
||||
5. Fix: Reset Cursor's configuration | 修復了 重置Cursor的配置的問題
|
||||
|
||||
|
||||
|
||||
## v1.0
|
||||
1. Preview Image | 預覽圖<br>
|
||||
<p align="center">
|
||||
<img src="./images/pro_2025-01-11_00-50-40.png" alt="Cursor Pro Logo" width="400"/><br>
|
||||
</p>
|
||||
<p align="center">
|
||||
<img src="./images/pro_2025-01-11_00-51-07.png" alt="Cursor Pro Logo" width="400"/><br>
|
||||
</p>
|
||||
2. Add usage period,but can be contacted by leaving MachineID | 不得已才添加,但可以通過留下MachineID 聯繫作者
|
||||
<br>
|
||||
|
||||
<p align="center">
|
||||
<img src="./images/pro_2025-01-11_16-24-03.png" alt="Cursor Pro Logo" width="400"/><br>
|
||||
</p>
|
||||
5
PBlock/background.js
Normal file
@@ -0,0 +1,5 @@
|
||||
// Import the contents of your other files
|
||||
importScripts('default_filters.js', 'block.js');
|
||||
|
||||
// Your service worker initialization code can go here
|
||||
console.log('Service worker initialized');
|
||||
129
PBlock/block.js
Normal file
@@ -0,0 +1,129 @@
|
||||
/**
|
||||
* All the actual functionality of the extension; loads as part of the background page.
|
||||
*
|
||||
* Active ingredient is enable(), which sets up the webRequest callbacks.
|
||||
*
|
||||
* */
|
||||
|
||||
let blockingEnabled = false;
|
||||
let allFilters = null;
|
||||
let webRTCPrivacy = null;
|
||||
|
||||
function setFilters(newFilters) {
|
||||
allFilters = newFilters;
|
||||
chrome.storage.local.set({"filters": newFilters});
|
||||
if (blockingEnabled) {
|
||||
refreshFilters();
|
||||
}
|
||||
}
|
||||
|
||||
// Convert URL patterns to declarativeNetRequest rule format
|
||||
function createRules(filters) {
|
||||
return filters.map((filter, index) => ({
|
||||
id: index + 1,
|
||||
priority: 1,
|
||||
action: {
|
||||
type: "block"
|
||||
},
|
||||
condition: {
|
||||
urlFilter: filter.replace("*://", "*"),
|
||||
resourceTypes: [
|
||||
"main_frame", "sub_frame", "stylesheet", "script", "image",
|
||||
"font", "object", "xmlhttprequest", "ping", "media", "websocket"
|
||||
]
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
async function enable(icon = true) {
|
||||
if (blockingEnabled) return;
|
||||
|
||||
if (allFilters && allFilters.length > 0) {
|
||||
const rules = createRules(allFilters);
|
||||
await chrome.declarativeNetRequest.updateDynamicRules({
|
||||
removeRuleIds: rules.map(rule => rule.id),
|
||||
addRules: rules
|
||||
});
|
||||
}
|
||||
|
||||
blockingEnabled = true;
|
||||
if (icon) {
|
||||
chrome.action.setIcon({
|
||||
path: {
|
||||
"16": "enabled16.png",
|
||||
"48": "enabled48.png"
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
async function disable(icon = true) {
|
||||
if (!blockingEnabled) return;
|
||||
|
||||
const rules = await chrome.declarativeNetRequest.getDynamicRules();
|
||||
await chrome.declarativeNetRequest.updateDynamicRules({
|
||||
removeRuleIds: rules.map(rule => rule.id),
|
||||
addRules: []
|
||||
});
|
||||
|
||||
blockingEnabled = false;
|
||||
if (icon) {
|
||||
chrome.action.setIcon({
|
||||
path: {
|
||||
"16": "disabled.png",
|
||||
"32": "disabled.png"
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
async function refreshFilters() {
|
||||
await disable(false);
|
||||
await enable(true);
|
||||
}
|
||||
|
||||
async function toggleEnabled() {
|
||||
if (blockingEnabled) {
|
||||
await disable();
|
||||
} else {
|
||||
await enable();
|
||||
}
|
||||
}
|
||||
|
||||
function setWebRTCPrivacy(flag, store = true) {
|
||||
webRTCPrivacy = flag;
|
||||
const privacySetting = flag ? "default_public_interface_only" : "default";
|
||||
chrome.privacy.network.webRTCIPHandlingPolicy.set({value: privacySetting});
|
||||
if (store) {
|
||||
chrome.storage.local.set({"webrtc_privacy": flag});
|
||||
}
|
||||
}
|
||||
|
||||
// Initialization
|
||||
chrome.storage.local.get("filters",
|
||||
function(result) {
|
||||
if (result["filters"] == undefined) {
|
||||
console.log("Initializing filters to defaults.");
|
||||
setFilters(defaultFilters);
|
||||
} else {
|
||||
setFilters(result["filters"]);
|
||||
allFilters = result["filters"];
|
||||
}
|
||||
|
||||
// toggle blocking on-off via the extension icon
|
||||
chrome.action.onClicked.addListener(toggleEnabled);
|
||||
// initialize blocking
|
||||
enable();
|
||||
}
|
||||
);
|
||||
|
||||
chrome.storage.local.get("webrtc_privacy",
|
||||
function(result) {
|
||||
if (result["webrtc_privacy"] == undefined) {
|
||||
console.log("Initializing WebRTC privacy to default.");
|
||||
setWebRTCPrivacy(false, true);
|
||||
} else {
|
||||
setWebRTCPrivacy(result["webrtc_privacy"], false);
|
||||
}
|
||||
}
|
||||
);
|
||||
14
PBlock/default_filters.js
Normal file
@@ -0,0 +1,14 @@
|
||||
defaultFilters = [
|
||||
// personally, I can't stand the like box
|
||||
//"http://www.facebook.com/plugins/likebox.php?*",
|
||||
"*://*.doubleclick.net/*",
|
||||
"*://partner.googleadservices.com/*",
|
||||
"*://*.googlesyndication.com/*",
|
||||
"*://*.google-analytics.com/*",
|
||||
"*://creative.ak.fbcdn.net/*",
|
||||
"*://*.adbrite.com/*",
|
||||
"*://*.exponential.com/*",
|
||||
"*://*.quantserve.com/*",
|
||||
"*://*.scorecardresearch.com/*",
|
||||
"*://*.zedo.com/*",
|
||||
]
|
||||
BIN
PBlock/enabled16.png
Normal file
|
After Width: | Height: | Size: 850 B |
BIN
PBlock/enabled48.png
Normal file
|
After Width: | Height: | Size: 3.4 KiB |
29
PBlock/manifest.json
Normal file
@@ -0,0 +1,29 @@
|
||||
{
|
||||
"name": "PBlock",
|
||||
"version": "0.1",
|
||||
"manifest_version": 3,
|
||||
"author": "yeongpin",
|
||||
"url": "https://github.com/yeongpin/PBlock",
|
||||
"description": "Just a simple blocker.",
|
||||
"action": {
|
||||
"default_icon": "enabled48.png"
|
||||
},
|
||||
"background": {
|
||||
"service_worker": "background.js"
|
||||
},
|
||||
"icons": {
|
||||
"16": "enabled16.png",
|
||||
"48": "enabled48.png"
|
||||
},
|
||||
"permissions": [
|
||||
"declarativeNetRequest",
|
||||
"storage",
|
||||
"privacy"
|
||||
],
|
||||
"host_permissions": [
|
||||
"http://*/*",
|
||||
"https://*/*",
|
||||
"ws://*/*",
|
||||
"wss://*/*"
|
||||
]
|
||||
}
|
||||
5
PBlock/rules.json
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"id": "ruleset_1",
|
||||
"version": "1.0",
|
||||
"rules": []
|
||||
}
|
||||
192
README.md
@@ -1,7 +1,7 @@
|
||||
# ➤ Cursor Free VIP
|
||||
<div align="center">
|
||||
<p align="center">
|
||||
<img src="./images/logo.png" alt="Cursor Pro Logo" width="200"/>
|
||||
<img src="./images/logo.png" alt="Cursor Pro Logo" width="200" style="border-radius: 6px;"/>
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
@@ -9,164 +9,34 @@
|
||||
[](https://github.com/yeongpin/cursor-free-vip/releases/latest)
|
||||
[](https://creativecommons.org/licenses/by-nc-nd/4.0/)
|
||||
[](https://github.com/yeongpin/cursor-free-vip/stargazers)
|
||||
[](https://github.com/yeongpin/cursor-free-vip/releases/latest)
|
||||
|
||||
</p>
|
||||
<h4>Support Latest 0.45.11 Version | 支持最新0.45.11版本</h4>
|
||||
<h4>Support Latest 0.46.3 Version | 支持最新0.46.3本</h4>
|
||||
|
||||
This is a tool to automatically register (except for Google verification code), support Windows and macOS systems, complete Auth verification, and reset Cursor's configuration.
|
||||
This is a tool to automatically register , support Windows and macOS systems, complete Auth verification, and reset Cursor's configuration.
|
||||
|
||||
這是一個自動化工具,自動註冊(除了Google驗證碼),支持 Windows 和 macOS 系統,完成Auth驗證,重置Cursor的配置。
|
||||
這是一個自動化工具,自動註冊 ,支持 Windows 和 macOS 系統,完成Auth驗證,重置Cursor的配置。
|
||||
|
||||
<p align="center">
|
||||
<img src="./images/new107_2025-01-15_13-53-56.png" alt="new" width="400"/><br>
|
||||
<img src="./images/new_2025-02-27_10-42-44.png" alt="new" width="400" style="border-radius: 6px;"/><br>
|
||||
</p>
|
||||
|
||||
<br>
|
||||
<p align="center">
|
||||
<img src="./images/free_2025-01-14_14-59-15.png" alt="free" width="400"/><br>
|
||||
</p>
|
||||
##### If you dont have google chrome , you can download it from [here](https://www.google.com/intl/en_pk/chrome/)
|
||||
|
||||
## ⚠️ Google Recaptcha need to be manually verified, don't be lazy, move your fingers, verify it, otherwise it will keep prompting you to verify ⚠️
|
||||
### If you dont have google chrome , you can download it from [here](https://www.google.com/intl/en_pk/chrome/)
|
||||
|
||||
## ⚠️ 郵箱驗證 需要手動驗證,不要那麼懶,動一動手指,驗證一下,不然會一直提示你驗證 ⚠️
|
||||
### 如果沒有Google Chrome,可以從[這裡](https://www.google.com/intl/en_pk/chrome/)下載
|
||||
##### 如果沒有Google Chrome,可以從[這裡](https://www.google.com/intl/en_pk/chrome/)下載
|
||||
|
||||
</p>
|
||||
</div>
|
||||
|
||||
|
||||
## 🔄 更新日志
|
||||
<details open>
|
||||
<summary>v1.0.9</summary>
|
||||
|
||||
<p align="center">
|
||||
<img src="./images/pass_2025-02-08_21-48-36.png" alt="free" width="400"/><br>
|
||||
</p>
|
||||
|
||||
1. Fixed New 0.45.x Version Reset Machine | 修復新0.45版本重置機器
|
||||
2. Fix Locale Language | 修復多語言
|
||||
3. Add Support Crypto Machine Regedit | 增加支持加密機器註冊
|
||||
4. Add Remake main.js | 重做main.js
|
||||
</details>
|
||||
<details>
|
||||
|
||||
<summary>Other Version Change Log</summary>
|
||||
<details>
|
||||
<summary>v1.0.8</summary>
|
||||
|
||||
1. Fix New 0.45 Version Reset Machine | 修復新0.45版本重置機器
|
||||
2. Fix Locale Language | 修復多語言
|
||||
3. Add Support Crypto Machine Regedit | 增加支持加密機器註冊
|
||||
</details>
|
||||
<details>
|
||||
<summary>v1.0.7 - HotFix</summary>
|
||||
|
||||
1. Fix Reset Machine | 修復重置機器
|
||||
2. Fix Locale Language | 修復多語言
|
||||
</details>
|
||||
<details>
|
||||
<summary>v1.0.7</summary>
|
||||
|
||||
1. Add Locale Language Support | 增加多語言支持
|
||||
<p align="center">
|
||||
<img src="./images/locale_2025-01-15_13-40-08.png" alt="locale" width="400"/><br>
|
||||
</p>
|
||||
</details>
|
||||
<details>
|
||||
<summary>v1.0.6</summary>
|
||||
|
||||
1. Add Quit Cursor Option | 增加退出Cursor選項
|
||||
2. Add Recaptcha Path Patch | 增加Recaptcha路徑修復
|
||||
3. Fix Admin Permission | 修復管理員權限問題
|
||||
4. Remove all need admin permission | 移除所有需要管理員權限
|
||||
</details>
|
||||
<details>
|
||||
<summary>v1.0.5 - HotFix</summary>
|
||||
|
||||
1. Fix: Mac Browser Control | 修復Mac瀏覽器控制問題
|
||||
2. Fix: Verification Code Cant Patch | 修復驗證碼無法修復問題
|
||||
3. Add Linux Support | 增加Linux支持
|
||||
<p align="center">
|
||||
<img src="./images/fix_2025-01-14_21-30-43.png" alt="fix" width="400"/><br>
|
||||
</p>
|
||||
</details>
|
||||
<details>
|
||||
<summary>v1.0.5</summary>
|
||||
|
||||
1. Remove MachineID | 移除機器碼ID
|
||||
2. Change to automatic registration account | 全面改為自動註冊賬號
|
||||
3. Use your own exclusive new account | 使用自己獨享的新賬號
|
||||
4. Fully automatic reset machine configuration | 全面自動化重置機器配置
|
||||
<p align="center">
|
||||
<img src="./images/pro_2025-01-14_14-40-37.png" alt="Why" width="400"/><br>
|
||||
</p>
|
||||
</details>
|
||||
<details>
|
||||
<summary>v1.0.4</summary>
|
||||
|
||||
1. Fix: Cursor's configuration | 修復Cursor的配置問題
|
||||
2. Fix Cloud Lame | 修復雲端慢速模式
|
||||
</details>
|
||||
<details>
|
||||
<summary>v1.0.3</summary>
|
||||
|
||||
1. Fix: Cursor's configuration | 修復Cursor的配置問題
|
||||
2. Add Manual Reset Machine | 增加手動重置機器
|
||||
3. Add CDN Cloud Control WatchDog | 增加CDN雲端控制WatchDog
|
||||
4. Add Mac OS Support | 增加Mac OS支持
|
||||
5. 759 ++ People use , but star only a few | 759 ++人使用,但只有幾個人點贊
|
||||
<p align="center">
|
||||
<img src="./images/what_2025-01-13_13-32-54.png" alt="Why" width="400"/><br>
|
||||
</p>
|
||||
</details>
|
||||
<details>
|
||||
<summary>v1.0.2</summary>
|
||||
|
||||
1. Fix: Some known issues | 修復了一些已知問題
|
||||
2. Add cloud control device code | 增加雲端控制設備碼
|
||||
3. Cloud reset device code | 雲端重置設備碼
|
||||
4. Remove official WatchDog monitoring | 移除官方WatchDog監控
|
||||
5. Remove Proxy official prompt | 移除Proxy 官方提示
|
||||
6. Fix: Too Many Computer | 修復Too Many Computer 問題
|
||||
7. Fix Billing Issue | 修復計費問題
|
||||
8. Fix: Cursor's configuration | 修復Cursor的配置問題
|
||||
9. Fix cursor-slow mode | 修復cursor-slow模式
|
||||
</details>
|
||||
<details>
|
||||
<summary>v1.0.1</summary>
|
||||
|
||||
1. Fix: Reset machine ID | 修復了重置機器ID的問題
|
||||
2. Fix: Bypass membership check | 修復了 繞過會員檢查的問題
|
||||
3. Fix: Auto upgrade to "pro" membership | 修復了 自動升級為pro會員的問題
|
||||
4. Fix: Real-time send Token request | 修復了 實時發送Token請求的問題
|
||||
5. Fix: Reset Cursor's configuration | 修復了 重置Cursor的配置的問題
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>v1.0</summary>
|
||||
1. Preview Image | 預覽圖<br>
|
||||
<p align="center">
|
||||
<img src="./images/pro_2025-01-11_00-50-40.png" alt="Cursor Pro Logo" width="400"/><br>
|
||||
</p>
|
||||
<p align="center">
|
||||
<img src="./images/pro_2025-01-11_00-51-07.png" alt="Cursor Pro Logo" width="400"/><br>
|
||||
</p>
|
||||
2. Add usage period,but can be contacted by leaving MachineID | 不得已才添加,但可以通過留下MachineID 聯繫作者
|
||||
<br>
|
||||
|
||||
<p align="center">
|
||||
<img src="./images/pro_2025-01-11_16-24-03.png" alt="Cursor Pro Logo" width="400"/><br>
|
||||
</p>
|
||||
</details>
|
||||
</details>
|
||||
## 🔄 Change Log | 更新日志
|
||||
[Watch Change Log | 查看更新日志](CHANGELOG.md)
|
||||
|
||||
## ✨ Features | 功能特點
|
||||
|
||||
* Automatically register Cursor membership<br>自動註冊Cursor會員<br>
|
||||
|
||||
* Except for Google verification code<br>除了Google驗證碼<br>
|
||||
|
||||
* Support Windows and macOS systems<br>支持 Windows 和 macOS 系統<br>
|
||||
|
||||
* Complete Auth verification<br>完成Auth驗證<br>
|
||||
@@ -183,9 +53,7 @@ This is a tool to automatically register (except for Google verification code),
|
||||
|Linux|ARM64|✅|Linux|ARM64|✅|
|
||||
|
||||
## 👀 How to use | 如何使用
|
||||
|⚠️Must logout your account before running the script⚠️|⚠️必須先登出你的帳戶再運行腳本⚠️ |
|
||||
|:---:|:---:|
|
||||
<br>
|
||||
|
||||
<details open>
|
||||
<summary><b>⭐ Auto Run Script | 腳本自動化運行</b></summary>
|
||||
|
||||
@@ -218,9 +86,9 @@ irm https://raw.githubusercontent.com/yeongpin/cursor-free-vip/main/scripts/rese
|
||||
|
||||
## ❗ Note | 注意事項
|
||||
|
||||
* Confirm that Cursor is closed before running the script <br>請確保在運行腳本前已經關閉 Cursor<br>
|
||||
* Use administrator to run the script <br>請使用管理員身份運行腳本
|
||||
|
||||
* Do not close this script when using Cursor <br>使用Cursor時請勿關閉此腳本<br>
|
||||
* Confirm that Cursor is closed before running the script <br>請確保在運行腳本前已經關閉 Cursor<br>
|
||||
|
||||
* This tool is only for learning and research purposes <br>此工具僅供學習和研究使用<br>
|
||||
|
||||
@@ -246,6 +114,36 @@ irm https://raw.githubusercontent.com/yeongpin/cursor-free-vip/main/scripts/rese
|
||||
|
||||
本工具僅供學習和研究使用,使用本工具所產生的任何後果由使用者自行承擔。 <br>
|
||||
|
||||
源代碼靈感來之 | Original code inspiration from [Here](https://github.com/hmhm2022/gpt-cursor-auto)
|
||||
|
||||
This tool is only for learning and research purposes, and any consequences arising from the use of this tool are borne by the user.
|
||||
|
||||
## 💰 Buy Me a Coffee | 請我喝杯咖啡
|
||||
|
||||
<div align="center">
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<img src="./images/provi-code.jpg" alt="buy_me_a_coffee" width="280"/><br>
|
||||
</td>
|
||||
<td>
|
||||
<img src="./images/paypal.png" alt="buy_me_a_coffee" width="280"/><br>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
## ⭐ Star History | 星星數
|
||||
|
||||
<div align="center">
|
||||
|
||||
[](https://star-history.com/#yeongpin/cursor-free-vip&Date)
|
||||
|
||||
</div>
|
||||
|
||||
## 📝 License | 授權
|
||||
|
||||
本項目採用 [CC BY-NC-ND 4.0](https://creativecommons.org/licenses/by-nc-nd/4.0/) 授權。
|
||||
Please refer to the [LICENSE](LICENSE.md) file for details.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
3
block_domain.txt
Normal file
@@ -0,0 +1,3 @@
|
||||
oakon.com
|
||||
famamail.com
|
||||
2925.com
|
||||
53
browser.py
@@ -27,13 +27,11 @@ class BrowserManager:
|
||||
try:
|
||||
extension_path = self._get_extension_path()
|
||||
co.add_extension(extension_path)
|
||||
co.set_argument("--allow-extensions-in-incognito")
|
||||
|
||||
extension_block_path = self.get_extension_block()
|
||||
co.add_extension(extension_block_path)
|
||||
|
||||
extension_recaptcha_path = self.get_extension_recaptcha()
|
||||
co.add_extension(extension_recaptcha_path)
|
||||
|
||||
co.set_argument("--allow-extensions-in-incognito")
|
||||
except FileNotFoundError as e:
|
||||
logging.warning(f"警告: {e}")
|
||||
|
||||
@@ -44,35 +42,6 @@ class BrowserManager:
|
||||
|
||||
# 基本设置
|
||||
co.set_pref("credentials_enable_service", False)
|
||||
co.set_pref("profile.password_manager_enabled", False)
|
||||
|
||||
# 禁用自动化标志
|
||||
co.set_pref("useAutomationExtension", False)
|
||||
co.set_pref("excludeSwitches", ["enable-automation"])
|
||||
|
||||
# WebGL 和 GPU 设置
|
||||
co.set_pref("webgl.disabled", False)
|
||||
co.set_pref("webgl.enable_webgl2", True)
|
||||
|
||||
# 设置语言和地区
|
||||
co.set_pref("intl.accept_languages", "en-US,en")
|
||||
|
||||
# 基本命令行参数
|
||||
co.set_argument("--disable-blink-features=AutomationControlled")
|
||||
co.set_argument("--hide-crash-restore-bubble")
|
||||
co.set_argument("--no-first-run")
|
||||
co.set_argument("--no-default-browser-check")
|
||||
co.set_argument("--disable-popup-blocking")
|
||||
|
||||
# 性能和稳定性参数
|
||||
co.set_argument("--disable-dev-shm-usage")
|
||||
co.set_argument("--disable-gpu")
|
||||
co.set_argument("--no-sandbox")
|
||||
co.set_argument("--ignore-certificate-errors")
|
||||
|
||||
# WebGL 相关参数
|
||||
co.set_argument("--use-gl=swiftshader")
|
||||
co.set_argument("--enable-webgl")
|
||||
|
||||
# 随机端口
|
||||
co.auto_port()
|
||||
@@ -84,7 +53,6 @@ class BrowserManager:
|
||||
elif sys.platform == "win32": # Windows
|
||||
co.set_argument("--disable-software-rasterizer")
|
||||
|
||||
|
||||
# 设置窗口大小
|
||||
window_width = random.randint(1024, 1920)
|
||||
window_height = random.randint(768, 1080)
|
||||
@@ -108,23 +76,10 @@ class BrowserManager:
|
||||
def get_extension_block(self):
|
||||
"""获取插件路径"""
|
||||
root_dir = os.getcwd()
|
||||
extension_path = os.path.join(root_dir, "uBlock0.chromium")
|
||||
extension_path = os.path.join(root_dir, "PBlock")
|
||||
|
||||
if hasattr(sys, "_MEIPASS"):
|
||||
extension_path = os.path.join(sys._MEIPASS, "uBlock0.chromium")
|
||||
|
||||
if not os.path.exists(extension_path):
|
||||
raise FileNotFoundError(f"插件不存在: {extension_path}")
|
||||
|
||||
return extension_path
|
||||
|
||||
def get_extension_recaptcha(self):
|
||||
"""获取插件路径"""
|
||||
root_dir = os.getcwd()
|
||||
extension_path = os.path.join(root_dir, "recaptchaPatch")
|
||||
|
||||
if hasattr(sys, "_MEIPASS"):
|
||||
extension_path = os.path.join(sys._MEIPASS, "recaptchaPatch")
|
||||
extension_path = os.path.join(sys._MEIPASS, "PBlock")
|
||||
|
||||
if not os.path.exists(extension_path):
|
||||
raise FileNotFoundError(f"插件不存在: {extension_path}")
|
||||
|
||||
30
build.bat
@@ -2,28 +2,28 @@
|
||||
chcp 65001 > nul
|
||||
cls
|
||||
|
||||
:: 檢查是否以管理員權限運行
|
||||
:: Check if running with administrator privileges
|
||||
net session >nul 2>&1
|
||||
if %errorLevel% == 0 (
|
||||
:: 如果是管理員權限,只創建虛擬環境後就降權運行
|
||||
:: If running with administrator privileges, create virtual environment and then run with normal user privileges
|
||||
if not exist venv (
|
||||
echo ℹ️ 正在創建虛擬環境...
|
||||
python -m venv venv
|
||||
)
|
||||
|
||||
:: 降權運行剩餘的步驟
|
||||
:: Run remaining steps with normal user privileges
|
||||
echo ℹ️ 以普通用戶權限繼續...
|
||||
powershell -Command "Start-Process -FilePath '%comspec%' -ArgumentList '/c cd /d %cd% && %~f0 run' -Verb RunAs:NO"
|
||||
exit /b
|
||||
) else (
|
||||
:: 檢查是否是第二階段運行
|
||||
:: Check if running in second stage
|
||||
if "%1"=="run" (
|
||||
goto RUN_BUILD
|
||||
) else (
|
||||
:: 如果是普通權限且需要創建虛擬環境,請求管理員權限
|
||||
:: If running with normal privileges and creating virtual environment is required, request administrator privileges
|
||||
if not exist venv (
|
||||
echo ⚠️ 需要管理員權限來創建虛擬環境
|
||||
echo ℹ️ 正在請求管理員權限...
|
||||
echo ⚠️ Requires administrator privileges to create virtual environment
|
||||
echo ℹ️ Requesting administrator privileges...
|
||||
powershell -Command "Start-Process -Verb RunAs -FilePath '%comspec%' -ArgumentList '/c cd /d %cd% && %~f0'"
|
||||
exit /b
|
||||
) else (
|
||||
@@ -33,30 +33,30 @@ if %errorLevel% == 0 (
|
||||
)
|
||||
|
||||
:RUN_BUILD
|
||||
echo ℹ️ 啟動虛擬環境...
|
||||
echo ℹ️ Starting virtual environment...
|
||||
call venv\Scripts\activate.bat
|
||||
if errorlevel 1 (
|
||||
echo ❌ 啟動虛擬環境失敗
|
||||
echo ❌ Failed to start virtual environment
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
:: 檢查並安裝缺失的依賴
|
||||
echo ℹ️ 檢查依賴...
|
||||
:: Check and install missing dependencies
|
||||
echo ℹ️ Checking dependencies...
|
||||
for /f "tokens=1" %%i in (requirements.txt) do (
|
||||
pip show %%i >nul 2>&1 || (
|
||||
echo ℹ️ 安裝 %%i...
|
||||
echo ℹ️ Installing %%i...
|
||||
pip install %%i
|
||||
)
|
||||
)
|
||||
|
||||
echo ℹ️ 開始構建...
|
||||
echo ℹ️ Starting build...
|
||||
python build.py
|
||||
if errorlevel 1 (
|
||||
echo ❌ 構建失敗
|
||||
echo ❌ Build failed
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
echo ✅ 完成!
|
||||
echo ✅ Completed!
|
||||
pause
|
||||
26
build.py
@@ -8,7 +8,7 @@ import shutil
|
||||
from logo import print_logo
|
||||
from dotenv import load_dotenv
|
||||
|
||||
# 忽略特定警告
|
||||
# Ignore specific warnings
|
||||
warnings.filterwarnings("ignore", category=SyntaxWarning)
|
||||
|
||||
class LoadingAnimation:
|
||||
@@ -50,21 +50,21 @@ def simulate_progress(message, duration=1.0, steps=20):
|
||||
progress_bar(i, steps, prefix="Progress:", length=40)
|
||||
|
||||
def build():
|
||||
# 清理屏幕
|
||||
# Clean screen
|
||||
os.system("cls" if platform.system().lower() == "windows" else "clear")
|
||||
|
||||
# 顯示 logo
|
||||
# Display logo
|
||||
print_logo()
|
||||
|
||||
# 清理 PyInstaller 緩存
|
||||
print("\033[93m🧹 清理構建緩存...\033[0m")
|
||||
# Clean PyInstaller cache
|
||||
print("\033[93m🧹 Cleaning build cache...\033[0m")
|
||||
if os.path.exists('build'):
|
||||
shutil.rmtree('build')
|
||||
|
||||
# 重新加載環境變量以確保獲取最新版本
|
||||
# Reload environment variables to ensure getting the latest version
|
||||
load_dotenv(override=True)
|
||||
version = os.getenv('VERSION', '1.0.0')
|
||||
print(f"\033[93m📦 正在構建版本: v{version}\033[0m")
|
||||
print(f"\033[93m📦 Building version: v{version}\033[0m")
|
||||
|
||||
try:
|
||||
simulate_progress("Preparing build environment...", 0.5)
|
||||
@@ -72,7 +72,7 @@ def build():
|
||||
loading = LoadingAnimation()
|
||||
loading.start("Building in progress")
|
||||
|
||||
# 根据系统类型设置输出名称
|
||||
# Set output name based on system type
|
||||
system = platform.system().lower()
|
||||
if system == "windows":
|
||||
os_type = "windows"
|
||||
@@ -86,7 +86,7 @@ def build():
|
||||
|
||||
output_name = f"CursorFreeVIP_{version}_{os_type}"
|
||||
|
||||
# 构建命令
|
||||
# Build command
|
||||
build_command = f'pyinstaller --clean --noconfirm build.spec'
|
||||
output_path = os.path.join('dist', f'{output_name}{ext}')
|
||||
|
||||
@@ -95,16 +95,16 @@ def build():
|
||||
loading.stop()
|
||||
|
||||
if os.path.exists(output_path):
|
||||
print(f"\n\033[92m✅ 構建完成!")
|
||||
print(f"📦 可執行文件位於: {output_path}\033[0m")
|
||||
print(f"\n\033[92m✅ Build completed!")
|
||||
print(f"📦 Executable file located: {output_path}\033[0m")
|
||||
else:
|
||||
print("\n\033[91m❌ 構建失敗:未找到輸出文件\033[0m")
|
||||
print("\n\033[91m❌ Build failed: Output file not found\033[0m")
|
||||
return False
|
||||
|
||||
except Exception as e:
|
||||
if loading:
|
||||
loading.stop()
|
||||
print(f"\n\033[91m❌ 構建過程出錯: {str(e)}\033[0m")
|
||||
print(f"\n\033[91m❌ Build process error: {str(e)}\033[0m")
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
20
build.sh
@@ -8,7 +8,7 @@ NC='\033[0m' # No Color
|
||||
|
||||
# 检查并安装必要的依赖
|
||||
check_dependencies() {
|
||||
echo -e "${YELLOW}检查系统依赖...${NC}"
|
||||
echo -e "${YELLOW}Checking system dependencies...${NC}"
|
||||
|
||||
# 检查是否为 Ubuntu/Debian
|
||||
if [ -f /etc/debian_version ]; then
|
||||
@@ -16,42 +16,42 @@ check_dependencies() {
|
||||
PACKAGES="python3 python3-pip python3-venv"
|
||||
for pkg in $PACKAGES; do
|
||||
if ! dpkg -l | grep -q "^ii $pkg "; then
|
||||
echo -e "${YELLOW}安装 $pkg...${NC}"
|
||||
echo -e "${YELLOW}Installing $pkg...${NC}"
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y $pkg
|
||||
fi
|
||||
done
|
||||
else
|
||||
echo -e "${RED}不支持的系统,请手动安装 python3, pip3 和 python3-venv${NC}"
|
||||
echo -e "${RED}Unsupported system, please install python3, pip3 and python3-venv manually${NC}"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
# 创建并激活虚拟环境
|
||||
setup_venv() {
|
||||
echo -e "${GREEN}正在创建虚拟环境...${NC}"
|
||||
echo -e "${GREEN}Creating virtual environment...${NC}"
|
||||
python3 -m venv venv
|
||||
|
||||
echo -e "${GREEN}启动虚拟环境...${NC}"
|
||||
echo -e "${GREEN}Starting virtual environment...${NC}"
|
||||
. ./venv/bin/activate || source ./venv/bin/activate
|
||||
}
|
||||
|
||||
# 安装依赖
|
||||
install_dependencies() {
|
||||
echo -e "${GREEN}安装依赖...${NC}"
|
||||
echo -e "${GREEN}Installing dependencies...${NC}"
|
||||
python3 -m pip install --upgrade pip
|
||||
pip3 install -r requirements.txt
|
||||
}
|
||||
|
||||
# 构建程序
|
||||
build_program() {
|
||||
echo -e "${GREEN}开始构建...${NC}"
|
||||
echo -e "${GREEN}Starting build...${NC}"
|
||||
python3 build.py
|
||||
}
|
||||
|
||||
# 清理
|
||||
cleanup() {
|
||||
echo -e "${GREEN}清理虚拟环境...${NC}"
|
||||
echo -e "${GREEN}Cleaning virtual environment...${NC}"
|
||||
deactivate 2>/dev/null || true
|
||||
rm -rf venv
|
||||
}
|
||||
@@ -73,8 +73,8 @@ main() {
|
||||
# 清理
|
||||
cleanup
|
||||
|
||||
echo -e "${GREEN}完成!${NC}"
|
||||
echo "按任意键退出..."
|
||||
echo -e "${GREEN}Completed!${NC}"
|
||||
echo "Press any key to exit..."
|
||||
# 使用兼容的方式读取输入
|
||||
if [ "$(uname)" = "Linux" ]; then
|
||||
read dummy
|
||||
|
||||
@@ -24,8 +24,7 @@ a = Analysis(
|
||||
binaries=[],
|
||||
datas=[
|
||||
('turnstilePatch', 'turnstilePatch'),
|
||||
('recaptchaPatch', 'recaptchaPatch'),
|
||||
('uBlock0.chromium', 'uBlock0.chromium'),
|
||||
('PBlock', 'PBlock'),
|
||||
('locales', 'locales'),
|
||||
('cursor_auth.py', '.'),
|
||||
('reset_machine_manual.py', '.'),
|
||||
|
||||
153
control.py
@@ -58,84 +58,7 @@ class BrowserControl:
|
||||
def get_current_tab(self):
|
||||
"""获取当前标签页"""
|
||||
return self.browser
|
||||
|
||||
def generate_new_email(self):
|
||||
"""点击新的按钮生成新邮箱"""
|
||||
try:
|
||||
print(f"{Fore.CYAN}{EMOJI['MAIL']} {self.translator.get('control.generate_email')}...{Style.RESET_ALL}")
|
||||
new_button = self.browser.ele('xpath://button[contains(@class, "egenbut")]')
|
||||
if new_button:
|
||||
new_button.click()
|
||||
time.sleep(1) # 等待生成
|
||||
print(f"{Fore.GREEN}{EMOJI['SUCCESS']} {self.translator.get('control.generate_email_success')}{Style.RESET_ALL}")
|
||||
return True
|
||||
else:
|
||||
print(f"{Fore.RED}{EMOJI['ERROR']} {self.translator.get('control.generate_email_failed')}{Style.RESET_ALL}")
|
||||
return False
|
||||
except Exception as e:
|
||||
print(f"{Fore.RED}{EMOJI['ERROR']} {self.translator.get('control.browser_error', error=str(e))}{Style.RESET_ALL}")
|
||||
return False
|
||||
|
||||
def select_email_domain(self, domain_index=None):
|
||||
"""选择邮箱域名,如果不指定index则随机选择。避免选择fr.nf域名"""
|
||||
try:
|
||||
print(f"{Fore.CYAN}{EMOJI['MAIL']} {self.translator.get('control.select_email_domain')}...{Style.RESET_ALL}")
|
||||
# 找到下拉框
|
||||
select_element = self.browser.ele('xpath://select[@id="seldom"]')
|
||||
if select_element:
|
||||
# 获取所有选项,包括两个 optgroup 下的所有 option
|
||||
all_options = []
|
||||
|
||||
# 获取 "新的" 组下的选项
|
||||
new_options = self.browser.eles('xpath://select[@id="seldom"]/optgroup[@label="-- 新的 --"]/option')
|
||||
all_options.extend(new_options)
|
||||
|
||||
# 获取 "其他" 组下的选项
|
||||
other_options = self.browser.eles('xpath://select[@id="seldom"]/optgroup[@label="-- 其他 --"]/option')
|
||||
all_options.extend(other_options)
|
||||
|
||||
if all_options:
|
||||
max_attempts = 5 # 最大尝试次数
|
||||
attempt = 0
|
||||
|
||||
while attempt < max_attempts:
|
||||
# 如果没有指定索引,随机选择一个
|
||||
if domain_index is None:
|
||||
domain_index = random.randint(0, len(all_options) - 1)
|
||||
|
||||
if domain_index < len(all_options):
|
||||
# 获取选中选项的文本
|
||||
selected_domain = all_options[domain_index].text
|
||||
|
||||
# 检查是否为fr.nf域名
|
||||
if "fr.nf" in selected_domain.lower():
|
||||
print(f"{Fore.YELLOW}{EMOJI['INFO']} 检测到fr.nf域名,重新选择...{Style.RESET_ALL}")
|
||||
domain_index = None # 重置索引以便重新随机选择
|
||||
attempt += 1
|
||||
continue
|
||||
|
||||
print(f"{Fore.CYAN}{EMOJI['MAIL']} {self.translator.get('control.select_email_domain')}: {selected_domain}{Style.RESET_ALL}")
|
||||
|
||||
# 点击选择
|
||||
all_options[domain_index].click()
|
||||
time.sleep(1)
|
||||
print(f"{Fore.GREEN}{EMOJI['SUCCESS']} {self.translator.get('control.select_email_domain_success')}{Style.RESET_ALL}")
|
||||
return True
|
||||
|
||||
attempt += 1
|
||||
|
||||
print(f"{Fore.RED}{EMOJI['ERROR']} 无法找到合适的非fr.nf域名{Style.RESET_ALL}")
|
||||
return False
|
||||
|
||||
print(f"{Fore.RED}{EMOJI['ERROR']} {self.translator.get('control.no_available_domain_options', count=len(all_options))}{Style.RESET_ALL}")
|
||||
return False
|
||||
else:
|
||||
print(f"{Fore.RED}{EMOJI['ERROR']} {self.translator.get('control.no_domain_select_box')}{Style.RESET_ALL}")
|
||||
return False
|
||||
except Exception as e:
|
||||
print(f"{Fore.RED}{EMOJI['ERROR']} {self.translator.get('control.select_email_domain_failed', error=str(e))}{Style.RESET_ALL}")
|
||||
return False
|
||||
|
||||
|
||||
def wait_for_page_load(self, seconds=2):
|
||||
"""等待页面加载"""
|
||||
time.sleep(seconds)
|
||||
@@ -151,80 +74,6 @@ class BrowserControl:
|
||||
print(f"{Fore.RED}{EMOJI['ERROR']} {self.translator.get('control.browser_error', error=str(e))}{Style.RESET_ALL}")
|
||||
return False
|
||||
|
||||
def copy_and_get_email(self):
|
||||
"""获取邮箱地址"""
|
||||
try:
|
||||
print(f"{Fore.CYAN}{EMOJI['MAIL']} {self.translator.get('control.generate_email')}...{Style.RESET_ALL}")
|
||||
|
||||
# 等待元素加载
|
||||
time.sleep(1)
|
||||
|
||||
# 获取邮箱名称
|
||||
try:
|
||||
email_div = self.browser.ele('xpath://div[@class="segen"]//div[contains(@style, "color: #e5e5e5")]')
|
||||
if email_div:
|
||||
email_name = email_div.text.split()[0]
|
||||
print(f"{Fore.CYAN}{EMOJI['MAIL']} {self.translator.get('control.get_email_name')}: {email_name}{Style.RESET_ALL}")
|
||||
else:
|
||||
print(f"{Fore.RED}{EMOJI['ERROR']} {self.translator.get('control.get_email_name_failed')}{Style.RESET_ALL}")
|
||||
return None
|
||||
except Exception as e:
|
||||
print(f"{Fore.RED}{EMOJI['ERROR']} {self.translator.get('control.get_email_name_failed', error=str(e))}{Style.RESET_ALL}")
|
||||
return None
|
||||
|
||||
# 直接使用上一步选择的域名
|
||||
try:
|
||||
domain = self.browser.ele('xpath://select[@id="seldom"]').value
|
||||
if not domain: # 如果获取不到value,尝试获取选中的选项文本
|
||||
selected_option = self.browser.ele('xpath://select[@id="seldom"]/option[1]')
|
||||
domain = selected_option.text if selected_option else "@yopmail.com" # 使用默认域名作为后备
|
||||
except:
|
||||
domain = "@yopmail.com" # 如果出错,使用默认域名
|
||||
|
||||
# 组合完整邮箱地址
|
||||
full_email = f"{email_name}{domain}"
|
||||
print(f"{Fore.GREEN}{EMOJI['MAIL']} {self.translator.get('control.get_email_address')}: {full_email}{Style.RESET_ALL}")
|
||||
return full_email
|
||||
|
||||
except Exception as e:
|
||||
print(f"{Fore.RED}{EMOJI['ERROR']} {self.translator.get('control.get_email_address_failed', error=str(e))}{Style.RESET_ALL}")
|
||||
return None
|
||||
|
||||
def view_mailbox(self):
|
||||
"""点击查看邮箱按钮"""
|
||||
try:
|
||||
print(f"{Fore.CYAN}{EMOJI['MAIL']} {self.translator.get('control.enter_mailbox')}...{Style.RESET_ALL}")
|
||||
view_button = self.browser.ele('xpath://button[contains(@class, "egenbut") and contains(.//span, "查看邮箱")]')
|
||||
if view_button:
|
||||
view_button.click()
|
||||
time.sleep(2) # 等待页面加载
|
||||
print(f"{Fore.GREEN}{EMOJI['SUCCESS']} {self.translator.get('control.enter_mailbox_success')}{Style.RESET_ALL}")
|
||||
return True
|
||||
else:
|
||||
print(f"{Fore.RED}{EMOJI['ERROR']} {self.translator.get('control.no_view_mailbox_button')}{Style.RESET_ALL}")
|
||||
return False
|
||||
except Exception as e:
|
||||
print(f"{Fore.RED}{EMOJI['ERROR']} {self.translator.get('control.enter_mailbox_failed', error=str(e))}{Style.RESET_ALL}")
|
||||
return False
|
||||
|
||||
def refresh_mailbox(self):
|
||||
"""刷新邮箱获取最新信息"""
|
||||
try:
|
||||
print(f"{Fore.CYAN}{EMOJI['MAIL']} {self.translator.get('control.refresh_mailbox')}...{Style.RESET_ALL}")
|
||||
refresh_button = self.browser.ele('xpath://button[@id="refresh"]')
|
||||
if refresh_button:
|
||||
refresh_button.click()
|
||||
time.sleep(2) # 等待刷新完成
|
||||
print(f"{Fore.GREEN}{EMOJI['SUCCESS']} {self.translator.get('control.refresh_mailbox_success')}{Style.RESET_ALL}")
|
||||
return True
|
||||
else:
|
||||
print(f"{Fore.RED}{EMOJI['ERROR']} {self.translator.get('control.no_refresh_button')}{Style.RESET_ALL}")
|
||||
return False
|
||||
except Exception as e:
|
||||
print(f"{Fore.RED}{EMOJI['ERROR']} {self.translator.get('control.refresh_mailbox_failed', error=str(e))}{Style.RESET_ALL}")
|
||||
return False
|
||||
|
||||
|
||||
def get_verification_code(self):
|
||||
"""从邮件中获取验证码"""
|
||||
try:
|
||||
|
||||
@@ -26,11 +26,32 @@ class CursorAuth:
|
||||
self.db_path = os.path.join(
|
||||
os.getenv("APPDATA"), "Cursor", "User", "globalStorage", "state.vscdb"
|
||||
)
|
||||
elif os.name =='posix':
|
||||
self.db_path = os.path.expanduser(
|
||||
"~/.config/Cursor/User/globalStorage/state.vscdb"
|
||||
)
|
||||
else: # macOS
|
||||
self.db_path = os.path.expanduser(
|
||||
"~/Library/Application Support/Cursor/User/globalStorage/state.vscdb"
|
||||
)
|
||||
|
||||
# 检查数据库文件是否存在
|
||||
if not os.path.exists(self.db_path):
|
||||
print(f"{Fore.RED}{EMOJI['ERROR']} {self.translator.get('auth.db_not_found', path=self.db_path)}{Style.RESET_ALL}")
|
||||
return
|
||||
|
||||
# 检查文件权限
|
||||
if not os.access(self.db_path, os.R_OK | os.W_OK):
|
||||
print(f"{Fore.RED}{EMOJI['ERROR']} {self.translator.get('auth.db_permission_error')}{Style.RESET_ALL}")
|
||||
return
|
||||
|
||||
try:
|
||||
self.conn = sqlite3.connect(self.db_path)
|
||||
print(f"{Fore.GREEN}{EMOJI['SUCCESS']} {self.translator.get('auth.connected_to_database')}{Style.RESET_ALL}")
|
||||
except sqlite3.Error as e:
|
||||
print(f"{Fore.RED}{EMOJI['ERROR']} {self.translator.get('auth.db_connection_error', error=str(e))}{Style.RESET_ALL}")
|
||||
return
|
||||
|
||||
def update_auth(self, email=None, access_token=None, refresh_token=None):
|
||||
conn = None
|
||||
try:
|
||||
|
||||
@@ -49,6 +49,9 @@ class CursorRegistration:
|
||||
self.password = self._generate_password()
|
||||
self.first_name = self._generate_name()
|
||||
self.last_name = self._generate_name()
|
||||
print(f"Password: {self.password}\n")
|
||||
print(f"First Name: {self.first_name}\n")
|
||||
print(f"Last Name: {self.last_name}\n")
|
||||
|
||||
def _generate_password(self, length=12):
|
||||
"""Generate Random Password"""
|
||||
@@ -65,269 +68,75 @@ class CursorRegistration:
|
||||
"""设置邮箱"""
|
||||
try:
|
||||
print(f"{Fore.CYAN}{EMOJI['START']} {self.translator.get('register.browser_start')}...{Style.RESET_ALL}")
|
||||
self.browser = self.browser_manager.init_browser()
|
||||
self.controller = BrowserControl(self.browser, self.translator)
|
||||
|
||||
# 打开邮箱生成器页面(第一个标签页)
|
||||
self.controller.navigate_to(self.mail_url)
|
||||
self.email_tab = self.browser # 保存邮箱标签页
|
||||
self.controller.email_tab = self.email_tab # 同时保存到controller
|
||||
# 使用 new_tempemail 创建临时邮箱,传入 translator
|
||||
from new_tempemail import NewTempEmail
|
||||
self.temp_email = NewTempEmail(self.translator) # 传入 translator
|
||||
|
||||
# 生成新邮箱
|
||||
self.controller.generate_new_email()
|
||||
# 创建临时邮箱
|
||||
email_address = self.temp_email.create_email()
|
||||
if not email_address:
|
||||
print(f"{Fore.RED}{EMOJI['ERROR']} {self.translator.get('register.email_create_failed')}{Style.RESET_ALL}")
|
||||
return False
|
||||
|
||||
# 选择随机域名
|
||||
self.controller.select_email_domain()
|
||||
# 保存邮箱地址
|
||||
self.email_address = email_address
|
||||
print(f"Email Address: {self.email_address}\n")
|
||||
self.email_tab = self.temp_email # 传递 NewTempEmail 实例
|
||||
|
||||
# 获取邮箱地址
|
||||
self.email_address = self.controller.copy_and_get_email()
|
||||
if self.email_address:
|
||||
print(f"{EMOJI['MAIL']}{Fore.CYAN} {self.translator.get('register.get_email_address')}: {self.email_address}{Style.RESET_ALL}")
|
||||
|
||||
# 进入邮箱
|
||||
if self.controller.view_mailbox():
|
||||
return True
|
||||
|
||||
return False
|
||||
return True
|
||||
|
||||
except Exception as e:
|
||||
print(f"{Fore.RED}{EMOJI['ERROR']} {self.translator.get('register.setup_error', error=str(e))}{Style.RESET_ALL}")
|
||||
print(f"{Fore.RED}{EMOJI['ERROR']} {self.translator.get('register.email_setup_failed', error=str(e))}{Style.RESET_ALL}")
|
||||
return False
|
||||
|
||||
def register_cursor(self):
|
||||
"""注册 Cursor"""
|
||||
signup_browser_manager = None
|
||||
browser_tab = None
|
||||
try:
|
||||
print(f"{Fore.CYAN}{EMOJI['START']} {self.translator.get('register.register_start')}...{Style.RESET_ALL}")
|
||||
|
||||
# 创建新的浏览器实例用于注册
|
||||
from browser import BrowserManager
|
||||
signup_browser_manager = BrowserManager(noheader=False)
|
||||
self.signup_tab = signup_browser_manager.init_browser()
|
||||
# 直接使用 new_signup.py 进行注册
|
||||
from new_signup import main as new_signup_main
|
||||
|
||||
# 访问注册页面
|
||||
self.signup_tab.get(self.sign_up_url)
|
||||
time.sleep(2)
|
||||
|
||||
# 填写注册表单
|
||||
if self.signup_tab.ele("@name=first_name"):
|
||||
print(f"{Fore.CYAN}{EMOJI['FORM']} {self.translator.get('register.filling_form')}...{Style.RESET_ALL}")
|
||||
|
||||
self.signup_tab.ele("@name=first_name").input(self.first_name)
|
||||
time.sleep(random.uniform(1, 2))
|
||||
|
||||
self.signup_tab.ele("@name=last_name").input(self.last_name)
|
||||
time.sleep(random.uniform(1, 2))
|
||||
|
||||
self.signup_tab.ele("@name=email").input(self.email_address)
|
||||
time.sleep(random.uniform(1, 2))
|
||||
|
||||
self.signup_tab.ele("@type=submit").click()
|
||||
print(f"{Fore.GREEN}{EMOJI['SUCCESS']} {self.translator.get('register.basic_info_submitted')}...{Style.RESET_ALL}")
|
||||
|
||||
# 处理 Turnstile 验证
|
||||
self._handle_turnstile()
|
||||
|
||||
# 设置密码
|
||||
if self.signup_tab.ele("@name=password"):
|
||||
print(f"{Fore.CYAN}{EMOJI['PASSWORD']} {self.translator.get('register.set_password')}...{Style.RESET_ALL}")
|
||||
self.signup_tab.ele("@name=password").input(self.password)
|
||||
time.sleep(random.uniform(1, 2))
|
||||
self.signup_tab.ele("@type=submit").click()
|
||||
# 执行新的注册流程,传入 translator
|
||||
result, browser_tab = new_signup_main(
|
||||
email=self.email_address,
|
||||
password=self.password,
|
||||
first_name=self.first_name,
|
||||
last_name=self.last_name,
|
||||
email_tab=self.email_tab,
|
||||
controller=self.controller,
|
||||
translator=self.translator
|
||||
)
|
||||
|
||||
self._handle_turnstile()
|
||||
|
||||
# 等待并获取验证码
|
||||
time.sleep(5) # 等待验证码邮件
|
||||
|
||||
self.browser.refresh()
|
||||
if result:
|
||||
# 使用返回的浏览器实例获取账户信息
|
||||
self.signup_tab = browser_tab # 保存浏览器实例
|
||||
success = self._get_account_info()
|
||||
|
||||
# 获取信息后关闭浏览器
|
||||
if browser_tab:
|
||||
try:
|
||||
browser_tab.quit()
|
||||
except:
|
||||
pass
|
||||
|
||||
return success
|
||||
|
||||
# 获取验证码,设置60秒超时
|
||||
verification_code = None
|
||||
max_attempts = 20 # 增加到10次尝试
|
||||
retry_interval = 10 # 每5秒重试一次
|
||||
start_time = time.time()
|
||||
timeout = 160 # 60秒超时
|
||||
|
||||
print(f"{Fore.CYAN}{EMOJI['WAIT']} {self.translator.get('register.start_getting_verification_code')}...{Style.RESET_ALL}")
|
||||
return False
|
||||
|
||||
for attempt in range(max_attempts):
|
||||
# 检查是否超时
|
||||
if time.time() - start_time > timeout:
|
||||
print(f"{Fore.RED}{EMOJI['ERROR']} {self.translator.get('register.get_verification_code_timeout')}...{Style.RESET_ALL}")
|
||||
break
|
||||
|
||||
verification_code = self.controller.get_verification_code()
|
||||
if verification_code:
|
||||
print(f"{Fore.GREEN}{EMOJI['SUCCESS']} {self.translator.get('register.get_verification_code_success')}: {verification_code}{Style.RESET_ALL}")
|
||||
break
|
||||
|
||||
remaining_time = int(timeout - (time.time() - start_time))
|
||||
print(f"{Fore.YELLOW}{EMOJI['WAIT']} {self.translator.get('register.try_get_verification_code', attempt=attempt + 1, remaining_time=remaining_time)}...{Style.RESET_ALL}")
|
||||
|
||||
# 刷新邮箱
|
||||
self.browser.refresh()
|
||||
time.sleep(retry_interval)
|
||||
|
||||
if verification_code:
|
||||
# 在注册页面填写验证码
|
||||
for i, digit in enumerate(verification_code):
|
||||
self.signup_tab.ele(f"@data-index={i}").input(digit)
|
||||
time.sleep(random.uniform(0.1, 0.3))
|
||||
|
||||
print(f"{Fore.GREEN}{EMOJI['SUCCESS']} {self.translator.get('register.verification_code_filled')}...{Style.RESET_ALL}")
|
||||
time.sleep(3)
|
||||
|
||||
self._handle_turnstile()
|
||||
|
||||
# 检查当前URL
|
||||
current_url = self.signup_tab.url
|
||||
if "authenticator.cursor.sh" in current_url:
|
||||
print(f"{Fore.CYAN}{EMOJI['VERIFY']} {self.translator.get('register.detect_login_page')}...{Style.RESET_ALL}")
|
||||
|
||||
# 填写邮箱
|
||||
email_input = self.signup_tab.ele('@name=email')
|
||||
if email_input:
|
||||
email_input.input(self.email_address)
|
||||
time.sleep(random.uniform(1, 2))
|
||||
|
||||
# 点击提交
|
||||
submit_button = self.signup_tab.ele('@type=submit')
|
||||
if submit_button:
|
||||
submit_button.click()
|
||||
time.sleep(2)
|
||||
|
||||
# 处理 Turnstile 验证
|
||||
self._handle_turnstile()
|
||||
|
||||
# 填写密码
|
||||
password_input = self.signup_tab.ele('@name=password')
|
||||
if password_input:
|
||||
password_input.input(self.password)
|
||||
time.sleep(random.uniform(1, 2))
|
||||
|
||||
# 点击提交
|
||||
submit_button = self.signup_tab.ele('@type=submit')
|
||||
if submit_button:
|
||||
submit_button.click()
|
||||
time.sleep(2)
|
||||
|
||||
# 处理 Turnstile 验证
|
||||
self._handle_turnstile()
|
||||
|
||||
# 等待跳转到设置页面
|
||||
max_wait = 30
|
||||
start_time = time.time()
|
||||
while time.time() - start_time < max_wait:
|
||||
if "cursor.com/settings" in self.signup_tab.url:
|
||||
print(f"{Fore.GREEN}{EMOJI['SUCCESS']} {self.translator.get('register.login_success_and_jump_to_settings_page')}...{Style.RESET_ALL}")
|
||||
break
|
||||
time.sleep(1)
|
||||
|
||||
# 获取账户信息
|
||||
result = self._get_account_info()
|
||||
|
||||
# 关闭注册窗口
|
||||
if signup_browser_manager:
|
||||
signup_browser_manager.quit()
|
||||
|
||||
return result
|
||||
else:
|
||||
print(f"{Fore.RED}{EMOJI['ERROR']} {self.translator.get('register.get_verification_code_timeout')}...{Style.RESET_ALL}")
|
||||
return False
|
||||
|
||||
except Exception as e:
|
||||
print(f"{Fore.RED}{EMOJI['ERROR']} {self.translator.get('register.register_process_error', error=str(e))}{Style.RESET_ALL}")
|
||||
return False
|
||||
finally:
|
||||
# 确保在任何情况下都关闭注册窗口
|
||||
if signup_browser_manager:
|
||||
signup_browser_manager.quit()
|
||||
|
||||
def _handle_turnstile(self):
|
||||
"""处理 Turnstile 验证"""
|
||||
try:
|
||||
print(f"{Fore.YELLOW}{EMOJI['VERIFY']} {self.translator.get('register.handle_turnstile')}...{Style.RESET_ALL}")
|
||||
|
||||
max_retries = 2
|
||||
retry_interval = (1, 2)
|
||||
retry_count = 0
|
||||
|
||||
while retry_count < max_retries:
|
||||
retry_count += 1
|
||||
print(f"{Fore.CYAN}{EMOJI['INFO']} {self.translator.get('register.turnstile_attempt', attempt=retry_count)}...{Style.RESET_ALL}")
|
||||
|
||||
# 确保在任何情况下都关闭浏览器
|
||||
if browser_tab:
|
||||
try:
|
||||
# 尝试重置 turnstile
|
||||
self.signup_tab.run_js("try { turnstile.reset() } catch(e) { }")
|
||||
time.sleep(2)
|
||||
|
||||
# 定位验证框元素
|
||||
challenge_check = (
|
||||
self.signup_tab.ele("@id=cf-turnstile", timeout=2)
|
||||
.child()
|
||||
.shadow_root.ele("tag:iframe")
|
||||
.ele("tag:body")
|
||||
.sr("tag:input")
|
||||
)
|
||||
|
||||
if challenge_check:
|
||||
print(f"{Fore.CYAN}{EMOJI['INFO']} {self.translator.get('register.turnstile_detected')}...{Style.RESET_ALL}")
|
||||
|
||||
# 随机延时后点击验证
|
||||
time.sleep(random.uniform(1, 3))
|
||||
challenge_check.click()
|
||||
time.sleep(2)
|
||||
|
||||
# 检查验证结果
|
||||
if self._check_verification_success():
|
||||
print(f"{Fore.GREEN}{EMOJI['SUCCESS']} {self.translator.get('register.turnstile_passed')}{Style.RESET_ALL}")
|
||||
return True
|
||||
|
||||
except Exception as e:
|
||||
print(f"{Fore.YELLOW}{EMOJI['INFO']} {self.translator.get('register.turnstile_attempt_failed', error=str(e))}{Style.RESET_ALL}")
|
||||
|
||||
# 检查是否已经验证成功
|
||||
if self._check_verification_success():
|
||||
print(f"{Fore.GREEN}{EMOJI['SUCCESS']} {self.translator.get('register.turnstile_passed')}{Style.RESET_ALL}")
|
||||
return True
|
||||
|
||||
# 随机延时后继续下一次尝试
|
||||
time.sleep(random.uniform(*retry_interval))
|
||||
|
||||
# 超出最大重试次数
|
||||
print(f"{Fore.RED}{EMOJI['ERROR']} {self.translator.get('register.turnstile_max_retries', max=max_retries)}{Style.RESET_ALL}")
|
||||
return False
|
||||
|
||||
except Exception as e:
|
||||
print(f"{Fore.RED}{EMOJI['ERROR']} {self.translator.get('register.turnstile_error', error=str(e))}{Style.RESET_ALL}")
|
||||
return False
|
||||
|
||||
def _check_verification_success(self):
|
||||
"""检查验证是否成功"""
|
||||
try:
|
||||
# 检查是否存在后续表单元素,这表示验证已通过
|
||||
if (self.signup_tab.ele("@name=password", timeout=0.5) or
|
||||
self.signup_tab.ele("@name=email", timeout=0.5) or
|
||||
self.signup_tab.ele("@data-index=0", timeout=0.5) or
|
||||
self.signup_tab.ele("Account Settings", timeout=0.5)):
|
||||
return True
|
||||
|
||||
# 检查是否出现错误消息
|
||||
error_messages = [
|
||||
'xpath://div[contains(text(), "Can\'t verify the user is human")]',
|
||||
'xpath://div[contains(text(), "Error: 600010")]',
|
||||
'xpath://div[contains(text(), "Please try again")]'
|
||||
]
|
||||
|
||||
for error_xpath in error_messages:
|
||||
if self.signup_tab.ele(error_xpath):
|
||||
return False
|
||||
browser_tab.quit()
|
||||
except:
|
||||
pass
|
||||
|
||||
return False
|
||||
except:
|
||||
return False
|
||||
|
||||
def _get_account_info(self):
|
||||
"""获取账户信息和 Token"""
|
||||
try:
|
||||
@@ -344,6 +153,7 @@ class CursorRegistration:
|
||||
if usage_ele:
|
||||
total_usage = usage_ele.text.split("/")[-1].strip()
|
||||
|
||||
print(f"Total Usage: {total_usage}\n")
|
||||
print(f"{Fore.CYAN}{EMOJI['WAIT']} {self.translator.get('register.get_token')}...{Style.RESET_ALL}")
|
||||
max_attempts = 30
|
||||
retry_interval = 2
|
||||
@@ -420,8 +230,12 @@ class CursorRegistration:
|
||||
return True
|
||||
return False
|
||||
finally:
|
||||
if self.browser_manager:
|
||||
self.browser_manager.quit()
|
||||
# 关闭邮箱标签页
|
||||
if hasattr(self, 'temp_email'):
|
||||
try:
|
||||
self.temp_email.close()
|
||||
except:
|
||||
pass
|
||||
|
||||
def update_cursor_auth(self, email=None, access_token=None, refresh_token=None):
|
||||
"""更新Cursor的认证信息的便捷函数"""
|
||||
|
||||
265
cursor_register_manual.py
Normal file
@@ -0,0 +1,265 @@
|
||||
import os
|
||||
from colorama import Fore, Style, init
|
||||
import time
|
||||
import random
|
||||
from browser import BrowserManager
|
||||
from control import BrowserControl
|
||||
from cursor_auth import CursorAuth
|
||||
from reset_machine_manual import MachineIDResetter
|
||||
|
||||
os.environ["PYTHONVERBOSE"] = "0"
|
||||
os.environ["PYINSTALLER_VERBOSE"] = "0"
|
||||
|
||||
# Initialize colorama
|
||||
init()
|
||||
|
||||
# Define emoji constants
|
||||
EMOJI = {
|
||||
'START': '🚀',
|
||||
'FORM': '📝',
|
||||
'VERIFY': '🔄',
|
||||
'PASSWORD': '🔑',
|
||||
'CODE': '📱',
|
||||
'DONE': '✨',
|
||||
'ERROR': '❌',
|
||||
'WAIT': '⏳',
|
||||
'SUCCESS': '✅',
|
||||
'MAIL': '📧',
|
||||
'KEY': '🔐',
|
||||
'UPDATE': '🔄',
|
||||
'INFO': 'ℹ️'
|
||||
}
|
||||
|
||||
class CursorRegistration:
|
||||
def __init__(self, translator=None):
|
||||
self.translator = translator
|
||||
# Set to display mode
|
||||
os.environ['BROWSER_HEADLESS'] = 'False'
|
||||
self.browser_manager = BrowserManager()
|
||||
self.browser = None
|
||||
self.controller = None
|
||||
self.sign_up_url = "https://authenticator.cursor.sh/sign-up"
|
||||
self.settings_url = "https://www.cursor.com/settings"
|
||||
self.email_address = None
|
||||
self.signup_tab = None
|
||||
self.email_tab = None
|
||||
|
||||
# Account information
|
||||
self.password = self._generate_password()
|
||||
self.first_name = self._generate_name()
|
||||
self.last_name = self._generate_name()
|
||||
print(f"Password: {self.password}\n")
|
||||
print(f"First Name: {self.first_name}\n")
|
||||
print(f"Last Name: {self.last_name}\n")
|
||||
|
||||
def _generate_password(self, length=12):
|
||||
"""Generate Random Password"""
|
||||
chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*"
|
||||
return ''.join(random.choices(chars, k=length))
|
||||
|
||||
def _generate_name(self, length=6):
|
||||
"""Generate Random Name"""
|
||||
first_letter = random.choice("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
|
||||
rest_letters = ''.join(random.choices("abcdefghijklmnopqrstuvwxyz", k=length-1))
|
||||
return first_letter + rest_letters
|
||||
|
||||
def setup_email(self):
|
||||
"""Setup Email"""
|
||||
try:
|
||||
print(f"{Fore.CYAN}{EMOJI['START']} {self.translator.get('register.manual_email_input') if self.translator else 'Please enter your email address:'}")
|
||||
self.email_address = input().strip()
|
||||
|
||||
if '@' not in self.email_address:
|
||||
print(f"{Fore.RED}{EMOJI['ERROR']} {self.translator.get('register.invalid_email') if self.translator else '无效的邮箱地址'}{Style.RESET_ALL}")
|
||||
return False
|
||||
|
||||
print(f"Email Address: {self.email_address}\n")
|
||||
return True
|
||||
|
||||
except Exception as e:
|
||||
print(f"{Fore.RED}{EMOJI['ERROR']} {self.translator.get('register.email_setup_failed', error=str(e))}{Style.RESET_ALL}")
|
||||
return False
|
||||
|
||||
def get_verification_code(self):
|
||||
"""Manually Get Verification Code"""
|
||||
try:
|
||||
print(f"{Fore.CYAN}{EMOJI['CODE']} {self.translator.get('register.manual_code_input') if self.translator else 'Please enter the verification code:'}")
|
||||
code = input().strip()
|
||||
|
||||
if not code.isdigit() or len(code) != 6:
|
||||
print(f"{Fore.RED}{EMOJI['ERROR']} {self.translator.get('register.invalid_code') if self.translator else '无效的验证码'}{Style.RESET_ALL}")
|
||||
return None
|
||||
|
||||
return code
|
||||
|
||||
except Exception as e:
|
||||
print(f"{Fore.RED}{EMOJI['ERROR']} {self.translator.get('register.code_input_failed', error=str(e))}{Style.RESET_ALL}")
|
||||
return None
|
||||
|
||||
def register_cursor(self):
|
||||
"""Register Cursor"""
|
||||
browser_tab = None
|
||||
try:
|
||||
print(f"{Fore.CYAN}{EMOJI['START']} {self.translator.get('register.register_start')}...{Style.RESET_ALL}")
|
||||
|
||||
# Use new_signup.py directly for registration
|
||||
from new_signup import main as new_signup_main
|
||||
|
||||
# Execute new registration process, passing translator
|
||||
result, browser_tab = new_signup_main(
|
||||
email=self.email_address,
|
||||
password=self.password,
|
||||
first_name=self.first_name,
|
||||
last_name=self.last_name,
|
||||
email_tab=None, # No email tab needed
|
||||
controller=self, # Pass self instead of self.controller
|
||||
translator=self.translator
|
||||
)
|
||||
|
||||
if result:
|
||||
# Use the returned browser instance to get account information
|
||||
self.signup_tab = browser_tab # Save browser instance
|
||||
success = self._get_account_info()
|
||||
|
||||
# Close browser after getting information
|
||||
if browser_tab:
|
||||
try:
|
||||
browser_tab.quit()
|
||||
except:
|
||||
pass
|
||||
|
||||
return success
|
||||
|
||||
return False
|
||||
|
||||
except Exception as e:
|
||||
print(f"{Fore.RED}{EMOJI['ERROR']} {self.translator.get('register.register_process_error', error=str(e))}{Style.RESET_ALL}")
|
||||
return False
|
||||
finally:
|
||||
# Ensure browser is closed in any case
|
||||
if browser_tab:
|
||||
try:
|
||||
browser_tab.quit()
|
||||
except:
|
||||
pass
|
||||
|
||||
def _get_account_info(self):
|
||||
"""Get Account Information and Token"""
|
||||
try:
|
||||
self.signup_tab.get(self.settings_url)
|
||||
time.sleep(2)
|
||||
|
||||
usage_selector = (
|
||||
"css:div.col-span-2 > div > div > div > div > "
|
||||
"div:nth-child(1) > div.flex.items-center.justify-between.gap-2 > "
|
||||
"span.font-mono.text-sm\\/\\[0\\.875rem\\]"
|
||||
)
|
||||
usage_ele = self.signup_tab.ele(usage_selector)
|
||||
total_usage = "未知"
|
||||
if usage_ele:
|
||||
total_usage = usage_ele.text.split("/")[-1].strip()
|
||||
|
||||
print(f"Total Usage: {total_usage}\n")
|
||||
print(f"{Fore.CYAN}{EMOJI['WAIT']} {self.translator.get('register.get_token')}...{Style.RESET_ALL}")
|
||||
max_attempts = 30
|
||||
retry_interval = 2
|
||||
attempts = 0
|
||||
|
||||
while attempts < max_attempts:
|
||||
try:
|
||||
cookies = self.signup_tab.cookies()
|
||||
for cookie in cookies:
|
||||
if cookie.get("name") == "WorkosCursorSessionToken":
|
||||
token = cookie["value"].split("%3A%3A")[1]
|
||||
print(f"{Fore.GREEN}{EMOJI['SUCCESS']} {self.translator.get('register.token_success')}{Style.RESET_ALL}")
|
||||
self._save_account_info(token, total_usage)
|
||||
return True
|
||||
|
||||
attempts += 1
|
||||
if attempts < max_attempts:
|
||||
print(f"{Fore.YELLOW}{EMOJI['WAIT']} {self.translator.get('register.token_attempt', attempt=attempts, time=retry_interval)}{Style.RESET_ALL}")
|
||||
time.sleep(retry_interval)
|
||||
else:
|
||||
print(f"{Fore.RED}{EMOJI['ERROR']} {self.translator.get('register.token_max_attempts', max=max_attempts)}{Style.RESET_ALL}")
|
||||
|
||||
except Exception as e:
|
||||
print(f"{Fore.RED}{EMOJI['ERROR']} {self.translator.get('register.token_failed', error=str(e))}{Style.RESET_ALL}")
|
||||
attempts += 1
|
||||
if attempts < max_attempts:
|
||||
print(f"{Fore.YELLOW}{EMOJI['WAIT']} {self.translator.get('register.token_attempt', attempt=attempts, time=retry_interval)}{Style.RESET_ALL}")
|
||||
time.sleep(retry_interval)
|
||||
|
||||
return False
|
||||
|
||||
except Exception as e:
|
||||
print(f"{Fore.RED}{EMOJI['ERROR']} {self.translator.get('register.account_error', error=str(e))}{Style.RESET_ALL}")
|
||||
return False
|
||||
|
||||
def _save_account_info(self, token, total_usage):
|
||||
"""Save Account Information to File"""
|
||||
try:
|
||||
# Update authentication information first
|
||||
print(f"{Fore.CYAN}{EMOJI['KEY']} {self.translator.get('register.update_cursor_auth_info')}...{Style.RESET_ALL}")
|
||||
if self.update_cursor_auth(email=self.email_address, access_token=token, refresh_token=token):
|
||||
print(f"{Fore.GREEN}{EMOJI['SUCCESS']} {self.translator.get('register.cursor_auth_info_updated')}...{Style.RESET_ALL}")
|
||||
else:
|
||||
print(f"{Fore.RED}{EMOJI['ERROR']} {self.translator.get('register.cursor_auth_info_update_failed')}...{Style.RESET_ALL}")
|
||||
|
||||
# Reset machine ID
|
||||
print(f"{Fore.CYAN}{EMOJI['UPDATE']} {self.translator.get('register.reset_machine_id')}...{Style.RESET_ALL}")
|
||||
resetter = MachineIDResetter(self.translator) # Create instance with translator
|
||||
if not resetter.reset_machine_ids(): # Call reset_machine_ids method directly
|
||||
raise Exception("Failed to reset machine ID")
|
||||
|
||||
# Save account information to file
|
||||
with open('cursor_accounts.txt', 'a', encoding='utf-8') as f:
|
||||
f.write(f"\n{'='*50}\n")
|
||||
f.write(f"Email: {self.email_address}\n")
|
||||
f.write(f"Password: {self.password}\n")
|
||||
f.write(f"Token: {token}\n")
|
||||
f.write(f"Usage Limit: {total_usage}\n")
|
||||
f.write(f"{'='*50}\n")
|
||||
|
||||
print(f"{Fore.GREEN}{EMOJI['SUCCESS']} {self.translator.get('register.account_info_saved')}...{Style.RESET_ALL}")
|
||||
return True
|
||||
|
||||
except Exception as e:
|
||||
print(f"{Fore.RED}{EMOJI['ERROR']} {self.translator.get('register.save_account_info_failed', error=str(e))}{Style.RESET_ALL}")
|
||||
return False
|
||||
|
||||
def start(self):
|
||||
"""Start Registration Process"""
|
||||
try:
|
||||
if self.setup_email():
|
||||
if self.register_cursor():
|
||||
print(f"\n{Fore.GREEN}{EMOJI['DONE']} {self.translator.get('register.cursor_registration_completed')}...{Style.RESET_ALL}")
|
||||
return True
|
||||
return False
|
||||
finally:
|
||||
# Close email tab
|
||||
if hasattr(self, 'temp_email'):
|
||||
try:
|
||||
self.temp_email.close()
|
||||
except:
|
||||
pass
|
||||
|
||||
def update_cursor_auth(self, email=None, access_token=None, refresh_token=None):
|
||||
"""Convenient function to update Cursor authentication information"""
|
||||
auth_manager = CursorAuth(translator=self.translator)
|
||||
return auth_manager.update_auth(email, access_token, refresh_token)
|
||||
|
||||
def main(translator=None):
|
||||
"""Main function to be called from main.py"""
|
||||
print(f"\n{Fore.CYAN}{'='*50}{Style.RESET_ALL}")
|
||||
print(f"{Fore.CYAN}{EMOJI['START']} {translator.get('register.title')}{Style.RESET_ALL}")
|
||||
print(f"{Fore.CYAN}{'='*50}{Style.RESET_ALL}")
|
||||
|
||||
registration = CursorRegistration(translator)
|
||||
registration.start()
|
||||
|
||||
print(f"\n{Fore.CYAN}{'='*50}{Style.RESET_ALL}")
|
||||
input(f"{EMOJI['INFO']} {translator.get('register.press_enter')}...")
|
||||
|
||||
if __name__ == "__main__":
|
||||
from main import translator as main_translator
|
||||
main(main_translator)
|
||||
135
disable_auto_update.py
Normal file
@@ -0,0 +1,135 @@
|
||||
import os
|
||||
import sys
|
||||
import platform
|
||||
import shutil
|
||||
from colorama import Fore, Style, init
|
||||
import subprocess
|
||||
|
||||
# Initialize colorama
|
||||
init()
|
||||
|
||||
# Define emoji constants
|
||||
EMOJI = {
|
||||
"PROCESS": "🔄",
|
||||
"SUCCESS": "✅",
|
||||
"ERROR": "❌",
|
||||
"INFO": "ℹ️",
|
||||
"FOLDER": "📁",
|
||||
"FILE": "📄",
|
||||
"STOP": "🛑",
|
||||
"CHECK": "✔️"
|
||||
}
|
||||
|
||||
class AutoUpdateDisabler:
|
||||
def __init__(self, translator=None):
|
||||
self.translator = translator
|
||||
self.system = platform.system()
|
||||
self.updater_paths = {
|
||||
"Windows": os.path.join(os.getenv("LOCALAPPDATA", ""), "cursor-updater"),
|
||||
"Darwin": os.path.expanduser("~/Library/Application Support/cursor-updater"),
|
||||
"Linux": os.path.expanduser("~/.config/cursor-updater")
|
||||
}
|
||||
|
||||
def _kill_cursor_processes(self):
|
||||
"""End all Cursor processes"""
|
||||
try:
|
||||
print(f"{Fore.CYAN}{EMOJI['PROCESS']} {self.translator.get('update.killing_processes') if self.translator else '正在结束 Cursor 进程...'}{Style.RESET_ALL}")
|
||||
|
||||
if self.system == "Windows":
|
||||
subprocess.run(['taskkill', '/F', '/IM', 'Cursor.exe', '/T'], capture_output=True)
|
||||
else:
|
||||
subprocess.run(['pkill', '-f', 'Cursor'], capture_output=True)
|
||||
|
||||
print(f"{Fore.GREEN}{EMOJI['SUCCESS']} {self.translator.get('update.processes_killed') if self.translator else 'Cursor 进程已结束'}{Style.RESET_ALL}")
|
||||
return True
|
||||
|
||||
except Exception as e:
|
||||
print(f"{Fore.RED}{EMOJI['ERROR']} {self.translator.get('update.kill_process_failed', error=str(e)) if self.translator else f'结束进程失败: {e}'}{Style.RESET_ALL}")
|
||||
return False
|
||||
|
||||
def _remove_updater_directory(self):
|
||||
"""Delete updater directory"""
|
||||
try:
|
||||
updater_path = self.updater_paths.get(self.system)
|
||||
if not updater_path:
|
||||
raise OSError(self.translator.get('update.unsupported_os', system=self.system) if self.translator else f"不支持的操作系统: {self.system}")
|
||||
|
||||
print(f"{Fore.CYAN}{EMOJI['FOLDER']} {self.translator.get('update.removing_directory') if self.translator else '正在删除更新程序目录...'}{Style.RESET_ALL}")
|
||||
|
||||
if os.path.exists(updater_path):
|
||||
if os.path.isdir(updater_path):
|
||||
shutil.rmtree(updater_path)
|
||||
else:
|
||||
os.remove(updater_path)
|
||||
|
||||
print(f"{Fore.GREEN}{EMOJI['SUCCESS']} {self.translator.get('update.directory_removed') if self.translator else '更新程序目录已删除'}{Style.RESET_ALL}")
|
||||
return True
|
||||
|
||||
except Exception as e:
|
||||
print(f"{Fore.RED}{EMOJI['ERROR']} {self.translator.get('update.remove_directory_failed', error=str(e)) if self.translator else f'删除目录失败: {e}'}{Style.RESET_ALL}")
|
||||
return False
|
||||
|
||||
def _create_blocking_file(self):
|
||||
"""Create blocking file"""
|
||||
try:
|
||||
updater_path = self.updater_paths.get(self.system)
|
||||
if not updater_path:
|
||||
raise OSError(self.translator.get('update.unsupported_os', system=self.system) if self.translator else f"不支持的操作系统: {self.system}")
|
||||
|
||||
print(f"{Fore.CYAN}{EMOJI['FILE']} {self.translator.get('update.creating_block_file') if self.translator else '正在创建阻止文件...'}{Style.RESET_ALL}")
|
||||
|
||||
# Create empty file
|
||||
open(updater_path, 'w').close()
|
||||
|
||||
# Set read-only attribute
|
||||
if self.system == "Windows":
|
||||
os.system(f'attrib +r "{updater_path}"')
|
||||
else:
|
||||
os.chmod(updater_path, 0o444) # Set to read-only
|
||||
|
||||
print(f"{Fore.GREEN}{EMOJI['SUCCESS']} {self.translator.get('update.block_file_created') if self.translator else '阻止文件已创建'}{Style.RESET_ALL}")
|
||||
return True
|
||||
|
||||
except Exception as e:
|
||||
print(f"{Fore.RED}{EMOJI['ERROR']} {self.translator.get('update.create_block_file_failed', error=str(e)) if self.translator else f'创建阻止文件失败: {e}'}{Style.RESET_ALL}")
|
||||
return False
|
||||
|
||||
def disable_auto_update(self):
|
||||
"""Disable auto update"""
|
||||
try:
|
||||
print(f"{Fore.CYAN}{EMOJI['INFO']} {self.translator.get('update.start_disable') if self.translator else '开始禁用自动更新...'}{Style.RESET_ALL}")
|
||||
|
||||
# 1. End processes
|
||||
if not self._kill_cursor_processes():
|
||||
return False
|
||||
|
||||
# 2. Delete directory
|
||||
if not self._remove_updater_directory():
|
||||
return False
|
||||
|
||||
# 3. Create blocking file
|
||||
if not self._create_blocking_file():
|
||||
return False
|
||||
|
||||
print(f"{Fore.GREEN}{EMOJI['CHECK']} {self.translator.get('update.disable_success') if self.translator else '自动更新已禁用'}{Style.RESET_ALL}")
|
||||
return True
|
||||
|
||||
except Exception as e:
|
||||
print(f"{Fore.RED}{EMOJI['ERROR']} {self.translator.get('update.disable_failed', error=str(e)) if self.translator else f'禁用自动更新失败: {e}'}{Style.RESET_ALL}")
|
||||
return False
|
||||
|
||||
def run(translator=None):
|
||||
"""Convenient function for directly calling the disable function"""
|
||||
print(f"\n{Fore.CYAN}{'='*50}{Style.RESET_ALL}")
|
||||
print(f"{Fore.CYAN}{EMOJI['STOP']} {translator.get('update.title') if translator else 'Disable Cursor Auto Update'}{Style.RESET_ALL}")
|
||||
print(f"{Fore.CYAN}{'='*50}{Style.RESET_ALL}")
|
||||
|
||||
disabler = AutoUpdateDisabler(translator)
|
||||
disabler.disable_auto_update()
|
||||
|
||||
print(f"\n{Fore.CYAN}{'='*50}{Style.RESET_ALL}")
|
||||
input(f"{EMOJI['INFO']} {translator.get('update.press_enter') if translator else 'Press Enter to Continue...'}")
|
||||
|
||||
if __name__ == "__main__":
|
||||
from main import translator as main_translator
|
||||
run(main_translator)
|
||||
BIN
images/cloudflare_2025-02-12_13-43-21.png
Normal file
|
After Width: | Height: | Size: 288 KiB |
BIN
images/new_2025-02-27_10-42-44.png
Normal file
|
After Width: | Height: | Size: 116 KiB |
BIN
images/paypal.png
Normal file
|
After Width: | Height: | Size: 32 KiB |
BIN
images/pronew_2025-02-13_15-01-32.png
Normal file
|
After Width: | Height: | Size: 66 KiB |
BIN
images/provi-code.jpg
Normal file
|
After Width: | Height: | Size: 123 KiB |
116
locales/en.json
@@ -2,15 +2,17 @@
|
||||
"menu": {
|
||||
"title": "Available Options",
|
||||
"exit": "Exit Program",
|
||||
"reset": "Reset Machine Manual",
|
||||
"register": "Register Cursor",
|
||||
"quit": "Quit Cursor",
|
||||
"select_language": "Select Language",
|
||||
"input_choice": "Enter your choice ({choices})",
|
||||
"invalid_choice": "Invalid choice. Please try again",
|
||||
"program_terminated": "Program terminated by user",
|
||||
"error_occurred": "An error occurred: {error}",
|
||||
"press_enter": "Press Enter to Exit"
|
||||
"reset": "Reset Machine ID",
|
||||
"register": "Register New Cursor Account",
|
||||
"register_manual": "Register Cursor with Custom Email",
|
||||
"quit": "Close Cursor Application",
|
||||
"select_language": "Change Language",
|
||||
"input_choice": "Please enter your choice ({choices})",
|
||||
"invalid_choice": "Invalid selection. Please enter a number from {choices}",
|
||||
"program_terminated": "Program was terminated by user",
|
||||
"error_occurred": "An error occurred: {error}. Please try again",
|
||||
"press_enter": "Press Enter to Exit",
|
||||
"disable_auto_update": "Disable Cursor Auto-Update"
|
||||
},
|
||||
"languages": {
|
||||
"en": "English",
|
||||
@@ -62,16 +64,33 @@
|
||||
"patch_completed": "Patching getMachineId Completed",
|
||||
"patch_failed": "Patching getMachineId Failed: {error}",
|
||||
"version_check_passed": "Cursor Version Check Passed",
|
||||
"file_modified": "File Modified"
|
||||
"file_modified": "File Modified",
|
||||
"version_less_than_0_45": "Cursor Version < 0.45.0, Skip Patching getMachineId",
|
||||
"detecting_version": "Detecting Cursor Version",
|
||||
"patching_getmachineid": "Patching getMachineId",
|
||||
"version_greater_than_0_45": "Cursor Version >= 0.45.0, Patching getMachineId"
|
||||
},
|
||||
"register": {
|
||||
"title": "Cursor Registration Tool",
|
||||
|
||||
|
||||
"start": "Starting Registration Process",
|
||||
"mailbox": "Successfully Entered Mailbox",
|
||||
"start": "Starting registration process...",
|
||||
"handling_turnstile": "Processing security verification...",
|
||||
"retry_verification": "Retrying verification...",
|
||||
"detect_turnstile": "Checking security verification...",
|
||||
"verification_success": "Security verification successful",
|
||||
"starting_browser": "Opening browser...",
|
||||
"form_success": "Form submitted successfully",
|
||||
"browser_started": "Browser opened successfully",
|
||||
"waiting_for_second_verification": "Waiting for email verification...",
|
||||
"waiting_for_verification_code": "Waiting for verification code...",
|
||||
"password_success": "Password set successfully",
|
||||
"password_error": "Could not set password: {error}. Please try again",
|
||||
"waiting_for_page_load": "Loading page...",
|
||||
"first_verification_passed": "Initial verification successful",
|
||||
"mailbox": "Successfully accessed email inbox",
|
||||
"register_start": "Start Register",
|
||||
"form_submitted": "Form Submitted, Start Verification...",
|
||||
"filling_form": "Fill Form",
|
||||
"visiting_url": "Visiting URL",
|
||||
"basic_info": "Basic Info Submitted",
|
||||
"handle_turnstile": "Handle Turnstile",
|
||||
"no_turnstile": "Not Detect Turnstile",
|
||||
@@ -109,7 +128,10 @@
|
||||
"save_account_info_failed": "Save Account Info Failed",
|
||||
"get_email_address": "Get Email Address",
|
||||
"update_cursor_auth_info": "Update Cursor Auth Info",
|
||||
"register_process_error": "Register Process Error: {error}"
|
||||
"register_process_error": "Register Process Error: {error}",
|
||||
"setting_password": "Setting Password",
|
||||
"manual_code_input": "Manual Code Input",
|
||||
"manual_email_input": "Manual Email Input"
|
||||
},
|
||||
"auth": {
|
||||
"title": "Cursor Auth Manager",
|
||||
@@ -127,10 +149,14 @@
|
||||
"database_connection_closed": "Database Connection Closed",
|
||||
"database_updated_successfully": "Database Updated Successfully",
|
||||
"connected_to_database": "Connected to Database",
|
||||
"updating_pair": "Updating Key-Value Pair"
|
||||
"updating_pair": "Updating Key-Value Pair",
|
||||
"db_not_found": "Database file not found at: {path}",
|
||||
"db_permission_error": "Cannot access database file. Please check permissions",
|
||||
"db_connection_error": "Failed to connect to database: {error}"
|
||||
},
|
||||
"control": {
|
||||
"generate_email": "Generating New Email",
|
||||
"blocked_domain": "Blocked Domain",
|
||||
"select_domain": "Selecting Random Domain",
|
||||
"copy_email": "Copying Email Address",
|
||||
"enter_mailbox": "Entering Mailbox",
|
||||
@@ -158,6 +184,62 @@
|
||||
"get_cursor_session_token_failed": "Get Cursor Session Token Failed",
|
||||
"save_token_failed": "Save Token Failed",
|
||||
"database_updated_successfully": "Database Updated Successfully",
|
||||
"database_connection_closed": "Database Connection Closed"
|
||||
"database_connection_closed": "Database Connection Closed",
|
||||
"no_valid_verification_code": "No Valid Verification Code"
|
||||
},
|
||||
"email": {
|
||||
"starting_browser": "Starting Browser",
|
||||
"visiting_site": "Visiting mail.tm",
|
||||
"create_success": "Email Created Successfully",
|
||||
"create_failed": "Failed to Create Email",
|
||||
"create_error": "Email Creation Error: {error}",
|
||||
"refreshing": "Refreshing Email",
|
||||
"refresh_success": "Email Refreshed Successfully",
|
||||
"refresh_error": "Email Refresh Error: {error}",
|
||||
"refresh_button_not_found": "Refresh Button Not Found",
|
||||
"verification_found": "Verification Found",
|
||||
"verification_not_found": "Verification Not Found",
|
||||
"verification_error": "Verification Error: {error}",
|
||||
"verification_code_found": "Verification Code Found",
|
||||
"verification_code_not_found": "Verification Code Not Found",
|
||||
"verification_code_error": "Verification Code Error: {error}",
|
||||
"address": "Email Address",
|
||||
"all_domains_blocked": "All Domains Blocked, Switching Service",
|
||||
"no_available_domains_after_filtering": "No Available Domains After Filtering",
|
||||
"switching_service": "Switching to {service} Service",
|
||||
"domains_list_error": "Failed to Get Domains List: {error}",
|
||||
"failed_to_get_available_domains": "Failed to Get Available Domains",
|
||||
"domains_excluded": "Domains Excluded: {domains}",
|
||||
"failed_to_create_account": "Failed to Create Account",
|
||||
"account_creation_error": "Account Creation Error: {error}",
|
||||
"blocked_domains": "Blocked Domains: {domains}",
|
||||
"blocked_domains_loaded": "Blocked Domains Loaded: {count}",
|
||||
"blocked_domains_loaded_error": "Blocked Domains Loaded Error: {error}",
|
||||
"blocked_domains_loaded_success": "Blocked Domains Loaded Successfully",
|
||||
"blocked_domains_loaded_timeout": "Blocked Domains Loaded Timeout: {timeout}s",
|
||||
"blocked_domains_loaded_timeout_error": "Blocked Domains Loaded Timeout Error: {error}",
|
||||
"available_domains_loaded": "Available Domains Loaded: {count}",
|
||||
"domains_filtered": "Domains Filtered: {count}"
|
||||
},
|
||||
"update": {
|
||||
"title": "Disable Cursor Auto Update",
|
||||
"disable_success": "Auto Update Disabled Successfully",
|
||||
"disable_failed": "Disable Auto Update Failed: {error}",
|
||||
"press_enter": "Press Enter to Exit",
|
||||
"start_disable": "Start Disabling Auto Update",
|
||||
"killing_processes": "Killing Processes",
|
||||
"processes_killed": "Processes Killed",
|
||||
"removing_directory": "Removing Directory",
|
||||
"directory_removed": "Directory Removed",
|
||||
"creating_block_file": "Creating Block File",
|
||||
"block_file_created": "Block File Created"
|
||||
},
|
||||
"updater": {
|
||||
"checking": "Checking for updates...",
|
||||
"new_version_available": "New version available! (Current: {current}, Latest: {latest})",
|
||||
"updating": "Updating to the latest version. The program will restart automatically.",
|
||||
"up_to_date": "You are using the latest version.",
|
||||
"check_failed": "Failed to check for updates: {error}",
|
||||
"continue_anyway": "Continuing with current version..."
|
||||
}
|
||||
}
|
||||
@@ -3,14 +3,16 @@
|
||||
"title": "可用选项",
|
||||
"exit": "退出程序",
|
||||
"reset": "重置机器标识",
|
||||
"register": "注册 Cursor",
|
||||
"quit": "退出 Cursor",
|
||||
"select_language": "选择语言",
|
||||
"input_choice": "输入选择 ({choices})",
|
||||
"invalid_choice": "无效选择,请重试",
|
||||
"program_terminated": "程序被用户终止",
|
||||
"error_occurred": "发生错误: {error}",
|
||||
"press_enter": "按回车键退出"
|
||||
"register": "注册新 Cursor 账号",
|
||||
"register_manual": "使用自定义邮箱注册",
|
||||
"quit": "关闭 Cursor 应用",
|
||||
"select_language": "更改语言",
|
||||
"input_choice": "请输入您的选择 ({choices})",
|
||||
"invalid_choice": "选择无效,请输入 {choices} 范围内的数字",
|
||||
"program_terminated": "程序已被用户终止",
|
||||
"error_occurred": "发生错误:{error},请重试",
|
||||
"press_enter": "按回车键退出",
|
||||
"disable_auto_update": "禁用 Cursor 自动更新"
|
||||
},
|
||||
"languages": {
|
||||
"en": "English",
|
||||
@@ -62,15 +64,34 @@
|
||||
"patch_completed": "getMachineId修补完成",
|
||||
"patch_failed": "getMachineId修补失败: {error}",
|
||||
"version_check_passed": "Cursor版本检查通过",
|
||||
"file_modified": "文件已修改"
|
||||
"file_modified": "文件已修改",
|
||||
"version_less_than_0_45": "Cursor版本 < 0.45.0,跳过getMachineId修补",
|
||||
"detecting_version": "检测Cursor版本",
|
||||
"patching_getmachineid": "修补getMachineId",
|
||||
"version_greater_than_0_45": "Cursor版本 >= 0.45.0,修补getMachineId"
|
||||
},
|
||||
"register": {
|
||||
"title": "Cursor 注册工具",
|
||||
"start": "开始注册流程",
|
||||
"mailbox": "成功进入邮箱",
|
||||
"start": "正在启动注册流程...",
|
||||
"browser_started": "浏览器已成功打开",
|
||||
"password_success": "密码设置成功",
|
||||
"password_error": "无法设置密码:{error},请重试",
|
||||
"waiting_for_page_load": "页面加载中...",
|
||||
"mailbox": "已成功访问邮箱",
|
||||
"waiting_for_second_verification": "等待邮箱验证...",
|
||||
"waiting_for_verification_code": "等待验证码...",
|
||||
"first_verification_passed": "初始验证通过",
|
||||
"register_start": "开始注册流程",
|
||||
"form_submitted": "表单已提交,开始验证...",
|
||||
"filling_form": "填写注册信息",
|
||||
"visiting_url": "访问URL",
|
||||
"basic_info": "基本信息提交完成",
|
||||
"handling_turnstile": "正在处理安全验证...",
|
||||
"retry_verification": "正在重试验证...",
|
||||
"detect_turnstile": "正在检查安全验证...",
|
||||
"verification_success": "安全验证通过",
|
||||
"starting_browser": "正在打开浏览器...",
|
||||
"form_success": "表单提交成功",
|
||||
"handle_turnstile": "处理 Turnstile 验证",
|
||||
"no_turnstile": "未检测到 Turnstile 验证",
|
||||
"turnstile_passed": "验证通过",
|
||||
@@ -107,7 +128,10 @@
|
||||
"save_account_info_failed": "保存账户信息失败",
|
||||
"get_email_address": "获取邮箱地址",
|
||||
"register_process_error": "注册流程错误: {error}",
|
||||
"update_cursor_auth_info": "更新Cursor认证信息"
|
||||
"update_cursor_auth_info": "更新Cursor认证信息",
|
||||
"setting_password": "设置密码",
|
||||
"manual_code_input": "手动输入验证码",
|
||||
"manual_email_input": "手动输入邮箱"
|
||||
},
|
||||
"auth": {
|
||||
"title": "Cursor 认证管理器",
|
||||
@@ -124,13 +148,17 @@
|
||||
"connected_to_database": "已连接到数据库",
|
||||
"database_updated_successfully": "数据库更新成功",
|
||||
"database_connection_closed": "数据库连接已关闭",
|
||||
"updating_pair": "更新键值对"
|
||||
"updating_pair": "更新键值对",
|
||||
"db_not_found": "未找到数据库文件:{path}",
|
||||
"db_permission_error": "无法访问数据库文件,请检查权限",
|
||||
"db_connection_error": "连接数据库失败:{error}"
|
||||
},
|
||||
"control": {
|
||||
"generate_email": "生成新邮箱",
|
||||
"select_domain": "选择随机域名",
|
||||
"copy_email": "复制邮箱地址",
|
||||
"enter_mailbox": "进入邮箱",
|
||||
"blocked_domain": "被屏蔽的域名",
|
||||
"refresh_mailbox": "刷新邮箱",
|
||||
"check_verification": "检查验证码",
|
||||
"verification_found": "找到验证码",
|
||||
@@ -153,6 +181,62 @@
|
||||
"get_cursor_session_token": "获取Cursor Session Token",
|
||||
"get_cursor_session_token_success": "获取Cursor Session Token成功",
|
||||
"get_cursor_session_token_failed": "获取Cursor Session Token失败",
|
||||
"save_token_failed": "保存Token失败"
|
||||
"save_token_failed": "保存Token失败",
|
||||
"no_valid_verification_code": "没有有效的验证码"
|
||||
},
|
||||
"email": {
|
||||
"starting_browser": "启动浏览器",
|
||||
"visiting_site": "访问 mail.tm",
|
||||
"create_success": "邮箱创建成功",
|
||||
"create_failed": "邮箱创建失败",
|
||||
"create_error": "邮箱创建错误: {error}",
|
||||
"refreshing": "刷新邮箱",
|
||||
"refresh_success": "邮箱刷新成功",
|
||||
"refresh_error": "邮箱刷新错误: {error}",
|
||||
"refresh_button_not_found": "未找到刷新按钮",
|
||||
"verification_found": "找到验证码",
|
||||
"verification_not_found": "未找到验证码",
|
||||
"verification_error": "验证错误: {error}",
|
||||
"verification_code_found": "找到验证码",
|
||||
"verification_code_not_found": "未找到验证码",
|
||||
"verification_code_error": "验证码错误: {error}",
|
||||
"address": "邮箱地址",
|
||||
"all_domains_blocked": "所有域名都被屏蔽了,切换服务",
|
||||
"no_available_domains_after_filtering": "过滤后没有可用域名",
|
||||
"switching_service": "切换到 {service} 服务",
|
||||
"domains_list_error": "获取域名列表失败: {error}",
|
||||
"failed_to_get_available_domains": "获取可用域名失败",
|
||||
"blocked_domains_loaded": "加载了 {count} 个被屏蔽的域名",
|
||||
"domains_excluded": "排除了 {domains} 个被屏蔽的域名",
|
||||
"failed_to_create_account": "创建账户失败",
|
||||
"account_creation_error": "账户创建错误: {error}",
|
||||
"blocked_domains": "被屏蔽的域名: {domains}",
|
||||
"blocked_domains_loaded_error": "加载被屏蔽的域名失败: {error}",
|
||||
"blocked_domains_loaded_success": "加载被屏蔽的域名成功",
|
||||
"blocked_domains_loaded_timeout": "加载被屏蔽的域名超时: {timeout}秒",
|
||||
"blocked_domains_loaded_timeout_error": "加载被屏蔽的域名超时错误: {error}",
|
||||
"available_domains_loaded": "获取到 {count} 个可用域名",
|
||||
"domains_filtered": "过滤后剩餘 {count} 個可用域名"
|
||||
},
|
||||
"update": {
|
||||
"title": "禁用 Cursor 自动更新",
|
||||
"disable_success": "自动更新禁用成功",
|
||||
"disable_failed": "禁用自动更新失败: {error}",
|
||||
"press_enter": "按回车键退出",
|
||||
"start_disable": "开始禁用自动更新",
|
||||
"killing_processes": "杀死进程",
|
||||
"processes_killed": "进程已杀死",
|
||||
"removing_directory": "删除目录",
|
||||
"directory_removed": "目录已删除",
|
||||
"creating_block_file": "创建阻止文件",
|
||||
"block_file_created": "阻止文件已创建"
|
||||
},
|
||||
"updater": {
|
||||
"checking": "检查更新...",
|
||||
"new_version_available": "有新版本可用! (当前版本: {current}, 最新版本: {latest})",
|
||||
"updating": "正在更新到最新版本。程序将自动重启。",
|
||||
"up_to_date": "您使用的是最新版本。",
|
||||
"check_failed": "检查更新失败: {error}",
|
||||
"continue_anyway": "继续使用当前版本..."
|
||||
}
|
||||
}
|
||||
@@ -1,16 +1,18 @@
|
||||
{
|
||||
"menu": {
|
||||
"title": "可用選項",
|
||||
"exit": "退出程序",
|
||||
"reset": "重置機器標識",
|
||||
"register": "註冊 Cursor",
|
||||
"quit": "退出 Cursor",
|
||||
"select_language": "選擇語言",
|
||||
"input_choice": "輸入選擇 ({choices})",
|
||||
"invalid_choice": "無效選擇,請重試",
|
||||
"program_terminated": "程序被用戶終止",
|
||||
"error_occurred": "發生錯誤: {error}",
|
||||
"press_enter": "按回車鍵退出"
|
||||
"exit": "退出程式",
|
||||
"reset": "重置機器識別碼",
|
||||
"register": "註冊新 Cursor 帳號",
|
||||
"register_manual": "使用自訂郵箱註冊",
|
||||
"quit": "關閉 Cursor 應用程式",
|
||||
"select_language": "變更語言",
|
||||
"input_choice": "請輸入您的選擇 ({choices})",
|
||||
"invalid_choice": "選擇無效,請輸入 {choices} 範圍內的數字",
|
||||
"program_terminated": "程式已被使用者終止",
|
||||
"error_occurred": "發生錯誤:{error},請重試",
|
||||
"press_enter": "按返回鍵退出",
|
||||
"disable_auto_update": "停用 Cursor 自動更新"
|
||||
},
|
||||
"languages": {
|
||||
"en": "English",
|
||||
@@ -62,42 +64,38 @@
|
||||
"patch_completed": "getMachineId修補完成",
|
||||
"patch_failed": "getMachineId修補失敗: {error}",
|
||||
"version_check_passed": "Cursor版本檢查通過",
|
||||
"file_modified": "文件已修改"
|
||||
"file_modified": "文件已修改",
|
||||
"version_less_than_0_45": "Cursor版本 < 0.45.0,跳过getMachineId修补",
|
||||
"detecting_version": "檢測Cursor版本",
|
||||
"patching_getmachineid": "修補getMachineId",
|
||||
"version_greater_than_0_45": "Cursor版本 >= 0.45.0,修補getMachineId"
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
"register": {
|
||||
"title": "Cursor 註冊工具",
|
||||
"start": "開始註冊流程",
|
||||
"mailbox": "成功進入郵箱",
|
||||
"start": "正在啟動註冊流程...",
|
||||
"handling_turnstile": "正在處理安全驗證...",
|
||||
"retry_verification": "正在重試驗證...",
|
||||
"detect_turnstile": "正在檢查安全驗證...",
|
||||
"verification_success": "安全驗證通過",
|
||||
"starting_browser": "正在開啟瀏覽器...",
|
||||
"form_success": "表單提交成功",
|
||||
"browser_started": "瀏覽器已成功開啟",
|
||||
"waiting_for_second_verification": "等待郵箱驗證...",
|
||||
"waiting_for_verification_code": "等待驗證碼...",
|
||||
"password_success": "密碼設定成功",
|
||||
"password_error": "無法設定密碼:{error},請重試",
|
||||
"waiting_for_page_load": "頁面載入中...",
|
||||
"first_verification_passed": "初始驗證通過",
|
||||
"mailbox": "已成功存取郵箱",
|
||||
"visiting_url": "訪問URL",
|
||||
"register_start": "開始註冊流程",
|
||||
"form_submitted": "表單已提交,開始驗證...",
|
||||
"filling_form": "填寫註冊信息",
|
||||
"basic_info": "基本信息提交完成",
|
||||
"handle_turnstile": "處理 Turnstile 驗證",
|
||||
"no_turnstile": "未檢測到 Turnstile 驗證",
|
||||
"turnstile_passed": "驗證通過",
|
||||
"verification_start": "開始獲取驗證碼",
|
||||
"verification_timeout": "獲取驗證碼超時",
|
||||
"verification_not_found": "未找到驗證碼",
|
||||
"try_get_code": "第 {attempt} 次嘗試獲取驗證碼 | 剩餘時間: {time}秒",
|
||||
"get_account": "獲取賬戶信息",
|
||||
"get_token": "獲取 Cursor Session Token",
|
||||
"token_success": "Token 獲取成功",
|
||||
"token_attempt": "第 {attempt} 次嘗試未獲取到 Token,{time}秒後重試",
|
||||
"token_max_attempts": "已達到最大嘗試次數({max}),獲取 Token 失敗",
|
||||
"token_failed": "獲取 Token 失敗: {error}",
|
||||
"account_error": "獲取賬戶信息失敗: {error}",
|
||||
"press_enter": "按回車鍵退出",
|
||||
"browser_start": "正在啟動瀏覽器",
|
||||
"open_mailbox": "正在打開郵箱頁面",
|
||||
"email_error": "獲取郵箱地址失敗",
|
||||
"setup_error": "郵箱設置出錯: {error}",
|
||||
"start_getting_verification_code": "開始獲取驗證碼,將在60秒內嘗試...",
|
||||
"get_verification_code_timeout": "獲取驗證碼超時",
|
||||
"get_verification_code_success": "成功獲取驗證碼",
|
||||
"try_get_verification_code": "第 {attempt} 次嘗試未獲取到驗證碼,剩餘時間: {remaining_time}秒",
|
||||
"verification_code_filled": "驗證碼填寫完成",
|
||||
"login_success_and_jump_to_settings_page": "成功登錄並跳轉到設置頁面",
|
||||
"detect_login_page": "檢測到登錄頁面,開始登錄...",
|
||||
@@ -111,7 +109,10 @@
|
||||
"save_account_info_failed": "保存賬戶信息失敗",
|
||||
"get_email_address": "獲取郵箱地址",
|
||||
"register_process_error": "註冊流程錯誤: {error}",
|
||||
"update_cursor_auth_info": "更新Cursor認證信息"
|
||||
"update_cursor_auth_info": "更新Cursor認證信息",
|
||||
"setting_password": "設置密碼",
|
||||
"manual_code_input": "手動輸入驗證碼",
|
||||
"manual_email_input": "手動輸入郵箱地址"
|
||||
},
|
||||
"auth": {
|
||||
"title": "Cursor 認證管理器",
|
||||
@@ -128,7 +129,10 @@
|
||||
"connected_to_database": "已連接到數據庫",
|
||||
"database_updated_successfully": "數據庫更新成功",
|
||||
"database_connection_closed": "數據庫連接已關閉",
|
||||
"updating_pair": "更新鍵值對"
|
||||
"updating_pair": "更新鍵值對",
|
||||
"db_not_found": "未找到數據庫文件:{path}",
|
||||
"db_permission_error": "無法訪問數據庫文件,請檢查權限",
|
||||
"db_connection_error": "連接數據庫失敗:{error}"
|
||||
},
|
||||
"control": {
|
||||
"generate_email": "生成新郵箱",
|
||||
@@ -157,6 +161,63 @@
|
||||
"get_cursor_session_token": "獲取Cursor Session Token",
|
||||
"get_cursor_session_token_success": "獲取Cursor Session Token成功",
|
||||
"get_cursor_session_token_failed": "獲取Cursor Session Token失敗",
|
||||
"save_token_failed": "保存Token失敗"
|
||||
"save_token_failed": "保存Token失敗",
|
||||
"blocked_domain": "被屏蔽的域名",
|
||||
"no_valid_verification_code": "沒有有效的驗證碼"
|
||||
},
|
||||
"email": {
|
||||
"starting_browser": "啟動瀏覽器",
|
||||
"visiting_site": "訪問 mail.tm",
|
||||
"create_success": "郵箱創建成功",
|
||||
"create_failed": "郵箱創建失敗",
|
||||
"create_error": "郵箱創建錯誤: {error}",
|
||||
"refreshing": "刷新郵箱",
|
||||
"refresh_success": "郵箱刷新成功",
|
||||
"refresh_error": "郵箱刷新錯誤: {error}",
|
||||
"refresh_button_not_found": "未找到刷新按鈕",
|
||||
"verification_found": "找到驗證碼",
|
||||
"verification_not_found": "未找到驗證碼",
|
||||
"verification_error": "驗證錯誤: {error}",
|
||||
"verification_code_found": "找到驗證碼",
|
||||
"verification_code_not_found": "未找到驗證碼",
|
||||
"verification_code_error": "驗證碼錯誤: {error}",
|
||||
"address": "郵箱地址",
|
||||
"all_domains_blocked": "所有域名都被屏蔽了,切換服務",
|
||||
"no_available_domains_after_filtering": "過濾後沒有可用域名",
|
||||
"switching_service": "切換到 {service} 服務",
|
||||
"domains_list_error": "獲取域名列表失敗: {error}",
|
||||
"failed_to_get_available_domains": "獲取可用域名失敗",
|
||||
"domains_excluded": "排除的域名: {domains}",
|
||||
"failed_to_create_account": "創建帳戶失敗",
|
||||
"account_creation_error": "帳戶創建錯誤: {error}",
|
||||
"blocked_domains": "被屏蔽的域名: {domains}",
|
||||
"blocked_domains_loaded": "加載被屏蔽的域名: {domains}",
|
||||
"blocked_domains_loaded_error": "加載被屏蔽的域名失敗: {error}",
|
||||
"blocked_domains_loaded_success": "加載被屏蔽的域名成功",
|
||||
"blocked_domains_loaded_timeout": "加載被屏蔽的域名超時: {timeout}秒",
|
||||
"blocked_domains_loaded_timeout_error": "加載被屏蔽的域名超時錯誤: {error}",
|
||||
"available_domains_loaded": "獲取到 {count} 個可用域名",
|
||||
"domains_filtered": "過濾後剩餘 {count} 個可用域名"
|
||||
},
|
||||
"update": {
|
||||
"title": "禁用 Cursor 自动更新",
|
||||
"disable_success": "自動更新禁用成功",
|
||||
"disable_failed": "禁用自動更新失敗: {error}",
|
||||
"press_enter": "按回車鍵退出",
|
||||
"start_disable": "開始禁用自動更新",
|
||||
"killing_processes": "殺死進程",
|
||||
"processes_killed": "進程已殺死",
|
||||
"removing_directory": "刪除目錄",
|
||||
"directory_removed": "目錄已刪除",
|
||||
"creating_block_file": "創建阻止文件",
|
||||
"block_file_created": "阻止文件已創建"
|
||||
},
|
||||
"updater": {
|
||||
"checking": "檢查更新...",
|
||||
"new_version_available": "有新版本可用! (當前版本: {current}, 最新版本: {latest})",
|
||||
"updating": "正在更新到最新版本。程序將自動重啟。",
|
||||
"up_to_date": "您使用的是最新版本。",
|
||||
"check_failed": "檢查更新失敗: {error}",
|
||||
"continue_anyway": "繼續使用當前版本..."
|
||||
}
|
||||
}
|
||||
14
logo.py
@@ -2,17 +2,17 @@ from colorama import Fore, Style, init
|
||||
from dotenv import load_dotenv
|
||||
import os
|
||||
|
||||
# 獲取當前腳本所在目錄
|
||||
# Get the current script directory
|
||||
current_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
# 構建.env文件的完整路徑
|
||||
# Build the full path to the .env file
|
||||
env_path = os.path.join(current_dir, '.env')
|
||||
|
||||
# 加載環境變量,指定.env文件路徑
|
||||
# Load environment variables, specifying the .env file path
|
||||
load_dotenv(env_path)
|
||||
# 獲取版本號,如果未找到則使用默認值
|
||||
# Get the version number, using the default value if not found
|
||||
version = os.getenv('VERSION', '1.0.0')
|
||||
|
||||
# 初始化 colorama
|
||||
# Initialize colorama
|
||||
init()
|
||||
|
||||
CURSOR_LOGO = f"""
|
||||
@@ -27,8 +27,10 @@ CURSOR_LOGO = f"""
|
||||
Pro Version Activator v{version}
|
||||
{Fore.GREEN}
|
||||
Author: Pin Studios | yeongpin
|
||||
|
||||
Github: https://github.com/yeongpin/cursor-free-vip
|
||||
{Fore.RED}
|
||||
Press 4 to change language | 按下 4 键切换语言
|
||||
Press 5 to change language | 按下 5 键切换语言
|
||||
{Style.RESET_ALL}
|
||||
"""
|
||||
|
||||
|
||||
229
main.py
@@ -3,8 +3,18 @@
|
||||
import os
|
||||
import sys
|
||||
import json
|
||||
from logo import print_logo
|
||||
from logo import print_logo, version
|
||||
from colorama import Fore, Style, init
|
||||
import locale
|
||||
import platform
|
||||
import requests
|
||||
import subprocess
|
||||
|
||||
# 只在 Windows 系统上导入 windll
|
||||
if platform.system() == 'Windows':
|
||||
import ctypes
|
||||
# 只在 Windows 上导入 windll
|
||||
from ctypes import windll
|
||||
|
||||
# 初始化colorama
|
||||
init()
|
||||
@@ -19,48 +29,144 @@ EMOJI = {
|
||||
"RESET": "🔄",
|
||||
"MENU": "📋",
|
||||
"ARROW": "➜",
|
||||
"LANG": "🌐"
|
||||
"LANG": "🌐",
|
||||
"UPDATE": "🔄"
|
||||
}
|
||||
|
||||
class Translator:
|
||||
def __init__(self):
|
||||
self.current_language = 'zh_tw' # 默认语言
|
||||
self.translations = {}
|
||||
self.current_language = self.detect_system_language() # 使用正确的方法名
|
||||
self.fallback_language = 'en' # Fallback language if translation is missing
|
||||
self.load_translations()
|
||||
|
||||
def load_translations(self):
|
||||
"""加载所有可用的翻译"""
|
||||
locales_dir = os.path.join(os.path.dirname(__file__), 'locales')
|
||||
if hasattr(sys, '_MEIPASS'):
|
||||
locales_dir = os.path.join(sys._MEIPASS, 'locales')
|
||||
def detect_system_language(self):
|
||||
"""Detect system language and return corresponding language code"""
|
||||
try:
|
||||
system = platform.system()
|
||||
|
||||
for file in os.listdir(locales_dir):
|
||||
if file.endswith('.json'):
|
||||
lang_code = file[:-5] # 移除 .json
|
||||
with open(os.path.join(locales_dir, file), 'r', encoding='utf-8') as f:
|
||||
self.translations[lang_code] = json.load(f)
|
||||
if system == 'Windows':
|
||||
return self._detect_windows_language()
|
||||
else:
|
||||
return self._detect_unix_language()
|
||||
|
||||
except Exception as e:
|
||||
print(f"{Fore.YELLOW}{EMOJI['INFO']} Failed to detect system language: {e}{Style.RESET_ALL}")
|
||||
return 'en'
|
||||
|
||||
def _detect_windows_language(self):
|
||||
"""Detect language on Windows systems"""
|
||||
try:
|
||||
# 确保我们在 Windows 上
|
||||
if platform.system() != 'Windows':
|
||||
return 'en'
|
||||
|
||||
# 获取键盘布局
|
||||
user32 = ctypes.windll.user32
|
||||
hwnd = user32.GetForegroundWindow()
|
||||
threadid = user32.GetWindowThreadProcessId(hwnd, 0)
|
||||
layout_id = user32.GetKeyboardLayout(threadid) & 0xFFFF
|
||||
|
||||
# Map language ID to our language codes
|
||||
language_map = {
|
||||
0x0409: 'en', # English
|
||||
0x0404: 'zh_tw', # Traditional Chinese
|
||||
0x0804: 'zh_cn', # Simplified Chinese
|
||||
}
|
||||
|
||||
return language_map.get(layout_id, 'en')
|
||||
except:
|
||||
return self._detect_unix_language()
|
||||
|
||||
def _detect_unix_language(self):
|
||||
"""Detect language on Unix-like systems (Linux, macOS)"""
|
||||
try:
|
||||
# Get the system locale
|
||||
system_locale = locale.getdefaultlocale()[0]
|
||||
if not system_locale:
|
||||
return 'en'
|
||||
|
||||
system_locale = system_locale.lower()
|
||||
|
||||
# Map locale to our language codes
|
||||
if system_locale.startswith('zh_tw') or system_locale.startswith('zh_hk'):
|
||||
return 'zh_tw'
|
||||
elif system_locale.startswith('zh_cn'):
|
||||
return 'zh_cn'
|
||||
elif system_locale.startswith('en'):
|
||||
return 'en'
|
||||
|
||||
# Try to get language from LANG environment variable as fallback
|
||||
env_lang = os.getenv('LANG', '').lower()
|
||||
if 'tw' in env_lang or 'hk' in env_lang:
|
||||
return 'zh_tw'
|
||||
elif 'cn' in env_lang:
|
||||
return 'zh_cn'
|
||||
|
||||
return 'en'
|
||||
except:
|
||||
return 'en'
|
||||
|
||||
def load_translations(self):
|
||||
"""Load all available translations"""
|
||||
try:
|
||||
locales_dir = os.path.join(os.path.dirname(__file__), 'locales')
|
||||
if hasattr(sys, '_MEIPASS'):
|
||||
locales_dir = os.path.join(sys._MEIPASS, 'locales')
|
||||
|
||||
if not os.path.exists(locales_dir):
|
||||
print(f"{Fore.RED}{EMOJI['ERROR']} Locales directory not found{Style.RESET_ALL}")
|
||||
return
|
||||
|
||||
for file in os.listdir(locales_dir):
|
||||
if file.endswith('.json'):
|
||||
lang_code = file[:-5] # Remove .json
|
||||
try:
|
||||
with open(os.path.join(locales_dir, file), 'r', encoding='utf-8') as f:
|
||||
self.translations[lang_code] = json.load(f)
|
||||
except (json.JSONDecodeError, UnicodeDecodeError) as e:
|
||||
print(f"{Fore.RED}{EMOJI['ERROR']} Error loading {file}: {e}{Style.RESET_ALL}")
|
||||
continue
|
||||
except Exception as e:
|
||||
print(f"{Fore.RED}{EMOJI['ERROR']} Failed to load translations: {e}{Style.RESET_ALL}")
|
||||
|
||||
def get(self, key, **kwargs):
|
||||
"""获取翻译文本"""
|
||||
"""Get translated text with fallback support"""
|
||||
try:
|
||||
# Try current language
|
||||
result = self._get_translation(self.current_language, key)
|
||||
if result == key and self.current_language != self.fallback_language:
|
||||
# Try fallback language if translation not found
|
||||
result = self._get_translation(self.fallback_language, key)
|
||||
return result.format(**kwargs) if kwargs else result
|
||||
except Exception:
|
||||
return key
|
||||
|
||||
def _get_translation(self, lang_code, key):
|
||||
"""Get translation for a specific language"""
|
||||
try:
|
||||
keys = key.split('.')
|
||||
value = self.translations.get(self.current_language, {})
|
||||
value = self.translations.get(lang_code, {})
|
||||
for k in keys:
|
||||
if isinstance(value, dict):
|
||||
value = value.get(k, key)
|
||||
else:
|
||||
return key # 如果中間值不是字典,返回原始key
|
||||
return value.format(**kwargs) if kwargs else value
|
||||
return key
|
||||
return value
|
||||
except Exception:
|
||||
return key # 出現任何錯誤時返回原始key
|
||||
return key
|
||||
|
||||
def set_language(self, lang_code):
|
||||
"""设置当前语言"""
|
||||
"""Set current language with validation"""
|
||||
if lang_code in self.translations:
|
||||
self.current_language = lang_code
|
||||
return True
|
||||
return False
|
||||
|
||||
def get_available_languages(self):
|
||||
"""Get list of available languages"""
|
||||
return list(self.translations.keys())
|
||||
|
||||
# 创建翻译器实例
|
||||
translator = Translator()
|
||||
|
||||
@@ -71,38 +177,72 @@ def print_menu():
|
||||
print(f"{Fore.GREEN}0{Style.RESET_ALL}. {EMOJI['ERROR']} {translator.get('menu.exit')}")
|
||||
print(f"{Fore.GREEN}1{Style.RESET_ALL}. {EMOJI['RESET']} {translator.get('menu.reset')}")
|
||||
print(f"{Fore.GREEN}2{Style.RESET_ALL}. {EMOJI['SUCCESS']} {translator.get('menu.register')}")
|
||||
print(f"{Fore.GREEN}3{Style.RESET_ALL}. {EMOJI['ERROR']} {translator.get('menu.quit')}")
|
||||
print(f"{Fore.GREEN}4{Style.RESET_ALL}. {EMOJI['LANG']} {translator.get('menu.select_language')}")
|
||||
print(f"{Fore.GREEN}3{Style.RESET_ALL}. {EMOJI['SUCCESS']} {translator.get('menu.register_manual')}")
|
||||
print(f"{Fore.GREEN}4{Style.RESET_ALL}. {EMOJI['ERROR']} {translator.get('menu.quit')}")
|
||||
print(f"{Fore.GREEN}5{Style.RESET_ALL}. {EMOJI['LANG']} {translator.get('menu.select_language')}")
|
||||
print(f"{Fore.GREEN}6{Style.RESET_ALL}. {EMOJI['UPDATE']} {translator.get('menu.disable_auto_update')}")
|
||||
print(f"{Fore.YELLOW}{'─' * 40}{Style.RESET_ALL}")
|
||||
|
||||
def select_language():
|
||||
"""语言选择菜单"""
|
||||
"""Language selection menu"""
|
||||
print(f"\n{Fore.CYAN}{EMOJI['LANG']} {translator.get('menu.select_language')}:{Style.RESET_ALL}")
|
||||
print(f"{Fore.YELLOW}{'─' * 40}{Style.RESET_ALL}")
|
||||
|
||||
languages = translator.get('languages')
|
||||
for i, (code, name) in enumerate(languages.items()):
|
||||
print(f"{Fore.GREEN}{i}{Style.RESET_ALL}. {name}")
|
||||
languages = translator.get_available_languages()
|
||||
for i, lang in enumerate(languages):
|
||||
lang_name = translator.get(f"languages.{lang}")
|
||||
print(f"{Fore.GREEN}{i}{Style.RESET_ALL}. {lang_name}")
|
||||
|
||||
try:
|
||||
choice = input(f"\n{EMOJI['ARROW']} {Fore.CYAN}{translator.get('menu.input_choice', choices='0-' + str(len(languages)-1))}: {Style.RESET_ALL}")
|
||||
choice = input(f"\n{EMOJI['ARROW']} {Fore.CYAN}{translator.get('menu.input_choice', choices=f'0-{len(languages)-1}')}: {Style.RESET_ALL}")
|
||||
if choice.isdigit() and 0 <= int(choice) < len(languages):
|
||||
lang_code = list(languages.keys())[int(choice)]
|
||||
translator.set_language(lang_code)
|
||||
translator.set_language(languages[int(choice)])
|
||||
return True
|
||||
else:
|
||||
print(f"{Fore.RED}{EMOJI['ERROR']} {translator.get('menu.invalid_choice')}{Style.RESET_ALL}")
|
||||
return False
|
||||
except (ValueError, IndexError):
|
||||
pass
|
||||
|
||||
print(f"{Fore.RED}{EMOJI['ERROR']} {translator.get('menu.invalid_choice')}{Style.RESET_ALL}")
|
||||
return False
|
||||
print(f"{Fore.RED}{EMOJI['ERROR']} {translator.get('menu.invalid_choice')}{Style.RESET_ALL}")
|
||||
return False
|
||||
|
||||
def check_latest_version():
|
||||
"""Check if current version matches the latest release version"""
|
||||
try:
|
||||
print(f"\n{Fore.CYAN}{EMOJI['UPDATE']} {translator.get('updater.checking')}{Style.RESET_ALL}")
|
||||
|
||||
# Get latest version from GitHub API with timeout
|
||||
response = requests.get("https://api.github.com/repos/yeongpin/cursor-free-vip/releases/latest", timeout=5)
|
||||
latest_version = response.json()["tag_name"].lstrip('v')
|
||||
|
||||
if latest_version != version:
|
||||
print(f"\n{Fore.YELLOW}{EMOJI['INFO']} {translator.get('updater.new_version_available', current=version, latest=latest_version)}{Style.RESET_ALL}")
|
||||
|
||||
# Execute update command based on platform
|
||||
if platform.system() == 'Windows':
|
||||
update_command = 'irm https://raw.githubusercontent.com/yeongpin/cursor-free-vip/main/scripts/install.ps1 | iex'
|
||||
subprocess.run(['powershell', '-NoProfile', '-ExecutionPolicy', 'Bypass', '-Command', update_command], check=True)
|
||||
else:
|
||||
update_command = 'curl -fsSL https://raw.githubusercontent.com/yeongpin/cursor-free-vip/main/scripts/install.sh -o install.sh && chmod +x install.sh && ./install.sh'
|
||||
subprocess.Popen(update_command, shell=True)
|
||||
|
||||
print(f"\n{Fore.GREEN}{EMOJI['SUCCESS']} {translator.get('updater.updating')}{Style.RESET_ALL}")
|
||||
sys.exit(0)
|
||||
else:
|
||||
print(f"{Fore.GREEN}{EMOJI['SUCCESS']} {translator.get('updater.up_to_date')}{Style.RESET_ALL}")
|
||||
|
||||
except Exception as e:
|
||||
print(f"{Fore.RED}{EMOJI['ERROR']} {translator.get('updater.check_failed', error=str(e))}{Style.RESET_ALL}")
|
||||
print(f"{Fore.YELLOW}{EMOJI['INFO']} {translator.get('updater.continue_anyway')}{Style.RESET_ALL}")
|
||||
return # Continue with the program instead of blocking
|
||||
|
||||
def main():
|
||||
print_logo()
|
||||
check_latest_version() # Add version check before showing menu
|
||||
print_menu()
|
||||
|
||||
while True:
|
||||
try:
|
||||
choice = input(f"\n{EMOJI['ARROW']} {Fore.CYAN}{translator.get('menu.input_choice', choices='0-4')}: {Style.RESET_ALL}")
|
||||
choice = input(f"\n{EMOJI['ARROW']} {Fore.CYAN}{translator.get('menu.input_choice', choices='0-6')}: {Style.RESET_ALL}")
|
||||
|
||||
if choice == "0":
|
||||
print(f"\n{Fore.YELLOW}{EMOJI['INFO']} {translator.get('menu.exit')}...{Style.RESET_ALL}")
|
||||
@@ -111,19 +251,27 @@ def main():
|
||||
elif choice == "1":
|
||||
import reset_machine_manual
|
||||
reset_machine_manual.run(translator)
|
||||
break
|
||||
print_menu()
|
||||
elif choice == "2":
|
||||
import cursor_register
|
||||
cursor_register.main(translator)
|
||||
break
|
||||
print_menu()
|
||||
elif choice == "3":
|
||||
import cursor_register_manual
|
||||
cursor_register_manual.main(translator)
|
||||
print_menu()
|
||||
elif choice == "4":
|
||||
import quit_cursor
|
||||
quit_cursor.quit_cursor(translator)
|
||||
break
|
||||
elif choice == "4":
|
||||
print_menu()
|
||||
elif choice == "5":
|
||||
if select_language():
|
||||
print_menu()
|
||||
continue
|
||||
elif choice == "6":
|
||||
import disable_auto_update
|
||||
disable_auto_update.run(translator)
|
||||
print_menu()
|
||||
else:
|
||||
print(f"{Fore.RED}{EMOJI['ERROR']} {translator.get('menu.invalid_choice')}{Style.RESET_ALL}")
|
||||
print_menu()
|
||||
@@ -134,10 +282,7 @@ def main():
|
||||
return
|
||||
except Exception as e:
|
||||
print(f"{Fore.RED}{EMOJI['ERROR']} {translator.get('menu.error_occurred', error=str(e))}{Style.RESET_ALL}")
|
||||
break
|
||||
|
||||
print(f"\n{Fore.CYAN}{'═' * 50}{Style.RESET_ALL}")
|
||||
input(f"{EMOJI['INFO']} {translator.get('menu.press_enter')}...{Style.RESET_ALL}")
|
||||
print_menu()
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
main()
|
||||
588
new_signup.py
Normal file
@@ -0,0 +1,588 @@
|
||||
from DrissionPage import ChromiumOptions, ChromiumPage
|
||||
import time
|
||||
import os
|
||||
import signal
|
||||
import random
|
||||
from colorama import Fore, Style
|
||||
|
||||
# 在文件开头添加全局变量
|
||||
_translator = None
|
||||
|
||||
def cleanup_chrome_processes(translator=None):
|
||||
"""清理所有Chrome相关进程"""
|
||||
print("\n正在清理Chrome进程...")
|
||||
try:
|
||||
if os.name == 'nt':
|
||||
os.system('taskkill /F /IM chrome.exe /T 2>nul')
|
||||
os.system('taskkill /F /IM chromedriver.exe /T 2>nul')
|
||||
else:
|
||||
os.system('pkill -f chrome')
|
||||
os.system('pkill -f chromedriver')
|
||||
except Exception as e:
|
||||
if translator:
|
||||
print(f"{Fore.RED}❌ {translator.get('register.cleanup_error', error=str(e))}{Style.RESET_ALL}")
|
||||
else:
|
||||
print(f"清理进程时出错: {e}")
|
||||
|
||||
def signal_handler(signum, frame):
|
||||
"""处理Ctrl+C信号"""
|
||||
global _translator
|
||||
if _translator:
|
||||
print(f"{Fore.CYAN}{_translator.get('register.exit_signal')}{Style.RESET_ALL}")
|
||||
else:
|
||||
print("\n接收到退出信号,正在关闭...")
|
||||
cleanup_chrome_processes(_translator)
|
||||
os._exit(0)
|
||||
|
||||
def simulate_human_input(page, url, translator=None):
|
||||
"""访问网址"""
|
||||
if translator:
|
||||
print(f"{Fore.CYAN}🚀 {translator.get('register.visiting_url')}: {url}{Style.RESET_ALL}")
|
||||
else:
|
||||
print("正在访问网址...")
|
||||
|
||||
# 先访问空白页面
|
||||
page.get('about:blank')
|
||||
time.sleep(random.uniform(1.0, 2.0))
|
||||
|
||||
# 访问目标页面
|
||||
page.get(url)
|
||||
time.sleep(random.uniform(2.0, 3.0)) # 等待页面加载
|
||||
|
||||
def fill_signup_form(page, first_name, last_name, email, translator=None):
|
||||
"""填写注册表单"""
|
||||
try:
|
||||
if translator:
|
||||
print(f"{Fore.CYAN}📧 {translator.get('register.filling_form')}{Style.RESET_ALL}")
|
||||
else:
|
||||
print("\n正在填写注册表单...")
|
||||
|
||||
# 填写名字
|
||||
first_name_input = page.ele("@name=first_name")
|
||||
if first_name_input:
|
||||
first_name_input.input(first_name)
|
||||
time.sleep(random.uniform(0.5, 1.0))
|
||||
|
||||
# 填写姓氏
|
||||
last_name_input = page.ele("@name=last_name")
|
||||
if last_name_input:
|
||||
last_name_input.input(last_name)
|
||||
time.sleep(random.uniform(0.5, 1.0))
|
||||
|
||||
# 填写邮箱
|
||||
email_input = page.ele("@name=email")
|
||||
if email_input:
|
||||
email_input.input(email)
|
||||
time.sleep(random.uniform(0.5, 1.0))
|
||||
|
||||
# 点击提交按钮
|
||||
submit_button = page.ele("@type=submit")
|
||||
if submit_button:
|
||||
submit_button.click()
|
||||
time.sleep(random.uniform(2.0, 3.0))
|
||||
|
||||
if translator:
|
||||
print(f"{Fore.GREEN}✅ {translator.get('register.form_success')}{Style.RESET_ALL}")
|
||||
else:
|
||||
print("表单填写完成")
|
||||
return True
|
||||
|
||||
except Exception as e:
|
||||
if translator:
|
||||
print(f"{Fore.RED}❌ {translator.get('register.form_error', error=str(e))}{Style.RESET_ALL}")
|
||||
else:
|
||||
print(f"填写表单时出错: {e}")
|
||||
return False
|
||||
|
||||
def setup_driver(translator=None):
|
||||
"""设置浏览器驱动"""
|
||||
co = ChromiumOptions()
|
||||
|
||||
# 使用无痕模式
|
||||
co.set_argument("--incognito")
|
||||
|
||||
# 设置随机端口
|
||||
co.auto_port()
|
||||
|
||||
# 使用有头模式(一定要设置为False,模擬人類操作)
|
||||
co.headless(False)
|
||||
|
||||
try:
|
||||
# 加载插件
|
||||
extension_path = os.path.join(os.getcwd(), "turnstilePatch")
|
||||
if os.path.exists(extension_path):
|
||||
co.set_argument("--allow-extensions-in-incognito")
|
||||
co.add_extension(extension_path)
|
||||
except Exception as e:
|
||||
if translator:
|
||||
print(f"{Fore.RED}❌ {translator.get('register.extension_load_error', error=str(e))}{Style.RESET_ALL}")
|
||||
else:
|
||||
print(f"加载插件失败: {e}")
|
||||
|
||||
if translator:
|
||||
print(f"{Fore.CYAN}🚀 {translator.get('register.starting_browser')}{Style.RESET_ALL}")
|
||||
else:
|
||||
print("正在启动浏览器...")
|
||||
page = ChromiumPage(co)
|
||||
|
||||
return page
|
||||
|
||||
def handle_turnstile(page, translator=None):
|
||||
"""处理 Turnstile 验证"""
|
||||
try:
|
||||
if translator:
|
||||
print(f"{Fore.CYAN}🔄 {translator.get('register.handling_turnstile')}{Style.RESET_ALL}")
|
||||
else:
|
||||
print("\n正在处理 Turnstile 验证...")
|
||||
|
||||
max_retries = 2
|
||||
retry_count = 0
|
||||
|
||||
while retry_count < max_retries:
|
||||
retry_count += 1
|
||||
if translator:
|
||||
print(f"{Fore.CYAN}🔄 {translator.get('register.retry_verification', attempt=retry_count)}{Style.RESET_ALL}")
|
||||
else:
|
||||
print(f"第 {retry_count} 次尝试验证...")
|
||||
|
||||
try:
|
||||
# 尝试重置 turnstile
|
||||
page.run_js("try { turnstile.reset() } catch(e) { }")
|
||||
time.sleep(2)
|
||||
|
||||
# 定位验证框元素
|
||||
challenge_check = (
|
||||
page.ele("@id=cf-turnstile", timeout=2)
|
||||
.child()
|
||||
.shadow_root.ele("tag:iframe")
|
||||
.ele("tag:body")
|
||||
.sr("tag:input")
|
||||
)
|
||||
|
||||
if challenge_check:
|
||||
if translator:
|
||||
print(f"{Fore.CYAN}🔄 {translator.get('register.detect_turnstile')}{Style.RESET_ALL}")
|
||||
else:
|
||||
print("检测到验证框...")
|
||||
|
||||
# 随机延时后点击验证
|
||||
time.sleep(random.uniform(1, 3))
|
||||
challenge_check.click()
|
||||
time.sleep(2)
|
||||
|
||||
# 检查验证结果
|
||||
if check_verification_success(page, translator):
|
||||
if translator:
|
||||
print(f"{Fore.GREEN}✅ {translator.get('register.verification_success')}{Style.RESET_ALL}")
|
||||
else:
|
||||
print("验证通过!")
|
||||
return True
|
||||
|
||||
except Exception as e:
|
||||
if translator:
|
||||
print(f"{Fore.RED}❌ {translator.get('register.verification_failed')}{Style.RESET_ALL}")
|
||||
else:
|
||||
print(f"验证尝试失败: {e}")
|
||||
|
||||
# 检查是否已经验证成功
|
||||
if check_verification_success(page, translator):
|
||||
if translator:
|
||||
print(f"{Fore.GREEN}✅ {translator.get('register.verification_success')}{Style.RESET_ALL}")
|
||||
else:
|
||||
print("验证通过!")
|
||||
return True
|
||||
|
||||
time.sleep(random.uniform(1, 2))
|
||||
|
||||
if translator:
|
||||
print(f"{Fore.RED}❌ {translator.get('register.verification_failed')}{Style.RESET_ALL}")
|
||||
else:
|
||||
print("超出最大重试次数")
|
||||
return False
|
||||
|
||||
except Exception as e:
|
||||
if translator:
|
||||
print(f"{Fore.RED}❌ {translator.get('register.verification_error', error=str(e))}{Style.RESET_ALL}")
|
||||
else:
|
||||
print(f"验证过程出错: {e}")
|
||||
return False
|
||||
|
||||
def check_verification_success(page, translator=None):
|
||||
"""检查验证是否成功"""
|
||||
try:
|
||||
# 检查是否存在后续表单元素,这表示验证已通过
|
||||
if (page.ele("@name=password", timeout=0.5) or
|
||||
page.ele("@name=email", timeout=0.5) or
|
||||
page.ele("@data-index=0", timeout=0.5) or
|
||||
page.ele("Account Settings", timeout=0.5)):
|
||||
return True
|
||||
|
||||
# 检查是否出现错误消息
|
||||
error_messages = [
|
||||
'xpath://div[contains(text(), "Can\'t verify the user is human")]',
|
||||
'xpath://div[contains(text(), "Error: 600010")]',
|
||||
'xpath://div[contains(text(), "Please try again")]'
|
||||
]
|
||||
|
||||
for error_xpath in error_messages:
|
||||
if page.ele(error_xpath):
|
||||
return False
|
||||
|
||||
return False
|
||||
except:
|
||||
return False
|
||||
|
||||
def generate_password(length=12):
|
||||
"""生成随机密码"""
|
||||
chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*"
|
||||
return ''.join(random.choices(chars, k=length))
|
||||
|
||||
def fill_password(page, password, translator=None):
|
||||
"""填写密码"""
|
||||
try:
|
||||
if translator:
|
||||
print(f"{Fore.CYAN}🔑 {translator.get('register.setting_password')}{Style.RESET_ALL}")
|
||||
else:
|
||||
print(f"\n{translator.get('register.setting_password')}")
|
||||
password_input = page.ele("@name=password")
|
||||
if password_input:
|
||||
password_input.input(password)
|
||||
time.sleep(random.uniform(0.5, 1.0))
|
||||
|
||||
submit_button = page.ele("@type=submit")
|
||||
if submit_button:
|
||||
submit_button.click()
|
||||
time.sleep(random.uniform(2.0, 3.0))
|
||||
|
||||
if translator:
|
||||
print(f"{Fore.GREEN}✅ {translator.get('register.password_success')}{Style.RESET_ALL}")
|
||||
else:
|
||||
print(f"{translator.get('register.password_success')}: {password}")
|
||||
return True
|
||||
|
||||
except Exception as e:
|
||||
if translator:
|
||||
print(f"{Fore.RED}❌ {translator.get('register.password_error', error=str(e))}{Style.RESET_ALL}")
|
||||
else:
|
||||
print(f"{translator.get('register.password_error')}: {e}")
|
||||
return False
|
||||
|
||||
def handle_verification_code(browser_tab, email_tab, controller, email, password, translator=None):
|
||||
"""处理验证码"""
|
||||
try:
|
||||
if translator:
|
||||
print(f"\n{Fore.CYAN}{translator.get('register.waiting_for_verification_code')}{Style.RESET_ALL}")
|
||||
else:
|
||||
print(f"\n{translator.get('register.waiting_for_verification_code')}")
|
||||
|
||||
# 检查是否使用手动输入验证码
|
||||
if hasattr(controller, 'get_verification_code') and email_tab is None: # 手动模式
|
||||
verification_code = controller.get_verification_code()
|
||||
if verification_code:
|
||||
# 在注册页面填写验证码
|
||||
for i, digit in enumerate(verification_code):
|
||||
browser_tab.ele(f"@data-index={i}").input(digit)
|
||||
time.sleep(random.uniform(0.1, 0.3))
|
||||
|
||||
print(f"{translator.get('register.verification_success')}")
|
||||
time.sleep(3)
|
||||
|
||||
# 处理最后一次 Turnstile 验证
|
||||
if handle_turnstile(browser_tab, translator):
|
||||
if translator:
|
||||
print(f"{translator.get('register.verification_success')}")
|
||||
else:
|
||||
print(f"{translator.get('register.verification_success')}")
|
||||
time.sleep(2)
|
||||
|
||||
# 访问设置页面
|
||||
print(f"{translator.get('register.visiting_url')}: https://www.cursor.com/settings")
|
||||
browser_tab.get("https://www.cursor.com/settings")
|
||||
time.sleep(3) # 等待页面加载
|
||||
return True, browser_tab
|
||||
|
||||
return False, None
|
||||
|
||||
# 自动获取验证码逻辑
|
||||
elif email_tab:
|
||||
print(f"{translator.get('register.waiting_for_verification_code')}")
|
||||
time.sleep(5) # 等待验证码邮件
|
||||
|
||||
# 使用已有的 email_tab 刷新邮箱
|
||||
email_tab.refresh_inbox()
|
||||
time.sleep(3)
|
||||
|
||||
# 检查邮箱是否有验证码邮件
|
||||
if email_tab.check_for_cursor_email():
|
||||
verification_code = email_tab.get_verification_code()
|
||||
if verification_code:
|
||||
# 在注册页面填写验证码
|
||||
for i, digit in enumerate(verification_code):
|
||||
browser_tab.ele(f"@data-index={i}").input(digit)
|
||||
time.sleep(random.uniform(0.1, 0.3))
|
||||
if translator:
|
||||
print(f"{Fore.GREEN}✅ {translator.get('register.verification_success')}{Style.RESET_ALL}")
|
||||
else:
|
||||
print("验证码填写完成")
|
||||
time.sleep(3)
|
||||
|
||||
# 处理最后一次 Turnstile 验证
|
||||
if handle_turnstile(browser_tab, translator):
|
||||
if translator:
|
||||
print(f"{Fore.GREEN}✅ {translator.get('register.verification_success')}{Style.RESET_ALL}")
|
||||
else:
|
||||
print("最后一次验证通过!")
|
||||
time.sleep(2)
|
||||
|
||||
# 访问设置页面
|
||||
if translator:
|
||||
print(f"{Fore.CYAN}🔑 {translator.get('register.visiting_url')}: https://www.cursor.com/settings{Style.RESET_ALL}")
|
||||
else:
|
||||
print("访问设置页面...")
|
||||
browser_tab.get("https://www.cursor.com/settings")
|
||||
time.sleep(3) # 等待页面加载
|
||||
return True, browser_tab
|
||||
|
||||
else:
|
||||
if translator:
|
||||
print(f"{Fore.RED}❌ {translator.get('register.verification_failed')}{Style.RESET_ALL}")
|
||||
else:
|
||||
print("最后一次验证失败")
|
||||
return False, None
|
||||
|
||||
# 获取验证码,设置超时
|
||||
verification_code = None
|
||||
max_attempts = 20
|
||||
retry_interval = 10
|
||||
start_time = time.time()
|
||||
timeout = 160
|
||||
|
||||
if translator:
|
||||
print(f"{Fore.CYAN}{translator.get('register.start_getting_verification_code')}{Style.RESET_ALL}")
|
||||
else:
|
||||
print("开始获取验证码...")
|
||||
|
||||
for attempt in range(max_attempts):
|
||||
# 检查是否超时
|
||||
if time.time() - start_time > timeout:
|
||||
if translator:
|
||||
print(f"{Fore.RED}❌ {translator.get('register.verification_timeout')}{Style.RESET_ALL}")
|
||||
else:
|
||||
print("获取验证码超时...")
|
||||
break
|
||||
|
||||
verification_code = controller.get_verification_code()
|
||||
if verification_code:
|
||||
if translator:
|
||||
print(f"{Fore.GREEN}✅ {translator.get('register.verification_success')}{Style.RESET_ALL}")
|
||||
else:
|
||||
print(f"成功获取验证码: {verification_code}")
|
||||
break
|
||||
|
||||
remaining_time = int(timeout - (time.time() - start_time))
|
||||
if translator:
|
||||
print(f"{Fore.CYAN}{translator.get('register.try_get_code', attempt=attempt + 1, time=remaining_time)}{Style.RESET_ALL}")
|
||||
else:
|
||||
print(f"第 {attempt + 1} 次尝试获取验证码,剩余时间: {remaining_time}秒...")
|
||||
|
||||
# 刷新邮箱
|
||||
email_tab.refresh_inbox()
|
||||
time.sleep(retry_interval)
|
||||
|
||||
if verification_code:
|
||||
# 在注册页面填写验证码
|
||||
for i, digit in enumerate(verification_code):
|
||||
browser_tab.ele(f"@data-index={i}").input(digit)
|
||||
time.sleep(random.uniform(0.1, 0.3))
|
||||
|
||||
if translator:
|
||||
print(f"{Fore.GREEN}✅ {translator.get('register.verification_success')}{Style.RESET_ALL}")
|
||||
else:
|
||||
print("验证码填写完成")
|
||||
time.sleep(3)
|
||||
|
||||
# 处理最后一次 Turnstile 验证
|
||||
if handle_turnstile(browser_tab, translator):
|
||||
if translator:
|
||||
print(f"{Fore.GREEN}✅ {translator.get('register.verification_success')}{Style.RESET_ALL}")
|
||||
else:
|
||||
print("最后一次验证通过!")
|
||||
time.sleep(2)
|
||||
|
||||
# 直接访问设置页面
|
||||
if translator:
|
||||
print(f"{Fore.CYAN}{translator.get('register.visiting_url')}: https://www.cursor.com/settings{Style.RESET_ALL}")
|
||||
else:
|
||||
print("访问设置页面...")
|
||||
browser_tab.get("https://www.cursor.com/settings")
|
||||
time.sleep(3) # 等待页面加载
|
||||
|
||||
# 直接返回成功,让 cursor_register.py 处理账户信息获取
|
||||
return True, browser_tab
|
||||
|
||||
else:
|
||||
if translator:
|
||||
print(f"{Fore.RED}❌ {translator.get('register.verification_failed')}{Style.RESET_ALL}")
|
||||
else:
|
||||
print("最后一次验证失败")
|
||||
return False, None
|
||||
|
||||
return False, None
|
||||
|
||||
except Exception as e:
|
||||
if translator:
|
||||
print(f"{Fore.RED}❌ {translator.get('register.verification_error', error=str(e))}{Style.RESET_ALL}")
|
||||
else:
|
||||
print(f"处理验证码时出错: {e}")
|
||||
return False, None
|
||||
|
||||
def handle_sign_in(browser_tab, email, password, translator=None):
|
||||
"""处理登录流程"""
|
||||
try:
|
||||
# 检查是否在登录页面
|
||||
sign_in_header = browser_tab.ele('xpath://h1[contains(text(), "Sign in")]')
|
||||
if not sign_in_header:
|
||||
return True # 如果不是登录页面,说明已经登录成功
|
||||
|
||||
print(f"{Fore.CYAN}检测到登录页面,开始登录...{Style.RESET_ALL}")
|
||||
|
||||
# 填写邮箱
|
||||
email_input = browser_tab.ele('@name=email')
|
||||
if email_input:
|
||||
email_input.input(email)
|
||||
time.sleep(1)
|
||||
|
||||
# 点击 Continue
|
||||
continue_button = browser_tab.ele('xpath://button[contains(@class, "BrandedButton") and text()="Continue"]')
|
||||
if continue_button:
|
||||
continue_button.click()
|
||||
time.sleep(2)
|
||||
|
||||
# 处理 Turnstile 验证
|
||||
if handle_turnstile(browser_tab, translator):
|
||||
# 填写密码
|
||||
password_input = browser_tab.ele('@name=password')
|
||||
if password_input:
|
||||
password_input.input(password)
|
||||
time.sleep(1)
|
||||
|
||||
# 点击 Sign in
|
||||
sign_in_button = browser_tab.ele('xpath://button[@name="intent" and @value="password"]')
|
||||
if sign_in_button:
|
||||
sign_in_button.click()
|
||||
time.sleep(2)
|
||||
|
||||
# 处理最后一次 Turnstile 验证
|
||||
if handle_turnstile(browser_tab, translator):
|
||||
print(f"{Fore.GREEN}登录成功!{Style.RESET_ALL}")
|
||||
time.sleep(3)
|
||||
return True
|
||||
|
||||
print(f"{Fore.RED}登录失败{Style.RESET_ALL}")
|
||||
return False
|
||||
|
||||
except Exception as e:
|
||||
print(f"{Fore.RED}登录过程出错: {str(e)}{Style.RESET_ALL}")
|
||||
return False
|
||||
|
||||
def main(email=None, password=None, first_name=None, last_name=None, email_tab=None, controller=None, translator=None):
|
||||
"""主函数,可以接收账号信息、邮箱标签页和翻译器"""
|
||||
global _translator
|
||||
_translator = translator # 保存到全局变量
|
||||
|
||||
signal.signal(signal.SIGINT, signal_handler)
|
||||
signal.signal(signal.SIGTERM, signal_handler)
|
||||
|
||||
page = None
|
||||
success = False
|
||||
try:
|
||||
page = setup_driver(translator)
|
||||
if translator:
|
||||
print(f"{Fore.CYAN}🚀 {translator.get('register.browser_started')}{Style.RESET_ALL}")
|
||||
else:
|
||||
print("浏览器已启动")
|
||||
|
||||
# 访问注册页面
|
||||
url = "https://authenticator.cursor.sh/sign-up"
|
||||
if translator:
|
||||
print(f"\n{Fore.CYAN}{translator.get('register.visiting_url')}: {url}{Style.RESET_ALL}")
|
||||
else:
|
||||
print(f"\n正在访问: {url}")
|
||||
|
||||
# 访问页面
|
||||
simulate_human_input(page, url, translator)
|
||||
if translator:
|
||||
print(f"{Fore.CYAN}{translator.get('register.waiting_for_page_load')}{Style.RESET_ALL}")
|
||||
else:
|
||||
print("等待页面加载...")
|
||||
time.sleep(5)
|
||||
|
||||
# 如果没有提供账号信息,则生成随机信息
|
||||
if not all([email, password, first_name, last_name]):
|
||||
first_name = ''.join(random.choices('abcdefghijklmnopqrstuvwxyz', k=6)).capitalize()
|
||||
last_name = ''.join(random.choices('abcdefghijklmnopqrstuvwxyz', k=6)).capitalize()
|
||||
email = f"{first_name.lower()}{random.randint(100,999)}@example.com"
|
||||
password = generate_password()
|
||||
|
||||
# 保存账号信息
|
||||
with open('test_accounts.txt', 'a', encoding='utf-8') as f:
|
||||
f.write(f"\n{'='*50}\n")
|
||||
f.write(f"Email: {email}\n")
|
||||
f.write(f"Password: {password}\n")
|
||||
f.write(f"{'='*50}\n")
|
||||
|
||||
# 填写表单
|
||||
if fill_signup_form(page, first_name, last_name, email, translator):
|
||||
if translator:
|
||||
print(f"\n{Fore.GREEN}{translator.get('register.form_submitted')}{Style.RESET_ALL}")
|
||||
else:
|
||||
print("\n表单已提交,开始验证...")
|
||||
|
||||
# 处理第一次 Turnstile 验证
|
||||
if handle_turnstile(page, translator):
|
||||
if translator:
|
||||
print(f"\n{Fore.GREEN}{translator.get('register.first_verification_passed')}{Style.RESET_ALL}")
|
||||
else:
|
||||
print("\n第一阶段验证通过!")
|
||||
|
||||
# 填写密码
|
||||
if fill_password(page, password, translator):
|
||||
if translator:
|
||||
print(f"\n{Fore.CYAN}{translator.get('register.waiting_for_second_verification')}{Style.RESET_ALL}")
|
||||
else:
|
||||
print("\n等待第二次验证...")
|
||||
time.sleep(2)
|
||||
|
||||
# 处理第二次 Turnstile 验证
|
||||
if handle_turnstile(page, translator):
|
||||
if translator:
|
||||
print(f"\n{Fore.CYAN}{translator.get('register.waiting_for_verification_code')}{Style.RESET_ALL}")
|
||||
else:
|
||||
print("\n开始处理验证码...")
|
||||
if handle_verification_code(page, email_tab, controller, email, password, translator):
|
||||
success = True
|
||||
return True, page # 返回浏览器实例
|
||||
else:
|
||||
print("\n验证码处理失败")
|
||||
else:
|
||||
print("\n第二次验证失败")
|
||||
else:
|
||||
print("\n密码设置失败")
|
||||
else:
|
||||
print("\n第一次验证失败")
|
||||
|
||||
return False, None
|
||||
|
||||
except Exception as e:
|
||||
print(f"发生错误: {e}")
|
||||
return False, None
|
||||
finally:
|
||||
if page and not success: # 只在失败时清理
|
||||
try:
|
||||
page.quit()
|
||||
except:
|
||||
pass
|
||||
cleanup_chrome_processes(translator)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main() # 直接运行时不传参数,使用随机生成的信息
|
||||
342
new_tempemail.py
Normal file
@@ -0,0 +1,342 @@
|
||||
from DrissionPage import ChromiumPage, ChromiumOptions
|
||||
import time
|
||||
import os
|
||||
import sys
|
||||
from colorama import Fore, Style, init
|
||||
import requests
|
||||
import random
|
||||
import string
|
||||
|
||||
# 初始化 colorama
|
||||
init()
|
||||
|
||||
class NewTempEmail:
|
||||
def __init__(self, translator=None):
|
||||
self.translator = translator
|
||||
# Randomly choose between mail.tm and mail.gw
|
||||
self.services = [
|
||||
{"name": "mail.tm", "api_url": "https://api.mail.tm"},
|
||||
{"name": "mail.gw", "api_url": "https://api.mail.gw"}
|
||||
]
|
||||
self.selected_service = random.choice(self.services)
|
||||
self.api_url = self.selected_service["api_url"]
|
||||
self.token = None
|
||||
self.email = None
|
||||
self.password = None
|
||||
self.blocked_domains = self.get_blocked_domains()
|
||||
|
||||
def get_blocked_domains(self):
|
||||
"""Get blocked domains list"""
|
||||
try:
|
||||
block_url = "https://raw.githubusercontent.com/yeongpin/cursor-free-vip/main/block_domain.txt"
|
||||
response = requests.get(block_url, timeout=5)
|
||||
if response.status_code == 200:
|
||||
# Split text and remove empty lines
|
||||
domains = [line.strip() for line in response.text.split('\n') if line.strip()]
|
||||
if self.translator:
|
||||
print(f"{Fore.CYAN}ℹ️ {self.translator.get('email.blocked_domains_loaded', count=len(domains))}{Style.RESET_ALL}")
|
||||
else:
|
||||
print(f"{Fore.CYAN}ℹ️ 已加载 {len(domains)} 个被屏蔽的域名{Style.RESET_ALL}")
|
||||
return domains
|
||||
return []
|
||||
except Exception as e:
|
||||
if self.translator:
|
||||
print(f"{Fore.YELLOW}⚠️ {self.translator.get('email.blocked_domains_error', error=str(e))}{Style.RESET_ALL}")
|
||||
else:
|
||||
print(f"{Fore.YELLOW}⚠️ 获取被屏蔽域名列表失败: {str(e)}{Style.RESET_ALL}")
|
||||
return []
|
||||
|
||||
def exclude_blocked_domains(self, domains):
|
||||
"""Exclude blocked domains"""
|
||||
if not self.blocked_domains:
|
||||
return domains
|
||||
|
||||
filtered_domains = []
|
||||
for domain in domains:
|
||||
if domain['domain'] not in self.blocked_domains:
|
||||
filtered_domains.append(domain)
|
||||
|
||||
excluded_count = len(domains) - len(filtered_domains)
|
||||
if excluded_count > 0:
|
||||
if self.translator:
|
||||
print(f"{Fore.YELLOW}⚠️ {self.translator.get('email.domains_excluded', domains=excluded_count)}{Style.RESET_ALL}")
|
||||
else:
|
||||
print(f"{Fore.YELLOW}⚠️ 已排除 {excluded_count} 个被屏蔽的域名{Style.RESET_ALL}")
|
||||
|
||||
return filtered_domains
|
||||
|
||||
def _generate_credentials(self):
|
||||
"""生成随机用户名和密码"""
|
||||
username = ''.join(random.choices(string.ascii_lowercase + string.digits, k=10))
|
||||
password = ''.join(random.choices(string.ascii_letters + string.digits + string.punctuation, k=12))
|
||||
return username, password
|
||||
|
||||
def create_email(self):
|
||||
"""创建临时邮箱"""
|
||||
try:
|
||||
if self.translator:
|
||||
print(f"{Fore.CYAN}ℹ️ {self.translator.get('email.visiting_site').replace('mail.tm', self.selected_service['name'])}{Style.RESET_ALL}")
|
||||
else:
|
||||
print(f"{Fore.CYAN}ℹ️ 正在访问 {self.selected_service['name']}...{Style.RESET_ALL}")
|
||||
|
||||
# 获取可用域名列表
|
||||
try:
|
||||
domains_response = requests.get(f"{self.api_url}/domains", timeout=10)
|
||||
if domains_response.status_code != 200:
|
||||
print(f"{Fore.RED}❌ {self.translator.get('email.domains_list_error', error=domains_response.status_code)}{Style.RESET_ALL}")
|
||||
print(f"{Fore.RED}❌ {self.translator.get('email.domains_list_error', error=domains_response.text)}{Style.RESET_ALL}")
|
||||
raise Exception(f"{self.translator.get('email.failed_to_get_available_domains') if self.translator else 'Failed to get available domains'}")
|
||||
|
||||
domains = domains_response.json()["hydra:member"]
|
||||
print(f"{Fore.CYAN}ℹ️ {self.translator.get('email.available_domains_loaded', count=len(domains))}{Style.RESET_ALL}")
|
||||
|
||||
if not domains:
|
||||
raise Exception(f"{self.translator.get('email.no_available_domains') if self.translator else '没有可用域名'}")
|
||||
except Exception as e:
|
||||
print(f"{Fore.RED}❌ 获取域名列表时出错: {str(e)}{Style.RESET_ALL}")
|
||||
raise
|
||||
|
||||
# 排除被屏蔽的域名
|
||||
try:
|
||||
filtered_domains = self.exclude_blocked_domains(domains)
|
||||
if self.translator:
|
||||
print(f"{Fore.CYAN}ℹ️ {self.translator.get('email.domains_filtered', count=len(filtered_domains))}{Style.RESET_ALL}")
|
||||
else:
|
||||
print(f"{Fore.CYAN}ℹ️ 过滤后剩余 {len(filtered_domains)} 个可用域名{Style.RESET_ALL}")
|
||||
|
||||
if not filtered_domains:
|
||||
if self.translator:
|
||||
print(f"{Fore.RED}❌ {self.translator.get('email.all_domains_blocked')}{Style.RESET_ALL}")
|
||||
else:
|
||||
print(f"{Fore.RED}❌ 所有域名都被屏蔽了,尝试切换服务{Style.RESET_ALL}")
|
||||
|
||||
# 切换到另一个服务
|
||||
for service in self.services:
|
||||
if service["api_url"] != self.api_url:
|
||||
self.selected_service = service
|
||||
self.api_url = service["api_url"]
|
||||
if self.translator:
|
||||
print(f"{Fore.CYAN}ℹ️ {self.translator.get('email.switching_service', service=service['name'])}{Style.RESET_ALL}")
|
||||
else:
|
||||
print(f"{Fore.CYAN}ℹ️ 切换到 {service['name']} 服务{Style.RESET_ALL}")
|
||||
return self.create_email() # 递归调用
|
||||
|
||||
raise Exception(f"{self.translator.get('email.no_available_domains_after_filtering') if self.translator else '过滤后没有可用域名'}")
|
||||
except Exception as e:
|
||||
print(f"{Fore.RED}❌ 过滤域名时出错: {str(e)}{Style.RESET_ALL}")
|
||||
raise
|
||||
|
||||
# 生成随机用户名和密码
|
||||
try:
|
||||
username, password = self._generate_credentials()
|
||||
self.password = password
|
||||
|
||||
# 创建邮箱账户
|
||||
selected_domain = filtered_domains[0]['domain']
|
||||
email = f"{username}@{selected_domain}"
|
||||
|
||||
print(f"{Fore.CYAN}ℹ️ 尝试创建邮箱: {email}{Style.RESET_ALL}")
|
||||
|
||||
account_data = {
|
||||
"address": email,
|
||||
"password": password
|
||||
}
|
||||
except Exception as e:
|
||||
print(f"{Fore.RED}❌ 生成凭据时出错: {str(e)}{Style.RESET_ALL}")
|
||||
raise
|
||||
|
||||
# 创建账户
|
||||
try:
|
||||
create_response = requests.post(f"{self.api_url}/accounts", json=account_data, timeout=15)
|
||||
|
||||
if create_response.status_code != 201:
|
||||
print(f"{Fore.RED}❌ 创建账户失败: 状态码 {create_response.status_code}{Style.RESET_ALL}")
|
||||
print(f"{Fore.RED}❌ 响应内容: {create_response.text}{Style.RESET_ALL}")
|
||||
|
||||
# 如果是域名问题,尝试下一个域名
|
||||
if len(filtered_domains) > 1 and ("domain" in create_response.text.lower() or "address" in create_response.text.lower()):
|
||||
print(f"{Fore.YELLOW}⚠️ 尝试使用下一个可用域名...{Style.RESET_ALL}")
|
||||
# 将当前域名添加到屏蔽列表
|
||||
if selected_domain not in self.blocked_domains:
|
||||
self.blocked_domains.append(selected_domain)
|
||||
# 递归调用自己
|
||||
return self.create_email()
|
||||
|
||||
raise Exception(f"{self.translator.get('email.failed_to_create_account') if self.translator else '创建账户失败'}")
|
||||
except Exception as e:
|
||||
print(f"{Fore.RED}❌ 创建账户时出错: {str(e)}{Style.RESET_ALL}")
|
||||
raise
|
||||
|
||||
# 获取访问令牌
|
||||
try:
|
||||
token_data = {
|
||||
"address": email,
|
||||
"password": password
|
||||
}
|
||||
|
||||
token_response = requests.post(f"{self.api_url}/token", json=token_data, timeout=10)
|
||||
if token_response.status_code != 200:
|
||||
print(f"{Fore.RED}❌ 获取令牌失败: 状态码 {token_response.status_code}{Style.RESET_ALL}")
|
||||
print(f"{Fore.RED}❌ 响应内容: {token_response.text}{Style.RESET_ALL}")
|
||||
raise Exception(f"{self.translator.get('email.failed_to_get_access_token') if self.translator else '获取访问令牌失败'}")
|
||||
|
||||
self.token = token_response.json()["token"]
|
||||
self.email = email
|
||||
except Exception as e:
|
||||
print(f"{Fore.RED}❌ 获取令牌时出错: {str(e)}{Style.RESET_ALL}")
|
||||
raise
|
||||
|
||||
if self.translator:
|
||||
print(f"{Fore.GREEN}✅ {self.translator.get('email.create_success')}: {email}{Style.RESET_ALL}")
|
||||
else:
|
||||
print(f"{Fore.GREEN}✅ 创建邮箱成功: {email}{Style.RESET_ALL}")
|
||||
return email
|
||||
|
||||
except Exception as e:
|
||||
if self.translator:
|
||||
print(f"{Fore.RED}❌ {self.translator.get('email.create_error')}: {str(e)}{Style.RESET_ALL}")
|
||||
else:
|
||||
print(f"{Fore.RED}❌ 创建邮箱出错: {str(e)}{Style.RESET_ALL}")
|
||||
return None
|
||||
|
||||
def close(self):
|
||||
"""关闭浏览器"""
|
||||
if self.page:
|
||||
self.page.quit()
|
||||
|
||||
def refresh_inbox(self):
|
||||
"""刷新邮箱"""
|
||||
try:
|
||||
if self.translator:
|
||||
print(f"{Fore.CYAN}🔄 {self.translator.get('email.refreshing')}{Style.RESET_ALL}")
|
||||
else:
|
||||
print(f"{Fore.CYAN}🔄 正在刷新邮箱...{Style.RESET_ALL}")
|
||||
|
||||
# 使用 API 获取最新邮件
|
||||
headers = {"Authorization": f"Bearer {self.token}"}
|
||||
response = requests.get(f"{self.api_url}/messages", headers=headers)
|
||||
|
||||
if response.status_code == 200:
|
||||
if self.translator:
|
||||
print(f"{Fore.GREEN}✅ {self.translator.get('email.refresh_success')}{Style.RESET_ALL}")
|
||||
else:
|
||||
print(f"{Fore.GREEN}✅ 邮箱刷新成功{Style.RESET_ALL}")
|
||||
return True
|
||||
|
||||
if self.translator:
|
||||
print(f"{Fore.RED}❌ {self.translator.get('email.refresh_failed')}{Style.RESET_ALL}")
|
||||
else:
|
||||
print(f"{Fore.RED}❌ 刷新邮箱失败{Style.RESET_ALL}")
|
||||
return False
|
||||
|
||||
except Exception as e:
|
||||
if self.translator:
|
||||
print(f"{Fore.RED}❌ {self.translator.get('email.refresh_error')}: {str(e)}{Style.RESET_ALL}")
|
||||
else:
|
||||
print(f"{Fore.RED}❌ 刷新邮箱出错: {str(e)}{Style.RESET_ALL}")
|
||||
return False
|
||||
|
||||
def check_for_cursor_email(self):
|
||||
"""检查是否有 Cursor 的验证邮件"""
|
||||
try:
|
||||
# 使用 API 获取邮件列表
|
||||
headers = {"Authorization": f"Bearer {self.token}"}
|
||||
response = requests.get(f"{self.api_url}/messages", headers=headers)
|
||||
|
||||
if response.status_code == 200:
|
||||
messages = response.json()["hydra:member"]
|
||||
for message in messages:
|
||||
if message["from"]["address"] == "no-reply@cursor.sh" and "Verify your email address" in message["subject"]:
|
||||
# 获取邮件内容
|
||||
message_id = message["id"]
|
||||
message_response = requests.get(f"{self.api_url}/messages/{message_id}", headers=headers)
|
||||
if message_response.status_code == 200:
|
||||
if self.translator:
|
||||
print(f"{Fore.GREEN}✅ {self.translator.get('email.verification_found')}{Style.RESET_ALL}")
|
||||
else:
|
||||
print(f"{Fore.GREEN}✅ 找到验证邮件{Style.RESET_ALL}")
|
||||
return True
|
||||
|
||||
if self.translator:
|
||||
print(f"{Fore.YELLOW}⚠️ {self.translator.get('email.verification_not_found')}{Style.RESET_ALL}")
|
||||
else:
|
||||
print(f"{Fore.YELLOW}⚠️ 未找到验证邮件{Style.RESET_ALL}")
|
||||
return False
|
||||
|
||||
except Exception as e:
|
||||
if self.translator:
|
||||
print(f"{Fore.RED}❌ {self.translator.get('email.verification_error')}: {str(e)}{Style.RESET_ALL}")
|
||||
else:
|
||||
print(f"{Fore.RED}❌ 检查验证邮件出错: {str(e)}{Style.RESET_ALL}")
|
||||
return False
|
||||
|
||||
def get_verification_code(self):
|
||||
"""获取验证码"""
|
||||
try:
|
||||
# 使用 API 获取邮件列表
|
||||
headers = {"Authorization": f"Bearer {self.token}"}
|
||||
response = requests.get(f"{self.api_url}/messages", headers=headers)
|
||||
|
||||
if response.status_code == 200:
|
||||
messages = response.json()["hydra:member"]
|
||||
for message in messages:
|
||||
if message["from"]["address"] == "no-reply@cursor.sh" and "Verify your email address" in message["subject"]:
|
||||
# 获取邮件内容
|
||||
message_id = message["id"]
|
||||
message_response = requests.get(f"{self.api_url}/messages/{message_id}", headers=headers)
|
||||
|
||||
if message_response.status_code == 200:
|
||||
# 从邮件内容中提取验证码
|
||||
email_content = message_response.json()["text"]
|
||||
# 查找6位数字验证码
|
||||
import re
|
||||
code_match = re.search(r'\b\d{6}\b', email_content)
|
||||
|
||||
if code_match:
|
||||
code = code_match.group(0)
|
||||
if self.translator:
|
||||
print(f"{Fore.GREEN}✅ {self.translator.get('email.verification_code_found')}: {code}{Style.RESET_ALL}")
|
||||
else:
|
||||
print(f"{Fore.GREEN}✅ 获取验证码成功: {code}{Style.RESET_ALL}")
|
||||
return code
|
||||
|
||||
if self.translator:
|
||||
print(f"{Fore.YELLOW}⚠️ {self.translator.get('email.verification_code_not_found')}{Style.RESET_ALL}")
|
||||
else:
|
||||
print(f"{Fore.YELLOW}⚠️ 未找到有效的验证码{Style.RESET_ALL}")
|
||||
return None
|
||||
|
||||
except Exception as e:
|
||||
if self.translator:
|
||||
print(f"{Fore.RED}❌ {self.translator.get('email.verification_code_error')}: {str(e)}{Style.RESET_ALL}")
|
||||
else:
|
||||
print(f"{Fore.RED}❌ 获取验证码出错: {str(e)}{Style.RESET_ALL}")
|
||||
return None
|
||||
|
||||
def main(translator=None):
|
||||
temp_email = NewTempEmail(translator)
|
||||
|
||||
try:
|
||||
email = temp_email.create_email()
|
||||
if email:
|
||||
if translator:
|
||||
print(f"\n{Fore.CYAN}📧 {translator.get('email.address')}: {email}{Style.RESET_ALL}")
|
||||
else:
|
||||
print(f"\n{Fore.CYAN}📧 临时邮箱地址: {email}{Style.RESET_ALL}")
|
||||
|
||||
# 测试刷新功能
|
||||
while True:
|
||||
if translator:
|
||||
choice = input(f"\n{translator.get('email.refresh_prompt')}: ").lower()
|
||||
else:
|
||||
choice = input("\n按 R 刷新邮箱,按 Q 退出: ").lower()
|
||||
if choice == 'r':
|
||||
temp_email.refresh_inbox()
|
||||
elif choice == 'q':
|
||||
break
|
||||
|
||||
finally:
|
||||
temp_email.close()
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -4,10 +4,10 @@ from colorama import Fore, Style, init
|
||||
import sys
|
||||
import os
|
||||
|
||||
# 初始化colorama
|
||||
# Initialize colorama
|
||||
init()
|
||||
|
||||
# 定义emoji常量
|
||||
# Define emoji constants
|
||||
EMOJI = {
|
||||
"PROCESS": "⚙️",
|
||||
"SUCCESS": "✅",
|
||||
@@ -19,15 +19,15 @@ EMOJI = {
|
||||
class CursorQuitter:
|
||||
def __init__(self, timeout=5, translator=None):
|
||||
self.timeout = timeout
|
||||
self.translator = translator # 使用传入的翻译器
|
||||
self.translator = translator # Use the passed translator
|
||||
|
||||
def quit_cursor(self):
|
||||
"""温和地关闭 Cursor 进程"""
|
||||
"""Gently close Cursor processes"""
|
||||
try:
|
||||
print(f"{Fore.CYAN}{EMOJI['PROCESS']} {self.translator.get('quit_cursor.start')}...{Style.RESET_ALL}")
|
||||
cursor_processes = []
|
||||
|
||||
# 收集所有 Cursor 进程
|
||||
# Collect all Cursor processes
|
||||
for proc in psutil.process_iter(['pid', 'name']):
|
||||
try:
|
||||
if proc.info['name'].lower() in ['cursor.exe', 'cursor']:
|
||||
@@ -39,7 +39,7 @@ class CursorQuitter:
|
||||
print(f"{Fore.GREEN}{EMOJI['INFO']} {self.translator.get('quit_cursor.no_process')}{Style.RESET_ALL}")
|
||||
return True
|
||||
|
||||
# 温和地请求进程终止
|
||||
# Gently request processes to terminate
|
||||
for proc in cursor_processes:
|
||||
try:
|
||||
if proc.is_running():
|
||||
@@ -48,7 +48,7 @@ class CursorQuitter:
|
||||
except (psutil.NoSuchProcess, psutil.AccessDenied):
|
||||
continue
|
||||
|
||||
# 等待进程自然终止
|
||||
# Wait for processes to terminate naturally
|
||||
print(f"{Fore.CYAN}{EMOJI['WAIT']} {self.translator.get('quit_cursor.waiting')}...{Style.RESET_ALL}")
|
||||
start_time = time.time()
|
||||
while time.time() - start_time < self.timeout:
|
||||
@@ -66,7 +66,7 @@ class CursorQuitter:
|
||||
|
||||
time.sleep(0.5)
|
||||
|
||||
# 如果超时后仍有进程在运行
|
||||
# If processes are still running after timeout
|
||||
if still_running:
|
||||
process_list = ", ".join([str(p.pid) for p in still_running])
|
||||
print(f"{Fore.RED}{EMOJI['ERROR']} {self.translator.get('quit_cursor.timeout', pids=process_list)}{Style.RESET_ALL}")
|
||||
@@ -79,11 +79,11 @@ class CursorQuitter:
|
||||
return False
|
||||
|
||||
def quit_cursor(translator=None, timeout=5):
|
||||
"""便捷函数,用于直接调用退出功能"""
|
||||
"""Convenient function for directly calling the quit function"""
|
||||
quitter = CursorQuitter(timeout, translator)
|
||||
return quitter.quit_cursor()
|
||||
|
||||
if __name__ == "__main__":
|
||||
# 如果直接运行,使用默认翻译器
|
||||
# If run directly, use the default translator
|
||||
from main import translator as main_translator
|
||||
quit_cursor(main_translator)
|
||||
@@ -1,22 +0,0 @@
|
||||
{
|
||||
"manifest_version": 3,
|
||||
"name": "Recaptcha Blocker",
|
||||
"version": "1.0",
|
||||
"description": "Blocks reCAPTCHA from loading",
|
||||
"content_scripts": [
|
||||
{
|
||||
"matches": ["*://yopmail.com/zh/wm*"],
|
||||
"js": ["script.js"],
|
||||
"run_at": "document_start",
|
||||
"all_frames": true
|
||||
}
|
||||
],
|
||||
"permissions": [
|
||||
"webNavigation",
|
||||
"activeTab"
|
||||
],
|
||||
"host_permissions": [
|
||||
"*://yopmail.com/*",
|
||||
"*://*.google.com/*"
|
||||
]
|
||||
}
|
||||
@@ -1,123 +0,0 @@
|
||||
// Debug logging function
|
||||
function log(message) {
|
||||
console.log(`[reCAPTCHA Bypass] ${new Date().toISOString()}: ${message}`);
|
||||
}
|
||||
|
||||
// Function to get element by selector
|
||||
function qSelector(selector) {
|
||||
return document.querySelector(selector);
|
||||
}
|
||||
|
||||
// Constants
|
||||
const MAX_ATTEMPTS = 1;
|
||||
const SELECTORS = {
|
||||
CHECK_BOX: ".recaptcha-checkbox-border",
|
||||
AUDIO_BUTTON: "#recaptcha-audio-button",
|
||||
PLAY_BUTTON: ".rc-audiochallenge-play-button .rc-button-default",
|
||||
AUDIO_SOURCE: "#audio-source",
|
||||
IMAGE_SELECT: "#rc-imageselect",
|
||||
RESPONSE_FIELD: ".rc-audiochallenge-response-field",
|
||||
AUDIO_ERROR_MESSAGE: ".rc-audiochallenge-error-message",
|
||||
AUDIO_RESPONSE: "#audio-response",
|
||||
RELOAD_BUTTON: "#recaptcha-reload-button",
|
||||
RECAPTCHA_STATUS: "#recaptcha-accessible-status",
|
||||
DOSCAPTCHA: ".rc-doscaptcha-body",
|
||||
VERIFY_BUTTON: "#recaptcha-verify-button"
|
||||
};
|
||||
|
||||
// Function to check if element is hidden
|
||||
function isHidden(el) {
|
||||
return (el.offsetParent === null);
|
||||
}
|
||||
|
||||
// Function to handle the bypass process
|
||||
async function bypassRecaptcha() {
|
||||
try {
|
||||
log('Starting bypass process...');
|
||||
log('Waiting 3 seconds before starting...');
|
||||
await new Promise(resolve => setTimeout(resolve, 3000));
|
||||
|
||||
let solved = false;
|
||||
let checkBoxClicked = false;
|
||||
let requestCount = 0;
|
||||
|
||||
const recaptchaInitialStatus = qSelector(SELECTORS.RECAPTCHA_STATUS) ?
|
||||
qSelector(SELECTORS.RECAPTCHA_STATUS).innerText : "";
|
||||
|
||||
log('Initial reCAPTCHA status: ' + recaptchaInitialStatus);
|
||||
|
||||
// Main bypass logic
|
||||
try {
|
||||
if (!checkBoxClicked && qSelector(SELECTORS.CHECK_BOX) &&
|
||||
!isHidden(qSelector(SELECTORS.CHECK_BOX))) {
|
||||
log('Clicking checkbox...');
|
||||
qSelector(SELECTORS.CHECK_BOX).click();
|
||||
checkBoxClicked = true;
|
||||
}
|
||||
|
||||
// Check if the captcha is solved
|
||||
if (qSelector(SELECTORS.RECAPTCHA_STATUS) &&
|
||||
(qSelector(SELECTORS.RECAPTCHA_STATUS).innerText != recaptchaInitialStatus)) {
|
||||
solved = true;
|
||||
log('SOLVED!');
|
||||
}
|
||||
|
||||
if (requestCount > MAX_ATTEMPTS) {
|
||||
log('Attempted Max Retries. Stopping the solver');
|
||||
solved = true;
|
||||
}
|
||||
|
||||
// Stop solving when Automated queries message is shown
|
||||
if (qSelector(SELECTORS.DOSCAPTCHA) &&
|
||||
qSelector(SELECTORS.DOSCAPTCHA).innerText.length > 0) {
|
||||
log('Automated Queries Detected');
|
||||
}
|
||||
|
||||
} catch (err) {
|
||||
log(`Error in main bypass logic: ${err.message}`);
|
||||
}
|
||||
|
||||
log('Bypass process completed');
|
||||
|
||||
// If not solved, retry after delay
|
||||
if (!solved && requestCount < MAX_ATTEMPTS) {
|
||||
requestCount++;
|
||||
log(`Retrying... Attempt ${requestCount} of ${MAX_ATTEMPTS}`);
|
||||
setTimeout(bypassRecaptcha, 2000);
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
log(`Bypass failed: ${e.message}`);
|
||||
}
|
||||
}
|
||||
|
||||
// Create a MutationObserver to watch for reCAPTCHA elements
|
||||
log('Setting up MutationObserver...');
|
||||
const observer = new MutationObserver((mutations) => {
|
||||
mutations.forEach((mutation) => {
|
||||
mutation.addedNodes.forEach((node) => {
|
||||
if (node.nodeType === 1 && // Element node
|
||||
((node.tagName === 'SCRIPT' && node.src && node.src.includes('recaptcha')) ||
|
||||
(node.tagName === 'IFRAME' && node.src && node.src.includes('recaptcha')))) {
|
||||
log(`Detected new reCAPTCHA element: ${node.tagName} - ${node.src}`);
|
||||
bypassRecaptcha();
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// Start observing
|
||||
observer.observe(document, {
|
||||
childList: true,
|
||||
subtree: true
|
||||
});
|
||||
log('MutationObserver started');
|
||||
|
||||
// Run on page load
|
||||
if (document.readyState === 'loading') {
|
||||
log('Document still loading, waiting for DOMContentLoaded');
|
||||
document.addEventListener('DOMContentLoaded', bypassRecaptcha);
|
||||
} else {
|
||||
log('Document already loaded, starting bypass process');
|
||||
bypassRecaptcha();
|
||||
}
|
||||
@@ -11,10 +11,10 @@ import tempfile
|
||||
from colorama import Fore, Style, init
|
||||
from typing import Tuple
|
||||
|
||||
# 初始化colorama
|
||||
# Initialize colorama
|
||||
init()
|
||||
|
||||
# 定义emoji常量
|
||||
# Define emoji constants
|
||||
EMOJI = {
|
||||
"FILE": "📄",
|
||||
"BACKUP": "💾",
|
||||
@@ -25,7 +25,7 @@ EMOJI = {
|
||||
}
|
||||
|
||||
def get_cursor_paths(translator=None) -> Tuple[str, str]:
|
||||
"""根据不同操作系统获取 Cursor 相关路径"""
|
||||
""" Get Cursor related paths"""
|
||||
system = platform.system()
|
||||
|
||||
paths_map = {
|
||||
@@ -65,7 +65,7 @@ def get_cursor_paths(translator=None) -> Tuple[str, str]:
|
||||
)
|
||||
|
||||
def version_check(version: str, min_version: str = "", max_version: str = "", translator=None) -> bool:
|
||||
"""版本号检查"""
|
||||
"""Version number check"""
|
||||
version_pattern = r"^\d+\.\d+\.\d+$"
|
||||
try:
|
||||
if not re.match(version_pattern, version):
|
||||
@@ -92,7 +92,7 @@ def version_check(version: str, min_version: str = "", max_version: str = "", tr
|
||||
return False
|
||||
|
||||
def check_cursor_version(translator) -> bool:
|
||||
"""检查 Cursor 版本"""
|
||||
"""Check Cursor version"""
|
||||
try:
|
||||
pkg_path, _ = get_cursor_paths(translator)
|
||||
with open(pkg_path, "r", encoding="utf-8") as f:
|
||||
@@ -103,7 +103,7 @@ def check_cursor_version(translator) -> bool:
|
||||
return False
|
||||
|
||||
def modify_main_js(main_path: str, translator) -> bool:
|
||||
"""修改 main.js 文件"""
|
||||
"""Modify main.js file"""
|
||||
try:
|
||||
original_stat = os.stat(main_path)
|
||||
original_mode = original_stat.st_mode
|
||||
@@ -142,14 +142,14 @@ def modify_main_js(main_path: str, translator) -> bool:
|
||||
return False
|
||||
|
||||
def patch_cursor_get_machine_id(translator) -> bool:
|
||||
"""修补 Cursor getMachineId 函数"""
|
||||
"""Patch Cursor getMachineId function"""
|
||||
try:
|
||||
print(f"{Fore.CYAN}{EMOJI['INFO']} {translator.get('reset.start_patching')}...{Style.RESET_ALL}")
|
||||
|
||||
# 获取路径
|
||||
# Get paths
|
||||
pkg_path, main_path = get_cursor_paths(translator)
|
||||
|
||||
# 检查文件权限
|
||||
# Check file permissions
|
||||
for file_path in [pkg_path, main_path]:
|
||||
if not os.path.isfile(file_path):
|
||||
print(f"{Fore.RED}{EMOJI['ERROR']} {translator.get('reset.file_not_found', path=file_path)}{Style.RESET_ALL}")
|
||||
@@ -158,7 +158,7 @@ def patch_cursor_get_machine_id(translator) -> bool:
|
||||
print(f"{Fore.RED}{EMOJI['ERROR']} {translator.get('reset.no_write_permission', path=file_path)}{Style.RESET_ALL}")
|
||||
return False
|
||||
|
||||
# 获取版本号
|
||||
# Get version number
|
||||
try:
|
||||
with open(pkg_path, "r", encoding="utf-8") as f:
|
||||
version = json.load(f)["version"]
|
||||
@@ -167,20 +167,20 @@ def patch_cursor_get_machine_id(translator) -> bool:
|
||||
print(f"{Fore.RED}{EMOJI['ERROR']} {translator.get('reset.read_version_failed', error=str(e))}{Style.RESET_ALL}")
|
||||
return False
|
||||
|
||||
# 检查版本
|
||||
# Check version
|
||||
if not version_check(version, min_version="0.45.0", translator=translator):
|
||||
print(f"{Fore.RED}{EMOJI['ERROR']} {translator.get('reset.version_not_supported')}{Style.RESET_ALL}")
|
||||
return False
|
||||
|
||||
print(f"{Fore.CYAN}{EMOJI['INFO']} {translator.get('reset.version_check_passed')}{Style.RESET_ALL}")
|
||||
|
||||
# 备份文件
|
||||
# Backup file
|
||||
backup_path = main_path + ".bak"
|
||||
if not os.path.exists(backup_path):
|
||||
shutil.copy2(main_path, backup_path)
|
||||
print(f"{Fore.GREEN}{EMOJI['SUCCESS']} {translator.get('reset.backup_created', path=backup_path)}{Style.RESET_ALL}")
|
||||
|
||||
# 修改文件
|
||||
# Modify file
|
||||
if not modify_main_js(main_path, translator):
|
||||
return False
|
||||
|
||||
@@ -195,7 +195,7 @@ class MachineIDResetter:
|
||||
def __init__(self, translator=None):
|
||||
self.translator = translator
|
||||
|
||||
# 判断操作系统
|
||||
# Check operating system
|
||||
if sys.platform == "win32": # Windows
|
||||
appdata = os.getenv("APPDATA")
|
||||
if appdata is None:
|
||||
@@ -224,17 +224,17 @@ class MachineIDResetter:
|
||||
raise NotImplementedError(f"Not Supported OS: {sys.platform}")
|
||||
|
||||
def generate_new_ids(self):
|
||||
"""生成新的机器ID"""
|
||||
# 生成新的UUID
|
||||
"""Generate new machine ID"""
|
||||
# Generate new UUID
|
||||
dev_device_id = str(uuid.uuid4())
|
||||
|
||||
# 生成新的machineId (64个字符的十六进制)
|
||||
# Generate new machineId (64 characters of hexadecimal)
|
||||
machine_id = hashlib.sha256(os.urandom(32)).hexdigest()
|
||||
|
||||
# 生成新的macMachineId (128个字符的十六进制)
|
||||
# Generate new macMachineId (128 characters of hexadecimal)
|
||||
mac_machine_id = hashlib.sha512(os.urandom(64)).hexdigest()
|
||||
|
||||
# 生成新的sqmId
|
||||
# Generate new sqmId
|
||||
sqm_id = "{" + str(uuid.uuid4()).upper() + "}"
|
||||
|
||||
return {
|
||||
@@ -242,11 +242,11 @@ class MachineIDResetter:
|
||||
"telemetry.macMachineId": mac_machine_id,
|
||||
"telemetry.machineId": machine_id,
|
||||
"telemetry.sqmId": sqm_id,
|
||||
"storage.serviceMachineId": dev_device_id, # 添加 storage.serviceMachineId
|
||||
"storage.serviceMachineId": dev_device_id, # Add storage.serviceMachineId
|
||||
}
|
||||
|
||||
def update_sqlite_db(self, new_ids):
|
||||
"""更新 SQLite 数据库中的机器ID"""
|
||||
"""Update machine ID in SQLite database"""
|
||||
try:
|
||||
print(f"{Fore.CYAN}{EMOJI['INFO']} {self.translator.get('reset.updating_sqlite')}...{Style.RESET_ALL}")
|
||||
|
||||
@@ -281,7 +281,7 @@ class MachineIDResetter:
|
||||
return False
|
||||
|
||||
def update_system_ids(self, new_ids):
|
||||
"""更新系统级别的ID"""
|
||||
"""Update system-level IDs"""
|
||||
try:
|
||||
print(f"{Fore.CYAN}{EMOJI['INFO']} {self.translator.get('reset.updating_system_ids')}...{Style.RESET_ALL}")
|
||||
|
||||
@@ -297,7 +297,7 @@ class MachineIDResetter:
|
||||
return False
|
||||
|
||||
def _update_windows_machine_guid(self):
|
||||
"""更新Windows MachineGuid"""
|
||||
"""Update Windows MachineGuid"""
|
||||
try:
|
||||
import winreg
|
||||
key = winreg.OpenKey(
|
||||
@@ -318,11 +318,11 @@ class MachineIDResetter:
|
||||
raise
|
||||
|
||||
def _update_macos_platform_uuid(self, new_ids):
|
||||
"""更新macOS Platform UUID"""
|
||||
"""Update macOS Platform UUID"""
|
||||
try:
|
||||
uuid_file = "/var/root/Library/Preferences/SystemConfiguration/com.apple.platform.uuid.plist"
|
||||
if os.path.exists(uuid_file):
|
||||
# 使用sudo来执行plutil命令
|
||||
# Use sudo to execute plutil command
|
||||
cmd = f'sudo plutil -replace "UUID" -string "{new_ids["telemetry.macMachineId"]}" "{uuid_file}"'
|
||||
result = os.system(cmd)
|
||||
if result == 0:
|
||||
@@ -334,7 +334,7 @@ class MachineIDResetter:
|
||||
raise
|
||||
|
||||
def reset_machine_ids(self):
|
||||
"""重置机器ID并备份原文件"""
|
||||
"""Reset machine ID and backup original file"""
|
||||
try:
|
||||
print(f"{Fore.CYAN}{EMOJI['INFO']} {self.translator.get('reset.checking')}...{Style.RESET_ALL}")
|
||||
|
||||
@@ -360,26 +360,26 @@ class MachineIDResetter:
|
||||
print(f"{Fore.CYAN}{EMOJI['RESET']} {self.translator.get('reset.generating')}...{Style.RESET_ALL}")
|
||||
new_ids = self.generate_new_ids()
|
||||
|
||||
# 更新配置文件
|
||||
# Update configuration file
|
||||
config.update(new_ids)
|
||||
|
||||
print(f"{Fore.CYAN}{EMOJI['FILE']} {self.translator.get('reset.saving_json')}...{Style.RESET_ALL}")
|
||||
with open(self.db_path, "w", encoding="utf-8") as f:
|
||||
json.dump(config, f, indent=4)
|
||||
|
||||
# 更新SQLite数据库
|
||||
# Update SQLite database
|
||||
self.update_sqlite_db(new_ids)
|
||||
|
||||
# 更新系统ID
|
||||
# Update system IDs
|
||||
self.update_system_ids(new_ids)
|
||||
|
||||
# 检查 Cursor 版本并执行相应的操作
|
||||
# Check Cursor version and perform corresponding actions
|
||||
greater_than_0_45 = check_cursor_version(self.translator)
|
||||
if greater_than_0_45:
|
||||
print(f"{Fore.CYAN}{EMOJI['INFO']} 检测到 Cursor 版本 >= 0.45.0,正在修补 getMachineId...{Style.RESET_ALL}")
|
||||
print(f"{Fore.CYAN}{EMOJI['INFO']} {self.translator.get('reset.detecting_version')} >= 0.45.0,{self.translator.get('reset.patching_getmachineid')}{Style.RESET_ALL}")
|
||||
patch_cursor_get_machine_id(self.translator)
|
||||
else:
|
||||
print(f"{Fore.YELLOW}{EMOJI['INFO']} Cursor 版本 < 0.45.0,跳过 getMachineId 修补{Style.RESET_ALL}")
|
||||
print(f"{Fore.YELLOW}{EMOJI['INFO']} {self.translator.get('reset.version_less_than_0_45')}{Style.RESET_ALL}")
|
||||
|
||||
print(f"{Fore.GREEN}{EMOJI['SUCCESS']} {self.translator.get('reset.success')}{Style.RESET_ALL}")
|
||||
print(f"\n{Fore.CYAN}{self.translator.get('reset.new_id')}:{Style.RESET_ALL}")
|
||||
@@ -397,12 +397,12 @@ class MachineIDResetter:
|
||||
return False
|
||||
|
||||
def run(translator=None):
|
||||
"""便捷函数,用于直接调用重置功能"""
|
||||
"""Convenient function for directly calling the reset function"""
|
||||
print(f"\n{Fore.CYAN}{'='*50}{Style.RESET_ALL}")
|
||||
print(f"{Fore.CYAN}{EMOJI['RESET']} {translator.get('reset.title')}{Style.RESET_ALL}")
|
||||
print(f"{Fore.CYAN}{'='*50}{Style.RESET_ALL}")
|
||||
|
||||
resetter = MachineIDResetter(translator) # 正確傳遞 translator
|
||||
resetter = MachineIDResetter(translator) # Correctly pass translator
|
||||
resetter.reset_machine_ids()
|
||||
|
||||
print(f"\n{Fore.CYAN}{'='*50}{Style.RESET_ALL}")
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# 設置顏色主題
|
||||
# set color theme
|
||||
$Theme = @{
|
||||
Primary = 'Cyan'
|
||||
Success = 'Green'
|
||||
@@ -17,7 +17,7 @@ $Logo = @"
|
||||
╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝
|
||||
"@
|
||||
|
||||
# 美化輸出函數
|
||||
# Beautiful Output Function
|
||||
function Write-Styled {
|
||||
param (
|
||||
[string]$Message,
|
||||
@@ -40,7 +40,7 @@ function Write-Styled {
|
||||
}
|
||||
}
|
||||
|
||||
# 獲取版本號函數
|
||||
# Get version number function
|
||||
function Get-LatestVersion {
|
||||
try {
|
||||
$latestRelease = Invoke-RestMethod -Uri "https://api.github.com/repos/yeongpin/cursor-free-vip/releases/latest"
|
||||
@@ -54,28 +54,28 @@ function Get-LatestVersion {
|
||||
}
|
||||
}
|
||||
|
||||
# 顯示 Logo
|
||||
# Show Logo
|
||||
Write-Host $Logo -ForegroundColor $Theme.Primary
|
||||
$releaseInfo = Get-LatestVersion
|
||||
$version = $releaseInfo.Version
|
||||
Write-Host "Version $version" -ForegroundColor $Theme.Info
|
||||
Write-Host "Created by YeongPin`n" -ForegroundColor $Theme.Info
|
||||
|
||||
# 設置 TLS 1.2
|
||||
# Set TLS 1.2
|
||||
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
||||
|
||||
# 主安裝函數
|
||||
# Main installation function
|
||||
function Install-CursorFreeVIP {
|
||||
Write-Styled "Start downloading Cursor Free VIP" -Color $Theme.Primary -Prefix "Download"
|
||||
|
||||
try {
|
||||
# 獲取最新版本
|
||||
# Get latest version
|
||||
Write-Styled "Checking latest version..." -Color $Theme.Primary -Prefix "Update"
|
||||
$releaseInfo = Get-LatestVersion
|
||||
$version = $releaseInfo.Version
|
||||
Write-Styled "Found latest version: $version" -Color $Theme.Success -Prefix "Version"
|
||||
|
||||
# 查找對應的資源
|
||||
# Find corresponding resources
|
||||
$asset = $releaseInfo.Assets | Where-Object { $_.name -eq "CursorFreeVIP_${version}_windows.exe" }
|
||||
if (!$asset) {
|
||||
Write-Styled "File not found: CursorFreeVIP_${version}_windows.exe" -Color $Theme.Error -Prefix "Error"
|
||||
@@ -86,22 +86,114 @@ function Install-CursorFreeVIP {
|
||||
throw "Cannot find target file"
|
||||
}
|
||||
|
||||
# 下載到Downloads文件夾
|
||||
# Check if Downloads folder already exists for the corresponding version
|
||||
$DownloadsPath = [Environment]::GetFolderPath("UserProfile") + "\Downloads"
|
||||
$downloadPath = Join-Path $DownloadsPath "CursorFreeVIP.exe"
|
||||
$downloadPath = Join-Path $DownloadsPath "CursorFreeVIP_${version}_windows.exe"
|
||||
|
||||
Write-Styled "Downloading to Downloads folder..." -Color $Theme.Primary -Prefix "Download"
|
||||
if (Test-Path $downloadPath) {
|
||||
Write-Styled "Found existing installation file" -Color $Theme.Success -Prefix "Found"
|
||||
Write-Styled "Location: $downloadPath" -Color $Theme.Info -Prefix "Location"
|
||||
|
||||
# Check if running with administrator privileges
|
||||
$isAdmin = ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)
|
||||
|
||||
if (-not $isAdmin) {
|
||||
Write-Styled "Requesting administrator privileges..." -Color $Theme.Warning -Prefix "Admin"
|
||||
|
||||
# Create new process with administrator privileges
|
||||
$startInfo = New-Object System.Diagnostics.ProcessStartInfo
|
||||
$startInfo.FileName = $downloadPath
|
||||
$startInfo.UseShellExecute = $true
|
||||
$startInfo.Verb = "runas"
|
||||
|
||||
try {
|
||||
[System.Diagnostics.Process]::Start($startInfo)
|
||||
Write-Styled "Program started with admin privileges" -Color $Theme.Success -Prefix "Launch"
|
||||
return
|
||||
}
|
||||
catch {
|
||||
Write-Styled "Failed to start with admin privileges. Starting normally..." -Color $Theme.Warning -Prefix "Warning"
|
||||
Start-Process $downloadPath
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
# If already running with administrator privileges, start directly
|
||||
Start-Process $downloadPath
|
||||
return
|
||||
}
|
||||
|
||||
Write-Styled "No existing installation file found, starting download..." -Color $Theme.Primary -Prefix "Download"
|
||||
|
||||
# Create WebClient and add progress event
|
||||
$webClient = New-Object System.Net.WebClient
|
||||
$webClient.Headers.Add("User-Agent", "PowerShell Script")
|
||||
$webClient.DownloadFile($asset.browser_download_url, $downloadPath)
|
||||
|
||||
# Define progress variables
|
||||
$Global:downloadedBytes = 0
|
||||
$Global:totalBytes = 0
|
||||
$Global:lastProgress = 0
|
||||
$Global:lastBytes = 0
|
||||
$Global:lastTime = Get-Date
|
||||
|
||||
# Download progress event
|
||||
$eventId = [guid]::NewGuid()
|
||||
Register-ObjectEvent -InputObject $webClient -EventName DownloadProgressChanged -Action {
|
||||
$Global:downloadedBytes = $EventArgs.BytesReceived
|
||||
$Global:totalBytes = $EventArgs.TotalBytesToReceive
|
||||
$progress = [math]::Round(($Global:downloadedBytes / $Global:totalBytes) * 100, 1)
|
||||
|
||||
# Only update display when progress changes by more than 1%
|
||||
if ($progress -gt $Global:lastProgress + 1) {
|
||||
$Global:lastProgress = $progress
|
||||
$downloadedMB = [math]::Round($Global:downloadedBytes / 1MB, 2)
|
||||
$totalMB = [math]::Round($Global:totalBytes / 1MB, 2)
|
||||
|
||||
# Calculate download speed
|
||||
$currentTime = Get-Date
|
||||
$timeSpan = ($currentTime - $Global:lastTime).TotalSeconds
|
||||
if ($timeSpan -gt 0) {
|
||||
$bytesChange = $Global:downloadedBytes - $Global:lastBytes
|
||||
$speed = $bytesChange / $timeSpan
|
||||
|
||||
# Choose appropriate unit based on speed
|
||||
$speedDisplay = if ($speed -gt 1MB) {
|
||||
"$([math]::Round($speed / 1MB, 2)) MB/s"
|
||||
} elseif ($speed -gt 1KB) {
|
||||
"$([math]::Round($speed / 1KB, 2)) KB/s"
|
||||
} else {
|
||||
"$([math]::Round($speed, 2)) B/s"
|
||||
}
|
||||
|
||||
Write-Host "`rDownloading: $downloadedMB MB / $totalMB MB ($progress%) - $speedDisplay" -NoNewline -ForegroundColor Cyan
|
||||
|
||||
# Update last data
|
||||
$Global:lastBytes = $Global:downloadedBytes
|
||||
$Global:lastTime = $currentTime
|
||||
}
|
||||
}
|
||||
} | Out-Null
|
||||
|
||||
# Download completed event
|
||||
Register-ObjectEvent -InputObject $webClient -EventName DownloadFileCompleted -Action {
|
||||
Write-Host "`r" -NoNewline
|
||||
Write-Styled "Download completed!" -Color $Theme.Success -Prefix "Complete"
|
||||
Unregister-Event -SourceIdentifier $eventId
|
||||
} | Out-Null
|
||||
|
||||
# Start download
|
||||
$webClient.DownloadFileAsync([Uri]$asset.browser_download_url, $downloadPath)
|
||||
|
||||
# Wait for download to complete
|
||||
while ($webClient.IsBusy) {
|
||||
Start-Sleep -Milliseconds 100
|
||||
}
|
||||
|
||||
Write-Styled "Download completed!" -Color $Theme.Success -Prefix "Complete"
|
||||
Write-Styled "File location: $downloadPath" -Color $Theme.Info -Prefix "Location"
|
||||
Write-Styled "Starting program..." -Color $Theme.Primary -Prefix "Launch"
|
||||
|
||||
# 運行程序
|
||||
# Run program
|
||||
Start-Process $downloadPath
|
||||
|
||||
}
|
||||
catch {
|
||||
Write-Styled $_.Exception.Message -Color $Theme.Error -Prefix "Error"
|
||||
@@ -109,7 +201,7 @@ function Install-CursorFreeVIP {
|
||||
}
|
||||
}
|
||||
|
||||
# 執行安裝
|
||||
# Execute installation
|
||||
try {
|
||||
Install-CursorFreeVIP
|
||||
}
|
||||
@@ -120,4 +212,4 @@ catch {
|
||||
finally {
|
||||
Write-Host "`nPress any key to exit..." -ForegroundColor $Theme.Info
|
||||
$null = $Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown')
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
# 顏色定義
|
||||
# Color definitions
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
@@ -22,7 +22,7 @@ EOF
|
||||
echo -e "${NC}"
|
||||
}
|
||||
|
||||
# 获取下载文件夹路径
|
||||
# Get download folder path
|
||||
get_downloads_dir() {
|
||||
if [[ "$(uname)" == "Darwin" ]]; then
|
||||
echo "$HOME/Downloads"
|
||||
@@ -36,59 +36,139 @@ get_downloads_dir() {
|
||||
fi
|
||||
}
|
||||
|
||||
# 獲取最新版本
|
||||
# Get latest version
|
||||
get_latest_version() {
|
||||
echo -e "${CYAN}ℹ️ 正在檢查最新版本...${NC}"
|
||||
echo -e "${CYAN}ℹ️ Checking latest version...${NC}"
|
||||
local latest_release
|
||||
latest_release=$(curl -s https://api.github.com/repos/yeongpin/cursor-free-vip/releases/latest)
|
||||
if [ $? -ne 0 ]; then
|
||||
echo -e "${RED}❌ 無法獲取最新版本信息${NC}"
|
||||
echo -e "${RED}❌ Cannot get latest version information${NC}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
VERSION=$(echo "$latest_release" | grep -o '"tag_name": ".*"' | cut -d'"' -f4 | tr -d 'v')
|
||||
echo -e "${GREEN}✅ 找到最新版本: ${VERSION}${NC}"
|
||||
echo -e "${GREEN}✅ Found latest version: ${VERSION}${NC}"
|
||||
}
|
||||
|
||||
# 檢測系統類型
|
||||
# Detect system type and architecture
|
||||
detect_os() {
|
||||
if [[ "$(uname)" == "Darwin" ]]; then
|
||||
OS="mac"
|
||||
else
|
||||
# Detect macOS architecture
|
||||
ARCH=$(uname -m)
|
||||
if [[ "$ARCH" == "arm64" ]]; then
|
||||
OS="mac_arm64"
|
||||
echo -e "${CYAN}ℹ️ Detected macOS ARM64 architecture${NC}"
|
||||
else
|
||||
OS="mac_intel"
|
||||
echo -e "${CYAN}ℹ️ Detected macOS Intel architecture${NC}"
|
||||
fi
|
||||
elif [[ "$(uname)" == "Linux" ]]; then
|
||||
OS="linux"
|
||||
echo -e "${CYAN}ℹ️ Detected Linux system${NC}"
|
||||
else
|
||||
# Assume Windows
|
||||
OS="windows"
|
||||
echo -e "${CYAN}ℹ️ Detected Windows system${NC}"
|
||||
fi
|
||||
}
|
||||
|
||||
# 下載並安裝
|
||||
# Install and download
|
||||
install_cursor_free_vip() {
|
||||
local downloads_dir=$(get_downloads_dir)
|
||||
local binary_name="CursorFreeVIP_${VERSION}_${OS}"
|
||||
local binary_path="${downloads_dir}/cursor-free-vip"
|
||||
local binary_path="${downloads_dir}/${binary_name}"
|
||||
local download_url="https://github.com/yeongpin/cursor-free-vip/releases/download/v${VERSION}/${binary_name}"
|
||||
|
||||
echo -e "${CYAN}ℹ️ 正在下載到 ${downloads_dir}...${NC}"
|
||||
# Check if file already exists
|
||||
if [ -f "${binary_path}" ]; then
|
||||
echo -e "${GREEN}✅ Found existing installation file${NC}"
|
||||
echo -e "${CYAN}ℹ️ Location: ${binary_path}${NC}"
|
||||
|
||||
# Check if running as root
|
||||
if [ "$EUID" -ne 0 ]; then
|
||||
echo -e "${YELLOW}⚠️ Requesting administrator privileges...${NC}"
|
||||
if command -v sudo >/dev/null 2>&1; then
|
||||
echo -e "${CYAN}ℹ️ Starting program with sudo...${NC}"
|
||||
sudo chmod +x "${binary_path}"
|
||||
sudo "${binary_path}"
|
||||
else
|
||||
echo -e "${YELLOW}⚠️ sudo not found, trying to run normally...${NC}"
|
||||
chmod +x "${binary_path}"
|
||||
"${binary_path}"
|
||||
fi
|
||||
else
|
||||
# Already running as root
|
||||
echo -e "${CYAN}ℹ️ Already running as root, starting program...${NC}"
|
||||
chmod +x "${binary_path}"
|
||||
"${binary_path}"
|
||||
fi
|
||||
return
|
||||
fi
|
||||
|
||||
echo -e "${CYAN}ℹ️ No existing installation file found, starting download...${NC}"
|
||||
echo -e "${CYAN}ℹ️ Downloading to ${downloads_dir}...${NC}"
|
||||
echo -e "${CYAN}ℹ️ Download link: ${download_url}${NC}"
|
||||
|
||||
# Check if file exists
|
||||
if curl --output /dev/null --silent --head --fail "$download_url"; then
|
||||
echo -e "${GREEN}✅ File exists, starting download...${NC}"
|
||||
else
|
||||
echo -e "${RED}❌ Download link does not exist: ${download_url}${NC}"
|
||||
echo -e "${YELLOW}⚠️ Trying without architecture...${NC}"
|
||||
|
||||
# Try without architecture
|
||||
if [[ "$OS" == "mac_arm64" || "$OS" == "mac_intel" ]]; then
|
||||
OS="mac"
|
||||
binary_name="CursorFreeVIP_${VERSION}_${OS}"
|
||||
download_url="https://github.com/yeongpin/cursor-free-vip/releases/download/v${VERSION}/${binary_name}"
|
||||
echo -e "${CYAN}ℹ️ New download link: ${download_url}${NC}"
|
||||
|
||||
if ! curl --output /dev/null --silent --head --fail "$download_url"; then
|
||||
echo -e "${RED}❌ New download link does not exist${NC}"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Download file
|
||||
if ! curl -L -o "${binary_path}" "$download_url"; then
|
||||
echo -e "${RED}❌ 下載失敗${NC}"
|
||||
echo -e "${RED}❌ Download failed${NC}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo -e "${CYAN}ℹ️ 正在設置執行權限...${NC}"
|
||||
# Check downloaded file size
|
||||
local file_size=$(stat -f%z "${binary_path}" 2>/dev/null || stat -c%s "${binary_path}" 2>/dev/null)
|
||||
echo -e "${CYAN}ℹ️ Downloaded file size: ${file_size} bytes${NC}"
|
||||
|
||||
# If file is too small, it might be an error message
|
||||
if [ "$file_size" -lt 1000 ]; then
|
||||
echo -e "${YELLOW}⚠️ Warning: Downloaded file is too small, possibly not a valid executable file${NC}"
|
||||
echo -e "${YELLOW}⚠️ File content:${NC}"
|
||||
cat "${binary_path}"
|
||||
echo ""
|
||||
echo -e "${RED}❌ Download failed, please check version and operating system${NC}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo -e "${CYAN}ℹ️ Setting executable permissions...${NC}"
|
||||
chmod +x "${binary_path}"
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
echo -e "${GREEN}✅ 安裝完成!${NC}"
|
||||
echo -e "${CYAN}ℹ️ 程序已下載到: ${binary_path}${NC}"
|
||||
echo -e "${CYAN}ℹ️ 正在啟動程序...${NC}"
|
||||
echo -e "${GREEN}✅ Installation completed!${NC}"
|
||||
echo -e "${CYAN}ℹ️ Program downloaded to: ${binary_path}${NC}"
|
||||
echo -e "${CYAN}ℹ️ Starting program...${NC}"
|
||||
|
||||
# 直接运行程序
|
||||
# Run program directly
|
||||
"${binary_path}"
|
||||
else
|
||||
echo -e "${RED}❌ 安裝失敗${NC}"
|
||||
echo -e "${RED}❌ Installation failed${NC}"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
# 主程序
|
||||
# Main program
|
||||
main() {
|
||||
print_logo
|
||||
get_latest_version
|
||||
@@ -96,5 +176,5 @@ main() {
|
||||
install_cursor_free_vip
|
||||
}
|
||||
|
||||
# 運行主程序
|
||||
main
|
||||
# Run main program
|
||||
main
|
||||
|
||||
@@ -1,69 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>uBlock — Your filters</title>
|
||||
|
||||
<link rel="stylesheet" href="lib/codemirror/lib/codemirror.css">
|
||||
<link rel="stylesheet" href="lib/codemirror/addon/hint/show-hint.css">
|
||||
<link rel="stylesheet" href="lib/codemirror/addon/search/matchesonscrollbar.css">
|
||||
|
||||
<link rel="stylesheet" href="css/themes/default.css">
|
||||
<link rel="stylesheet" href="css/common.css">
|
||||
<link rel="stylesheet" href="css/fa-icons.css">
|
||||
<link rel="stylesheet" href="css/dashboard-common.css">
|
||||
<link rel="stylesheet" href="css/cloud-ui.css">
|
||||
<link rel="stylesheet" href="css/1p-filters.css">
|
||||
<link rel="stylesheet" href="css/codemirror.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div class="body">
|
||||
<div id="cloudWidget" class="hide" data-cloud-entry="myFiltersPane"></div>
|
||||
<p>
|
||||
<button id="userFiltersApply" class="preferred iconified" type="button" disabled><span class="fa-icon">check</span><span data-i18n="1pApplyChanges">_</span><span class="hover"></span></button>
|
||||
<button id="userFiltersRevert" class="iconified" type="button" disabled><span class="fa-icon">undo</span><span data-i18n="genericRevert">_</span><span class="hover"></span></button>
|
||||
 
|
||||
<button id="importUserFiltersFromFile" class="iconified" type="button"><span class="fa-icon">download-alt</span><span data-i18n="1pImport">_</span><span class="hover"></span></button>
|
||||
<button id="exportUserFiltersToFile" class="iconified" type="button"><span class="fa-icon">upload-alt</span><span data-i18n="1pExport">_</span><span class="hover"></span></button>
|
||||
</p>
|
||||
<p data-i18n="1pTrustWarning"></p>
|
||||
<div class="li"><label><span id="enableMyFilters" class="input checkbox"><input type="checkbox"><svg viewBox="0 0 24 24"><path d="M1.73,12.91 8.1,19.28 22.79,4.59"/></svg></span><span data-i18n="1pEnableMyFiltersLabel"></span></label></div>
|
||||
<div id="trustMyFilters" class="li"><label><span class="input checkbox"><input type="checkbox"><svg viewBox="0 0 24 24"><path d="M1.73,12.91 8.1,19.28 22.79,4.59"/></svg></span><span data-i18n="1pTrustMyFiltersLabel"></span></label></div>
|
||||
</div>
|
||||
<div id="userFilters" class="codeMirrorContainer codeMirrorBreakAll cm-theme-override" spellcheck="false"></div>
|
||||
<div class="hidden">
|
||||
<input id="importFilePicker" type="file" accept="text/plain">
|
||||
</div>
|
||||
|
||||
<script src="lib/codemirror/lib/codemirror.js"></script>
|
||||
<script src="lib/codemirror/addon/comment/comment.js"></script>
|
||||
<script src="lib/codemirror/addon/display/panel.js"></script>
|
||||
<script src="lib/codemirror/addon/edit/closebrackets.js"></script>
|
||||
<script src="lib/codemirror/addon/edit/matchbrackets.js"></script>
|
||||
<script src="lib/codemirror/addon/fold/foldcode.js"></script>
|
||||
<script src="lib/codemirror/addon/hint/show-hint.js"></script>
|
||||
<script src="lib/codemirror/addon/scroll/annotatescrollbar.js"></script>
|
||||
<script src="lib/codemirror/addon/search/searchcursor.js"></script>
|
||||
<script src="lib/codemirror/addon/selection/active-line.js"></script>
|
||||
<script src="lib/diff/swatinem_diff.js"></script>
|
||||
<script src="lib/hsluv/hsluv-0.1.0.min.js"></script>
|
||||
|
||||
<script src="js/vapi.js"></script>
|
||||
<script src="js/vapi-common.js"></script>
|
||||
<script src="js/vapi-client.js"></script>
|
||||
|
||||
<script src="js/codemirror/search.js" type="module"></script>
|
||||
<script src="js/codemirror/search-thread.js"></script>
|
||||
|
||||
<script src="js/fa-icons.js" type="module"></script>
|
||||
<script src="js/theme.js" type="module"></script>
|
||||
<script src="js/i18n.js" type="module"></script>
|
||||
<script src="js/dashboard-common.js" type="module"></script>
|
||||
<script src="js/cloud-ui.js" type="module"></script>
|
||||
<script src="js/1p-filters.js" type="module"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,117 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1">
|
||||
<title>uBlock — Filter lists</title>
|
||||
<link rel="stylesheet" type="text/css" href="css/themes/default.css">
|
||||
<link rel="stylesheet" type="text/css" href="css/common.css">
|
||||
<link rel="stylesheet" type="text/css" href="css/fa-icons.css">
|
||||
<link rel="stylesheet" type="text/css" href="css/dashboard-common.css">
|
||||
<link rel="stylesheet" type="text/css" href="css/cloud-ui.css">
|
||||
<link rel="stylesheet" type="text/css" href="css/3p-filters.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div class="body">
|
||||
|
||||
<div id="cloudWidget" class="hide" data-cloud-entry="tpFiltersPane"></div>
|
||||
<p id="actions">
|
||||
<button id="buttonApply" class="preferred disabled iconified dontshrink" type="button" data-i18n-title="3pApplyChanges"><span class="fa-icon">check</span><span data-i18n="3pApplyChanges">_</span><span class="hover"></span></button>
|
||||
<button id="buttonUpdate" class="preferred disabled iconified" type="button" data-i18n-title="3pUpdateNow"><span class="fa-icon">refresh</span><span data-i18n="3pUpdateNow">_</span><span class="hover"></span></button>
|
||||
</p>
|
||||
|
||||
<div>
|
||||
<div class="li">
|
||||
<label><span class="input checkbox"><input type="checkbox" id="autoUpdate"><svg viewBox="0 0 24 24"><path d="M1.73,12.91 8.1,19.28 22.79,4.59"/></svg></span><span data-i18n="3pAutoUpdatePrompt1"></span></label>
|
||||
</div>
|
||||
<div class="li">
|
||||
<label><span class="input checkbox"><input type="checkbox" id="suspendUntilListsAreLoaded"><svg viewBox="0 0 24 24"><path d="M1.73,12.91 8.1,19.28 22.79,4.59"/></svg></span><span data-i18n="3pSuspendUntilListsAreLoaded"></span></label>
|
||||
</div>
|
||||
<div class="li">
|
||||
<label><span class="input checkbox"><input type="checkbox" id="parseCosmeticFilters"><svg viewBox="0 0 24 24"><path d="M1.73,12.91 8.1,19.28 22.79,4.59"/></svg></span><span><span data-i18n="3pParseAllABPHideFiltersPrompt1"></span> <span class="fa-icon info" data-i18n-title="3pParseAllABPHideFiltersInfo">question-circle</span></span></label>
|
||||
</div>
|
||||
<div class="li">
|
||||
<label><span class="input checkbox"><input type="checkbox" id="ignoreGenericCosmeticFilters"><svg viewBox="0 0 24 24"><path d="M1.73,12.91 8.1,19.28 22.79,4.59"/></svg></span><span><span data-i18n="3pIgnoreGenericCosmeticFilters"></span> <span class="fa-icon info" data-i18n-title="3pIgnoreGenericCosmeticFiltersInfo">question-circle</span></span></label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
</div>
|
||||
|
||||
<div id="lists">
|
||||
<div class="rootstats expandable" data-key="*">
|
||||
<span class="fa-icon listExpander">angle-up</span><span id="listsOfBlockedHostsPrompt"></span>
|
||||
</div>
|
||||
<div class="searchfield"><input type="search" spellcheck="false" placeholder="" /><span class="fa-icon">search</span></div>
|
||||
<div class="listEntries"></div>
|
||||
<div class="li listEntry expandable" data-role="import">
|
||||
<span class="detailbar">
|
||||
<label><span class="fa-icon listExpander">angle-up</span><span class="listname" data-i18n="3pImport"></span></label>
|
||||
<a class="fa-icon info towiki" href="https://github.com/gorhill/uBlock/wiki/Filter-lists-from-around-the-web" target="_blank">info-circle</a>
|
||||
</span>
|
||||
<textarea dir="ltr" spellcheck="false" placeholder="3pExternalListsHint"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="templates" style="display: none;">
|
||||
<div class="listEntries"></div>
|
||||
<div class="li listEntry" data-role="leaf">
|
||||
<span class="detailbar">
|
||||
<label><span class="input checkbox"><input type="checkbox"><svg viewBox="0 0 24 24"><path d="M1.73,12.91 8.1,19.28 22.79,4.59"/></svg></span><span><span class="listname forinput"></span>
|
||||
</span></label>
|
||||
<span class="iconbar"><!--
|
||||
--><a class="fa-icon content" href="#" type="text/plain" target="_blank" data-i18n-title="3pViewContent">eye-open</a><!--
|
||||
--><a class="fa-icon support" href="#" target="_blank">home</a><!--
|
||||
--><span class="fa-icon remove">trash-o</span><!--
|
||||
--><a class="fa-icon mustread" href="#" target="_blank">info-circle</a><!--
|
||||
--><span class="fa-icon status unsecure" title="http">unlock-alt</span><!--
|
||||
--><span class="fa-icon status obsolete" data-i18n-title="3pExternalListObsolete">exclamation-triangle</span><!--
|
||||
--><span class="fa-icon status cache">clock-o</span><!--
|
||||
--><span class="fa-icon status updating" data-i18n-title="3pUpdating">spinner</span><!--
|
||||
--><span class="fa-icon status failed" data-i18n-title="3pNetworkError">unlink</span>
|
||||
</span>
|
||||
<span class="leafstats"></span>
|
||||
</span>
|
||||
</div>
|
||||
<div class="li listEntry expandable" data-role="node">
|
||||
<span class="detailbar">
|
||||
<label><span class="input checkbox"><input type="checkbox"><svg viewBox="0 0 24 24"><path d="M1.73,12.91 8.1,19.28 22.79,4.59"/></svg></span><span class="listname forinput"></span></label>
|
||||
<span class="nodestats"></span>
|
||||
<span class="fa-icon listExpander">angle-up</span>
|
||||
<span class="iconbar"><!--
|
||||
--><a class="fa-icon support" href="#" target="_blank">home</a><!--
|
||||
--><a class="fa-icon mustread" href="#" target="_blank">info-circle</a><!--
|
||||
--><span class="fa-icon status obsolete" data-i18n-title="3pExternalListObsolete">exclamation-triangle</span><!--
|
||||
--><span class="fa-icon status cache">clock-o</span><!--
|
||||
--><span class="fa-icon status updating" data-i18n-title="3pUpdating">spinner</span><!--
|
||||
--><span class="fa-icon status failed" data-i18n-title="3pNetworkError">unlink</span>
|
||||
</span>
|
||||
<span class="leafstats"></span>
|
||||
</span>
|
||||
</div>
|
||||
<div class="li listEntry expandable" data-parent="root" data-role="node">
|
||||
<span class="detailbar">
|
||||
<label><span class="fa-icon listExpander">angle-up</span><span class="listname"></span></label>
|
||||
<span class="nodestats"></span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="lib/hsluv/hsluv-0.1.0.min.js"></script>
|
||||
|
||||
<script src="js/fa-icons.js" type="module"></script>
|
||||
<script src="js/vapi.js"></script>
|
||||
<script src="js/vapi-common.js"></script>
|
||||
<script src="js/vapi-client.js"></script>
|
||||
<script src="js/theme.js" type="module"></script>
|
||||
<script src="js/i18n.js" type="module"></script>
|
||||
<script src="js/dashboard-common.js" type="module"></script>
|
||||
<script src="js/cloud-ui.js" type="module"></script>
|
||||
<script src="js/3p-filters.js" type="module"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,674 +0,0 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. {http://fsf.org/}
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
{one line to give the program's name and a brief idea of what it does.}
|
||||
Copyright (C) {year} {name of author}
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see {http://www.gnu.org/licenses/}.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
{{project}} Copyright (C) {{year}} {{fullname}}
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
{http://www.gnu.org/licenses/}.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
{http://www.gnu.org/philosophy/why-not-lgpl.html}.
|
||||