From 28ca8abc86481d200ead3107fb094b3033c99418 Mon Sep 17 00:00:00 2001 From: KOLANICH Date: Mon, 13 Aug 2018 10:13:08 +0000 Subject: [PATCH] Added some surrogates --- src/legacy/defaults.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/legacy/defaults.js b/src/legacy/defaults.js index 5526353..c689e29 100644 --- a/src/legacy/defaults.js +++ b/src/legacy/defaults.js @@ -300,6 +300,20 @@ Legacy.migrated.prefs = Object.assign( "surrogate.stripe.sources": "js.stripe.com", "surrogate.wp.sources": "!^.*\\/20\\d{2}\\/\\d{2}\\/\\d{2}\\/", "surrogate.wp.replacement": "let s=document.createElement('style');s.textContent='.site{opacity: 1 !important}';document.documentElement.appendChild(s)", + "surrogate.oracle_downloads.sources": "!^https?://(?:www\\.)oracle\\.com/.+?/downloads/[^\\/]+?-downloads-.+$", + "surrogate.oracle_downloads.replacement" : "document.cookie = 'oraclelicense=accept-securebackup-cookie; domain=.oracle.com; path=/; expires=' +(new Date(Date.now() + 1800000)).toGMTString();", + "surrogate.microsoft_kb.sources" : "!https?://support\\.microsoft\\.com/(\\w{2}-\\w{2,3}/help|kb)/\\d+(/.+)?", + "surrogate.microsoft_kb.replacement" : "'use strict';let ce=document.createElement.bind(document);let r=/microsoft\\.support\\.prefetchedArticle\\s*=\\s*\\(\\s*function\\s*\\(\\s*\\)\\s*\\{\\s*return\\s+([^]+?)\\}\\)\\(\\);/m;let x=/'([a-z]{2}(?:-[a-z]{2})?\\/\\d+)'/g;let t;for(let w of document.getElementsByTagName('SCRIPT')){if(!w.src){let m=w.textContent.match(r);if(m){t=m[1].replace(x,'\"$1\"');break;}}}let j=JSON.parse(t),M=document.getElementById('mainContent');function A(a,b){a=new Date(a);var g=ce('time'),n=ce('p');n.textContent=b;g.a=a;g.textContent=a;n.appendChild(g);M.appendChild(n);}M.innerHTML='';for(let B in j){var d=j[B].details,h=ce('h1');document.head.title=h.textContent='KB'+d.id+' - '+d.heading;M.appendChild(h);A(d.createdOn,'created: ');A(d.publishedOn,'published: ');var s=ce('section');s.textContent=d.description;M.appendChild(s);for(var body of d.body){let S=ce('section'),J=ce('h3');J.textContent=body.title;S.appendChild(J);var P=ce('p');P.innerHTML=body.content;S.appendChild(P);M.appendChild(S)}var a=ce('a');a.textContent='Download JSON';a.download='KB'+d.id+'.json';a.href=URL.createObjectURL(new Blob([JSON.stringify(j,null,'\\t')],{type:'application/json'}));a.style.color='blue';M.appendChild(a);break;}", + "surrogate.microsoft_VisualStudio_download.sources" : "!https://(www\\.)?visualstudio\\.com/thank-you-downloading-visual-studio/.+", + "surrogate.microsoft_VisualStudio_download.replacement" : "'use strict';let d=/var\\s+downloadResult\\s*=\\s*(\\{.+\\})\\s*;/,e=/(\\w+)(\\s*:(?!\\/\\/))/g;for(let f of document.getElementsByTagName('script'))try{let a=d.exec(f.innerHTML);if(a){let b=a[1].replace(/'/g,'\"');b=b.replace(e,'\"$1\"$2');let c=JSON.parse(b);if(c.downloadUrl){window.location.href=c.downloadUrl;break}}}catch(a){};", + "surrogate.goszakupki.sources" : "!https?://zakupki\\.gov\\.ru/.+", + "surrogate.goszakupki.replacement" : "'use strict';for(let el of document.querySelectorAll('[url]')){let a=document.createElement('A');a.href=el.getAttribute('url');let spn=el.getElementsByTagName('SPAN')[0];a.innerHTML=spn.innerHTML;a.className=spn.className;spn.replaceWith(a);}", + "surrogate.cloud_mail_ru.sources":"!^https://cloud\\.mail\\.ru/(stock|public)/.+$", + "surrogate.cloud_mail_ru.replacement":"'use strict';const rx=/require.config\((\{[^]+?\})\)/;const entRx=/\\x([\da-fA-F]+)/g;function getConfig(){let scripts=[...document.querySelectorAll('script:not([class]):not([src])')];let text=scripts.map((s)=>s.textContent.match(rx)).filter(j=>!!j)[0][1];text=text.replace(entRx,(...e)=>String.fromCodePoint(parseInt(e[1],16)));let config=JSON.parse(text);return config;}function getToken(){fetch('https://cloud.mail.ru/api/v2/tokens/download').then((res)=>{return res.json().then((res)=>{return new Promise(function(resolve,reject){let b=res['body'];if(b){let t=b['token'];if(t){console.log('token:',t);resolve(t);console.log('never called');}}console.error('No token present');reject('No token present: error code '+res['status']);});});}).then(token=>console.log(token));};const config=getConfig();const cls=config['config']['Cloud/settings'];const notifEl=document.querySelector('.b-page-content-loader__message-text_nojs');const stockBase=cls['dispatcher']['stock'][0]['url'];const weblinkBase=cls['dispatcher']['weblink_get'][0]['url'];var processMapping={'file':function(file,parentName){console.info(file);let fileName=file['name'];let id=file['id'];let url;if(file['dwl_token']){url=stockBase+'get/'+file['dwl_token']+'/'+encodeURIComponent(fileName);}else{url=cls['dispatcher']['weblink_get'][0]['url']+'/'+id+'/'+encodeURIComponent(fileName);}a=document.createElement('A');a.href=url;a.download=fileName;a.textContent=`${parentName}${fileName}(${file['size']}bytes,virus scan:${file['virus_scan']})`;return a;},'folder':function(folderObj,parentName){let cont=document.createElement('UL');for(var file of folderObj['list']){let child=processMapping[file['kind']](file,parentName+folderObj['id']);let it=document.createElement('LI');it.appendChild(child);cont.appendChild(it);}return cont;}};noti fEl.appendChild(processMapping['folder'](cls['folders']['folder'],''));", + + "surrogate.yandex-disk.sources":"!^https://yadi\\.sk/d/\\w{13}$", + "surrogate.yandex-disk.replacement":"window.location.href='https://cloud-api.yandex.net/v1/disk/public/resources/download?public_key='+window.location.href;", + "fakeScriptLoadEvents.enabled": true, "fakeScriptLoadEvents.onlyRequireJS": true, "fakeScriptLoadEvents.exceptions": "",