Brutal check that this looks like a yunohost app

This commit is contained in:
Alexandre Aubin 2019-03-06 01:44:23 +01:00
parent 5ff9b77cb1
commit 0cd152242c

View file

@ -51,13 +51,22 @@ class UnlistedApp(db.Model):
if item["name"] in known_apps: if item["name"] in known_apps:
continue 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", "") item["name"] = item["name"].replace("_ynh", "")
app = UnlistedApp(name=item["name"], app = UnlistedApp(name=item["name"],
url=item["html_url"], url=item["html_url"],
owner=item["owner"]["login"], owner=item["owner"]["login"],
description=item["description"], description=item["description"],
updated_days_ago=githubDateToDaysAgo(item["updated_at"]) updated_days_ago=githubDateToDaysAgo(item["pushed_at"])
) )
db.session.add(app) db.session.add(app)