fix 自定义仓库地址

This commit is contained in:
thsrite
2024-01-03 21:15:02 +08:00
parent 48763ba9bc
commit 99f90ca6a5

View File

@@ -44,18 +44,15 @@ class PluginReInstall(_PluginBase):
self._plugin_url = config.get("plugin_url")
# 校验插件仓库格式
pattern = "https://github.com/(.*?)/(.*?)/"
matches = re.findall(pattern, str(self._plugin_url))
if not matches:
logger.warn(f"指定插件仓库地址 {self._plugin_url} 错误,将使用插件默认地址重装")
self._plugin_url = ""
plugin_url = None
if self._plugin_url:
user, repo = self.get_repo_info(self._plugin_url)
if not user or not repo:
pattern = "https://github.com/(.*?)/(.*?)/"
matches = re.findall(pattern, str(self._plugin_url))
if not matches:
logger.warn(f"指定插件仓库地址 {self._plugin_url} 错误,将使用插件默认地址重装")
self._plugin_url = ""
user, repo = self.get_repo_info(self._plugin_url)
plugin_url = self._base_url % (user, repo)
self.update_config({
@@ -135,119 +132,119 @@ class PluginReInstall(_PluginBase):
"value": local_plugin.get("id")
})
return [
{
'component': 'VForm',
'content': [
{
'component': 'VRow',
'content': [
{
'component': 'VCol',
'props': {
'cols': 12,
'md': 4
},
'content': [
{
'component': 'VSelect',
'props': {
'multiple': True,
'chips': True,
'model': 'plugin_ids',
'label': '重装插件',
'items': pluginOptions
}
}
]
},
{
'component': 'VCol',
'props': {
'cols': 12,
'md': 8
},
'content': [
{
'component': 'VTextField',
'props': {
'model': 'plugin_url',
'label': '仓库地址',
'placeholder': 'https://github.com/%s/%s/'
}
}
]
}
]
},
{
'component': 'VRow',
'content': [
{
'component': 'VCol',
'props': {
'cols': 12,
},
'content': [
{
'component': 'VAlert',
'props': {
'type': 'info',
'variant': 'tonal',
'text': '选择已安装的本地插件,强制安装插件市场最新版本。'
}
}
]
}
]
},
{
'component': 'VRow',
'content': [
{
'component': 'VCol',
'props': {
'cols': 12,
},
'content': [
{
'component': 'VAlert',
'props': {
'type': 'info',
'variant': 'tonal',
'text': '支持指定插件仓库地址https://github.com/%s/%s/'
}
}
]
}
]
},
{
'component': 'VRow',
'content': [
{
'component': 'VCol',
'props': {
'cols': 12,
},
'content': [
{
'component': 'VAlert',
'props': {
'type': 'info',
'variant': 'tonal',
'text': '点击保存卡住请稍等一会,等其他线程执行完先。重载完有提示。'
}
}
]
}
]
}
]
}
], {
"plugin_ids": [],
"plugin_url": ""
}
{
'component': 'VForm',
'content': [
{
'component': 'VRow',
'content': [
{
'component': 'VCol',
'props': {
'cols': 12,
'md': 4
},
'content': [
{
'component': 'VSelect',
'props': {
'multiple': True,
'chips': True,
'model': 'plugin_ids',
'label': '重装插件',
'items': pluginOptions
}
}
]
},
{
'component': 'VCol',
'props': {
'cols': 12,
'md': 8
},
'content': [
{
'component': 'VTextField',
'props': {
'model': 'plugin_url',
'label': '仓库地址',
'placeholder': 'https://github.com/%s/%s/'
}
}
]
}
]
},
{
'component': 'VRow',
'content': [
{
'component': 'VCol',
'props': {
'cols': 12,
},
'content': [
{
'component': 'VAlert',
'props': {
'type': 'info',
'variant': 'tonal',
'text': '选择已安装的本地插件,强制安装插件市场最新版本。'
}
}
]
}
]
},
{
'component': 'VRow',
'content': [
{
'component': 'VCol',
'props': {
'cols': 12,
},
'content': [
{
'component': 'VAlert',
'props': {
'type': 'info',
'variant': 'tonal',
'text': '支持指定插件仓库地址https://github.com/%s/%s/'
}
}
]
}
]
},
{
'component': 'VRow',
'content': [
{
'component': 'VCol',
'props': {
'cols': 12,
},
'content': [
{
'component': 'VAlert',
'props': {
'type': 'info',
'variant': 'tonal',
'text': '点击保存卡住请稍等一会,等其他线程执行完先。重载完有提示。'
}
}
]
}
]
}
]
}
], {
"plugin_ids": [],
"plugin_url": ""
}
@staticmethod
def get_local_plugins():