aboutsummaryrefslogtreecommitdiff
path: root/cgi
diff options
context:
space:
mode:
authorLibravatar Renard 2020-07-27 10:53:25 -0400
committerLibravatar Renard 2020-07-27 10:53:25 -0400
commitb38a9ced073910dab2bb2cf50b67d502fc0663f1 (patch)
treec36ddc2f776fdedbe04daf5462a39c02a5e8a769 /cgi
parent09c2bedde69fd5533228e93362230f0169cb914f (diff)
downloadweabot-b38a9ced073910dab2bb2cf50b67d502fc0663f1.tar.gz
weabot-b38a9ced073910dab2bb2cf50b67d502fc0663f1.tar.xz
weabot-b38a9ced073910dab2bb2cf50b67d502fc0663f1.zip
Mod API: members, stats
Diffstat (limited to 'cgi')
-rw-r--r--cgi/modapi.py14
1 files changed, 14 insertions, 0 deletions
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"