Open misaochan opened 4 years ago
Summary of the problem:
https://commons-android-app.toolforge.org/tool-commons-android-app/feedback.py?user=Syced returns erroneous JSON:
Content-type: application/json
()
{"status": "ok", "uniqueUsedImages": 645, "articlesUsingImages": 3334, "database": "commonswiki", "deletedUploads": 38, "featuredImages": {"Quality_images": 0, "Featured_pictures_on_Wikimedia_Commons": 0}, "labs": false, "thanksReceived": 23, "user": "Syced", "imagesEditedBySomeoneElse": 1688}
The script should return correct JSON like https://commons-android-app.toolforge.org/tool-commons-android-app/feedback_test.py?user=Syced shows:
{"status": "ok", "uniqueUsedImages": 645, "articlesUsingImages": 3334, "database": "commonswiki", "deletedUploads": 38, "featuredImages": {"Quality_images": 0, "Featured_pictures_on_Wikimedia_Commons": 0}, "labs": false, "thanksReceived": 23, "user": "Syced", "imagesEditedBySomeoneElse": 1688}
urbanecmbot.toolforge.org-powered copy of the script now returns a valid JSON:
urbanecm@tools-sgebastion-07 ~
$ curl https://urbanecmbot.toolforge.org/commonsmisc/feedback.py?user=Syced
{"status": "ok", "uniqueUsedImages": 662, "articlesUsingImages": 3368, "database": "commonswiki", "deletedUploads": 45, "featuredImages": {"Quality_images": 0, "Featured_pictures_on_Wikimedia_Commons": 0}, "labs": false, "thanksReceived": 24, "user": "Syced", "imagesEditedBySomeoneElse": 1735}
urbanecm@tools-sgebastion-07 ~
$
I apologize for the delay here – if you do need me urgently, please feel free to ping me (either via mail, or IRC), I might miss notifications from GitHub :/.
(didn't intend to close this, just wanted to reference the commit; reopening)
For the record, this is my new .lighttpd.conf which fixes this:
tools.urbanecmbot@tools-sgebastion-07 ~/commonsmisc
$ cat ~/.lighttpd.conf
index-file.names += ("index.py")
setenv.add-response-header += ( "Access-Control-Allow-Origin" => "*" )
accesslog.filename = "/data/project/urbanecmbot/access.log"
$HTTP["url"] =~ "^" {
cgi.assign = (".py" => "/usr/bin/python3")
}
tools.urbanecmbot@tools-sgebastion-07 ~/commonsmisc
$
The key part is at the end, it previously said "^/urbanecmbot", since the tool was in a subdirectory. That changed...recently, and the part no longer took effect. I'd fix it in the other tool as well, but it seems I'm not a maintainer there, so I'll leave that to someone else.
Currently this API returns invalid JSON, leading to display of wrong achievement count in the app. See https://github.com/commons-app/apps-android-commons/issues/3900 for more details.