* SAAS-1084 - initial work on publishing API backend
* More work on automatic ingest * Add automatic_ingest_timestamp column to ImportedPodcast
This commit is contained in:
parent
3a791ef9b5
commit
0b1df6baf3
27 changed files with 490 additions and 106 deletions
|
@ -21,7 +21,7 @@ class SoundcloudController extends ThirdPartyController implements OAuth2Control
|
|||
}
|
||||
|
||||
/**
|
||||
* Upload the file with the given id to a third-party service
|
||||
* Upload the file with the given id to SoundCloud
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
|
@ -34,7 +34,7 @@ class SoundcloudController extends ThirdPartyController implements OAuth2Control
|
|||
}
|
||||
|
||||
/**
|
||||
* Download the file with the given id from a third-party service
|
||||
* Download the file with the given id from SoundCloud
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
|
@ -47,7 +47,7 @@ class SoundcloudController extends ThirdPartyController implements OAuth2Control
|
|||
}
|
||||
|
||||
/**
|
||||
* Delete the file with the given id from a third-party service
|
||||
* Delete the file with the given id from SoundCloud
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
|
|
|
@ -223,7 +223,7 @@ class Zend_Controller_Plugin_Acl extends Zend_Controller_Plugin_Abstract
|
|||
}
|
||||
|
||||
private function verifyAuth() {
|
||||
if ($this->verifyAPIKey()) {
|
||||
if ($this->isVerifiedDownload() || $this->verifyAPIKey()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -233,7 +233,32 @@ class Zend_Controller_Plugin_Acl extends Zend_Controller_Plugin_Abstract
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check if the requested file can be downloaded.
|
||||
* It should satisfy the following requirements:
|
||||
* * request path is /rest/media/:id/download
|
||||
* * download key is correct
|
||||
* * requested file belongs to the station podcast
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
private function isVerifiedDownload() {
|
||||
$request = $this->getRequest();
|
||||
$fileId = $request->getParam("id");
|
||||
$key = $request->getParam("download_key");
|
||||
$module = $request->getModuleName();
|
||||
$controller = $request->getControllerName();
|
||||
$action = $request->getActionName();
|
||||
$stationPodcast = StationPodcastQuery::create()
|
||||
->findOneByDbPodcastId(Application_Model_Preference::getStationPodcastId());
|
||||
return $module == "rest"
|
||||
&& $controller == "media"
|
||||
&& $action == "download"
|
||||
&& $key === Application_Model_Preference::getStationPodcastDownloadKey()
|
||||
&& $stationPodcast->hasEpisodeForFile($fileId);
|
||||
}
|
||||
|
||||
private function verifyCSRFToken($token) {
|
||||
return SecurityHelper::verifyCSRFToken($token);
|
||||
}
|
||||
|
|
|
@ -157,6 +157,7 @@ class PageLayoutInitPlugin extends Zend_Controller_Plugin_Abstract
|
|||
|
||||
$view->headScript()->appendFile($baseUrl . 'js/libs/jquery-1.8.3.min.js?' . $CC_CONFIG['airtime_version'], 'text/javascript')
|
||||
->appendFile($baseUrl . 'js/libs/jquery-ui-1.8.24.min.js?' . $CC_CONFIG['airtime_version'], 'text/javascript')
|
||||
->appendFile($baseUrl . 'js/libs/angular.min.js?' . $CC_CONFIG['airtime_version'], 'text/javascript')
|
||||
->appendFile($baseUrl . 'js/bootstrap/bootstrap.js?' . $CC_CONFIG['airtime_version'], 'text/javascript')
|
||||
->appendFile($baseUrl . 'js/libs/underscore-min.js?' . $CC_CONFIG['airtime_version'], 'text/javascript')
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue