mirror of
https://github.com/Genshin-bots/gsuid_core.git
synced 2025-05-12 06:55:49 +08:00
🐛 修复core应用设置代理
的git链接识别
This commit is contained in:
parent
29d15bdcee
commit
eb0c55998b
@ -16,6 +16,51 @@ else:
|
||||
# 玩家、武器、圣遗物、角色模型
|
||||
|
||||
|
||||
class PostDrawRole(TypedDict):
|
||||
role_id: int
|
||||
name: str
|
||||
jump_type: str
|
||||
jump_target: str
|
||||
jump_start_time: str
|
||||
jump_end_time: str
|
||||
role_gender: int
|
||||
take_picture: str
|
||||
gal_xml: str
|
||||
gal_resource: str
|
||||
is_partake: bool
|
||||
bgm: str
|
||||
|
||||
|
||||
class PostDrawTask(TypedDict):
|
||||
task_id: int
|
||||
status: str
|
||||
|
||||
|
||||
class _PostDraw(TypedDict):
|
||||
nick_name: str
|
||||
uid: int
|
||||
region: str
|
||||
role: List[PostDrawRole]
|
||||
draw_notice: bool
|
||||
CurrentTime: str
|
||||
gender: int
|
||||
is_show_remind: bool
|
||||
is_compensate_num: str
|
||||
current_compensate_num: int
|
||||
guide_task: bool
|
||||
guide_compensate: bool
|
||||
guide_draw: bool
|
||||
task_infos: List[PostDrawTask]
|
||||
is_year_subscribe: bool
|
||||
has_compensate_role: bool
|
||||
|
||||
|
||||
class PostDraw(TypedDict):
|
||||
retcode: int
|
||||
message: str
|
||||
data: _PostDraw
|
||||
|
||||
|
||||
class MihoyoRole(TypedDict):
|
||||
AvatarUrl: str
|
||||
nickname: str
|
||||
|
@ -48,6 +48,7 @@ from .models import (
|
||||
GachaLog,
|
||||
MysGoods,
|
||||
MysOrder,
|
||||
PostDraw,
|
||||
SignInfo,
|
||||
SignList,
|
||||
AbyssData,
|
||||
@ -811,7 +812,9 @@ class MysApi(BaseMysApi):
|
||||
return cast(BsIndex, data['data'])
|
||||
return data
|
||||
|
||||
async def post_draw(self, uid: str, role_id: int) -> Union[int, Dict]:
|
||||
async def post_draw(
|
||||
self, uid: str, role_id: int
|
||||
) -> Union[int, PostDraw, Dict]:
|
||||
server_id = self.RECOGNIZE_SERVER.get(uid[0])
|
||||
ck = await self.get_ck(uid, 'OWNER')
|
||||
if ck is None:
|
||||
|
@ -1,4 +1,5 @@
|
||||
import os
|
||||
import re
|
||||
import time
|
||||
import asyncio
|
||||
import subprocess
|
||||
@ -17,7 +18,6 @@ from .api import CORE_PATH, PLUGINS_PATH, plugins_lib
|
||||
plugins_list: Dict[str, Dict[str, str]] = {}
|
||||
|
||||
is_update_dep = core_plugins_config.get_config('AutoUpdateDep').data
|
||||
proxy_url: str = core_plugins_config.get_config('ProxyURL').data
|
||||
|
||||
|
||||
# 传入一个path对象
|
||||
@ -135,6 +135,8 @@ async def get_plugins_url(name: str) -> Optional[Dict[str, str]]:
|
||||
|
||||
|
||||
def install_plugins(plugins: Dict[str, str]) -> str:
|
||||
proxy_url: str = core_plugins_config.get_config('ProxyURL').data
|
||||
|
||||
plugin_name = plugins['link'].split('/')[-1]
|
||||
if proxy_url and not proxy_url.endswith('/'):
|
||||
_proxy_url = proxy_url + '/'
|
||||
@ -201,6 +203,8 @@ def check_status(plugin_name: str) -> int:
|
||||
|
||||
async def set_proxy(repo: Path, proxy: Optional[str] = None) -> str:
|
||||
plugin_name = repo.name
|
||||
proxy_url: str = core_plugins_config.get_config('ProxyURL').data
|
||||
|
||||
try:
|
||||
process = await asyncio.create_subprocess_shell(
|
||||
'git remote get-url origin',
|
||||
@ -219,10 +223,14 @@ async def set_proxy(repo: Path, proxy: Optional[str] = None) -> str:
|
||||
logger.info(f'[core插件设置代理] {plugin_name} git地址为SSH, 无需设置代理')
|
||||
return f'{plugin_name} 无需设置代理'
|
||||
|
||||
if original_url.count('https://') >= 2:
|
||||
main_url = 'https://' + original_url.split('https://')[-1]
|
||||
_main_url = re.search(r"https:\/\/github[\s\S]+?git", original_url)
|
||||
if _main_url:
|
||||
main_url = _main_url[0]
|
||||
else:
|
||||
main_url = original_url
|
||||
logger.info(f'[core插件设置代理] {plugin_name} 未发现有效git地址')
|
||||
return f'{plugin_name} 未发现有效git地址'
|
||||
|
||||
# _proxy_url = re.search(r'^(https?:\/\/.+?)\/', original_url)
|
||||
|
||||
if proxy is None:
|
||||
_proxy_url = proxy_url
|
||||
|
Loading…
x
Reference in New Issue
Block a user