mirror of
https://github.com/yeongpin/cursor-free-vip.git
synced 2025-08-03 04:57:36 +08:00
Merge branch 'main' of https://github.com/yeongpin/cursor-free-vip
This commit is contained in:
commit
1e3e9c99eb
4
.github/workflows/build.yml
vendored
4
.github/workflows/build.yml
vendored
@ -6,7 +6,7 @@ on:
|
|||||||
version:
|
version:
|
||||||
description: 'Version number (e.g. 1.0.9)'
|
description: 'Version number (e.g. 1.0.9)'
|
||||||
required: true
|
required: true
|
||||||
default: '1.8.08'
|
default: '1.8.09'
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
@ -241,4 +241,4 @@ jobs:
|
|||||||
draft: false
|
draft: false
|
||||||
prerelease: false
|
prerelease: false
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
@ -5,9 +5,12 @@
|
|||||||
2. Fix: Some Issues | 修復一些問題
|
2. Fix: Some Issues | 修復一些問題
|
||||||
|
|
||||||
## v1.8.09
|
## v1.8.09
|
||||||
1. Add: Force Update Config | 添加強制更新配置
|
1. Add: Bypass Token Limit Check | 繞過 Token 使用限制檢查
|
||||||
2. Add: Multilanguage support for force update | 添加強制更新功能的多語言支持
|
2. Add:Bypass Claude Limit 30000 set to 900000(9e5) | 繞過 Claude 使用限制 30000 設置為 900000(9e5)
|
||||||
3. Fix: Some Issues | 修復一些問題
|
3. Add: Force Update Config | 添加強制更新配置
|
||||||
|
4. Add: Multilanguage support for force update | 添加強制更新功能的多語言支持
|
||||||
|
5. Fix: Reset break | 修復重置中斷
|
||||||
|
4. Fix: Some Issues | 修復一些問題
|
||||||
|
|
||||||
## v1.8.08
|
## v1.8.08
|
||||||
1. Add: Force Update Config | 添加強制更新配置
|
1. Add: Force Update Config | 添加強制更新配置
|
||||||
|
@ -15,6 +15,7 @@ import configparser
|
|||||||
from new_signup import get_user_documents_path
|
from new_signup import get_user_documents_path
|
||||||
import traceback
|
import traceback
|
||||||
from config import get_config
|
from config import get_config
|
||||||
|
from datetime import datetime
|
||||||
|
|
||||||
# Initialize colorama
|
# Initialize colorama
|
||||||
init()
|
init()
|
||||||
@ -334,37 +335,40 @@ def modify_workbench_js(file_path: str, translator=None) -> bool:
|
|||||||
with open(file_path, "r", encoding="utf-8", errors="ignore") as main_file:
|
with open(file_path, "r", encoding="utf-8", errors="ignore") as main_file:
|
||||||
content = main_file.read()
|
content = main_file.read()
|
||||||
|
|
||||||
if sys.platform == "win32":
|
patterns = {
|
||||||
# Define replacement patterns
|
# 通用按钮替换模式
|
||||||
CButton_old_pattern = r'M(x,I(as,{title:"Upgrade to Pro",size:"small",get codicon(){return $.rocket},get onClick(){return t.pay}}),null)'
|
r'B(k,D(Ln,{title:"Upgrade to Pro",size:"small",get codicon(){return A.rocket},get onClick(){return t.pay}}),null)': r'B(k,D(Ln,{title:"yeongpin GitHub",size:"small",get codicon(){return A.github},get onClick(){return function(){window.open("https://github.com/yeongpin/cursor-free-vip","_blank")}}}),null)',
|
||||||
CButton_new_pattern = r'M(x,I(as,{title:"yeongpin GitHub",size:"small",get codicon(){return $.rocket},get onClick(){return function(){window.open("https://github.com/yeongpin/cursor-free-vip","_blank")}}}),null)'
|
|
||||||
elif sys.platform == "linux":
|
# Windows/Linux/Mac 通用按钮替换模式
|
||||||
CButton_old_pattern = r'M(x,I(as,{title:"Upgrade to Pro",size:"small",get codicon(){return $.rocket},get onClick(){return t.pay}}),null)'
|
r'M(x,I(as,{title:"Upgrade to Pro",size:"small",get codicon(){return $.rocket},get onClick(){return t.pay}}),null)': r'M(x,I(as,{title:"yeongpin GitHub",size:"small",get codicon(){return $.rocket},get onClick(){return function(){window.open("https://github.com/yeongpin/cursor-free-vip","_blank")}}}),null)',
|
||||||
CButton_new_pattern = r'M(x,I(as,{title:"yeongpin GitHub",size:"small",get codicon(){return $.rocket},get onClick(){return function(){window.open("https://github.com/yeongpin/cursor-free-vip","_blank")}}}),null)'
|
|
||||||
elif sys.platform == "darwin":
|
# Badge 替换
|
||||||
CButton_old_pattern = r'M(x,I(as,{title:"Upgrade to Pro",size:"small",get codicon(){return $.rocket},get onClick(){return t.pay}}),null)'
|
r'<div>Pro Trial': r'<div>Pro',
|
||||||
CButton_new_pattern = r'M(x,I(as,{title:"yeongpin GitHub",size:"small",get codicon(){return $.rocket},get onClick(){return function(){window.open("https://github.com/yeongpin/cursor-free-vip","_blank")}}}),null)'
|
|
||||||
|
|
||||||
CBadge_old_pattern = r'<div>Pro Trial'
|
r'py-1">Auto-select': r'py-1">Bypass-Version-Pin',
|
||||||
CBadge_new_pattern = r'<div>Pro'
|
|
||||||
|
#
|
||||||
|
r'async getEffectiveTokenLimit(e){const n=e.modelName;if(!n)return 2e5;':r'async getEffectiveTokenLimit(e){return 9000000;const n=e.modelName;if(!n)return 9e5;',
|
||||||
|
# Pro
|
||||||
|
r'var DWr=ne("<div class=settings__item_description>You are currently signed in with <strong></strong>.");': r'var DWr=ne("<div class=settings__item_description>You are currently signed in with <strong></strong>. <h1>Pro</h1>");',
|
||||||
|
|
||||||
|
# Toast 替换
|
||||||
|
r'notifications-toasts': r'notifications-toasts hidden'
|
||||||
|
}
|
||||||
|
|
||||||
CToast_old_pattern = r'notifications-toasts'
|
# 使用patterns进行替换
|
||||||
CToast_new_pattern = r'notifications-toasts hidden'
|
for old_pattern, new_pattern in patterns.items():
|
||||||
|
content = content.replace(old_pattern, new_pattern)
|
||||||
# Replace content
|
|
||||||
content = content.replace(CButton_old_pattern, CButton_new_pattern)
|
|
||||||
content = content.replace(CBadge_old_pattern, CBadge_new_pattern)
|
|
||||||
content = content.replace(CToast_old_pattern, CToast_new_pattern)
|
|
||||||
|
|
||||||
# Write to temporary file
|
# Write to temporary file
|
||||||
tmp_file.write(content)
|
tmp_file.write(content)
|
||||||
tmp_path = tmp_file.name
|
tmp_path = tmp_file.name
|
||||||
|
|
||||||
# Backup original file
|
# Backup original file with timestamp
|
||||||
backup_path = file_path + ".backup"
|
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
|
||||||
if os.path.exists(backup_path):
|
backup_path = f"{file_path}.backup.{timestamp}"
|
||||||
os.remove(backup_path)
|
|
||||||
shutil.copy2(file_path, backup_path)
|
shutil.copy2(file_path, backup_path)
|
||||||
|
print(f"{Fore.GREEN}{EMOJI['SUCCESS']} {translator.get('reset.backup_created', path=backup_path)}{Style.RESET_ALL}")
|
||||||
|
|
||||||
# Move temporary file to original position
|
# Move temporary file to original position
|
||||||
if os.path.exists(file_path):
|
if os.path.exists(file_path):
|
||||||
@ -411,7 +415,10 @@ def modify_main_js(main_path: str, translator) -> bool:
|
|||||||
tmp_file.write(content)
|
tmp_file.write(content)
|
||||||
tmp_path = tmp_file.name
|
tmp_path = tmp_file.name
|
||||||
|
|
||||||
shutil.copy2(main_path, main_path + ".old")
|
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
|
||||||
|
backup_path = f"{main_path}.old.{timestamp}"
|
||||||
|
shutil.copy2(main_path, backup_path)
|
||||||
|
print(f"{Fore.GREEN}{EMOJI['SUCCESS']} {translator.get('reset.backup_created', path=backup_path)}{Style.RESET_ALL}")
|
||||||
shutil.move(tmp_path, main_path)
|
shutil.move(tmp_path, main_path)
|
||||||
|
|
||||||
os.chmod(main_path, original_mode)
|
os.chmod(main_path, original_mode)
|
||||||
@ -461,7 +468,8 @@ def patch_cursor_get_machine_id(translator) -> bool:
|
|||||||
print(f"{Fore.CYAN}{EMOJI['INFO']} {translator.get('reset.version_check_passed')}{Style.RESET_ALL}")
|
print(f"{Fore.CYAN}{EMOJI['INFO']} {translator.get('reset.version_check_passed')}{Style.RESET_ALL}")
|
||||||
|
|
||||||
# Backup file
|
# Backup file
|
||||||
backup_path = main_path + ".bak"
|
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
|
||||||
|
backup_path = f"{main_path}.bak.{timestamp}"
|
||||||
if not os.path.exists(backup_path):
|
if not os.path.exists(backup_path):
|
||||||
shutil.copy2(main_path, 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}")
|
print(f"{Fore.GREEN}{EMOJI['SUCCESS']} {translator.get('reset.backup_created', path=backup_path)}{Style.RESET_ALL}")
|
||||||
@ -638,8 +646,8 @@ class MachineIDResetter:
|
|||||||
winreg.SetValueEx(key, "MachineGuid", 0, winreg.REG_SZ, new_guid)
|
winreg.SetValueEx(key, "MachineGuid", 0, winreg.REG_SZ, new_guid)
|
||||||
winreg.CloseKey(key)
|
winreg.CloseKey(key)
|
||||||
print(f"{Fore.GREEN}{EMOJI['SUCCESS']} {self.translator.get('reset.windows_machine_guid_updated')}{Style.RESET_ALL}")
|
print(f"{Fore.GREEN}{EMOJI['SUCCESS']} {self.translator.get('reset.windows_machine_guid_updated')}{Style.RESET_ALL}")
|
||||||
except PermissionError:
|
except PermissionError as e:
|
||||||
print(f"{Fore.RED}{EMOJI['ERROR']} {self.translator.get('reset.permission_denied')}{Style.RESET_ALL}")
|
print(f"{Fore.RED}{EMOJI['ERROR']} {self.translator.get('reset.permission_denied', error=str(e))}{Style.RESET_ALL}")
|
||||||
raise
|
raise
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"{Fore.RED}{EMOJI['ERROR']} {self.translator.get('reset.update_windows_machine_guid_failed', error=str(e))}{Style.RESET_ALL}")
|
print(f"{Fore.RED}{EMOJI['ERROR']} {self.translator.get('reset.update_windows_machine_guid_failed', error=str(e))}{Style.RESET_ALL}")
|
||||||
@ -717,12 +725,10 @@ class MachineIDResetter:
|
|||||||
with open(self.db_path, "r", encoding="utf-8") as f:
|
with open(self.db_path, "r", encoding="utf-8") as f:
|
||||||
config = json.load(f)
|
config = json.load(f)
|
||||||
|
|
||||||
backup_path = self.db_path + ".bak"
|
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
|
||||||
if not os.path.exists(backup_path):
|
backup_path = f"{self.db_path}.bak.{timestamp}"
|
||||||
print(f"{Fore.YELLOW}{EMOJI['BACKUP']} {self.translator.get('reset.creating_backup')}: {backup_path}{Style.RESET_ALL}")
|
print(f"{Fore.YELLOW}{EMOJI['BACKUP']} {self.translator.get('reset.creating_backup')}: {backup_path}{Style.RESET_ALL}")
|
||||||
shutil.copy2(self.db_path, backup_path)
|
shutil.copy2(self.db_path, backup_path)
|
||||||
else:
|
|
||||||
print(f"{Fore.YELLOW}{EMOJI['INFO']} {self.translator.get('reset.backup_exists')}{Style.RESET_ALL}")
|
|
||||||
|
|
||||||
print(f"{Fore.CYAN}{EMOJI['RESET']} {self.translator.get('reset.generating')}...{Style.RESET_ALL}")
|
print(f"{Fore.CYAN}{EMOJI['RESET']} {self.translator.get('reset.generating')}...{Style.RESET_ALL}")
|
||||||
new_ids = self.generate_new_ids()
|
new_ids = self.generate_new_ids()
|
||||||
@ -786,7 +792,8 @@ class MachineIDResetter:
|
|||||||
|
|
||||||
# Create backup if file exists
|
# Create backup if file exists
|
||||||
if os.path.exists(machine_id_path):
|
if os.path.exists(machine_id_path):
|
||||||
backup_path = machine_id_path + ".backup"
|
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
|
||||||
|
backup_path = f"{machine_id_path}.backup.{timestamp}"
|
||||||
try:
|
try:
|
||||||
shutil.copy2(machine_id_path, backup_path)
|
shutil.copy2(machine_id_path, backup_path)
|
||||||
print(f"{Fore.GREEN}{EMOJI['INFO']} {self.translator.get('reset.backup_created', path=backup_path) if self.translator else f'Backup created at: {backup_path}'}{Style.RESET_ALL}")
|
print(f"{Fore.GREEN}{EMOJI['INFO']} {self.translator.get('reset.backup_created', path=backup_path) if self.translator else f'Backup created at: {backup_path}'}{Style.RESET_ALL}")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user