Skip to content

Commit f3995c0

Browse files
fix: 更正 Token 检查逻辑
fix #36
1 parent 3b916fe commit f3995c0

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

other-languages/en-US/glm.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def read_token():
2929
print(f"{Fore.RED}{Fore.RESET} Error reading Token:\n{Fore.RED}{e}{Fore.RESET}")
3030
return "error"
3131

32-
def set_token(token, yes=False):
32+
def set_token(token: str, yes=False):
3333
# 凭据 github-access-token.glm
3434
# == 移除 ==
3535
if token == "remove":
@@ -49,7 +49,7 @@ def set_token(token, yes=False):
4949

5050
# == 添加 ==
5151
# --- Token 检查 ---
52-
if not (token.startswith("ghp_") and token.startwith("github_pat_") and yes):
52+
if not (token.startswith("ghp_") or token.startswith("github_pat_") or yes):
5353
print(f"{Fore.YELLOW}{Fore.RESET} Please check whether the Token is correct.")
5454
try:
5555
input(f"Press {Fore.BLUE}Enter{Fore.RESET} to confirm, press {Fore.BLUE}Ctrl + C{Fore.RESET} to cancel...")

程序脚本/glm.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def read_token():
2929
print(f"{Fore.RED}{Fore.RESET} 读取Token时出错:\n{Fore.RED}{e}{Fore.RESET}")
3030
return "error"
3131

32-
def set_token(token, yes=False):
32+
def set_token(token: str, yes=False):
3333
# 凭据 github-access-token.glm
3434
# == 移除 ==
3535
if token == "remove":
@@ -49,7 +49,7 @@ def set_token(token, yes=False):
4949

5050
# == 添加 ==
5151
# --- Token 检查 ---
52-
if not (token.startswith("ghp_") and token.startwith("github_pat_") and yes):
52+
if not (token.startswith("ghp_") or token.startswith("github_pat_") or yes):
5353
print(f"{Fore.YELLOW}{Fore.RESET} 请确认Token是否正确")
5454
try:
5555
input(f"按{Fore.BLUE}Enter{Fore.RESET}键确认,按{Fore.BLUE}Ctrl + C{Fore.RESET}键取消...")

0 commit comments

Comments
 (0)