diff --git a/data/actionsmap/yunohost.yml b/data/actionsmap/yunohost.yml index bcdb87da1..0cc1dc18b 100644 --- a/data/actionsmap/yunohost.yml +++ b/data/actionsmap/yunohost.yml @@ -588,6 +588,14 @@ app: string: help: Return matching app name or description with "string" + ### app_manifest() + manifest: + action_help: Return the manifest of a given app from the catalog, or from a remote git repo + api: GET /apps/manifest + arguments: + app: + help: Name, local path or git URL of the app to fetch the manifest of + fetchlist: deprecated: true @@ -659,7 +667,7 @@ app: help: Do not ask confirmation if the app is not safe to use (low quality, experimental or 3rd party) action: store_true - ### app_remove() TODO: Write help + ### app_remove() remove: action_help: Remove app api: DELETE /apps/ diff --git a/data/templates/nginx/plain/yunohost_admin.conf.inc b/data/templates/nginx/plain/yunohost_admin.conf.inc index 326e003ee..4b9938eac 100644 --- a/data/templates/nginx/plain/yunohost_admin.conf.inc +++ b/data/templates/nginx/plain/yunohost_admin.conf.inc @@ -6,6 +6,6 @@ location /yunohost/admin/ { default_type text/html; index index.html; - more_set_headers "Content-Security-Policy: upgrade-insecure-requests; default-src 'self'; connect-src 'self' https://raw.githubusercontent.com https://paste.yunohost.org wss://$host; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-eval'; object-src 'none'; img-src 'self' data:;"; + more_set_headers "Content-Security-Policy: upgrade-insecure-requests; default-src 'self'; connect-src 'self' https://paste.yunohost.org wss://$host; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-eval'; object-src 'none'; img-src 'self' data:;"; more_set_headers "Content-Security-Policy-Report-Only:"; } diff --git a/src/yunohost/app.py b/src/yunohost/app.py index 5197a2f44..08e13e9f2 100644 --- a/src/yunohost/app.py +++ b/src/yunohost/app.py @@ -767,6 +767,21 @@ def app_upgrade(app=[], url=None, file=None, force=False): logger.success(m18n.n("upgrade_complete")) +def app_manifest(app): + + raw_app_list = _load_apps_catalog()["apps"] + + if app in raw_app_list or ("@" in app) or ("http://" in app) or ("https://" in app): + manifest, extracted_app_folder = _fetch_app_from_git(app) + elif os.path.exists(app): + manifest, extracted_app_folder = _extract_app_from_file(app) + else: + raise YunohostValidationError("app_unknown") + + shutil.rmtree(extracted_app_folder) + + return manifest + @is_unit_operation() def app_install( operation_logger,