优化iframe视频渲染和解决某些情况下获取文集列表403的问题

This commit is contained in:
yangjian 2021-03-07 10:26:54 +08:00
parent 224dffb984
commit e80f063371
4 changed files with 13 additions and 9 deletions

View File

@ -3628,14 +3628,18 @@
} else if (tedMatch && tedMatch[1]) {
return `<iframe height=400 width=500 frameborder=0 allowfullscreen src="//embed.ted.com/talks/${tedMatch[1]}">`
}else{
for(var i = 0; i< iframe_whitelist.length; i++){
if(href.match(iframe_whitelist[i])){
return '<iframe height=400 width=500 src="' + href +'" frameborder=0 allowfullscreen />'
if(iframe_whitelist.length == 1 && iframe_whitelist[0] == ""){
return href
}else{
for(var i = 0; i< iframe_whitelist.length; i++){
if(href.match(iframe_whitelist[i])){
return '<iframe height=400 width=500 src="' + href +'" frameborder=0 allowfullscreen />'
}
}
}
}
break;
// return '<iframe height=400 width=500 src="' + href +'" frameborder=0 allowfullscreen />'
}
}
@ -4246,7 +4250,7 @@
*/
editormd.filterHTMLTags = function(html, filters) {
if (typeof html !== "string") {
html = new String(html).toString();
}

View File

@ -8,7 +8,7 @@
<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<meta http-equiv="Cache-Control" content="max-age=7200" />
<meta name="referrer" content="no-referrer">
<!-- <meta name="referrer" content="no-referrer"> -->
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="keywords" content="{% block keyword %}{% endblock %}{{site_keywords}}"/>
<meta name="description" content="{% block description %}{% endblock %}" />
@ -339,7 +339,7 @@
tocContainer : "#toc-container",
tocDropdown : false,
atLink : false,//禁用@链接
htmlDecode : "link,style,base,script,iframe", //过滤部分HTML标签
htmlDecode : "link,style,base,script", //过滤部分HTML标签
});
{% elif doc.editor_mode == 2 %}

View File

@ -8,7 +8,7 @@
<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<meta http-equiv="Cache-Control" content="max-age=7200" />
<meta name="referrer" content="no-referrer">
<!-- <meta name="referrer" content="no-referrer"> -->
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>{% block title %}{% endblock %} - {% if site_name != None and site_name != '' %}{{site_name}} {% else %}站点标题{% endif %}</title>
<link href="{% static 'layui/css/layui.css' %}?version={{mrdoc_version}}" rel="stylesheet">

View File

@ -219,7 +219,7 @@
sequenceDiagram : true, //开启序列图
imageUpload : true, //开启图片上传
codeFold :true, //代码折叠
htmlDecode : "link,style,base,script,iframe", //过滤部分HTML标签
htmlDecode : "link,style,base,script", //过滤部分HTML标签
imageFormats : ["jpg", "jpeg", "gif", "png", "bmp", "webp"],
imageUploadURL : "{% url 'upload_doc_img' %}",
onchange:function(){