@@ -40,9 +40,9 @@ async def get_all() -> list[dict[str, Any]]:
40
40
return result
41
41
42
42
@staticmethod
43
- async def has_new () -> str | None :
44
- """是否存在新插件 """
45
- return await redis_client .get (f'{ settings .PLUGIN_REDIS_PREFIX } :new ' )
43
+ async def changed () -> str | None :
44
+ """插件状态是否变更 """
45
+ return await redis_client .get (f'{ settings .PLUGIN_REDIS_PREFIX } :changed ' )
46
46
47
47
@staticmethod
48
48
async def install_zip (* , file : UploadFile ) -> None :
@@ -94,7 +94,7 @@ async def install_zip(*, file: UploadFile) -> None:
94
94
zf .extractall (os .path .join (PLUGIN_DIR , plugin_name ), members )
95
95
96
96
await install_requirements_async (plugin_name )
97
- await redis_client .set (f'{ settings .PLUGIN_REDIS_PREFIX } :new ' , 'ture' )
97
+ await redis_client .set (f'{ settings .PLUGIN_REDIS_PREFIX } :changed ' , 'ture' )
98
98
99
99
@staticmethod
100
100
async def install_git (* , repo_url : str ):
@@ -118,7 +118,7 @@ async def install_git(*, repo_url: str):
118
118
raise errors .ServerError (msg = '插件安装失败,请稍后重试' ) from e
119
119
else :
120
120
await install_requirements_async (repo_name )
121
- await redis_client .set (f'{ settings .PLUGIN_REDIS_PREFIX } :new ' , 'ture' )
121
+ await redis_client .set (f'{ settings .PLUGIN_REDIS_PREFIX } :changed ' , 'ture' )
122
122
123
123
@staticmethod
124
124
async def uninstall (* , plugin : str ):
@@ -135,6 +135,8 @@ async def uninstall(*, plugin: str):
135
135
bacup_dir = os .path .join (PLUGIN_DIR , f'{ plugin } .{ timezone .now ().strftime ("%Y%m%d%H%M%S" )} .backup' )
136
136
shutil .move (plugin_dir , bacup_dir )
137
137
await redis_client .delete (f'{ settings .PLUGIN_REDIS_PREFIX } :info:{ plugin } ' )
138
+ await redis_client .hdel (f'{ settings .PLUGIN_REDIS_PREFIX } :status' , plugin )
139
+ await redis_client .set (f'{ settings .PLUGIN_REDIS_PREFIX } :changed' , 'ture' )
138
140
139
141
@staticmethod
140
142
async def update_status (* , plugin : str ):
0 commit comments