forked from Ponysearch/Ponysearch
[mod] engine gitea: compatible with modern gitea or forgejo
Without this patch the Gitea Search Engine is only partially compatible with modern gitea or forgejo: - Fixing some JSON Fields - Using Repository Avatar when Available To Verify My results you can look at the Modern API doc and results, its available on all Gitea and Forgejo instance by Default. Heres an Search API result of Mine: - https://git.euph.dev/api/v1/repos/search?q=ccna
This commit is contained in:
parent
7e8b330b3e
commit
5b6f40414a
1 changed files with 12 additions and 5 deletions
|
@ -1,7 +1,8 @@
|
||||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||||
"""Engine to search in collaborative software platforms based on Gitea_.
|
"""Engine to search in collaborative software platforms based on Gitea_ or Forgejo_.
|
||||||
|
|
||||||
.. _Gitea: https://about.gitea.com/
|
.. _Gitea: https://about.gitea.com/
|
||||||
|
.. _Forgejo: https://forgejo.org/
|
||||||
|
|
||||||
Configuration
|
Configuration
|
||||||
=============
|
=============
|
||||||
|
@ -23,6 +24,11 @@ Optional settings are:
|
||||||
base_url: https://gitea.com
|
base_url: https://gitea.com
|
||||||
shortcut: gitea
|
shortcut: gitea
|
||||||
|
|
||||||
|
- name: forgejo.com
|
||||||
|
engine: gitea
|
||||||
|
base_url: https://code.forgejo.org
|
||||||
|
shortcut: forgejo
|
||||||
|
|
||||||
If you would like to use additional instances, just configure new engines in the
|
If you would like to use additional instances, just configure new engines in the
|
||||||
:ref:`settings <settings engine>` and set the ``base_url``.
|
:ref:`settings <settings engine>` and set the ``base_url``.
|
||||||
|
|
||||||
|
@ -95,13 +101,14 @@ def response(resp):
|
||||||
'url': item.get('html_url'),
|
'url': item.get('html_url'),
|
||||||
'title': item.get('full_name'),
|
'title': item.get('full_name'),
|
||||||
'content': ' / '.join(content),
|
'content': ' / '.join(content),
|
||||||
'img_src': item.get('owner', {}).get('avatar_url'),
|
# Use Repository Avatar and fall back to Owner Avatar if not set.
|
||||||
|
'thumbnail': item.get('avatar_url') or item.get('owner', {}).get('avatar_url'),
|
||||||
'package_name': item.get('name'),
|
'package_name': item.get('name'),
|
||||||
'maintainer': item.get('owner', {}).get('login'),
|
'maintainer': item.get('owner', {}).get('username'),
|
||||||
'publishedDate': parser.parse(item.get("updated_at") or item.get("created_at")),
|
'publishedDate': parser.parse(item.get("updated_at") or item.get("created_at")),
|
||||||
'tags': item.get('topics', []),
|
'tags': item.get('topics', []),
|
||||||
'popularity': item.get('stargazers_count'),
|
'popularity': item.get('stars_count'),
|
||||||
'homepage': item.get('homepage'),
|
'homepage': item.get('website'),
|
||||||
'source_code_url': item.get('clone_url'),
|
'source_code_url': item.get('clone_url'),
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue