diff --git a/backend/routers/apps.py b/backend/routers/apps.py index d0d8b14fd..c9c92412f 100644 --- a/backend/routers/apps.py +++ b/backend/routers/apps.py @@ -83,6 +83,8 @@ def update_app(app_id: str, app_data: str = Form(...), file: UploadFile = File(N data['image'] = img_url data['updated_at'] = datetime.now(timezone.utc) update_app_in_db(data) + if plugin['approved'] and (plugin['private'] is None or plugin['private'] is False): + delete_generic_cache('get_public_approved_apps_data') return {'status': 'ok'} @@ -189,7 +191,8 @@ def enable_app(app_id: str, uid: str = Depends(auth.get_current_user_uid)): print('enable_app_endpoint', res.status_code, res.content) if res.status_code != 200 or not res.json().get('is_setup_completed', False): raise HTTPException(status_code=400, detail='App setup is not completed') - increase_plugin_installs_count(app_id) + if app.private is None or app.private is False: + increase_plugin_installs_count(app_id) enable_plugin(uid, app_id) return {'status': 'ok'} @@ -204,7 +207,8 @@ def disable_app(app_id: str, uid: str = Depends(auth.get_current_user_uid)): if app.private and app.uid != uid: raise HTTPException(status_code=403, detail='You are not authorized to perform this action') disable_plugin(uid, app_id) - decrease_plugin_installs_count(app_id) + if app.private is None or app.private is False: + decrease_plugin_installs_count(app_id) return {'status': 'ok'} diff --git a/backend/routers/plugins.py b/backend/routers/plugins.py index 134066805..d2e05cf01 100644 --- a/backend/routers/plugins.py +++ b/backend/routers/plugins.py @@ -36,7 +36,8 @@ def enable_plugin_endpoint(plugin_id: str, uid: str = Depends(auth.get_current_u print('enable_plugin_endpoint', res.status_code, res.content) if res.status_code != 200 or not res.json().get('is_setup_completed', False): raise HTTPException(status_code=400, detail='Plugin setup is not completed') - increase_plugin_installs_count(plugin_id) + if plugin.private is not None and plugin.private is False: + increase_plugin_installs_count(plugin_id) enable_plugin(uid, plugin_id) return {'status': 'ok'} @@ -48,7 +49,8 @@ def disable_plugin_endpoint(plugin_id: str, uid: str = Depends(auth.get_current_ if not plugin: raise HTTPException(status_code=404, detail='App not found') disable_plugin(uid, plugin_id) - decrease_plugin_installs_count(plugin_id) + if plugin.private is not None and plugin.private is False: + decrease_plugin_installs_count(plugin_id) return {'status': 'ok'}