mirror of https://github.com/gorhill/uBlock.git
general code review re. most recent commits
This commit is contained in:
parent
f12a89edfa
commit
3956605ee0
|
@ -1,11 +1,11 @@
|
||||||
4d0e777a82576a2ec771742abb91925b assets/ublock/unbreak.txt
|
4d0e777a82576a2ec771742abb91925b assets/ublock/unbreak.txt
|
||||||
62111a29f0a5cb361ba8dbae92054adb assets/ublock/redirect-resources.txt
|
62111a29f0a5cb361ba8dbae92054adb assets/ublock/redirect-resources.txt
|
||||||
6c077d6d5b39e8a5a407966ad62c9c32 assets/ublock/privacy.txt
|
6c077d6d5b39e8a5a407966ad62c9c32 assets/ublock/privacy.txt
|
||||||
9bcc718383fec8b2ce0f9c379f45da9a assets/ublock/filters.txt
|
527f9f064f164a3445801d39caff3c6b assets/ublock/filters.txt
|
||||||
146704ad1c0393e342afdb416762c183 assets/ublock/badware.txt
|
146704ad1c0393e342afdb416762c183 assets/ublock/badware.txt
|
||||||
5baa90e2da7cd6a73edff2010557ee57 assets/ublock/redirect.txt
|
5baa90e2da7cd6a73edff2010557ee57 assets/ublock/redirect.txt
|
||||||
b5e3ffc73ffce5c671b1eb9edd466241 assets/ublock/experimental.txt
|
d6f734c851d5077bd545d0fa39e8bb8d assets/ublock/experimental.txt
|
||||||
62111a29f0a5cb361ba8dbae92054adb assets/ublock/resources.txt
|
2f7339c072133f487c25f90d4da0632a assets/ublock/resources.txt
|
||||||
6c9d89c5dc6db345de36c8c966fff575 assets/ublock/filter-lists.json
|
6c9d89c5dc6db345de36c8c966fff575 assets/ublock/filter-lists.json
|
||||||
50573388b525ede1a920cd4b4ee7fbf0 assets/thirdparties/easylist-downloads.adblockplus.org/easyprivacy.txt
|
50573388b525ede1a920cd4b4ee7fbf0 assets/thirdparties/easylist-downloads.adblockplus.org/easyprivacy.txt
|
||||||
61cc16cf02e034370f0f47bc17c46551 assets/thirdparties/easylist-downloads.adblockplus.org/easylist.txt
|
61cc16cf02e034370f0f47bc17c46551 assets/thirdparties/easylist-downloads.adblockplus.org/easylist.txt
|
||||||
|
|
|
@ -16,8 +16,3 @@
|
||||||
# Replacement for `www.google-analytics.com/ga.js`: the goal is to be able to
|
# Replacement for `www.google-analytics.com/ga.js`: the goal is to be able to
|
||||||
# block `www.google-analytics.com` while preventing web page breakage.
|
# block `www.google-analytics.com` while preventing web page breakage.
|
||||||
||www.google-analytics.com/ga.js$script,redirect=www.google-analytics.com/ga.js,important
|
||www.google-analytics.com/ga.js$script,redirect=www.google-analytics.com/ga.js,important
|
||||||
|
|
||||||
|
|
||||||
# https://github.com/gorhill/uBlock/issues/1100
|
|
||||||
# This will be moved to mainstream filter list once 1.5.0 lands.
|
|
||||||
1erforum.de,20min.ch,abendzeitung-muenchen.de,allgemeine-zeitung.de,arcor.de,ariva.de,auto-motor-und-sport.de,autoextrem.de,boerse-online.de,buerstaedter-zeitung.de,computerbild.de,comunio.de,echo-online.de,fanfiktion.de,fem.com,finanzen.net,focus.de,gamestar.de,gelnhaeuser-tageblatt.de,general-anzeiger-bonn.de,giessener-anzeiger.de,hochheimer-zeitung.de,hofheimer-zeitung.de,kabeleins.de,kreis-anzeiger.de,lampertheimer-zeitung.de,lauterbacher-anzeiger.de,lpgforum.de,lustich.de,main-spitze.de,motorradonline.de,notebookcheck.net,oberhessische-zeitung.de,pcwelt.de,prosieben.de,prosiebenmaxx.de,rhein-main-presse.de,rp-online.de,runnersworld.de,sat1.de,sat1gold.de,serienjunkies.de,sixx.de,spiegel.de,spox.com,shz.de,teccentral.de,the-voice-of-germany.de,transfermarkt.de,tvspielfilm.de,tvtoday.de,usinger-anzeiger.de,webfail.com,wetter.com,wetteronline.at,wetteronline.de,wiesbadener-kurier.de,wiesbadener-tagblatt.de,wn.de,wormser-zeitung.de##script:inject(uabinject-defuser.js)
|
|
||||||
|
|
|
@ -165,7 +165,6 @@ investopedia.com##.pg-wrapper > div:not(#Nav):not(.nav-space):not(.subnav-space)
|
||||||
# Useful inline script tag filters until filter list maintainers start to use
|
# Useful inline script tag filters until filter list maintainers start to use
|
||||||
# it in their respective filter lists
|
# it in their respective filter lists
|
||||||
arstechnica.com##script:contains(ars.READY.push)
|
arstechnica.com##script:contains(ars.READY.push)
|
||||||
1erforum.de,20min.ch,abendzeitung-muenchen.de,allgemeine-zeitung.de,arcor.de,ariva.de,auto-motor-und-sport.de,autoextrem.de,boerse-online.de,buerstaedter-zeitung.de,computerbild.de,comunio.de,echo-online.de,fanfiktion.de,fem.com,finanzen.net,focus.de,gamestar.de,gelnhaeuser-tageblatt.de,general-anzeiger-bonn.de,giessener-anzeiger.de,hochheimer-zeitung.de,hofheimer-zeitung.de,kabeleins.de,kreis-anzeiger.de,lampertheimer-zeitung.de,lauterbacher-anzeiger.de,lpgforum.de,lustich.de,main-spitze.de,motorradonline.de,notebookcheck.net,oberhessische-zeitung.de,pcwelt.de,prosieben.de,prosiebenmaxx.de,rhein-main-presse.de,rp-online.de,sat1.de,sat1gold.de,serienjunkies.de,sixx.de,spiegel.de,spox.com,shz.de,teccentral.de,the-voice-of-germany.de,transfermarkt.de,tvspielfilm.de,tvtoday.de,usinger-anzeiger.de,webfail.com,wetter.com,wetteronline.at,wetteronline.de,wiesbadener-kurier.de,wiesbadener-tagblatt.de,wn.de,wormser-zeitung.de##script:contains(uabInject)
|
|
||||||
aussenwirtschaftslupe.de,autozeitung.de,brieffreunde.de,donnerwetter.de,formel1.de,fremdwort.de,helles-koepfchen.de,inside-handy.de,motorsport-total.com,moviejones.de,news.de,rechtslupe.de,wintotal.de##script:contains(window.tisoomi)
|
aussenwirtschaftslupe.de,autozeitung.de,brieffreunde.de,donnerwetter.de,formel1.de,fremdwort.de,helles-koepfchen.de,inside-handy.de,motorsport-total.com,moviejones.de,news.de,rechtslupe.de,wintotal.de##script:contains(window.tisoomi)
|
||||||
bild.de##script:contains(/^\s*de.bild.cmsKonfig/)
|
bild.de##script:contains(/^\s*de.bild.cmsKonfig/)
|
||||||
bild.de##script:contains(Javascript)
|
bild.de##script:contains(Javascript)
|
||||||
|
@ -234,7 +233,17 @@ skystreaming.net###fanback + style + div[id]
|
||||||
||c8factor.com^
|
||c8factor.com^
|
||||||
||k5zoom.com^
|
||k5zoom.com^
|
||||||
|
|
||||||
|
# https://github.com/gorhill/uBlock/issues/1100
|
||||||
|
# AdDefend
|
||||||
|
1erforum.de,20min.ch,abendzeitung-muenchen.de,allgemeine-zeitung.de,arcor.de,ariva.de,auto-motor-und-sport.de,autoextrem.de,boerse-online.de,buerstaedter-zeitung.de,computerbild.de,comunio.de,echo-online.de,fanfiktion.de,fem.com,finanzen.net,focus.de,gamestar.de,gelnhaeuser-tageblatt.de,general-anzeiger-bonn.de,giessener-anzeiger.de,hochheimer-zeitung.de,hofheimer-zeitung.de,kabeleins.de,kreis-anzeiger.de,lampertheimer-zeitung.de,lauterbacher-anzeiger.de,lpgforum.de,lustich.de,main-spitze.de,motorradonline.de,notebookcheck.net,oberhessische-zeitung.de,pcwelt.de,prosieben.de,prosiebenmaxx.de,rhein-main-presse.de,rp-online.de,runnersworld.de,sat1.de,sat1gold.de,serienjunkies.de,sixx.de,spiegel.de,spox.com,shz.de,teccentral.de,the-voice-of-germany.de,transfermarkt.de,tvspielfilm.de,tvtoday.de,usinger-anzeiger.de,webfail.com,wetter.com,wetteronline.at,wetteronline.de,wiesbadener-kurier.de,wiesbadener-tagblatt.de,wn.de,wormser-zeitung.de##script:inject(uabinject-defuser.js)
|
||||||
|
|
||||||
# Yavli ads
|
# Yavli ads
|
||||||
|
activistpost.com,alfonzorachel.com,aplus.com,breathecast.com,bulletsfirst.net,clashdaily.com,comicallyincorrect.com,conservativebyte.com,cowboybyte.com,dailysurge.com,dccrimestories.com,drhotze.com,explosm.net,genfringe.com,girlsjustwannahaveguns.com,joeforamerica.com,latinpost.com,mensfitness.com,minutemennews.com,mobilelikez.com,muscleandfitness.com,naturalblaze.com,oddee.com,okmagazine.com,patriotoutdoornews.com,pitgrit.com,radaronline.com,redmaryland.com,segmentnext.com,shark-tank.com,theblacksphere.net,thegatewaypundit.com,themattwalshblog.com,thepoke.co.uk,unilad.co.uk,valuewalk.com,vcpost.com,victoriajackson.com,viralnova.com##script:inject(yavli-defuser.js)
|
||||||
|
|
||||||
|
# The following filters will be removed once 1.5.0 is widespread
|
||||||
|
# AdDefend
|
||||||
|
1erforum.de,20min.ch,abendzeitung-muenchen.de,allgemeine-zeitung.de,arcor.de,ariva.de,auto-motor-und-sport.de,autoextrem.de,boerse-online.de,buerstaedter-zeitung.de,computerbild.de,comunio.de,echo-online.de,fanfiktion.de,fem.com,finanzen.net,focus.de,gamestar.de,gelnhaeuser-tageblatt.de,general-anzeiger-bonn.de,giessener-anzeiger.de,hochheimer-zeitung.de,hofheimer-zeitung.de,kabeleins.de,kreis-anzeiger.de,lampertheimer-zeitung.de,lauterbacher-anzeiger.de,lpgforum.de,lustich.de,main-spitze.de,motorradonline.de,notebookcheck.net,oberhessische-zeitung.de,pcwelt.de,prosieben.de,prosiebenmaxx.de,rhein-main-presse.de,rp-online.de,sat1.de,sat1gold.de,serienjunkies.de,sixx.de,spiegel.de,spox.com,shz.de,teccentral.de,the-voice-of-germany.de,transfermarkt.de,tvspielfilm.de,tvtoday.de,usinger-anzeiger.de,webfail.com,wetter.com,wetteronline.at,wetteronline.de,wiesbadener-kurier.de,wiesbadener-tagblatt.de,wn.de,wormser-zeitung.de##script:contains(uabInject)
|
||||||
|
# Yavli
|
||||||
activistpost.com,alfonzorachel.com,aplus.com,breathecast.com,bulletsfirst.net,clashdaily.com,comicallyincorrect.com,conservativebyte.com,cowboybyte.com,dailysurge.com,dccrimestories.com,drhotze.com,explosm.net,genfringe.com,girlsjustwannahaveguns.com,joeforamerica.com,latinpost.com,mensfitness.com,minutemennews.com,mobilelikez.com,muscleandfitness.com,naturalblaze.com,oddee.com,okmagazine.com,patriotoutdoornews.com,pitgrit.com,radaronline.com,redmaryland.com,segmentnext.com,shark-tank.com,theblacksphere.net,thegatewaypundit.com,themattwalshblog.com,thepoke.co.uk,unilad.co.uk,valuewalk.com,vcpost.com,victoriajackson.com,viralnova.com##script:contains(/^.{0,16}__durl=/)
|
activistpost.com,alfonzorachel.com,aplus.com,breathecast.com,bulletsfirst.net,clashdaily.com,comicallyincorrect.com,conservativebyte.com,cowboybyte.com,dailysurge.com,dccrimestories.com,drhotze.com,explosm.net,genfringe.com,girlsjustwannahaveguns.com,joeforamerica.com,latinpost.com,mensfitness.com,minutemennews.com,mobilelikez.com,muscleandfitness.com,naturalblaze.com,oddee.com,okmagazine.com,patriotoutdoornews.com,pitgrit.com,radaronline.com,redmaryland.com,segmentnext.com,shark-tank.com,theblacksphere.net,thegatewaypundit.com,themattwalshblog.com,thepoke.co.uk,unilad.co.uk,valuewalk.com,vcpost.com,victoriajackson.com,viralnova.com##script:contains(/^.{0,16}__durl=/)
|
||||||
||a.postrelease.com/serve/load.js$script,redirect=yavli-defuser.js,domain=mensfitness.com|okmagazine.com|radaronline.com
|
||a.postrelease.com/serve/load.js$script,redirect=yavli-defuser.js,domain=mensfitness.com|okmagazine.com|radaronline.com
|
||||||
||ads.intergi.com^$script,redirect=yavli-defuser.js,domain=segmentnext.com
|
||ads.intergi.com^$script,redirect=yavli-defuser.js,domain=segmentnext.com
|
||||||
|
|
|
@ -200,31 +200,18 @@ i.ligatus.com/*/angular-tag.js application/javascript
|
||||||
# script is normally blocked on the site.
|
# script is normally blocked on the site.
|
||||||
yavli-defuser.js application/javascript
|
yavli-defuser.js application/javascript
|
||||||
(function() {
|
(function() {
|
||||||
|
var descriptor = {
|
||||||
|
set: function() {
|
||||||
|
;
|
||||||
|
},
|
||||||
|
get: function() {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
};
|
||||||
try {
|
try {
|
||||||
Object.defineProperty(window, '__durl', {
|
Object.defineProperty(window, '__durl', descriptor);
|
||||||
set: function() {
|
Object.defineProperty(window, '__lsurl', descriptor);
|
||||||
;
|
Object.defineProperty(window, '__lturl', descriptor);
|
||||||
},
|
|
||||||
get: function() {
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
});
|
|
||||||
Object.defineProperty(window, '__lsurl', {
|
|
||||||
set: function() {
|
|
||||||
;
|
|
||||||
},
|
|
||||||
get: function() {
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
});
|
|
||||||
Object.defineProperty(window, '__lturl', {
|
|
||||||
set: function() {
|
|
||||||
;
|
|
||||||
},
|
|
||||||
get: function() {
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
"manifest_version": 2,
|
"manifest_version": 2,
|
||||||
|
|
||||||
"name": "uBlock Origin",
|
"name": "uBlock Origin",
|
||||||
"version": "1.4.1",
|
"version": "1.5.0",
|
||||||
|
|
||||||
"default_locale": "en",
|
"default_locale": "en",
|
||||||
"description": "__MSG_extShortDesc__",
|
"description": "__MSG_extShortDesc__",
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
"manifest_version": 2,
|
"manifest_version": 2,
|
||||||
|
|
||||||
"name": "uBlock Origin",
|
"name": "uBlock Origin",
|
||||||
"version": "1.4.1",
|
"version": "1.5.0",
|
||||||
|
|
||||||
"default_locale": "en",
|
"default_locale": "en",
|
||||||
"description": "__MSG_extShortDesc__",
|
"description": "__MSG_extShortDesc__",
|
||||||
|
|
|
@ -141,15 +141,15 @@ var netFilters = function(details) {
|
||||||
// Library of redirection resources:
|
// Library of redirection resources:
|
||||||
// https://github.com/gorhill/uBlock/blob/master/assets/ublock/resources.txt
|
// https://github.com/gorhill/uBlock/blob/master/assets/ublock/resources.txt
|
||||||
|
|
||||||
var injectScripts = function(dataURIs) {
|
var injectScripts = function(scripts) {
|
||||||
var parent = document.head || document.documentElement;
|
var parent = document.head || document.documentElement;
|
||||||
if ( !parent ) {
|
if ( !parent ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var i = dataURIs.length, scriptTag;
|
var i = scripts.length, scriptTag;
|
||||||
while ( i-- ) {
|
while ( i-- ) {
|
||||||
scriptTag = document.createElement('script');
|
scriptTag = document.createElement('script');
|
||||||
scriptTag.src = dataURIs[i];
|
scriptTag.appendChild(document.createTextNode(scripts[i]));
|
||||||
parent.appendChild(scriptTag);
|
parent.appendChild(scriptTag);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -169,7 +169,7 @@ var filteringHandler = function(details) {
|
||||||
if ( details.netHide.length !== 0 ) {
|
if ( details.netHide.length !== 0 ) {
|
||||||
netFilters(details);
|
netFilters(details);
|
||||||
}
|
}
|
||||||
if ( details.scripts !== 0 ) {
|
if ( Array.isArray(details.scripts) ) {
|
||||||
injectScripts(details.scripts);
|
injectScripts(details.scripts);
|
||||||
}
|
}
|
||||||
// The port will never be used again at this point, disconnecting allows
|
// The port will never be used again at this point, disconnecting allows
|
||||||
|
|
|
@ -1103,13 +1103,13 @@ FilterContainer.prototype.retrieveScriptTags = function(domain, hostname) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var out = [],
|
var out = [],
|
||||||
hn = hostname, pos, rnames, i, dataURI;
|
hn = hostname, pos, rnames, i, content;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
rnames = this.scriptTags[hn];
|
rnames = this.scriptTags[hn];
|
||||||
i = rnames && rnames.length || 0;
|
i = rnames && rnames.length || 0;
|
||||||
while ( i-- ) {
|
while ( i-- ) {
|
||||||
if ( (dataURI = reng.resourceFromName(rnames[i], 'application/javascript')) ) {
|
if ( (content = reng.resourceContentFromName(rnames[i], 'application/javascript')) ) {
|
||||||
out.push(dataURI);
|
out.push(content);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( hn === domain ) {
|
if ( hn === domain ) {
|
||||||
|
@ -1123,12 +1123,11 @@ FilterContainer.prototype.retrieveScriptTags = function(domain, hostname) {
|
||||||
}
|
}
|
||||||
pos = domain.indexOf('.');
|
pos = domain.indexOf('.');
|
||||||
if ( pos !== -1 ) {
|
if ( pos !== -1 ) {
|
||||||
hn = domain.slice(0, pos);
|
rnames = this.scriptTags[domain.slice(0, pos)];
|
||||||
rnames = this.scriptTags[hn];
|
|
||||||
i = rnames && rnames.length || 0;
|
i = rnames && rnames.length || 0;
|
||||||
while ( i-- ) {
|
while ( i-- ) {
|
||||||
if ( (dataURI = reng.resourceFromName(rnames[i], 'application/javascript')) ) {
|
if ( (content = reng.resourceContentFromName(rnames[i], 'application/javascript')) ) {
|
||||||
out.push(dataURI);
|
out.push(content);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,48 +42,42 @@ var toBroaderHostname = function(hostname) {
|
||||||
|
|
||||||
var RedirectEntry = function() {
|
var RedirectEntry = function() {
|
||||||
this.mime = '';
|
this.mime = '';
|
||||||
this.encoded = false;
|
|
||||||
this.ph = false;
|
|
||||||
this.data = '';
|
this.data = '';
|
||||||
};
|
};
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
RedirectEntry.rePlaceHolders = /\{\{.+?\}\}/;
|
RedirectEntry.prototype.toURL = function() {
|
||||||
RedirectEntry.reRequestURL = /\{\{requestURL\}\}/g;
|
if ( this.data.startsWith('data:') === false ) {
|
||||||
|
if ( this.mime.indexOf(';') === -1 ) {
|
||||||
|
this.data = 'data:' + this.mime + ';base64,' + btoa(this.data);
|
||||||
|
} else {
|
||||||
|
this.data = 'data:' + this.mime + ',' + this.data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return this.data;
|
||||||
|
};
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
RedirectEntry.prototype.toURL = function(requestURL) {
|
RedirectEntry.prototype.toContent = function() {
|
||||||
if ( this.ph === false ) {
|
if ( this.data.startsWith('data:') ) {
|
||||||
return this.data;
|
var pos = this.data.indexOf(',');
|
||||||
|
var base64 = this.data.endsWith(';base64', pos);
|
||||||
|
this.data = this.data.slice(pos + 1);
|
||||||
|
if ( base64 ) {
|
||||||
|
this.data = atob(this.data);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return 'data:' +
|
return this.data;
|
||||||
this.mime + ';base64,' +
|
|
||||||
btoa(this.data.replace(RedirectEntry.reRequestURL, requestURL));
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
RedirectEntry.fromFields = function(mime, lines) {
|
RedirectEntry.fromFields = function(mime, lines) {
|
||||||
var r = new RedirectEntry();
|
var r = new RedirectEntry();
|
||||||
|
|
||||||
r.mime = mime;
|
r.mime = mime;
|
||||||
r.encoded = mime.indexOf(';') !== -1;
|
r.data = lines.join(mime.indexOf(';') !== -1 ? '' : '\n');
|
||||||
var data = lines.join(r.encoded ? '' : '\n');
|
|
||||||
// check for placeholders.
|
|
||||||
r.ph = r.encoded === false && RedirectEntry.rePlaceHolders.test(data);
|
|
||||||
if ( r.ph ) {
|
|
||||||
r.data = data;
|
|
||||||
} else {
|
|
||||||
r.data =
|
|
||||||
'data:' +
|
|
||||||
mime +
|
|
||||||
(r.encoded ? '' : ';base64') +
|
|
||||||
',' +
|
|
||||||
(r.encoded ? data : btoa(data));
|
|
||||||
}
|
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -91,12 +85,8 @@ RedirectEntry.fromFields = function(mime, lines) {
|
||||||
|
|
||||||
RedirectEntry.fromSelfie = function(selfie) {
|
RedirectEntry.fromSelfie = function(selfie) {
|
||||||
var r = new RedirectEntry();
|
var r = new RedirectEntry();
|
||||||
|
|
||||||
r.mime = selfie.mime;
|
r.mime = selfie.mime;
|
||||||
r.encoded = selfie.encoded;
|
|
||||||
r.ph = selfie.ph;
|
|
||||||
r.data = selfie.data;
|
r.data = selfie.data;
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -167,7 +157,7 @@ RedirectEngine.prototype.toURL = function(context) {
|
||||||
}
|
}
|
||||||
var entry = this.resources[token];
|
var entry = this.resources[token];
|
||||||
if ( entry !== undefined ) {
|
if ( entry !== undefined ) {
|
||||||
return entry.toURL(context.requestURL);
|
return entry.toURL();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -359,7 +349,7 @@ RedirectEngine.prototype.fromSelfie = function(selfie) {
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
RedirectEngine.prototype.resourceFromName = function(name, mime) {
|
RedirectEngine.prototype.resourceURIFromName = function(name, mime) {
|
||||||
var entry = this.resources[name];
|
var entry = this.resources[name];
|
||||||
if ( entry && (mime === undefined || entry.mime.startsWith(mime)) ) {
|
if ( entry && (mime === undefined || entry.mime.startsWith(mime)) ) {
|
||||||
return entry.toURL();
|
return entry.toURL();
|
||||||
|
@ -368,6 +358,15 @@ RedirectEngine.prototype.resourceFromName = function(name, mime) {
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
|
RedirectEngine.prototype.resourceContentFromName = function(name, mime) {
|
||||||
|
var entry = this.resources[name];
|
||||||
|
if ( entry && (mime === undefined || entry.mime.startsWith(mime)) ) {
|
||||||
|
return entry.toContent();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
|
||||||
// TODO: combine same key-redirect pairs into a single regex.
|
// TODO: combine same key-redirect pairs into a single regex.
|
||||||
|
|
||||||
RedirectEngine.prototype.resourcesFromString = function(text) {
|
RedirectEngine.prototype.resourcesFromString = function(text) {
|
||||||
|
|
Loading…
Reference in New Issue