mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-12 12:33:26 +00:00
Enable etag in URI by default
This commit is contained in:
@@ -146,14 +146,15 @@ class media_Permalink_Adapter implements media_Permalink_Interface, cache_cachea
|
||||
{
|
||||
$registry = registry::get_instance();
|
||||
|
||||
return sprintf('%spermalink/v1/%d/%d/%s/%s.%s?token=%s',
|
||||
return sprintf('%spermalink/v1/%d/%d/%s/%s.%s?token=%s&etag=%s',
|
||||
$registry->get('GV_ServerName'),
|
||||
$this->media_subdef->get_sbas_id(),
|
||||
$this->media_subdef->get_record_id(),
|
||||
$this->media_subdef->get_name(),
|
||||
$this->get_label(),
|
||||
pathinfo($this->media_subdef->get_file(), PATHINFO_EXTENSION),
|
||||
$this->get_token()
|
||||
$this->get_token(),
|
||||
$this->media_subdef->getEtag()
|
||||
);
|
||||
}
|
||||
|
||||
|
@@ -229,7 +229,7 @@ class media_subdef extends media_abstract implements cache_cacheableInterface
|
||||
, 'height' => $this->height
|
||||
, 'etag' => $this->etag
|
||||
, 'path' => $this->path
|
||||
, 'url' => $this->url
|
||||
, 'url' => $this->url . ($this->is_physically_present ? '?etag=' . $this->etag : '')
|
||||
, 'file' => $this->file
|
||||
, 'physically_present' => $this->is_physically_present
|
||||
, 'is_substituted' => $this->is_substituted
|
||||
|
@@ -60,7 +60,7 @@
|
||||
<script type="text/javascript">
|
||||
flowplayer("preview{{random}}",
|
||||
{src:"/include/jslibs/flowplayer/flowplayer-3.2.12.swf", wmode: "transparent"},
|
||||
{clip:{url:"{{url}}",autoPlay: true,autoBuffering:true,provider: "h264streaming",scaling:"fit"},
|
||||
{clip:{url:"{{url|urlencode}}",autoPlay: true,autoBuffering:true,provider: "h264streaming",scaling:"fit"},
|
||||
onError:function(code,message){getNewVideoToken({{thumbnail.get_sbas_id()}}, {{thumbnail.get_record_id()}}, this);},
|
||||
plugins: {h264streaming: {url: "/include/jslibs/flowplayer/flowplayer.pseudostreaming-3.2.9.swf"}}
|
||||
});
|
||||
@@ -91,7 +91,6 @@
|
||||
"{{d_width}}", "{{d_height}}", "9.0.0", false, false,
|
||||
{menu: "false",flashvars: "playerID=2&autostart=yes&noinfo=yes&animation=no&remaining=yes&soundFile={{url}}", movie: "/include/jslibs/audio-player/player.swf", allowFullScreen :"true",wmode: "transparent"}, false);</script>
|
||||
{% else %}
|
||||
{% set url = url ~ '?tag=' ~ thumbnail.getEtag() %}
|
||||
<img class="{% if lazyload %}lazyload{% endif %} record record_image imgTips zoomable thumb" oncontextMenu="return(false);"
|
||||
style="width:{{d_width|round}}px;height:{{d_height|round}}px;top:{{top|round}}px;"
|
||||
src="{% if lazyload %}/skins/grey.gif{% else %}{{ url }}{% endif %}" data-original="{{ url }}" ondragstart="return false;">
|
||||
|
@@ -8,12 +8,14 @@ class media_Permalink_AdapterTest extends PhraseanetPHPUnitAbstract
|
||||
* @var media_Permalink_Adapter
|
||||
*/
|
||||
static $object;
|
||||
static $subdef;
|
||||
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
parent::setUpBeforeClass();
|
||||
$databox = static::$records['record_1']->get_databox();
|
||||
static::$object = media_Permalink_Adapter::getPermalink($databox, static::$records['record_1']->get_subdef('document'));
|
||||
static::$subdef = static::$records['record_1']->get_subdef('document');
|
||||
static::$object = media_Permalink_Adapter::getPermalink($databox, static::$subdef);
|
||||
}
|
||||
|
||||
public function testGet_label()
|
||||
@@ -55,7 +57,8 @@ class media_Permalink_AdapterTest extends PhraseanetPHPUnitAbstract
|
||||
. static::$records['record_1']->get_record_id()
|
||||
. '/document/' . static::$object->get_label()
|
||||
. '.' . pathinfo(static::$records['record_1']->get_subdef('document')->get_file(), PATHINFO_EXTENSION)
|
||||
. '?token=' . static::$object->get_token();
|
||||
. '?token=' . static::$object->get_token()
|
||||
. '&etag=' . static::$subdef->getEtag();
|
||||
|
||||
$this->assertEquals($url, static::$object->get_url($registry));
|
||||
}
|
||||
@@ -63,7 +66,8 @@ class media_Permalink_AdapterTest extends PhraseanetPHPUnitAbstract
|
||||
public function testGet_Previewurl()
|
||||
{
|
||||
$databox = static::$records['record_1']->get_databox();
|
||||
$previewPermalink = media_Permalink_Adapter::getPermalink($databox, static::$records['record_1']->get_subdef('preview'));
|
||||
$subdef = static::$records['record_1']->get_subdef('preview');
|
||||
$previewPermalink = media_Permalink_Adapter::getPermalink($databox, $subdef);
|
||||
|
||||
$registry = registry::get_instance();
|
||||
$url = $registry->get('GV_ServerName') . 'permalink/v1/'
|
||||
@@ -71,7 +75,8 @@ class media_Permalink_AdapterTest extends PhraseanetPHPUnitAbstract
|
||||
. static::$records['record_1']->get_record_id()
|
||||
. '/preview/' . $previewPermalink->get_label()
|
||||
. '.' . pathinfo(static::$records['record_1']->get_subdef('preview')->get_file(), PATHINFO_EXTENSION)
|
||||
. '?token=' . $previewPermalink->get_token();
|
||||
. '?token=' . $previewPermalink->get_token()
|
||||
. '&etag=' . $subdef->getEtag();
|
||||
|
||||
$this->assertEquals($url, $previewPermalink->get_url($registry));
|
||||
}
|
||||
|
Reference in New Issue
Block a user