mirror of https://github.com/searxng/searxng.git
Merge d4b5051966
into 383d873597
This commit is contained in:
commit
20c4f05e45
|
@ -33,10 +33,8 @@ def response(resp):
|
|||
results = []
|
||||
for package in resp.json():
|
||||
meta = package["meta"]
|
||||
publishedDate = package.get("inserted_at")
|
||||
if publishedDate:
|
||||
publishedDate = parser.parse(publishedDate)
|
||||
tags = meta.get("licenses", [])
|
||||
published_date = package.get("updated_at")
|
||||
published_date = parser.parse(published_date)
|
||||
results.append(
|
||||
{
|
||||
"template": "packages.html",
|
||||
|
@ -46,11 +44,24 @@ def response(resp):
|
|||
"content": meta.get("description", ""),
|
||||
"version": meta.get("latest_version"),
|
||||
"maintainer": ", ".join(meta.get("maintainers", [])),
|
||||
"publishedDate": publishedDate,
|
||||
"tags": tags,
|
||||
"homepage": meta.get("links", {}).get("homepage"),
|
||||
"source_code_url": meta.get("links", {}).get("github"),
|
||||
"publishedDate": published_date,
|
||||
"license_name": ", ".join(meta.get("licenses", [])),
|
||||
"homepage": package["docs_html_url"],
|
||||
"source_code_url": get_source_code_url(meta.get("links", {})),
|
||||
}
|
||||
)
|
||||
|
||||
return results
|
||||
|
||||
|
||||
def get_source_code_url(links):
|
||||
source_url = None
|
||||
for k, v in links.items():
|
||||
if not source_url and k.lower() in ["source", "github", "gitlab"]:
|
||||
source_url = v
|
||||
|
||||
for k, v in links.items():
|
||||
if not source_url and ("github" in v or "gitlab" in v):
|
||||
source_url = v
|
||||
|
||||
return source_url
|
||||
|
|
Loading…
Reference in New Issue