mirror of
https://github.com/minetest/contentdb.git
synced 2024-12-23 06:22:24 +01:00
Add more info to /api/homepage/
This commit is contained in:
parent
f714d809f8
commit
41e0e65a6b
@ -13,6 +13,7 @@
|
|||||||
#
|
#
|
||||||
# You should have received a copy of the GNU Affero General Public License
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
from typing import List
|
||||||
|
|
||||||
from flask import request, jsonify, current_app
|
from flask import request, jsonify, current_app
|
||||||
from flask_login import current_user, login_required
|
from flask_login import current_user, login_required
|
||||||
@ -431,8 +432,8 @@ def homepage():
|
|||||||
downloads_result = db.session.query(func.sum(Package.downloads)).one_or_none()
|
downloads_result = db.session.query(func.sum(Package.downloads)).one_or_none()
|
||||||
downloads = 0 if not downloads_result or not downloads_result[0] else downloads_result[0]
|
downloads = 0 if not downloads_result or not downloads_result[0] else downloads_result[0]
|
||||||
|
|
||||||
def mapPackages(packages):
|
def mapPackages(packages: List[Package]):
|
||||||
return [pkg.getAsDictionaryKey() for pkg in packages]
|
return [pkg.getAsDictionaryShort(current_app.config["BASE_URL"]) for pkg in packages]
|
||||||
|
|
||||||
return jsonify({
|
return jsonify({
|
||||||
"count": count,
|
"count": count,
|
||||||
|
Loading…
Reference in New Issue
Block a user