Fix Access-Control-Allow-Origin: * for get_data
Lucas Werkmeister
Branch: lucaswerkmeister/pagepile:cors
Branch: magnusmanske/pagepile:master
Merged
Merged pull request
Merged in lucaswerkmeister/pagepile/cors (pull request #7)
Merged in lucaswerkmeister/pagepile/cors (pull request #7)
The various
outputData*()
functions all control their own headers and output and then exit, so adding a header at the bottom of the script doesn't work when they are used (though it works forget_info
, which doesn't use those functions and always returns JSON). Instead, let's set the header right before calling those functions. And to keep it simple, also directly set the header in theget_info
handler, even though the$public
/ delayedheader()
approach works there.Sorry for the broken pull request #5... it was pretty hard to debug this because I couldn't initially figure out how to run this tool anywhere else. I finally got it partially working on Toolforge (
speed-patrolling
tool, otherwise unused) with the following file:tools.speed-patrolling@tools-sgebastion-07:~$ cat public_html/.user.ini include_path = '.:/data/project/magnustools/public_html:/usr/share/php'
However, for some reason that only fixes
api.php
, notindex.php
, and also I don't understand how theinclude_path
is being set in the realpagepile
tool, since I don't see any.user.ini
file there.