Add CORS handling to podcast feed

This commit is contained in:
Ryan Barber 2017-11-24 22:44:01 -08:00
parent f17a3cb5bb
commit 62a85bbe77
1 changed files with 6 additions and 3 deletions

View File

@ -7,14 +7,17 @@ class FeedsController extends Zend_Controller_Action
$this->view->layout()->disableLayout(); $this->view->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true); $this->_helper->viewRenderer->setNoRender(true);
$request = $this->getRequest();
$response = $this->getResponse();
if ((Application_Model_Preference::getStationPodcastPrivacy() if ((Application_Model_Preference::getStationPodcastPrivacy()
&& $this->getRequest()->getParam("sharing_token") != Application_Model_Preference::getStationPodcastDownloadKey()) && $request->getParam("sharing_token") != Application_Model_Preference::getStationPodcastDownloadKey())
&& !RestAuth::verifyAuth(true, false, $this)) { && !RestAuth::verifyAuth(true, false, $this)) {
$this->getResponse() $response->setHttpResponseCode(401);
->setHttpResponseCode(401);
return; return;
} }
CORSHelper::enableCrossOriginRequests($request, $response);
$rssData = Application_Service_PodcastService::createStationRssFeed(); $rssData = Application_Service_PodcastService::createStationRssFeed();