@@ -79,77 +79,77 @@ export const EmbedServiceLink: any = {
7979 'https://v.youku.com/v_show/id_XNDM0NDM4MTcy.html?spm=a2h0c.8166622.PhoneSokuUgc_4.dtitle' ,
8080 src : 'https://player.youku.com/embed/XNDM0NDM4MTcy' ,
8181 srcPrefix : 'https://player.youku.com/embed' ,
82- linkRule : [ ' v.youku.com\\ /v_show\\ /id_\\ w+\\=*' ] ,
83- idRule : ' id_\\ w+\\=*' ,
82+ linkRule : [ String . raw ` v.youku.com\/v_show\/id_\w+\=*` ] ,
83+ idRule : String . raw ` id_\w+\=*` ,
8484 } ,
8585 bilibili : {
8686 example : 'https://www.bilibili.com/video/BV1EJ411u7DN' ,
8787 src : 'https://player.bilibili.com/player.html?bvid=BV1EJ411u7DN' ,
8888 srcPrefix : 'https://player.bilibili.com/player.html?bvid' ,
89- linkRule : [ ' www.bilibili.com\\ /video\\/\\w+' ] ,
89+ linkRule : [ String . raw ` www.bilibili.com\/video\/\w+` ] ,
9090 } ,
9191 qqvideo : {
9292 example : 'https://v.qq.com/x/cover/mzc0020006aw1mn/u0033nvzb5v.html' ,
9393 src : 'https://v.qq.com/txp/iframe/player.html?vid=u0033nvzb5v' ,
9494 srcPrefix : 'https://v.qq.com/txp/iframe/player.html?vid' ,
95- linkRule : [ ' v.qq.com\\ /x\\ /cover\\/\\ w+\\/\\w+' ] ,
95+ linkRule : [ String . raw ` v.qq.com\/x\/cover\/\ w+\/\w+` ] ,
9696 } ,
9797 amap : {
9898 example : 'https://ditu.amap.com/' ,
9999 src : 'https://www.amap.com/place/B000A45467' ,
100100 srcPrefix : '' ,
101- linkRule : [ '\\ .amap\\ .com' ] ,
101+ linkRule : [ String . raw `\ .amap\.com` ] ,
102102 } ,
103103 baidu_map : {
104104 example : 'https://j.map.baidu.com/15/fo' ,
105105 src : 'https://j.map.baidu.com/15/fo' ,
106106 srcPrefix : '' ,
107- linkRule : [ ' map\\ .baidu\\ .com' ] ,
107+ linkRule : [ String . raw ` map\.baidu\.com` ] ,
108108 } ,
109109 modao : {
110110 example :
111111 'https://free.modao.cc/app/2cd26580a6717a147454df7470e7ec464093cba3/embed/v2#screen=sk71k6d1dfxulzx' ,
112112 src : 'https://free.modao.cc/app/6UkpAxcGE3nPz52GLqhnOZgC7MATBSy/embed/v2' ,
113113 srcPrefix : '' ,
114- linkRule : [ ' https:\\/\\/\\ w+.modao.cc\\ /app\\/\\ w+\\ /embed\\ /v2' ] ,
114+ linkRule : [ String . raw ` https:\/\/\ w+.modao.cc\/app\/\ w+\/embed\/v2` ] ,
115115 tips : 'Modao > More > Share > Embed > COPY' ,
116116 } ,
117117 lanhu : {
118118 example : 'https://lanhuapp.com/link/#/invite?sid=evP7L' ,
119119 src : 'https://lanhuapp.com/url/evP7L' ,
120120 srcPrefix : '' ,
121- linkRule : [ ' https:\\/\\ /lanhuapp.com\\ /url\\/\\w+' ] ,
121+ linkRule : [ String . raw ` https:\/\ /lanhuapp.com\/url\/\w+` ] ,
122122 tips : 'Lanhu > Project > Share > Copy Link' ,
123123 } ,
124124 figma : {
125125 example : 'https://www.figma.com/file/aS9uSgPXoNpaPkzbjNcK8v/Demo?node-id=0%3A1' ,
126126 src : 'https://www.figma.com/file/aS9uSgPXoNpaPkzbjNcK8v/Demo?node-id=0%3A1' ,
127127 srcPrefix : 'https://www.figma.com/embed?embed_host=share&url' ,
128- linkRule : [ ' https:\\/\\ /www.figma.com\\ /file\\/\\w+' ] ,
128+ linkRule : [ String . raw ` https:\/\ /www.figma.com\/file\/\w+` ] ,
129129 } ,
130130 canva : {
131131 example : 'https://www.canva.cn/design/DAD61-t29UI/view' ,
132132 src : 'https://www.canva.cn/design/DAD61-t29UI/view' ,
133133 srcPrefix : '' ,
134- linkRule : [ ' https:\\/\\ /www.canva.cn\\ /design\\ /.+\\ /view' ] ,
134+ linkRule : [ String . raw ` https:\/\ /www.canva.cn\/design\/.+\/view` ] ,
135135 } ,
136136 processon : {
137137 example : 'https://www.processon.com/embed/5ea99d8607912948b0e6fe78' ,
138138 src : 'https://www.processon.com/embed/5ea99d8607912948b0e6fe78' ,
139139 srcPrefix : '' ,
140- linkRule : [ ' https:\\/\\ /www.processon.com\\ /embed\\/\\w+' ] ,
140+ linkRule : [ String . raw ` https:\/\ /www.processon.com\/embed\/\w+` ] ,
141141 } ,
142142 codepen : {
143143 example : 'https://codepen.io/mekery/embed/YzyrKOJ' ,
144144 src : 'https://codepen.io/mekery/embed/YzyrKOJ' ,
145145 srcPrefix : '' ,
146- linkRule : [ ' https:\\/\\ /codepen.io\\ /.+\\ /embed\\/\\w+' ] ,
146+ linkRule : [ String . raw ` https:\/\ /codepen.io\/.+\/embed\/\w+` ] ,
147147 } ,
148148 jinshuju : {
149149 example : 'https://jinshuju.net/f/q9YvVf' ,
150150 src : 'https://jinshuju.net/f/q9YvVf' ,
151151 srcPrefix : '' ,
152- linkRule : [ ' https:\\/\\ /jinshuju.net\\ /f\\/\\w+' ] ,
152+ linkRule : [ String . raw ` https:\/\ /jinshuju.net\/f\/\w+` ] ,
153153 } ,
154154 iframe : {
155155 example : 'https://v.youku.com/v_show/id_XNDM0NDM4MTcy.html' ,
@@ -161,7 +161,7 @@ export const EmbedServiceLink: any = {
161161 example : 'https://goo.gl/maps/8Ys8b4K1ZJY2' ,
162162 src : 'https://www.google.com/maps/embed?pb=https://goo.gl/maps/8Ys8b4K1ZJY2' ,
163163 srcPrefix : '' ,
164- linkRule : [ ' https:\\/\\ /goo.gl\\ /maps\\/\\w+' ] ,
164+ linkRule : [ String . raw ` https:\/\ /goo.gl\/maps\/\w+` ] ,
165165 } ,
166166} ;
167167
@@ -182,7 +182,7 @@ function getYoutubeSrc(result: any) {
182182}
183183
184184function getYoukuSrc ( result : any ) {
185- const link = EmbedServiceLink . youku as any ;
185+ const link = EmbedServiceLink . youku ;
186186 const url = result . matchedUrl ;
187187
188188 const idRule = link . idRule ;
@@ -436,52 +436,53 @@ export function getServiceSrc(originalLink: any) {
436436
437437 // src
438438 switch ( service ) {
439- case 'youtube' : {
440- return getYoutubeSrc ( result ) ;
441- }
442- case 'youku' : {
443- return getYoukuSrc ( result ) ;
444- }
445- case 'bilibili' : {
446- return getBilibiliSrc ( result ) ;
447- }
448- case 'qqvideo' : {
449- return getQQVideoSrc ( result ) ;
450- }
451- case 'amap' : {
452- return getAMapSrc ( originalLink , result ) ;
453- }
454- case 'baidu_map' : {
455- return getBaiduMapSrc ( originalLink , result ) ;
456- }
457- case 'googlemaps' : {
458- return getGoogleMapSrc ( originalLink , result ) ;
459- }
460- case 'modao' : {
461- return getModaoSrc ( result ) ;
462- }
463- case 'lanhu' : {
464- return getLanhuSrc ( result ) ;
465- }
466- case 'figma' : {
467- return getFigmaSrc ( result ) ;
468- }
469- case 'canva' : {
470- return getCanvaSrc ( originalLink , result ) ;
471- }
472- case 'processon' : {
473- return getProcessonSrc ( originalLink , result ) ;
474- }
475- case 'codepen' : {
476- return getCodepenSrc ( result ) ;
477- }
478- case 'jinshuju' : {
479- return getJinshujuSrc ( originalLink , result ) ;
480- }
481- case 'iframe' : {
482- return getCommonSrc ( originalLink , result ) ;
483- }
439+ case 'youtube' : {
440+ return getYoutubeSrc ( result ) ;
441+ }
442+ case 'youku' : {
443+ return getYoukuSrc ( result ) ;
444+ }
445+ case 'bilibili' : {
446+ return getBilibiliSrc ( result ) ;
447+ }
448+ case 'qqvideo' : {
449+ return getQQVideoSrc ( result ) ;
450+ }
451+ case 'amap' : {
452+ return getAMapSrc ( originalLink , result ) ;
453+ }
454+ case 'baidu_map' : {
455+ return getBaiduMapSrc ( originalLink , result ) ;
456+ }
457+ case 'googlemaps' : {
458+ return getGoogleMapSrc ( originalLink , result ) ;
459+ }
460+ case 'modao' : {
461+ return getModaoSrc ( result ) ;
462+ }
463+ case 'lanhu' : {
464+ return getLanhuSrc ( result ) ;
465+ }
466+ case 'figma' : {
467+ return getFigmaSrc ( result ) ;
468+ }
469+ case 'canva' : {
470+ return getCanvaSrc ( originalLink , result ) ;
471+ }
472+ case 'processon' : {
473+ return getProcessonSrc ( originalLink , result ) ;
474+ }
475+ case 'codepen' : {
476+ return getCodepenSrc ( result ) ;
477+ }
478+ case 'jinshuju' : {
479+ return getJinshujuSrc ( originalLink , result ) ;
480+ }
481+ case 'iframe' : {
482+ return getCommonSrc ( originalLink , result ) ;
483+ }
484+ default : {
485+ return originalLink ;
486+ }
484487 }
485-
486- return result ;
487488}
0 commit comments