diff --git a/amd/build/clientrender.min.js b/amd/build/clientrender.min.js index d26913e..7e8df81 100644 --- a/amd/build/clientrender.min.js +++ b/amd/build/clientrender.min.js @@ -5,6 +5,6 @@ * @copyright 2026 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -define("filter_oembed/clientrender",["jquery","core/log"],(function($,Log){return{init:function(){$(".oembed-client-render").each((function(){var $container=$(this);if(!$container.data("processed")){$container.data("processed",!0);var oembedUrl=$container.data("oembed-url"),originalUrl=$container.data("original-url"),params=$container.data("params");if(!oembedUrl)return Log.debug("filter_oembed/clientrender: No oembed URL provided"),void $container.html(''+originalUrl+"");$.ajax({url:oembedUrl,dataType:"json",success:function(data){if(data&&data.html){var embed=data.html;if(params){var paramStr="";for(var key in params)params.hasOwnProperty(key)&&(paramStr+="&"+key+"="+encodeURIComponent(params[key]));embed=embed.replace("?feature=oembed","?feature=oembed"+paramStr)}var aspectRatio=0;if(data.width&&data.height&&(aspectRatio=data.height/data.width),aspectRatio>0){var paddiv='
';$container.html('
'+embed+paddiv+"
")}else $container.html('
'+embed+"
")}else Log.debug("filter_oembed/clientrender: No HTML in oembed response for "+originalUrl),$container.html(''+originalUrl+"")},error:function(jqXHR,textStatus,errorThrown){Log.debug("filter_oembed/clientrender: Error loading oembed content for "+originalUrl+" - "+textStatus+": "+errorThrown),$container.html(''+originalUrl+"")}})}}))}}})); +define("filter_oembed/clientrender",["jquery","core/log"],(function($,Log){return{init:function(){$(".oembed-client-render").each((function(){var $container=$(this);if(!$container.data("processed")){$container.data("processed",!0);var oembedUrl=$container.data("oembed-url"),originalUrl=$container.data("original-url"),params=$container.data("params");if(!oembedUrl)return Log.debug("filter_oembed/clientrender: No oembed URL provided"),void $container.html(''+originalUrl+"");$.ajax({url:oembedUrl,dataType:"json",xhrFields:{withCredentials:!0},success:function(data){if(data&&data.html){var embed=data.html;if(params){var paramStr="";for(var key in params)params.hasOwnProperty(key)&&(paramStr+="&"+key+"="+encodeURIComponent(params[key]));embed=embed.replace("?feature=oembed","?feature=oembed"+paramStr)}var aspectRatio=0;if(data.width&&data.height&&(aspectRatio=data.height/data.width),aspectRatio>0){var paddiv='
';$container.html('
'+embed+paddiv+"
")}else $container.html('
'+embed+"
")}else Log.debug("filter_oembed/clientrender: No HTML in oembed response for "+originalUrl),$container.html(''+originalUrl+"")},error:function(jqXHR,textStatus,errorThrown){Log.debug("filter_oembed/clientrender: Error loading oembed content for "+originalUrl+" - "+textStatus+": "+errorThrown),$container.html(''+originalUrl+"")}})}}))}}})); //# sourceMappingURL=clientrender.min.js.map \ No newline at end of file diff --git a/amd/src/clientrender.js b/amd/src/clientrender.js index cdaf701..d1df313 100644 --- a/amd/src/clientrender.js +++ b/amd/src/clientrender.js @@ -48,6 +48,9 @@ define(['jquery', 'core/log'], function($, Log) { $.ajax({ url: oembedUrl, dataType: 'json', + xhrFields: { + withCredentials: true + }, success: function(data) { if (data && data.html) { var embed = data.html; diff --git a/classes/forms/provider.php b/classes/forms/provider.php index bf218a8..868ca3a 100644 --- a/classes/forms/provider.php +++ b/classes/forms/provider.php @@ -74,6 +74,7 @@ public function definition() { 'client' => get_string('rendermode_client', 'filter_oembed'), ]; $el = $mform->addElement($row->type, $fieldname, $fieldlabel, $options); + $mform->addHelpButton($fieldname, $fieldname, 'filter_oembed'); } else { $el = $mform->addElement($row->type, $fieldname, $fieldlabel); } diff --git a/lang/en/filter_oembed.php b/lang/en/filter_oembed.php index cee684b..746d351 100644 --- a/lang/en/filter_oembed.php +++ b/lang/en/filter_oembed.php @@ -57,6 +57,7 @@ $string['providersrestrict_desc'] = 'Restrict providers to a list of allowed providers'; $string['providerurl'] = 'Provider URL'; $string['rendermode'] = 'Render mode'; +$string['rendermode_help'] = 'Choose how oEmbed content is loaded. In client mode, the browser requests oEmbed content directly and sends credentials (such as cookies) with the request.'; $string['rendermode_client'] = 'Client'; $string['rendermode_server'] = 'Server'; $string['requiredfield'] = 'The field "{$a}" must be completed'; diff --git a/version.php b/version.php index 083e3f5..1306ec9 100644 --- a/version.php +++ b/version.php @@ -26,8 +26,8 @@ defined('MOODLE_INTERNAL') || die(); -$plugin->version = 2026031300; +$plugin->version = 2026031301; $plugin->requires = 2019111800; $plugin->component = 'filter_oembed'; $plugin->maturity = MATURITY_STABLE; -$plugin->release = '3.8.0 (Build - 2026031300)'; +$plugin->release = '3.8.0 (Build - 2026031301)';