Merge pull request #369 from rfb/feed-cors

Add CORS handling to podcast feed
This commit is contained in:
Lucas Bickel 2018-06-30 12:22:16 +02:00 committed by GitHub
commit 1c2aec95ea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -7,14 +7,17 @@ class FeedsController extends Zend_Controller_Action
$this->view->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
$request = $this->getRequest();
$response = $this->getResponse();
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)) {
$this->getResponse()
->setHttpResponseCode(401);
$response->setHttpResponseCode(401);
return;
}
CORSHelper::enableCrossOriginRequests($request, $response);
$rssData = Application_Service_PodcastService::createStationRssFeed();