From 0cd152242ceb19daa3b1a4c5fbfdee00d4bd2486 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Wed, 6 Mar 2019 01:44:23 +0100 Subject: [PATCH] Brutal check that this looks like a yunohost app --- app/models/unlistedapps.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/app/models/unlistedapps.py b/app/models/unlistedapps.py index 653b755..415d544 100644 --- a/app/models/unlistedapps.py +++ b/app/models/unlistedapps.py @@ -51,13 +51,22 @@ class UnlistedApp(db.Model): if item["name"] in known_apps: continue + owner = item["owner"]["login"] + + r = requests.head("https://raw.githubusercontent.com/%s/%s/master/manifest.json" % (owner, item["name"])) + if r.status_code != 200: + continue + r = requests.head("https://raw.githubusercontent.com/%s/%s/master/scripts/install" % (owner, item["name"])) + if r.status_code != 200: + continue + item["name"] = item["name"].replace("_ynh", "") app = UnlistedApp(name=item["name"], url=item["html_url"], owner=item["owner"]["login"], description=item["description"], - updated_days_ago=githubDateToDaysAgo(item["updated_at"]) + updated_days_ago=githubDateToDaysAgo(item["pushed_at"]) ) db.session.add(app)