从根源上解决cursor免费版50次限制问题

cursor免费版用了50次会limit。
下面是python代码,直接运行即可。
工具已经打包成exe可以在win上运行。
具体操作可以参考 风车

import os
import json
import uuid  # 导入uuid库以生成唯一ID


def get_current_id(file_path):
    """获取当前的机器ID"""
    if os.path.exists(file_path):
        with open(file_path, "r", encoding="utf-8") as f:
            try:
                data = json.load(f)
                return data.get("telemetry.machineId", "未找到机器ID")
            except json.JSONDecodeError:
                return "文件格式错误"
    return "文件不存在"


def generate_new_id():
    """生成新的唯一机器ID"""
    return str(uuid.uuid4())  # 生成一个UUID作为新的机器ID


def backup_file(file_path):
    """备份文件"""
    if os.path.exists(file_path):
        os.rename(file_path, file_path + ".bak")


def update_machine_id(file_path, new_id):
    """更新机器ID"""
    os.makedirs(os.path.dirname(file_path), exist_ok=True)

    # 如果文件不存在,创建一个空文件
    if not os.path.exists(file_path):
        with open(file_path, "w", encoding="utf-8") as f:
            json.dump({}, f)

    # 读取当前数据并更新机器ID
    with open(file_path, "r", encoding="utf-8") as f:
        try:
            data = json.load(f)
        except json.JSONDecodeError:
            data = {}

    data["telemetry.machineId"] = new_id

    with open(file_path, "w", encoding="utf-8") as f:
        json.dump(data, f, indent=4, ensure_ascii=False)

    print(f"已成功修改 machineId 为: {new_id}")


if __name__ == "__main__":
    storage_file = "C:/path/to/storage.json"  # 修改为实际路径

    # 获取当前的机器ID
    current_id = get_current_id(storage_file)
    print(f"当前机器ID: {current_id}")

    # 生成新的机器ID
    new_id = generate_new_id()

    # 备份并更新机器ID
    backup_file(storage_file)
    update_machine_id(storage_file, new_id)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值