()
| 353 | } |
| 354 | |
| 355 | export function getBrowser() { |
| 356 | if(navigator.userAgent.indexOf('Electron') >= 0) { |
| 357 | return {name: 'Electron', version: /Electron\/([\d.]+\d+)/.exec(navigator.userAgent)[1]}; |
| 358 | } |
| 359 | |
| 360 | let ua=navigator.userAgent,tem,M=(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i).exec(ua) || []; |
| 361 | if(/trident/i.test(M[1])) { |
| 362 | tem=/\brv[ :]+(\d+)/g.exec(ua) || []; |
| 363 | return {name:'IE', version:(tem[1]||'')}; |
| 364 | } |
| 365 | if(ua.indexOf('Electron') >= 0) { |
| 366 | return {name: 'Electron', version: /Electron\/([\d.]+\d+)/.exec(ua)[1]}; |
| 367 | } |
| 368 | |
| 369 | if(M[1]==='Chrome') { |
| 370 | tem=(/\bOPR|Edge\/(\d+)/).exec(ua); |
| 371 | if(tem!=null) {return {name:tem[0], version:tem[1]};} |
| 372 | } |
| 373 | |
| 374 | M=M[2]? [M[1], M[2]]: [navigator.appName, navigator.appVersion, '-?']; |
| 375 | if((tem=(/version\/(\d+)/i).exec(ua))!=null) {M.splice(1,1,tem[1]);} |
| 376 | return { |
| 377 | name: M[0], |
| 378 | version: M[1], |
| 379 | }; |
| 380 | } |
| 381 | |
| 382 | export function checkTrojanSource(content, isPasteEvent) { |
| 383 | // Call the hasTrojanSource function of 'anti-trojan-source' package |
no test coverage detected