@@ -40,9 +40,9 @@ async def get_all() -> list[dict[str, Any]]:
4040 return result
4141
4242 @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 ' )
4646
4747 @staticmethod
4848 async def install_zip (* , file : UploadFile ) -> None :
@@ -94,7 +94,7 @@ async def install_zip(*, file: UploadFile) -> None:
9494 zf .extractall (os .path .join (PLUGIN_DIR , plugin_name ), members )
9595
9696 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' )
9898
9999 @staticmethod
100100 async def install_git (* , repo_url : str ):
@@ -118,7 +118,7 @@ async def install_git(*, repo_url: str):
118118 raise errors .ServerError (msg = '插件安装失败,请稍后重试' ) from e
119119 else :
120120 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' )
122122
123123 @staticmethod
124124 async def uninstall (* , plugin : str ):
@@ -135,6 +135,8 @@ async def uninstall(*, plugin: str):
135135 bacup_dir = os .path .join (PLUGIN_DIR , f'{ plugin } .{ timezone .now ().strftime ("%Y%m%d%H%M%S" )} .backup' )
136136 shutil .move (plugin_dir , bacup_dir )
137137 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' )
138140
139141 @staticmethod
140142 async def update_status (* , plugin : str ):
0 commit comments