From da9b212e549e65f16072ff58eb828a19b053c260 Mon Sep 17 00:00:00 2001 From: zmister Date: Wed, 9 Nov 2022 21:10:15 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=96=E6=B6=88iframe=E7=99=BD=E5=90=8D?= =?UTF-8?q?=E5=8D=95=E7=9B=B8=E5=85=B3=E9=85=8D=E7=BD=AE=E5=8F=8A=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app_admin/views.py | 6 ------ static/editor.md/editormd.js | 31 +++------------------------ template/app_admin/admin_setting.html | 10 --------- 3 files changed, 3 insertions(+), 44 deletions(-) diff --git a/app_admin/views.py b/app_admin/views.py index 0711ca1..539fe53 100644 --- a/app_admin/views.py +++ b/app_admin/views.py @@ -1357,12 +1357,6 @@ def admin_setting(request): return render(request, 'app_admin/admin_setting.html',locals()) # 文档全局设置 elif types == 'doc': - # iframe白名单 - iframe_whitelist = request.POST.get('iframe_whitelist','') - SysSetting.objects.update_or_create( - name = 'iframe_whitelist', - defaults = {'value':iframe_whitelist,'types':'doc'} - ) # 上传图片大小 img_size = request.POST.get('img_size', 10) try: diff --git a/static/editor.md/editormd.js b/static/editor.md/editormd.js index 2ea95b7..9ddb222 100644 --- a/static/editor.md/editormd.js +++ b/static/editor.md/editormd.js @@ -3624,26 +3624,10 @@ // console.log(text) switch(text){ case '=video': - if(href.match(/^.+.(mp4|m4v|ogg|ogv|webm)$/)){ - return "" - }else{ - for(var i = 0; i< iframe_whitelist.length; i++){ - if(href.match(iframe_whitelist[i])){ - return "" - } - } - } + return "" break; case '=audio': - if(href.match(/^.+.(mp3|wav|flac|m4a)$/)){ - return "" - }else{ - for(var i = 0; i< iframe_whitelist.length; i++){ - if(href.match(iframe_whitelist[i])){ - return "" - } - } - } + return "" break; case '=video_iframe': const youtubeMatch = href.match(/\/\/(?:www\.)?(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=))([\w|-]{11})(?:(?:[\?&]t=)(\S+))?/); @@ -3672,16 +3656,7 @@ } else if (tedMatch && tedMatch[1]) { return `` }else{ - 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 '