From b38a9ced073910dab2bb2cf50b67d502fc0663f1 Mon Sep 17 00:00:00 2001 From: Renard Date: Mon, 27 Jul 2020 10:53:25 -0400 Subject: Mod API: members, stats --- cgi/modapi.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'cgi') diff --git a/cgi/modapi.py b/cgi/modapi.py index b05410d..c1f6319 100644 --- a/cgi/modapi.py +++ b/cgi/modapi.py @@ -88,6 +88,20 @@ def api_process(self, path_split): values['posts'] = posts elif method == 'login': values['token'] = token + elif method == 'members': + members = FetchAll( + "SELECT * FROM `staff` ORDER BY lastactive DESC") + values['members'] = members + elif method == 'stats': + report_count = FetchOne("SELECT COUNT(id) FROM `reports`") + values['reportCount'] = report_count + try: + with open('stats.json', 'r') as f: + out = json.load(f) + values['stats'] = out + except ValueError: + values['stats'] = None + raise APIError, "Stats error" else: raise APIError, "Invalid method" -- cgit v1.2.1-18-gbd029