Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • Synzvato/decentraleyes
  • gkrishnaks/decentraleyes
  • ExE-Boss/decentraleyes
  • whtsky/decentraleyes
  • grtgarrett/decentraleyes
  • An_dz/decentraleyes
  • Alaska/decentraleyes
  • finn/decentraleyes
  • klippy/decentraleyes
9 results
Show changes
Showing
with 2360 additions and 949 deletions
/**
* State Manager
* Belongs to Decentraleyes.
*
* @author Thomas Rientjes
* @since 2017-03-10
* @license MPL 2.0
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
import Constants from '../data/constants.js';
import Helpers from '../utilities/helpers.js';
import Storage from './storage.js';
import View from './view.js';
/**
* Private Constants
*/
const _requestContexts = {};
/**
* Private Functions
*/
const _registerInjection = async (requestIdentifier) => {
let tabIdentifier, targetDetails, injectionIdentifier, tabContext, injectionCount;
({tabIdentifier, targetDetails} = _requestContexts[requestIdentifier]);
injectionIdentifier = targetDetails.source + targetDetails.path + targetDetails.version;
tabContext = await Storage.getTabContext(tabIdentifier);
tabContext[Constants.TabContext.INJECTIONS][injectionIdentifier] = targetDetails;
injectionCount = Object.keys(tabContext[Constants.TabContext.INJECTIONS]).length;
Storage.incrementStatistic(Constants.Statistic.AMOUNT_INJECTED);
View.renderInjectionCount(tabIdentifier, injectionCount);
await Storage.updateTabContext(tabIdentifier, tabContext);
};
const _clearInjections = async (requestDetails) => {
if (requestDetails.frameId === Constants.WebRequest.MAIN_FRAME_ID) {
if (requestDetails.tabId !== chrome.tabs.TAB_ID_NONE) {
const tabContext = await Storage.getTabContext(requestDetails.tabId);
if (tabContext) {
tabContext[Constants.TabContext.INJECTIONS] = {};
Storage.updateTabContext(requestDetails.tabId, tabContext);
}
View.renderInitialTabState(requestDetails.tabId, requestDetails.url);
}
}
};
/**
* Public Functions
*/
const createRequestContext = (requestIdentifier, requestContext) => {
_requestContexts[requestIdentifier] = requestContext;
};
const deleteRequestContext = (requestIdentifier) => {
delete _requestContexts[requestIdentifier];
};
/**
* Initializations
*/
chrome.tabs.query({}, (tabs) => {
for (const tab of tabs) {
View.renderInitialTabState(tab.id, tab.url, false);
}
Storage.createTabContexts(tabs);
});
/**
* Event Handlers
*/
chrome.tabs.onCreated.addListener((tab) => {
Storage.createTabContexts([tab], true);
});
chrome.tabs.onRemoved.addListener((tabIdentifier) => {
Storage.clearTabContext(tabIdentifier);
});
chrome.webRequest.onBeforeRequest.addListener(async (requestDetails) => {
const tabContext = await Storage.getTabContext(requestDetails.tabId);
if (tabContext) {
const tabIdentifier = tabContext[Constants.TabContext.IDENTIFIER];
if (tabIdentifier !== chrome.tabs.TAB_ID_NONE) {
tabContext[Constants.TabContext.URL] = requestDetails.url;
await Storage.updateTabContext(tabIdentifier, tabContext);
}
}
}, {'types': [Constants.WebRequestType.MAIN_FRAME], 'urls': [Constants.Address.ANY]});
chrome.webNavigation.onErrorOccurred.addListener(_clearInjections, {'url': [{'urlContains': ':'}]});
chrome.webNavigation.onCommitted.addListener(_clearInjections, {'url': [{'urlContains': ':'}]});
chrome.webRequest.onBeforeRedirect.addListener((requestDetails) => {
if (typeof _requestContexts[requestDetails.requestId] === 'object') {
if (! _requestContexts[requestDetails.requestId].isSilent) {
_registerInjection(requestDetails.requestId);
}
deleteRequestContext(requestDetails.requestId);
}
}, {'urls': [Constants.Address.ANY]});
chrome.storage.onChanged.addListener((changes) => {
if (Object.keys(changes).includes(Constants.Setting.DISABLE_PREFETCH)) {
Helpers.setPrefetchDisabled(changes[Constants.Setting.DISABLE_PREFETCH].newValue);
}
});
/**
* Initializations
*/
(async () => {
Helpers.setPrefetchDisabled(await Storage.getSetting(Constants.Setting.DISABLE_PREFETCH));
})();
/**
* Exports
*/
export default {
createRequestContext,
deleteRequestContext
};
/**
* Storage Manager
* Belongs to Decentraleyes.
*
* @author Thomas Rientjes
* @since 2024-10-09
* @license MPL-2.0
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
import Constants from '../data/constants.js';
import SettingDefaults from '../data/setting/defaults.js';
import StatisticDefaults from '../data/statistic/defaults.js';
/**
* Private Constants
*/
const _items = {
'tabContexts': null, 'settings': null, 'statistics': null
};
const _promises = {
'tabContexts': null, 'settings': null, 'statistics': null
};
const _timeouts = {
'tabContexts': null, 'settings': null, 'statistics': null
};
/**
* Private Functions
*/
const _getLocalSettings = async () => {
const localSettings = await chrome.storage.local.get(SettingDefaults);
return localSettings;
};
const _getManagedSettings = async () => {
let managedSettingKeys, managedSettings;
managedSettingKeys = Object.keys(Constants.Setting);
try {
managedSettings = await chrome.storage.managed.get(managedSettingKeys);
if (window.chrome.runtime.lastError) {
throw new Error(window.chrome.runtime.lastError);
}
} catch {
managedSettings = {};
}
return managedSettings;
};
/**
* Public Functions
*/
const getTabContexts = async () => {
if (! _items.tabContexts) {
_promises.tabContexts ??= chrome.storage.session.get(Constants.SessionItem.TAB_CONTEXTS);
const tabContents = (await _promises.tabContexts)?.[Constants.SessionItem.TAB_CONTEXTS];
_items.tabContexts = tabContents ?? {};
_promises.tabContexts = null;
}
return _items.tabContexts;
};
const getTabContext = async (key) => {
const tabContexts = await getTabContexts();
key = String(key);
return tabContexts[key] ?? null;
};
const createTabContexts = async (tabs, replaceExisting = false) => {
const tabContexts = await getTabContexts();
for (const tab of tabs) {
const key = String(tab.id);
if (replaceExisting === true || ! Object.keys(tabContexts).includes(key)) {
tabContexts[key] = {
[Constants.TabContext.IDENTIFIER]: Number(key),
[Constants.TabContext.INJECTIONS]: {},
[Constants.TabContext.URL]: tab.url ?? null
};
}
}
await chrome.storage.session.set({tabContexts});
};
const updateTabContext = async (key, value) => {
const tabContexts = await getTabContexts();
key = String(key);
tabContexts[key] = value;
await chrome.storage.session.set({tabContexts});
};
const clearTabContext = async (key) => {
const tabContexts = await getTabContexts();
key = String(key);
delete tabContexts[key];
await chrome.storage.session.set({tabContexts});
};
const getSettings = async (concise = true) => {
if (! _items.settings) {
let localSettings, managedSettings, settings, environmentName;
_promises.settings ??= Promise.all([_getLocalSettings(), _getManagedSettings()]);
[localSettings, managedSettings] = await _promises.settings;
settings = Object.keys({...localSettings, ...managedSettings}).reduce((accumulator, key) => {
accumulator[key] = {
'value': managedSettings[key] || localSettings[key],
'origin': 'local'
};
if (managedSettings[key]) {
accumulator[key].origin = 'managed';
}
return accumulator;
}, {});
if (settings.blockMissing.value === true || settings.enforceStaging.value === true) {
environmentName = Constants.Environment.STAGING;
} else {
environmentName = Constants.Environment.STABLE;
};
settings[Constants.ComputedSetting.ENVIRONMENT_NAME] = {
'value': environmentName, 'origin': 'computed'
};
_items.settings ??= settings;
_promises.settings = null;
}
if (concise) {
return {...Object.fromEntries(Object.entries(_items.settings)
.map(([key, setting]) => [key, setting.value]))};
}
return _items.settings;
};
const getSetting = async (key, concise = true) => {
const settings = await getSettings(false);
if (! Object.keys(settings).includes(key)) {
throw new Error(`Setting "${key}" does not exist.`);
}
if (concise) {
return settings[key].value;
}
return settings[key];
};
const updateSetting = async (key, value) => {
const settings = await getSettings(false);
if (! Object.keys(settings).includes(key)) {
throw new Error(`Setting "${key}" does not exist.`);
}
if (settings[key].origin === 'computed') {
throw new Error(`Setting "${key}" is read-only.`);
}
await chrome.storage.local.set({[key]: value});
};
const clearSetting = async (key) => {
const settings = await getSettings(false);
if (! Object.keys(settings).includes(key)) {
throw new Error(`Setting "${key}" does not exist.`);
}
if (settings[key].origin === 'computed') {
throw new Error(`Setting "${key}" is read-only.`);
}
chrome.storage.local.remove(key);
};
const getStatistics = async () => {
if (! _items.statistics) {
_promises.statistics ??= chrome.storage.local.get(StatisticDefaults);
const statistics = await _promises.statistics;
if (typeof statistics[Constants.Statistic.AMOUNT_INJECTED] === 'number') {
statistics[Constants.Statistic.AMOUNT_INJECTED] = {
'value': statistics[Constants.Statistic.AMOUNT_INJECTED],
'createdAt': null
};
}
_items.statistics ??= statistics;
_promises.statistics = null;
}
return _items.statistics;
};
const getStatistic = async (key) => {
const statistics = await getStatistics();
if (! Object.keys(statistics).includes(key)) {
throw new Error(`Statistic "${key}" does not exist.`);
}
return statistics[key];
};
const incrementStatistic = async (key) => {
const statistics = await getStatistics();
clearTimeout(_timeouts.statistics);
if (! Object.keys(statistics).includes(key)) {
throw new Error(`Setting "${key}" does not exist.`);
}
statistics[key].value = ++statistics[key].value;
_timeouts.statistics = setTimeout(() => {
chrome.storage.local.set(statistics);
}, 500);
};
const clearStatistic = async (key) => {
const statistics = await getStatistics();
if (! Object.keys(statistics).includes(key)) {
throw new Error(`Statistic "${key}" does not exist.`);
}
clearTimeout(_timeouts.statistics);
chrome.storage.local.remove(key);
};
/**
* Event Handlers
*/
chrome.storage.onChanged.addListener((changes) => {
let updatedKeys, statisticKeys, settingKeys;
updatedKeys = Object.keys(changes);
statisticKeys = Object.values(Constants.Statistic);
settingKeys = Object.values(Constants.Setting);
if (updatedKeys.some((key) => statisticKeys.includes(key))) {
_items.statistics = null;
}
if (updatedKeys.some((key) => settingKeys.includes(key))) {
_items.settings = null;
}
if (updatedKeys.includes(Constants.SessionItem.TAB_CONTEXTS)) {
_items.tabContexts = null;
}
});
/**
* Exports
*/
export default {
getTabContexts,
getTabContext,
createTabContexts,
updateTabContext,
clearTabContext,
getSettings,
getSetting,
updateSetting,
clearSetting,
getStatistics,
getStatistic,
incrementStatistic,
clearStatistic
};
/**
* View Manager
* Belongs to Decentraleyes.
*
* @author Thomas Rientjes
* @since 2024-10-17
* @license MPL 2.0
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
import Constants from '../data/constants.js';
import Helpers from '../utilities/helpers.js';
import Storage from './storage.js';
import Wrappers from '../utilities/wrappers.js';
/**
* Private Functions
*/
const _renderTabWhitelistState = async (tabIdentifier, url, injectionCount = 0) => {
let domain, domainIsWhitelisted;
domain = Helpers.extractDomainFromUrl(url);
domainIsWhitelisted = await Helpers.domainIsWhitelisted(domain);
if (domainIsWhitelisted) {
Wrappers.action.setIcon({'tabId': tabIdentifier, 'path': Helpers.determineIconPaths('disabled')});
} else {
Wrappers.action.setIcon({'tabId': tabIdentifier, 'path': Helpers.determineIconPaths('default')});
}
if (domainIsWhitelisted && injectionCount <= 0) {
Wrappers.action.setTitle({'tabId': tabIdentifier, 'title': 'Decentraleyes (–)'});
} else {
Wrappers.action.setTitle({'tabId': tabIdentifier, 'title': `Decentraleyes (${injectionCount})`});
}
};
const _clearBadgeText = (tabIdentifier) => {
Wrappers.action.setBadgeText({'tabId': tabIdentifier, 'text': ''});
};
/**
* Public Functions
*/
const renderInitialTabState = async (tabIdentifier, url, clearBadgeText = true) => {
const showIconBadge = await Storage.getSetting(Constants.Setting.SHOW_ICON_BADGE);
_renderTabWhitelistState(tabIdentifier, url);
if (showIconBadge === true && clearBadgeText === true) {
_clearBadgeText(tabIdentifier);
}
};
const renderInjectionCount = async (tabIdentifier, injectionCount) => {
const showIconBadge = await Storage.getSetting(Constants.Setting.SHOW_ICON_BADGE);
if (injectionCount > 0) {
Wrappers.action.setTitle({'tabId': tabIdentifier, 'title': `Decentraleyes (${injectionCount})`});
if (showIconBadge === true) {
Wrappers.action.setBadgeText({'tabId': tabIdentifier, 'text': injectionCount.toString()});
}
}
};
/**
* Event Handlers
*/
chrome.runtime.onInstalled.addListener(async (details) => {
let location, previousVersion, showReleaseNotes;
location = chrome.runtime.getURL('pages/welcome/welcome.html');
if (details.reason === chrome.runtime.OnInstalledReason.INSTALL ||
details.reason === chrome.runtime.OnInstalledReason.UPDATE) {
previousVersion = details.previousVersion;
if (previousVersion && previousVersion.startsWith('3')) {
return; // Do not show release notes after minor updates.
}
if (details.temporary === true) {
return; // Only show release notes on full installations.
}
showReleaseNotes = await Storage.getSetting(Constants.Setting.SHOW_RELEASE_NOTES);
if (showReleaseNotes === true) {
chrome.tabs.create({'url': location, 'active': false});
}
}
});
chrome.storage.onChanged.addListener(async (changes) => {
if (Object.keys(changes).includes(Constants.Setting.SHOW_ICON_BADGE)) {
const tabContexts = await Storage.getTabContexts();
if (changes[Constants.Setting.SHOW_ICON_BADGE].newValue === true) {
for (const tabContext of Object.values(tabContexts)) {
let tabIdentifier, injectionCount;
tabIdentifier = tabContext[Constants.TabContext.IDENTIFIER];
injectionCount = Object.keys(tabContext[Constants.TabContext.INJECTIONS]).length;
renderInjectionCount(tabIdentifier, injectionCount);
}
} else {
for (const tabContext of Object.values(tabContexts)) {
_clearBadgeText(tabContext[Constants.TabContext.IDENTIFIER]);
}
}
}
if (Object.keys(changes).includes(Constants.Setting.WHITELISTED_DOMAINS)) {
const tabContexts = await Storage.getTabContexts();
for (const tabContext of Object.values(tabContexts)) {
_renderTabWhitelistState(
tabContext[Constants.TabContext.IDENTIFIER],
tabContext[Constants.TabContext.URL],
Object.keys(tabContext[Constants.TabContext.INJECTIONS]).length
);
}
}
});
/**
* Initializations
*/
Wrappers.action.setBadgeBackgroundColor({'color': 'rgb(74, 130, 108)'});
Wrappers.action.setBadgeTextColor({'color': 'rgb(255, 255, 255)'});
/**
* Exports
*/
export default {
renderInitialTabState,
renderInjectionCount
};
/**
* Global Constants
* Belongs to Decentraleyes.
*
* @author Thomas Rientjes
* @since 2017-10-27
* @license MPL 2.0
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
/**
* Public Constants
*/
const Address = {
'ANY': '*://*/*',
'ANY_PATH': '/*',
'ANY_PROTOCOL': '*://',
'CHROME': 'chrome:',
'DECENTRALEYES': 'decentraleyes.org',
'EXAMPLE': 'example.org',
'HTTP': 'http:',
'HTTPS': 'https:',
'WWW_PREFIX': 'www.'
};
const Environment = {
'STABLE': 'stable',
'STAGING': 'staging'
};
const Header = {
'COOKIE': 'Cookie',
'ORIGIN': 'Origin',
'REFERER': 'Referer'
};
const MessageResponse = {
'ASYNCHRONOUS': true,
'SYNCHRONOUS': false
};
const Resource = {
'MAPPING_EXPRESSION': /\.map$/i,
'VERSION_EXPRESSION': /(?:\d{1,2}\.){1,3}\d{1,2}/,
'VERSION_PLACEHOLDER': '{version}'
};
const SessionItem = {
'TAB_CONTEXTS': 'tabContexts'
};
const TabContext = {
'IDENTIFIER': 'identifier',
'INJECTIONS': 'injections',
'URL': 'url'
};
const Setting = {
'BLOCK_MISSING': 'blockMissing',
'DISABLE_PREFETCH': 'disablePrefetch',
'ENFORCE_STAGING': 'enforceStaging',
'SHOW_ICON_BADGE': 'showIconBadge',
'SHOW_RELEASE_NOTES': 'showReleaseNotes',
'STRIP_METADATA': 'stripMetadata',
'WHITELISTED_DOMAINS': 'whitelistedDomains',
'XHR_TEST_DOMAIN': 'xhrTestDomain'
};
const ComputedSetting = {
'ENVIRONMENT_NAME': 'environmentName'
};
const Statistic = {
'AMOUNT_INJECTED': 'amountInjected',
'AMOUNT_SANITIZED': 'amountSanitized',
'AMOUNT_BLOCKED': 'amountBlocked'
};
const WebRequest = {
'GET': 'GET',
'BLOCKING': 'blocking',
'HEADERS': 'requestHeaders',
'MAIN_FRAME_ID': 0
};
const WebRequestType = {
'MAIN_FRAME': 'main_frame',
'XHR': 'xmlhttprequest'
};
/**
* Exports
*/
export default {
Address,
Environment,
Header,
MessageResponse,
Resource,
SessionItem,
TabContext,
Setting,
ComputedSetting,
Statistic,
WebRequest,
WebRequestType
};
/**
* Domain Exceptions
* Belongs to Decentraleyes.
*
* @author Thomas Rientjes
* @since 2017-10-08 (originally "tainted")
* @license MPL 2.0
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
/**
* Public Constants
*/
const literal = {
'MTBmYXN0ZmluZ2Vycy5jb20=': true,
'Y291cmllci10cmlidW5lLmNvbQ==': true,
'Y29kZS53b3JsZA==': true,
'Y29sdW1iaWF0cmlidW5lLmNvbQ==': true,
'Y29sdW1iaWFkYWlseWhlcmFsZC5jb20=': true,
'Y2FtYnJpZGdlY2hyb24uY29t': true,
'Y2FudG9uZGFpbHlsZWRnZXIuY29t': true,
'Y2FudG9ucmVwLmNvbQ==': true,
'Y2FwZWNvZHRpbWVzLmNvbQ==': true,
'Y2FwdGNoYS5yZWFsdGVrLmNvbQ==': true,
'Y2FybWl0aW1lcy5jb20=': true,
'Y2RuanMuY29t': true,
'Y2VsbG1hcHBlci5uZXQ=': true,
'Y2hhcmxlc3RvbmV4cHJlc3MuY29t': true,
'Y2hlYm95Z2FubmV3cy5jb20=': true,
'Y2hpZWZ0YWluLmNvbQ==': true,
'Y2hpbGxpY290aGV0aW1lc2J1bGxldGluLmNvbQ==': true,
'Y2hpbGxpY290aGVuZXdzLmNvbQ==': true,
'Y2hpcGxleXBhcGVyLmNvbQ==': true,
'Y2hyb25pY2xlLWV4cHJlc3MuY29t': true,
'Y2lyY3VpdGxhYi5jb20=': true,
'Y2pvbmxpbmUuY29t': true,
'Y3JlYXRpdmVjb21tb25zLm9yZw==': true,
'Y3Jlc3R2aWV3YnVsbGV0aW4uY29t': true,
'Y3Jvb2tzdG9udGltZXMuY29t': true,
'Y3Nnb3N0YXRzLmdn': true,
'YW10cmliLmNvbQ==': true,
'YW1hcmlsbG8uY29t': true,
'YW1lc3RyaWIuY29t': true,
'YW55dmFuLmNvbQ==': true,
'YWNrLm5ldA==': true,
'YWR2b2NhdGVwcmVzcy5jb20=': true,
'YWRlbG5ld3MuY29t': true,
'YWRoZXJlbnQubGF2aWxsZWF2ZWxvLm9yZw==': true,
'YWxlZG90aW1lc3JlY29yZC5jb20=': true,
'YWxpY2V0eC5jb20=': true,
'YXBhbGFjaHRpbWVzLmNvbQ==': true,
'YXJkbW9yZWl0ZS5jb20=': true,
'YXVndXN0YWNocm9uaWNsZS5jb20=': true,
'YXVyb3JhYWR2ZXJ0aXNlci5uZXQ=': true,
'Ym9vbmV2aWxsZWRlbW9jcmF0LmNvbQ==': true,
'Ym9vbnZpbGxlZGFpbHluZXdzLmNvbQ==': true,
'YmFybmVzdmlsbGUtZW50ZXJwcmlzZS5jb20=': true,
'YmFybnN0YWJsZXBhdHJpb3QuY29t': true,
'YmFzaXNzZXRleGNoYW5nZS5vcmc=': true,
'YmNkZW1vY3JhdG9ubGluZS5jb20=': true,
'YmVhdXJlZ2FyZGRhaWx5bmV3cy5uZXQ=': true,
'Ymx1ZXJpZGdlbm93LmNvbQ==': true,
'Ymx1ZmZ0b250b2RheS5jb20=': true,
'YmxvZy5kYXRhd3JhcHBlci5kZQ==': true,
'YnIuc3BhbmtiYW5nLmNvbQ==': true,
'YnJvd253b29kdHguY29t': true,
'YnV0bGVyY291bnR5dGltZXNnYXpldHRlLmNvbQ==': true,
'YnVja3Njb3VudHljb3VyaWVydGltZXMuY29t': true,
'YnVuZGxlb2Zob2xkaW5nLmNvbQ==': true,
'YnVybGluZ3RvbmNvdW50eXRpbWVzLmNvbQ==': true,
'Z291cHN0YXRlLmNvbQ==': true,
'Z29lcmllLmNvbQ==': true,
'Z2F6ZXRhZG9wb3ZvLmNvbS5icg==': true,
'Z2Fkc2RlbnRpbWVzLmNvbQ==': true,
'Z2FpbmVzdmlsbGUuY29t': true,
'Z2FsZXNidXJnLmNvbQ==': true,
'Z2FsdmFuZXdzLmNvbQ==': true,
'Z2FzdG9uZ2F6ZXR0ZS5jb20=': true,
'Z2N0ZWxlZ3JhbS5jb20=': true,
'Z2R0Lm9xbGYuZ291di5xYy5jYQ==': true,
'Z2VuZXNlb3JlcHVibGljLmNvbQ==': true,
'Z2xvYmV0cm90dGVyLmRl': true,
'Z2xvd2luZy1iZWFyLm9yZw==': true,
'Z3JhbmRsYWtlbmV3cy5jb20=': true,
'Z3Jhbml0ZWZhbGxzbmV3cy5jb20=': true,
'Z3JlZW53b29kZGVtb2NyYXQuY29t': true,
'ZG92ZXJwb3N0LmNvbQ==': true,
'ZG9jcy5zZXJ2aWNlbm93LmNvbQ==': true,
'ZG9kZ2VnbG9iZS5jb20=': true,
'ZG9uYWxkc29udmlsbGVjaGllZi5jb20=': true,
'ZGFpbHktamVmZi5jb20=': true,
'ZGFpbHljb21ldC5jb20=': true,
'ZGFpbHljb21tZXJjaWFsLmNvbQ==': true,
'ZGFuc3ZpbGxlb25saW5lLmNvbQ==': true,
'ZGUuc2hhcmtvb24uY29t': true,
'ZGUuc3BhbmtiYW5nLmNvbQ==': true,
'ZGV2aWxzbGFrZWpvdXJuYWwuY29t': true,
'ZGlzcGF0Y2guY29t': true,
'ZHJvcGJveC5jb20=': true,
'ZW4uc2hhcmtvb24uY29t': true,
'ZW50ZXJwcmlzZW5ld3MuY29t': true,
'ZWFzdHBlb3JpYXRpbWVzY291cmllci5jb20=': true,
'ZWNoby1uZXdzLmNvLnVr': true,
'ZWNoby1waWxvdC5jb20=': true,
'ZWRpbmJ1cmdyZXZpZXcuY29t': true,
'ZWxsd29vZGNpdHlsZWRnZXIuY29t': true,
'ZXBleS5jb20=': true,
'ZXMuc2hhcmtvb24uY29t': true,
'ZXMuc3BhbmtiYW5nLmNvbQ==': true,
'ZXZvaWNlLmNvbQ==': true,
'ZXhhbWluZXItZW50ZXJwcmlzZS5jb20=': true,
'ZXhhbWluZXIubmV0': true,
'Zm93bGVydHJpYnVuZS5jb20=': true,
'Zm9zdGVycy5jb20=': true,
'ZmF5b2JzZXJ2ZXIuY29t': true,
'ZnIuc2hhcmtvb24uY29t': true,
'ZnIuc3BhbmtiYW5nLmNvbQ==': true,
'ZnJlZWJ1c3kuaW8=': true,
'a28uc2hhcmtvb24uY29t': true,
'a2luc3Rvbi5jb20=': true,
'a2lvd2Fjb3VudHlzaWduYWwuY29t': true,
'a2lya3N2aWxsZWRhaWx5ZXhwcmVzcy5jb20=': true,
'aG91bWF0b2RheS5jb20=': true,
'aG9ja2Vzc2luY29tbXVuaXR5bmV3cy5jb20=': true,
'aG9sbGFuZHNlbnRpbmVsLmNvbQ==': true,
'aGF2ZW5ld3MuY29t': true,
'aGFtYnVyZ3JlcG9ydGVyLmNvbQ==': true,
'aGFubmliYWwubmV0': true,
'aGRuZXdzLm5ldA==': true,
'aGVsZW5hLWFya2Fuc2FzLmNvbQ==': true,
'aGVyYWxkZGVtb2NyYXQuY29t': true,
'aGVyYWxkbmV3cy5jb20=': true,
'aGVyYWxkdHJpYnVuZS5jb20=': true,
'aGlsbHNkYWxlLm5ldA==': true,
'aHN2dm9pY2UuY29t': true,
'aHV0Y2huZXdzLmNvbQ==': true,
'aW4uc3BhbmtiYW5nLmNvbQ==': true,
'aW5kZW9ubGluZS5jb20=': true,
'aWNvLm9yZy51aw==': true,
'aWQuc3BhbmtiYW5nLmNvbQ==': true,
'aWRlbnRpLmNh': true,
'aXQuc2hhcmtvb24uY29t': true,
'aXQuc3BhbmtiYW5nLmNvbQ==': true,
'am91cm5hbGRlbW9jcmF0LmNvbQ==': true,
'am91cm5hbHN0YW5kYXJkLmNvbQ==': true,
'am95ZnVsbm9pc2VyZWNvcmRpbmdzLmNvbQ==': true,
'amEuc2hhcmtvb24uY29t': true,
'amFja3Nvbm5ld3NwYXBlcnMuY29t': true,
'amFja3NvbnZpbGxlLmNvbQ==': true,
'amRuZXdzLmNvbQ==': true,
'anAuc3BhbmtiYW5nLmNvbQ==': true,
'b253ZWxvLmNvbQ==': true,
'b25saW5lYXRoZW5zLmNvbQ==': true,
'b2FrcmlkZ2VyLmNvbQ==': true,
'b2NhbGEuY29t': true,
'b2hpby5jb20=': true,
'b2xuZXlkYWlseW1haWwuY29t': true,
'b3Bhdm90ZS5jb20=': true,
'b3BlbmRhdGEuY2JzLm5s': true,
'b3BlbndlYXRoZXJtYXAub3Jn': true,
'b3J6ZXN6ZS5jb20ucGw=': true,
'b3Jpb25nYXpldHRlLmNvbQ==': true,
'b3R0YXdhaGVyYWxkLmNvbQ==': true,
'bGEuc3BhbmtiYW5nLmNvbQ==': true,
'bGF6aXNrYS5jb20ucGw=': true,
'bGFiZG9vci5jb20=': true,
'bGFqdW50YXRyaWJ1bmVkZW1vY3JhdC5jb20=': true,
'bGFrZW5ld3NvbmxpbmUuY29t': true,
'bGVhdmVud29ydGh0aW1lcy5jb20=': true,
'bGVlc3ZpbGxlZGFpbHlsZWFkZXIuY29t': true,
'bGVtb24tYWlkLmRl': true,
'bGVuY29ubmVjdC5jb20=': true,
'bGVvbWluc3RlcmNoYW1wLmNvbQ==': true,
'bGluY29sbmNvdXJpZXIuY29t': true,
'bGlua2Jvc3RvbmhvbWVzLmNvbQ==': true,
'bGlubmNvdW50eWxlYWRlci5jb20=': true,
'bHViYm9ja29ubGluZS5jb20=': true,
'bS1jZS5wbA==': true,
'bW9iZXJseW1vbml0b3IuY29t': true,
'bW9qY2hvcnpvdy5wbA==': true,
'bW9qYnl0b20ucGw=': true,
'bW9qZWdsaXdpY2UucGw=': true,
'bW9qZWthdG93aWNlLnBs': true,
'bW9qZXR5Y2h5LnBs': true,
'bW9qbWlrb2xvdy5wbA==': true,
'bW9ucm9lY29wb3N0LmNvbQ==': true,
'bW9ucm9lbmV3cy5jb20=': true,
'bW9udGVuZXdzLmNvbQ==': true,
'bW9ybmluZ3N1bi5uZXQ=': true,
'bW9ydG9udGltZXNuZXdzLmNvbQ==': true,
'bW9zY293dmlsbGFnZXIuY29t': true,
'bWFudWFsc2xpYi5jb20=': true,
'bWNkb25vdWdodm9pY2UuY29t': true,
'bWNwaGVyc29uc2VudGluZWwuY29t': true,
'bWV0cm93ZXN0ZGFpbHluZXdzLmNvbQ==': true,
'bWV4aWNvbGVkZ2VyLmNvbQ==': true,
'bWVzbGlldXgucGFyaXMuZnI=': true,
'bWdtLmdvdi50cg==': true,
'bWlhbWlvay5jb20=': true,
'bWlkZGxldG93bnRyYW5zY3JpcHQuY29t': true,
'bWlkbG90aGlhbm1pcnJvci5jb20=': true,
'bWlsZm9yZGJlYWNvbi5jb20=': true,
'bWlsZm9yZGRhaWx5bmV3cy5jb20=': true,
'bWlsbGJ1cnlzdXR0b24uY29t': true,
'bWluaWdhbWVzLm1haWwucnU=': true,
'bWluaXF1YWR0ZXN0YmVuY2guY29t': true,
'bXBubm93LmNvbQ==': true,
'bXMuc3BhbmtiYW5nLmNvbQ==': true,
'bXRzaGFzdGFuZXdzLmNvbQ==': true,
'bXl0b3dubmVvLmNvbQ==': true,
'bm9yd2ljaGJ1bGxldGluLmNvbQ==': true,
'bm9ydGhuZWlnaGJvcm5ld3MuY29t': true,
'bmNuZXdzcHJlc3MuY29t': true,
'bmV2YWRhaW93YWpvdXJuYWwuY29t': true,
'bmV3Y29tZXJzdG93bi1uZXdzLmNvbQ==': true,
'bmV3YmVybnNqLmNvbQ==': true,
'bmV3bG9vay5kdGVlbmVyZ3kuY29t': true,
'bmV3c2NoaWVmLmNvbQ==': true,
'bmV3c2hlcmFsZC5jb20=': true,
'bmV3c3JlcHVibGljYW4uY29t': true,
'bmV3c3RyaWJ1bmUuaW5mbw==': true,
'bmV3cG9ydHJpLmNvbQ==': true,
'bmV3cy1qb3VybmFsb25saW5lLmNvbQ==': true,
'bmV3cy1zdGFyLmNvbQ==': true,
'bmVhZ2xlLmNvbQ==': true,
'bmVvc2hvZGFpbHluZXdzLmNvbQ==': true,
'bmhtLmFjLnVr': true,
'bmwuc2hhcmtvb24uY29t': true,
'bmwuc3BhbmtiYW5nLmNvbQ==': true,
'bndmZGFpbHluZXdzLmNvbQ==': true,
'c291dGhjb2FzdHRvZGF5LmNvbQ==': true,
'c29taWliby5jb20=': true,
'c29vZXZlbmluZ25ld3MuY29t': true,
'c29zbm93aWVja2kucGw=': true,
'c2F2YW5uYWhub3cuY29t': true,
'c2FsaW5hLmNvbQ==': true,
'c2Nhbi5uZXh0Y2xvdWQuY29t': true,
'c2NvdHRoZWxtZS5jby51aw==': true,
'c2NzdW50aW1lcy5jb20=': true,
'c2Uuc3BhbmtiYW5nLmNvbQ==': true,
'c2VhY29hc3RvbmxpbmUuY29t': true,
'c2VjdXJlLnBheW1lbnRldm9sdXRpb24uY29t': true,
'c2VjdXJpdHloZWFkZXJzLmNvbQ==': true,
'c2VjdXJpdHloZWFkZXJzLmlv': true,
'c2Vrdm9pY2UuY29t': true,
'c2VudGluZWwtc3RhbmRhcmQuY29t': true,
'c2hlbGJ5c3Rhci5jb20=': true,
'c2llbWlhbm93aWNlLm5ldC5wbA==': true,
'c2lnbmFsLm9yZw==': true,
'c2lza2l5b3VkYWlseS5jb20=': true,
'c2otci5jb20=': true,
'c2puZXdzb25saW5lLmNvbQ==': true,
'c2tvdXNlbi5kaw==': true,
'c2tvdXNlbi5ubw==': true,
'c2xlZXB5ZXllbmV3cy5jb20=': true,
'c3BhbmtiYW5nLmNvbQ==': true,
'c3JwcmVzc2dhemV0dGUuY29t': true,
'c3R1cmdpc2pvdXJuYWwuY29t': true,
'c3R1dHRnYXJ0ZGFpbHlsZWFkZXIuY29t': true,
'c3RhZGl1bS5zZQ==': true,
'c3Rhcm5ld3NvbmxpbmUuY29t': true,
'c3RhcmNvdXJpZXIuY29t': true,
'c3RhcmZsLmNvbQ==': true,
'c3RhdGVzbWFuLmNvbQ==': true,
'c3RhdWd1c3RpbmUuY29t': true,
'c3RlZmFuc3VuZGluLmdpdGh1Yi5pbw==': true,
'c3RldWJlbmNvdXJpZXIuY29t': true,
'c3RqYW1lc25ld3MuY29t': true,
'c3d0aW1lcy5jb20=': true,
'c3dpb255LnBs': true,
'cG9jb25vcmVjb3JkLmNvbQ==': true,
'cG9lZGIudHc=': true,
'cG9udGlhY2RhaWx5bGVhZGVyLmNvbQ==': true,
'cG9zdHNvdXRoLmNvbQ==': true,
'cGF0cmlvdGxlZGdlci5jb20=': true,
'cGF3aHVza2Fqb3VybmFsY2FwaXRhbC5jb20=': true,
'cGFsbWJlYWNocG9zdC5jb20=': true,
'cGFuZG9jLm9yZw==': true,
'cGFyaXMtZXhwcmVzcy5jb20=': true,
'cGJjb21tZXJjaWFsLmNvbQ==': true,
'cGVraW50aW1lcy5jb20=': true,
'cGVvcGxlZm9uZS5jaA==': true,
'cGlla2FyeXNsYXNraWUuY29tLnBs': true,
'cGpzdGFyLmNvbQ==': true,
'cGwuc2hhcmtvb24uY29t': true,
'cGwuc3BhbmtiYW5nLmNvbQ==': true,
'cHJhdHR0cmlidW5lLmNvbQ==': true,
'cHJlc3Nhcmd1cy5jb20=': true,
'cHJlc3NtZW50b3IuY29t': true,
'cHJvY2Vzc3R5cGVmb3VuZHJ5LmNvbQ==': true,
'cHJvZ3Jlc3MtaW5kZXguY29t': true,
'cHJvc3BlcnByZXNzbmV3cy5jb20=': true,
'cHJvdmlkZW5jZWpvdXJuYWwuY29t': true,
'cHQuc2hhcmtvb24uY29t': true,
'cHQuc3BhbmtiYW5nLmNvbQ==': true,
'cHlza293aWNlLmNvbS5wbA==': true,
'cXdlcnRlZS5jb20=': true,
'cmV2aWV3YXRsYXMuY29t': true,
'cmVjb3JkLWNvdXJpZXIuY29t': true,
'cmVjb3Jkb25saW5lLmNvbQ==': true,
'cmVjb3JkbmV0LmNvbQ==': true,
'cmVjb3Jkc3Rhci5jb20=': true,
'cmVkd29vZGZhbGxzZ2F6ZXR0ZS5jb20=': true,
'cmVnZW50Z3JleW1vdXRoLmNvLm56': true,
'cmVnaXN0ZXJndWFyZC5jb20=': true,
'cmVwb3J0LXVyaS5pbw==': true,
'cmlkZ2VjcmVzdGNhLmNvbQ==': true,
'cnJzdGFyLmNvbQ==': true,
'cnUuc2hhcmtvb24uY29t': true,
'cnUuc3BhbmtiYW5nLmNvbQ==': true,
'cnVkYXNsYXNrYS5jb20ucGw=': true,
'cnVubmVsc2NvdW50eXJlZ2lzdGVyLmNvbQ==': true,
'cnlibmlja2kuY29t': true,
'd29kemlzbGF3LmNvbS5wbA==': true,
'd29vZGZvcmR0aW1lcy5jb20=': true,
'd29yY2VzdGVybWFnLmNvbQ==': true,
'd2F4YWhhY2hpZXR4LmNvbQ==': true,
'd2F5bmVpbmRlcGVuZGVudC5jb20=': true,
'd2F5bmVwb3N0LmNvbQ==': true,
'd2FsdG9uc3VuLmNvbQ==': true,
'd2FzaGluZ3RvbnRpbWVzcmVwb3J0ZXIuY29t': true,
'd2ViLXBhdGllbnQuZGs=': true,
'd2Vla2x5Y2l0aXplbi5jb20=': true,
'd2VsbGluZ3RvbmRhaWx5bmV3cy5jb20=': true,
'd2VsbHN2aWxsZWRhaWx5LmNvbQ==': true,
'd2hpdGVhd2F5Lm5v': true,
'd2hpdGVhd2F5LmNvbQ==': true,
'd2hpdGVhd2F5LnNl': true,
'd2hpdGVoYWxsam91cm5hbC5jb20=': true,
'dG9uZXMuYmU=': true,
'dG9wc2FpbGFkdmVydGlzZXIuY29t': true,
'dGF1bnRvbmdhemV0dGUuY29t': true,
'dGFmdG1pZHdheWRyaWxsZXIuY29t': true,
'dGV1dG9wb2xpc3ByZXNzLmNvbQ==': true,
'dGVsZWdyYW0uY29t': true,
'dGguc3BhbmtiYW5nLmNvbQ==': true,
'dGhlLWRhaWx5LXJlY29yZC5jb20=': true,
'dGhlLWRpc3BhdGNoLmNvbQ==': true,
'dGhlLWxlYWRlci5jb20=': true,
'dGhlLXJldmlldy5jb20=': true,
'dGhlY2FyYm9uZGFsZW5ld3MuY29t': true,
'dGhlZ3JhZnRvbm5ld3MuY29t': true,
'dGhlZ3VyZG9udGltZXMuY29t': true,
'dGhlZGFpbHlyZXBvcnRlci5jb20=': true,
'dGhlZGVzdGlubG9nLmNvbQ==': true,
'dGhla2Fuc2FuLmNvbQ==': true,
'dGhlaGF3a2V5ZS5jb20=': true,
'dGhlaW50ZWxsLmNvbQ==': true,
'dGhlbGFuZG1hcmsuY29t': true,
'dGhlbGVkZ2VyLmNvbQ==': true,
'dGhlc3VidXJiYW5pdGUuY29t': true,
'dGhlcGVycnljaGllZi5jb20=': true,
'dGhlcm9sbGFkYWlseW5ld3MuY29t': true,
'dGhlcmVjb3JkaGVyYWxkLmNvbQ==': true,
'dGhldGltZXNuZXdzLmNvbQ==': true,
'dGhpc3dlZWtuZXdzLmNvbQ==': true,
'dGltZXMtZ2F6ZXR0ZS5jb20=': true,
'dGltZXN0ZWxlZ3JhbS5jb20=': true,
'dGltZXNjYWxlLmNvbQ==': true,
'dGltZXNvbmxpbmUuY29t': true,
'dGltZXNyZXBvcnRlci5jb20=': true,
'dHIuc2hhcmtvb24uY29t': true,
'dHIuc3BhbmtiYW5nLmNvbQ==': true,
'dHJhbnNjZW5kLWluZm8uY29t': true,
'dHVuZW15bXVzaWMuY29t': true,
'dHVzY2Fsb29zYW5ld3MuY29t': true,
'dW5pZmllZHBvcnRhbC1tZW0uZXBmaW5kaWEuZ292Lmlu': true,
'dWRhY2l0eS5jb20=': true,
'dXRpY2FvZC5jb20=': true,
'dXdvcmxkLmNvbQ==': true,
'dmFuYWxzdHluZWxlYWRlci5jb20=': true,
'dnZkYWlseXByZXNzLmNvbQ==': true,
'eW91cmdsZW5yb3NldHguY29t': true,
'eW91cnN0ZXBoZW52aWxsZXR4LmNvbQ==': true,
'eW91cnZhbGxleXZvaWNlLmNvbQ==': true,
'eW91cnZvdGVtYXR0ZXJzLmNvLnVr': true,
'eWFkaS5zaw==': true,
'eWVscC5jb20=': true,
'em9yeS5jb20ucGw=': true,
'emFicnplLmNvbS5wbA==': true,
'emgtaGFudC5zaGFya29vbi5jb20=': true
};
const dynamic = [
'd2lja2VkbG9jYWxcLmNvbQ==',
'eWFuZGV4XC5jb20=',
'eWFuZGV4XC5ydQ=='
];
/**
* Exports
*/
export default {
'literal': Object.fromEntries(Object.entries(literal).map(([key, value]) => [atob(key), value])),
'dynamic': dynamic.map((value) => new RegExp(atob(value)))
};
/**
* Resource Aliases
* Belongs to Decentraleyes.
*
* @author Thomas Rientjes
* @since 2018-02-24 (originally "shorthands")
* @license MPL 2.0
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
/**
* Public Constants
*/
const aliases = {
// Google Hosted Libraries [Deprecated]
'ajax.googleapis.com': {
'resources/jquery/1.8/jquery.min.jsm': {
'path': 'resources/jquery/1.8.3/jquery.min.jsm',
'version': '1.8.3'
},
'resources/jquery/1.7/jquery.min.jsm': {
'path': 'resources/jquery/1.7.2/jquery.min.jsm',
'version': '1.7.2'
},
'resources/jquery/1.6/jquery.min.jsm': {
'path': 'resources/jquery/1.6.4/jquery.min.jsm',
'version': '1.6.4'
},
'resources/jquery/1.5/jquery.min.jsm': {
'path': 'resources/jquery/1.5.2/jquery.min.jsm',
'version': '1.5.2'
},
'resources/jquery/1.4/jquery.min.jsm': {
'path': 'resources/jquery/1.4.4/jquery.min.jsm',
'version': '1.4.4'
},
'resources/jquery/1.3/jquery.min.jsm': {
'path': 'resources/jquery/1.3.2/jquery.min.jsm',
'version': '1.3.2'
},
'resources/jquery/1.2/jquery.min.jsm': {
'path': 'resources/jquery/1.2.6/jquery.min.jsm',
'version': '1.2.6'
}
},
// jQuery CDN [Deprecated]
'code.jquery.com': {
'resources/jquery/1.7/jquery.min.jsm': {
'path': 'resources/jquery/1.7.0/jquery.min.jsm',
'version': '1.7.0'
},
'resources/jquery/1.6/jquery.min.jsm': {
'path': 'resources/jquery/1.6.0/jquery.min.jsm',
'version': '1.6.0'
},
'resources/jquery/1.5/jquery.min.jsm': {
'path': 'resources/jquery/1.5.0/jquery.min.jsm',
'version': '1.5.0'
},
'resources/jquery/1.4/jquery.min.jsm': {
'path': 'resources/jquery/1.4.0/jquery.min.jsm',
'version': '1.4.0'
},
'resources/jquery/1.3/jquery.min.jsm': {
'path': 'resources/jquery/1.3.0/jquery.min.jsm',
'version': '1.3.0'
}
}
};
/**
* Initializations
*/
// Geekzu Public Service [Mirror]
aliases['sdn.geekzu.org'] = aliases['ajax.googleapis.com'];
// USTC Linux User Group [Mirror]
aliases['ajax.proxy.ustclug.org'] = aliases['ajax.googleapis.com'];
/**
* Exports
*/
export default aliases;
/**
* Resource Environments
* Belongs to Decentraleyes.
*
* @author Thomas Rientjes
* @since 2014-07-24 (originally "files")
* @license MPL 2.0
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
/**
* Public Constants
*/
const stable = {
// AngularJS
'resources/angularjs/1.0.1/angular.min.jsm': true,
'resources/angularjs/1.0.2/angular.min.jsm': true,
'resources/angularjs/1.0.3/angular.min.jsm': true,
'resources/angularjs/1.0.4/angular.min.jsm': true,
'resources/angularjs/1.0.5/angular.min.jsm': true,
'resources/angularjs/1.0.6/angular.min.jsm': true,
'resources/angularjs/1.0.8/angular.min.jsm': true,
'resources/angularjs/1.2.0/angular.min.jsm': true,
'resources/angularjs/1.2.1/angular.min.jsm': true,
'resources/angularjs/1.2.10/angular.min.jsm': true,
'resources/angularjs/1.2.15/angular.min.jsm': true,
'resources/angularjs/1.2.16/angular.min.jsm': true,
'resources/angularjs/1.2.20/angular.min.jsm': true,
'resources/angularjs/1.2.23/angular.min.jsm': true,
'resources/angularjs/1.2.26/angular.min.jsm': true,
'resources/angularjs/1.2.28/angular.min.jsm': true,
'resources/angularjs/1.2.29/angular.min.jsm': true,
'resources/angularjs/1.3.0/angular.min.jsm': true,
'resources/angularjs/1.3.3/angular.min.jsm': true,
'resources/angularjs/1.3.8/angular.min.jsm': true,
'resources/angularjs/1.3.10/angular.min.jsm': true,
'resources/angularjs/1.3.11/angular.min.jsm': true,
'resources/angularjs/1.3.14/angular.min.jsm': true,
'resources/angularjs/1.3.15/angular.min.jsm': true,
'resources/angularjs/1.4.0/angular.min.jsm': true,
'resources/angularjs/1.4.2/angular.min.jsm': true,
'resources/angularjs/1.4.8/angular.min.jsm': true,
// Backbone.js
'resources/backbone.js/0.9.0/backbone-min.jsm': true,
'resources/backbone.js/0.9.1/backbone-min.jsm': true,
'resources/backbone.js/0.9.2/backbone-min.jsm': true,
'resources/backbone.js/0.9.9/backbone-min.jsm': true,
'resources/backbone.js/0.9.10/backbone-min.jsm': true,
'resources/backbone.js/1.0.0/backbone-min.jsm': true,
'resources/backbone.js/1.1.0/backbone-min.jsm': true,
'resources/backbone.js/1.1.1/backbone-min.jsm': true,
'resources/backbone.js/1.1.2/backbone-min.jsm': true,
'resources/backbone.js/1.2.0/backbone-min.jsm': true,
'resources/backbone.js/1.2.1/backbone-min.jsm': true,
'resources/backbone.js/1.2.2/backbone-min.jsm': true,
'resources/backbone.js/1.2.3/backbone-min.jsm': true,
// Dojo
'resources/dojo/1.4.1/dojo/dojo.jsm': true,
'resources/dojo/1.4.5/dojo/dojo.jsm': true,
'resources/dojo/1.5.0/dojo/dojo.jsm': true,
'resources/dojo/1.6.1/dojo/dojo.jsm': true,
'resources/dojo/1.7.5/dojo/dojo.jsm': true,
'resources/dojo/1.8.3/dojo/dojo.jsm': true,
'resources/dojo/1.8.7/dojo/dojo.jsm': true,
'resources/dojo/1.8.9/dojo/dojo.jsm': true,
'resources/dojo/1.9.1/dojo/dojo.jsm': true,
'resources/dojo/1.9.3/dojo/dojo.jsm': true,
'resources/dojo/1.9.7/dojo/dojo.jsm': true,
'resources/dojo/1.10.4/dojo/dojo.jsm': true,
// Ember.js
'resources/ember.js/1.0.1/ember.min.jsm': true,
'resources/ember.js/1.1.3/ember.min.jsm': true,
'resources/ember.js/1.2.2/ember.min.jsm': true,
'resources/ember.js/1.3.2/ember.min.jsm': true,
'resources/ember.js/1.4.0/ember.min.jsm': true,
'resources/ember.js/1.5.1/ember.min.jsm': true,
'resources/ember.js/2.0.0/ember.min.jsm': true,
'resources/ember.js/2.0.2/ember.min.jsm': true,
'resources/ember.js/2.1.0/ember.min.jsm': true,
// Ext Core
'resources/ext-core/3.0.0/ext-core.jsm': true,
'resources/ext-core/3.1.0/ext-core.jsm': true,
// jQuery
'resources/jquery/1.2.3/jquery.min.jsm': true,
'resources/jquery/1.2.6/jquery.min.jsm': true,
'resources/jquery/1.3.0/jquery.min.jsm': true,
'resources/jquery/1.3.1/jquery.min.jsm': true,
'resources/jquery/1.3.2/jquery.min.jsm': true,
'resources/jquery/1.4.0/jquery.min.jsm': true,
'resources/jquery/1.4.1/jquery.min.jsm': true,
'resources/jquery/1.4.2/jquery.min.jsm': true,
'resources/jquery/1.4.3/jquery.min.jsm': true,
'resources/jquery/1.4.4/jquery.min.jsm': true,
'resources/jquery/1.5.0/jquery.min.jsm': true,
'resources/jquery/1.5.1/jquery.min.jsm': true,
'resources/jquery/1.5.2/jquery.min.jsm': true,
'resources/jquery/1.6.0/jquery.min.jsm': true,
'resources/jquery/1.6.1/jquery.min.jsm': true,
'resources/jquery/1.6.2/jquery.min.jsm': true,
'resources/jquery/1.6.3/jquery.min.jsm': true,
'resources/jquery/1.6.4/jquery.min.jsm': true,
'resources/jquery/1.7.0/jquery.min.jsm': true,
'resources/jquery/1.7.1/jquery.min.jsm': true,
'resources/jquery/1.7.2/jquery.min.jsm': true,
'resources/jquery/1.8.0/jquery.min.jsm': true,
'resources/jquery/1.8.1/jquery.min.jsm': true,
'resources/jquery/1.8.2/jquery.min.jsm': true,
'resources/jquery/1.8.3/jquery.min.jsm': true,
'resources/jquery/1.9.0/jquery.min.jsm': true,
'resources/jquery/1.9.1/jquery.min.jsm': true,
'resources/jquery/1.10.0/jquery.min.jsm': true,
'resources/jquery/1.10.1/jquery.min.jsm': true,
'resources/jquery/1.10.2/jquery.min.jsm': true,
'resources/jquery/1.11.0/jquery.min.jsm': true,
'resources/jquery/1.11.1/jquery.min.jsm': true,
'resources/jquery/1.11.2/jquery.min.jsm': true,
'resources/jquery/1.11.3/jquery.min.jsm': true,
'resources/jquery/1.12.0/jquery.min.jsm': true,
'resources/jquery/1.12.1/jquery.min.jsm': true,
'resources/jquery/1.12.2/jquery.min.jsm': true,
'resources/jquery/1.12.3/jquery.min.jsm': true,
'resources/jquery/1.12.4/jquery.min.jsm': true,
'resources/jquery/2.0.0/jquery.min.jsm': true,
'resources/jquery/2.0.1/jquery.min.jsm': true,
'resources/jquery/2.0.2/jquery.min.jsm': true,
'resources/jquery/2.0.3/jquery.min.jsm': true,
'resources/jquery/2.1.0/jquery.min.jsm': true,
'resources/jquery/2.1.1/jquery.min.jsm': true,
'resources/jquery/2.1.3/jquery.min.jsm': true,
'resources/jquery/2.1.4/jquery.min.jsm': true,
// jQuery UI
'resources/jqueryui/1.5.3/jquery-ui.min.jsm': true,
'resources/jqueryui/1.6.0/jquery-ui.min.jsm': true,
'resources/jqueryui/1.7.3/jquery-ui.min.jsm': true,
'resources/jqueryui/1.8.24/jquery-ui.min.jsm': true,
'resources/jqueryui/1.9.2/jquery-ui.min.jsm': true,
'resources/jqueryui/1.10.4/jquery-ui.min.jsm': true,
'resources/jqueryui/1.11.0/jquery-ui.min.jsm': true,
'resources/jqueryui/1.11.1/jquery-ui.min.jsm': true,
'resources/jqueryui/1.11.2/jquery-ui.min.jsm': true,
'resources/jqueryui/1.11.3/jquery-ui.min.jsm': true,
'resources/jqueryui/1.11.4/jquery-ui.min.jsm': true,
// Modernizr
'resources/modernizr/2.6.2/modernizr.min.jsm': true,
'resources/modernizr/2.7.1/modernizr.min.jsm': true,
'resources/modernizr/2.7.2/modernizr.min.jsm': true,
'resources/modernizr/2.8.2/modernizr.min.jsm': true,
'resources/modernizr/2.8.3/modernizr.min.jsm': true,
// MooTools
'resources/mootools/1.1.1/mootools-yui-compressed.jsm': true,
'resources/mootools/1.1.2/mootools-yui-compressed.jsm': true,
'resources/mootools/1.2.1/mootools-yui-compressed.jsm': true,
'resources/mootools/1.2.3/mootools-yui-compressed.jsm': true,
'resources/mootools/1.2.4/mootools-yui-compressed.jsm': true,
'resources/mootools/1.2.5/mootools-yui-compressed.jsm': true,
'resources/mootools/1.3.0/mootools-yui-compressed.jsm': true,
'resources/mootools/1.3.1/mootools-yui-compressed.jsm': true,
'resources/mootools/1.3.2/mootools-yui-compressed.jsm': true,
'resources/mootools/1.4.1/mootools-yui-compressed.jsm': true,
'resources/mootools/1.4.5/mootools-yui-compressed.jsm': true,
'resources/mootools/1.5.0/mootools-yui-compressed.jsm': true,
'resources/mootools/1.5.1/mootools-yui-compressed.jsm': true,
// Prototype
'resources/prototype/1.6.0.2/prototype.jsm': true,
'resources/prototype/1.6.0.3/prototype.jsm': true,
'resources/prototype/1.6.1.0/prototype.jsm': true,
'resources/prototype/1.7.0.0/prototype.jsm': true,
'resources/prototype/1.7.1.0/prototype.jsm': true,
'resources/prototype/1.7.2.0/prototype.jsm': true,
'resources/prototype/1.7.3.0/prototype.jsm': true,
// Scriptaculous
'resources/scriptaculous/1.8.1/scriptaculous.jsm': true,
'resources/scriptaculous/1.8.2/scriptaculous.jsm': true,
'resources/scriptaculous/1.8.3/scriptaculous.jsm': true,
'resources/scriptaculous/1.9.0/scriptaculous.jsm': true,
// SWFObject
'resources/swfobject/2.1/swfobject.jsm': true,
'resources/swfobject/2.2/swfobject.jsm': true,
// Underscore.js
'resources/underscore.js/1.3.0/underscore-min.jsm': true,
'resources/underscore.js/1.3.1/underscore-min.jsm': true,
'resources/underscore.js/1.3.3/underscore-min.jsm': true,
'resources/underscore.js/1.4.0/underscore-min.jsm': true,
'resources/underscore.js/1.4.1/underscore-min.jsm': true,
'resources/underscore.js/1.4.2/underscore-min.jsm': true,
'resources/underscore.js/1.4.3/underscore-min.jsm': true,
'resources/underscore.js/1.4.4/underscore-min.jsm': true,
'resources/underscore.js/1.5.0/underscore-min.jsm': true,
'resources/underscore.js/1.5.1/underscore-min.jsm': true,
'resources/underscore.js/1.5.2/underscore-min.jsm': true,
'resources/underscore.js/1.6.0/underscore-min.jsm': true,
'resources/underscore.js/1.7.0/underscore-min.jsm': true,
'resources/underscore.js/1.8.0/underscore-min.jsm': true,
'resources/underscore.js/1.8.1/underscore-min.jsm': true,
'resources/underscore.js/1.8.2/underscore-min.jsm': true,
'resources/underscore.js/1.8.3/underscore-min.jsm': true,
// Web Font Loader
'resources/webfont/1.0.0/webfont.jsm': true,
'resources/webfont/1.0.1/webfont.jsm': true,
'resources/webfont/1.0.2/webfont.jsm': true,
'resources/webfont/1.0.3/webfont.jsm': true,
'resources/webfont/1.0.4/webfont.jsm': true,
'resources/webfont/1.0.5/webfont.jsm': true,
'resources/webfont/1.0.6/webfont.jsm': true,
'resources/webfont/1.0.9/webfont.jsm': true,
'resources/webfont/1.0.10/webfont.jsm': true,
'resources/webfont/1.0.11/webfont.jsm': true,
'resources/webfont/1.0.12/webfont.jsm': true,
'resources/webfont/1.0.13/webfont.jsm': true,
'resources/webfont/1.0.14/webfont.jsm': true,
'resources/webfont/1.0.15/webfont.jsm': true,
'resources/webfont/1.0.16/webfont.jsm': true,
'resources/webfont/1.0.17/webfont.jsm': true,
'resources/webfont/1.0.18/webfont.jsm': true,
'resources/webfont/1.0.19/webfont.jsm': true,
'resources/webfont/1.0.21/webfont.jsm': true,
'resources/webfont/1.0.22/webfont.jsm': true,
'resources/webfont/1.0.23/webfont.jsm': true,
'resources/webfont/1.0.24/webfont.jsm': true,
'resources/webfont/1.0.25/webfont.jsm': true,
'resources/webfont/1.0.26/webfont.jsm': true,
'resources/webfont/1.0.27/webfont.jsm': true,
'resources/webfont/1.0.28/webfont.jsm': true,
'resources/webfont/1.0.29/webfont.jsm': true,
'resources/webfont/1.0.30/webfont.jsm': true,
'resources/webfont/1.0.31/webfont.jsm': true,
'resources/webfont/1.1.0/webfont.jsm': true,
'resources/webfont/1.1.1/webfont.jsm': true,
'resources/webfont/1.1.2/webfont.jsm': true,
'resources/webfont/1.3.0/webfont.jsm': true,
'resources/webfont/1.4.2/webfont.jsm': true,
'resources/webfont/1.4.6/webfont.jsm': true,
'resources/webfont/1.4.7/webfont.jsm': true,
'resources/webfont/1.4.8/webfont.jsm': true,
'resources/webfont/1.4.10/webfont.jsm': true,
'resources/webfont/1.5.0/webfont.jsm': true,
'resources/webfont/1.5.2/webfont.jsm': true,
'resources/webfont/1.5.3/webfont.jsm': true,
'resources/webfont/1.5.6/webfont.jsm': true,
'resources/webfont/1.5.10/webfont.jsm': true,
'resources/webfont/1.5.18/webfont.jsm': true
};
const staging = {...stable, ...{
// AngularJS
'resources/angularjs/1.5.8/angular.min.jsm': true,
'resources/angularjs/1.6.1/angular.min.jsm': true,
'resources/angularjs/1.6.5/angular.min.jsm': true,
// Backbone.js
'resources/backbone.js/1.3.3/backbone-min.jsm': true,
'resources/backbone.js/1.4.0/backbone-min.jsm': true,
// jQuery
'resources/jquery/2.2.0/jquery.min.jsm': true,
'resources/jquery/2.2.1/jquery.min.jsm': true,
'resources/jquery/2.2.2/jquery.min.jsm': true,
'resources/jquery/2.2.3/jquery.min.jsm': true,
'resources/jquery/2.2.4/jquery.min.jsm': true,
'resources/jquery/3.0.0/jquery.min.jsm': true,
'resources/jquery/3.1.0/jquery.min.jsm': true,
'resources/jquery/3.1.1/jquery.min.jsm': true,
'resources/jquery/3.2.0/jquery.min.jsm': true,
'resources/jquery/3.2.1/jquery.min.jsm': true,
'resources/jquery/3.3.1/jquery.min.jsm': true,
'resources/jquery/3.4.0/jquery.min.jsm': true,
'resources/jquery/3.4.1/jquery.min.jsm': true,
'resources/jquery/3.5.0/jquery.min.jsm': true,
'resources/jquery/3.5.1/jquery.min.jsm': true,
'resources/jquery/3.6.0/jquery.min.jsm': true,
'resources/jquery/3.6.1/jquery.min.jsm': true,
'resources/jquery/3.6.4/jquery.min.jsm': true,
'resources/jquery/3.7.0/jquery.min.jsm': true,
'resources/jquery/3.7.1/jquery.min.jsm': true,
// Moment.js
'resources/moment.js/2.8.3/moment.min.jsm': true,
'resources/moment.js/2.8.4/moment.min.jsm': true,
'resources/moment.js/2.10.2/moment.min.jsm': true,
'resources/moment.js/2.10.3/moment.min.jsm': true,
'resources/moment.js/2.10.6/moment.min.jsm': true,
'resources/moment.js/2.11.1/moment.min.jsm': true,
'resources/moment.js/2.11.2/moment.min.jsm': true,
'resources/moment.js/2.17.0/moment.min.jsm': true,
'resources/moment.js/2.17.1/moment.min.jsm': true,
'resources/moment.js/2.18.1/moment.min.jsm': true,
'resources/moment.js/2.19.1/moment.min.jsm': true,
'resources/moment.js/2.19.2/moment.min.jsm': true,
'resources/moment.js/2.19.3/moment.min.jsm': true,
'resources/moment.js/2.20.1/moment.min.jsm': true,
'resources/moment.js/2.22.0/moment.min.jsm': true,
'resources/moment.js/2.22.1/moment.min.jsm': true,
'resources/moment.js/2.22.2/moment.min.jsm': true,
'resources/moment.js/2.24.0/moment.min.jsm': true,
'resources/moment.js/2.29.1/moment.min.jsm': true,
'resources/moment.js/2.29.4/moment.min.jsm': true,
// Underscore.js
'resources/underscore.js/1.9.0/underscore-min.jsm': true,
'resources/underscore.js/1.9.1/underscore-min.jsm': true,
'resources/underscore.js/1.13.4/underscore-min.jsm': true
}};
/**
* Exports
*/
export default {
stable,
staging
};
/**
* Resource Mappings
* Belongs to Decentraleyes.
*
* @author Thomas Rientjes
* @since 2014-05-30
* @license MPL 2.0
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
import ResourceSets from './sets.js';
/**
* Public Constants
*/
const mappings = {
// Google Hosted Libraries
'ajax.googleapis.com': {
'/ajax/libs/': {
'angularjs/{version}/angular.': ResourceSets.angular,
'dojo/{version}/dojo/dojo.': ResourceSets.dojo,
'ext-core/{version}/ext-core.': ResourceSets.extCore,
'ext-core/{version}/ext-core-debug.': ResourceSets.extCore,
'jquery/{version}/jquery.': ResourceSets.jQuery,
'jqueryui/{version}/jquery-ui.js': ResourceSets.jQueryUI,
'jqueryui/{version}/jquery-ui.min.js': ResourceSets.jQueryUI,
'mootools/{version}/mootools-yui-compressed.': ResourceSets.mootools,
'prototype/{version}/prototype.': ResourceSets.prototypeJS,
'scriptaculous/{version}/scriptaculous.': ResourceSets.scriptaculous,
'swfobject/{version}/swfobject.': ResourceSets.swfobject,
'webfont/{version}/webfont.': ResourceSets.webfont,
// Mapping Aliases [Deprecated]
'dojo/1/dojo/dojo.': {
'path': 'resources/dojo/1.6.1/dojo/dojo.jsm',
'type': 'application/javascript'
},
'jquery/1/jquery.': {
'path': 'resources/jquery/1.11.1/jquery.min.jsm',
'type': 'application/javascript'
},
'jqueryui/1/jquery-ui.js': {
'path': 'resources/jqueryui/1.10.4/jquery-ui.min.jsm',
'type': 'application/javascript'
},
'jqueryui/1/jquery-ui.min.js': {
'path': 'resources/jqueryui/1.10.4/jquery-ui.min.jsm',
'type': 'application/javascript'
},
'mootools/1/mootools-yui-compressed.': {
'path': 'resources/mootools/1.1.2/mootools-yui-compressed.jsm',
'type': 'application/javascript'
},
'prototype/1/prototype.': {
'path': 'resources/prototype/1.7.1.0/prototype.jsm',
'type': 'application/javascript'
},
'scriptaculous/1/scriptaculous.': {
'path': 'resources/scriptaculous/1.9.0/scriptaculous.jsm',
'type': 'application/javascript'
},
'swfobject/2/swfobject.': {
'path': 'resources/swfobject/2.2/swfobject.jsm',
'type': 'application/javascript'
},
'webfont/1/webfont.': {
'path': 'resources/webfont/1.5.18/webfont.jsm',
'type': 'application/javascript'
}
}
},
// Microsoft Ajax CDN
'ajax.aspnetcdn.com': {
'/ajax/': {
'jQuery/jquery-{version}.': ResourceSets.jQuery,
'jquery/jquery-{version}.': ResourceSets.jQuery,
'modernizr/modernizr-{version}.': ResourceSets.modernizr
}
},
// Microsoft Ajax CDN [Deprecated]
'ajax.microsoft.com': {
'/ajax/': {
'jQuery/jquery-{version}.': ResourceSets.jQuery,
'jquery/jquery-{version}.': ResourceSets.jQuery,
'modernizr/modernizr-{version}.': ResourceSets.modernizr
}
},
// CDNJS (Cloudflare)
'cdnjs.cloudflare.com': {
'/ajax/libs/': {
'angular.js/{version}/angular.': ResourceSets.angular,
'backbone.js/{version}/backbone.': ResourceSets.backbone,
'backbone.js/{version}/backbone-min.': ResourceSets.backbone,
'dojo/{version}/dojo.': ResourceSets.dojo,
'ember.js/{version}/ember.': ResourceSets.ember,
'ext-core/{version}/ext-core.': ResourceSets.extCore,
'jquery/{version}/jquery.': ResourceSets.jQuery,
'jqueryui/{version}/jquery-ui.js': ResourceSets.jQueryUI,
'jqueryui/{version}/jquery-ui.min.js': ResourceSets.jQueryUI,
'modernizr/{version}/modernizr.': ResourceSets.modernizr,
'moment.js/{version}/moment.': ResourceSets.moment,
'mootools/{version}/mootools-core': ResourceSets.mootools,
'scriptaculous/{version}/scriptaculous.': ResourceSets.scriptaculous,
'swfobject/{version}/swfobject.': ResourceSets.swfobject,
'underscore.js/{version}/underscore.': ResourceSets.underscore,
'underscore.js/{version}/underscore-min.': ResourceSets.underscore,
'webfont/{version}/webfont': ResourceSets.webfont
}
},
// jQuery CDN (Fastly)
'code.jquery.com': {
'/': {
'jquery-{version}.': ResourceSets.jQuery,
'ui/{version}/jquery-ui.js': ResourceSets.jQueryUI,
'ui/{version}/jquery-ui.min.js': ResourceSets.jQueryUI,
// Mapping Aliases [Deprecated]
'jquery-latest.': {
'path': 'resources/jquery/1.11.1/jquery.min.jsm',
'type': 'application/javascript'
},
'jquery.': {
'path': 'resources/jquery/1.11.1/jquery.min.jsm',
'type': 'application/javascript'
}
}
},
// jsDelivr (Cloudflare, Fastly)
'cdn.jsdelivr.net': {
'/': {
'angularjs/{version}/angular.': ResourceSets.angular,
'backbonejs/{version}/backbone.': ResourceSets.backbone,
'backbonejs/{version}/backbone-min.': ResourceSets.backbone,
'dojo/{version}/dojo.': ResourceSets.dojo,
'emberjs/{version}/ember.': ResourceSets.ember,
'jquery/{version}/jquery.': ResourceSets.jQuery,
'jquery.ui/{version}/jquery-ui.js': ResourceSets.jQueryUI,
'jquery.ui/{version}/jquery-ui.min.js': ResourceSets.jQueryUI,
'momentjs/{version}/moment.': ResourceSets.moment,
'mootools/{version}/mootools-': ResourceSets.mootools,
'swfobject/{version}/swfobject.': ResourceSets.swfobject,
'underscorejs/{version}/underscore.': ResourceSets.underscore,
'underscorejs/{version}/underscore-min.': ResourceSets.underscore,
'webfontloader/{version}/webfont': ResourceSets.webfont
}
},
// Yandex CDN
'yastatic.net': {
'/': {
'angularjs/{version}/angular.': ResourceSets.angular,
'backbone/{version}/backbone.': ResourceSets.backbone,
'backbone/{version}/backbone-min.': ResourceSets.backbone,
'dojo/{version}/dojo/dojo.': ResourceSets.dojo,
'ext-core/{version}/ext-core.': ResourceSets.extCore,
'jquery/{version}/jquery.': ResourceSets.jQuery,
'jquery-ui/{version}/jquery-ui.js': ResourceSets.jQueryUI,
'jquery-ui/{version}/jquery-ui.min.js': ResourceSets.jQueryUI,
'modernizr/{version}/modernizr.': ResourceSets.modernizr,
'momentjs/{version}/moment.': ResourceSets.moment,
'prototype/{version}/prototype.': ResourceSets.prototypeJS,
'scriptaculous/{version}/scriptaculous.': ResourceSets.scriptaculous,
'swfobject/{version}/swfobject.': ResourceSets.swfobject,
'underscore/{version}/underscore.': ResourceSets.underscore,
'underscore/{version}/underscore-min.': ResourceSets.underscore
}
},
// Yandex CDN [Deprecated]
'yandex.st': {
'/': {
'angularjs/{version}/angular.': ResourceSets.angular,
'backbone/{version}/backbone.': ResourceSets.backbone,
'backbone/{version}/backbone-min.': ResourceSets.backbone,
'dojo/{version}/dojo/dojo.': ResourceSets.dojo,
'ext-core/{version}/ext-core.': ResourceSets.extCore,
'jquery/{version}/jquery.': ResourceSets.jQuery,
'jquery-ui/{version}/jquery-ui.js': ResourceSets.jQueryUI,
'jquery-ui/{version}/jquery-ui.min.js': ResourceSets.jQueryUI,
'modernizr/{version}/modernizr.': ResourceSets.modernizr,
'momentjs/{version}/moment.': ResourceSets.moment,
'prototype/{version}/prototype.': ResourceSets.prototypeJS,
'scriptaculous/{version}/scriptaculous.': ResourceSets.scriptaculous,
'swfobject/{version}/swfobject.': ResourceSets.swfobject,
'underscore/{version}/underscore.': ResourceSets.underscore,
'underscore/{version}/underscore-min.': ResourceSets.underscore
}
},
// Baidu CDN
'apps.bdimg.com': {
'/libs/': {
'angular.js/{version}/angular.': ResourceSets.angular,
'backbone.js/{version}/backbone.': ResourceSets.backbone,
'backbone.js/{version}/backbone-min.': ResourceSets.backbone,
'dojo/{version}/dojo.': ResourceSets.dojo,
'ember.js/{version}/ember.': ResourceSets.ember,
'ext-core/{version}/ext-core.': ResourceSets.extCore,
'jquery/{version}/jquery.': ResourceSets.jQuery,
'jqueryui/{version}/jquery-ui.js': ResourceSets.jQueryUI,
'jqueryui/{version}/jquery-ui.min.js': ResourceSets.jQueryUI,
'moment/{version}/moment.': ResourceSets.moment,
'mootools/{version}/mootools-yui-compressed.': ResourceSets.mootools,
'prototype/{version}/prototype.': ResourceSets.prototypeJS,
'scriptaculous/{version}/scriptaculous.': ResourceSets.scriptaculous,
'swfobject/{version}/swfobject.': ResourceSets.swfobject,
'swfobject/{version}/swfobject_src.': ResourceSets.swfobject,
'underscore.js/{version}/underscore.': ResourceSets.underscore,
'underscore.js/{version}/underscore-min.': ResourceSets.underscore,
'webfont/{version}/webfont.': ResourceSets.webfont,
'webfont/{version}/webfont_debug.': ResourceSets.webfont
}
},
// Baidu CDN [Deprecated]
'libs.baidu.com': {
'/': {
'angular.js/{version}/angular.': ResourceSets.angular,
'backbone.js/{version}/backbone.': ResourceSets.backbone,
'backbone.js/{version}/backbone-min.': ResourceSets.backbone,
'dojo/{version}/dojo.': ResourceSets.dojo,
'ember.js/{version}/ember.': ResourceSets.ember,
'ext-core/{version}/ext-core.': ResourceSets.extCore,
'jquery/{version}/jquery.': ResourceSets.jQuery,
'jqueryui/{version}/jquery-ui.js': ResourceSets.jQueryUI,
'jqueryui/{version}/jquery-ui.min.js': ResourceSets.jQueryUI,
'moment/{version}/moment.': ResourceSets.moment,
'mootools/{version}/mootools-yui-compressed.': ResourceSets.mootools,
'prototype/{version}/prototype.': ResourceSets.prototypeJS,
'scriptaculous/{version}/scriptaculous.': ResourceSets.scriptaculous,
'swfobject/{version}/swfobject.': ResourceSets.swfobject,
'swfobject/{version}/swfobject_src.': ResourceSets.swfobject,
'underscore.js/{version}/underscore.': ResourceSets.underscore,
'underscore.js/{version}/underscore-min.': ResourceSets.underscore,
'webfont/{version}/webfont.': ResourceSets.webfont,
'webfont/{version}/webfont_debug.': ResourceSets.webfont
}
},
// Sina Public Resources
'lib.sinaapp.com': {
'/js/': {
'angular.js/angular-{version}/angular.': ResourceSets.angular,
'backbone/{version}/backbone.': ResourceSets.backbone,
'dojo/{version}/dojo.': ResourceSets.dojo,
'ext-core/{version}/ext-core.': ResourceSets.extCore,
'ext-core/{version}/ext-core-debug.': ResourceSets.extCore,
'jquery/{version}/jquery.': ResourceSets.jQuery,
'jquery-ui/{version}/jquery-ui.js': ResourceSets.jQueryUI,
'jquery-ui/{version}/jquery-ui.min.js': ResourceSets.jQueryUI,
'mootools/{version}/mootools.': ResourceSets.mootools,
'prototype/{version}/prototype.': ResourceSets.prototypeJS,
'scriptaculous/{version}/scriptaculous.': ResourceSets.scriptaculous,
'swfobject/{version}/swfobject.': ResourceSets.swfobject,
'underscore/{version}/underscore.': ResourceSets.underscore,
'underscore/{version}/underscore-min.': ResourceSets.underscore,
'webfont/{version}/webfont.': ResourceSets.webfont,
'webfont/{version}/webfont_debug.': ResourceSets.webfont
}
},
// UpYun Library
'upcdn.b0.upaiyun.com': {
'/libs/': {
'dojo/dojo-{version}.': ResourceSets.dojo,
'emberjs/emberjs-{version}.': ResourceSets.ember,
'jquery/jquery-{version}.': ResourceSets.jQuery,
'jqueryui/jquery.ui-{version}.js': ResourceSets.jQueryUI,
'jqueryui/jquery.ui-{version}.min.js': ResourceSets.jQueryUI,
'modernizr/modernizr-{version}.': ResourceSets.modernizr,
'mootoolscore/mootools.core-{version}.': ResourceSets.mootools
}
},
// Tencent Cloud CDN
'mat1.gtimg.com': {
'/libs/': {
'jquery/{version}/jquery.': ResourceSets.jQuery,
'jquery/jquery-{version}.': ResourceSets.jQuery
}
},
// BootCDN [Dissolved]
'cdn.bootcss.com': {
'/': {
'angular.js/{version}/angular.': ResourceSets.angular,
'backbone.js/{version}/backbone.': ResourceSets.backbone,
'backbone.js/{version}/backbone-min.': ResourceSets.backbone,
'dojo/{version}/dojo.': ResourceSets.dojo,
'ember.js/{version}/ember.': ResourceSets.ember,
'ext-core/{version}/ext-core.': ResourceSets.extCore,
'jquery/{version}/jquery.': ResourceSets.jQuery,
'jqueryui/{version}/jquery-ui.js': ResourceSets.jQueryUI,
'jqueryui/{version}/jquery-ui.min.js': ResourceSets.jQueryUI,
'modernizr/{version}/modernizr.': ResourceSets.modernizr,
'moment.js/{version}/moment.': ResourceSets.moment,
'mootools/{version}/mootools-yui-compressed.': ResourceSets.mootools,
'prototype/{version}/prototype.': ResourceSets.prototypeJS,
'scriptaculous/{version}/scriptaculous.': ResourceSets.scriptaculous,
'swfobject/{version}/swfobject.': ResourceSets.swfobject,
'underscore.js/{version}/underscore.': ResourceSets.underscore,
'underscore.js/{version}/underscore-min.': ResourceSets.underscore,
'webfont/{version}/webfontloader.': ResourceSets.webfont
}
}
};
/**
* Initializations
*/
// Geekzu Public Service [Mirror]
mappings['sdn.geekzu.org'] = {
'/ajax/ajax/libs/': mappings['ajax.googleapis.com']['/ajax/libs/']
};
// USTC Linux User Group [Mirror]
mappings['ajax.proxy.ustclug.org'] = mappings['ajax.googleapis.com'];
/**
* Exports
*/
export default mappings;
/**
* Resources
* Resource Sets
* Belongs to Decentraleyes.
*
* @author Thomas Rientjes
* @since 2014-05-30
* @since 2014-05-30 (originally "resources")
* @license MPL 2.0
*
* This Source Code Form is subject to the terms of the Mozilla Public
......@@ -11,82 +11,91 @@
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
'use strict';
/**
* Resources
* Public Constants
*/
var resources = {
const sets = {
// AngularJS
'angular': {
'path': 'resources/angularjs/{version}/angular.min.js.dec',
'path': 'resources/angularjs/{version}/angular.min.jsm',
'type': 'application/javascript'
},
// Backbone.js
'backbone': {
'path': 'resources/backbone.js/{version}/backbone-min.js.dec',
'path': 'resources/backbone.js/{version}/backbone-min.jsm',
'type': 'application/javascript'
},
// Dojo
'dojo': {
'path': 'resources/dojo/{version}/dojo/dojo.js.dec',
'path': 'resources/dojo/{version}/dojo/dojo.jsm',
'type': 'application/javascript'
},
// Ember.js
'ember': {
'path': 'resources/ember.js/{version}/ember.min.js.dec',
'path': 'resources/ember.js/{version}/ember.min.jsm',
'type': 'application/javascript'
},
// Ext Core
'extCore': {
'path': 'resources/ext-core/{version}/ext-core.js.dec',
'path': 'resources/ext-core/{version}/ext-core.jsm',
'type': 'application/javascript'
},
// jQuery
'jQuery': {
'path': 'resources/jquery/{version}/jquery.min.js.dec',
'path': 'resources/jquery/{version}/jquery.min.jsm',
'type': 'application/javascript'
},
// jQuery UI
'jQueryUI': {
'path': 'resources/jqueryui/{version}/jquery-ui.min.js.dec',
'path': 'resources/jqueryui/{version}/jquery-ui.min.jsm',
'type': 'application/javascript'
},
// Modernizr
'modernizr': {
'path': 'resources/modernizr/{version}/modernizr.min.js.dec',
'path': 'resources/modernizr/{version}/modernizr.min.jsm',
'type': 'application/javascript'
},
// Moment.js
'moment': {
'path': 'resources/moment.js/{version}/moment.min.jsm',
'type': 'application/javascript'
},
// MooTools
'mootools': {
'path': 'resources/mootools/{version}/mootools-yui-compressed.js.dec',
'path': 'resources/mootools/{version}/mootools-yui-compressed.jsm',
'type': 'application/javascript'
},
// Prototype
'prototypeJS': {
'path': 'resources/prototype/{version}/prototype.js.dec',
'path': 'resources/prototype/{version}/prototype.jsm',
'type': 'application/javascript'
},
// Scriptaculous
'scriptaculous': {
'path': 'resources/scriptaculous/{version}/scriptaculous.js.dec',
'path': 'resources/scriptaculous/{version}/scriptaculous.jsm',
'type': 'application/javascript'
},
// SWFObject
'swfobject': {
'path': 'resources/swfobject/{version}/swfobject.js.dec',
'path': 'resources/swfobject/{version}/swfobject.jsm',
'type': 'application/javascript'
},
// Underscore.js
'underscore': {
'path': 'resources/underscore.js/{version}/underscore-min.js.dec',
'path': 'resources/underscore.js/{version}/underscore-min.jsm',
'type': 'application/javascript'
},
// Web Font Loader
'webfont': {
'path': 'resources/webfont/{version}/webfont.js.dec',
'path': 'resources/webfont/{version}/webfont.jsm',
'type': 'application/javascript'
}
};
/**
* Exports
*/
export default sets;
/**
* Setting Defaults
* Belongs to Decentraleyes.
*
* @author Thomas Rientjes
* @since 2024-10-10
* @license MPL-2.0
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
import Constants from '../constants.js';
/**
* Public Constants
*/
const defaults = {
[Constants.Setting.BLOCK_MISSING]: false,
[Constants.Setting.DISABLE_PREFETCH]: true,
[Constants.Setting.ENFORCE_STAGING]: false,
[Constants.Setting.SHOW_ICON_BADGE]: true,
[Constants.Setting.SHOW_RELEASE_NOTES]: true,
[Constants.Setting.STRIP_METADATA]: true,
[Constants.Setting.WHITELISTED_DOMAINS]: {},
[Constants.Setting.XHR_TEST_DOMAIN]: Constants.Address.DECENTRALEYES
};
/**
* Exports
*/
export default defaults;
/**
* Global Constants
* Statistic Defaults
* Belongs to Decentraleyes.
*
* @author Thomas Rientjes
* @since 2017-10-27
* @license MPL 2.0
* @since 2024-10-10
* @license MPL-2.0
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
'use strict';
import Constants from '../constants.js';
/**
* Constants
* Public Constants
*/
const HOST_PREFIX = '*://';
const HOST_SUFFIX = '/*';
const HTTP_EXPRESSION = /^http?:\/\//;
const MAPPING_FILE_EXPRESSION = /\.map$/i;
const REQUEST_BLOCKING = 'blocking';
const REQUEST_HEADERS = 'requestHeaders';
const VALUE_SEPARATOR = ';';
const VERSION_EXPRESSION = /(?:\d{1,2}\.){1,3}\d{1,2}/;
const VERSION_PLACEHOLDER = '{version}';
const WEB_DOMAIN_EXPRESSION = /:\/\/(.[^/]+)(.*)/;
const WEB_PREFIX_LENGTH = 4;
const WEB_PREFIX_VALUE = 'www.';
const defaults = {
[Constants.Statistic.AMOUNT_INJECTED]: {
'value': 0, 'createdAt': new Date().toISOString()
},
[Constants.Statistic.AMOUNT_SANITIZED]: {
'value': 0, 'createdAt': new Date().toISOString()
},
[Constants.Statistic.AMOUNT_BLOCKED]: {
'value': 0, 'createdAt': new Date().toISOString()
}
};
/**
* Exports
*/
export default defaults;
/**
* Entry Point
* Belongs to Decentraleyes.
*
* @author Thomas Rientjes
* @since 2016-04-04
* @license MPL-2.0
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
import './core/request/interceptor.js';
import './core/request/sanitizer.js';
import './utilities/messenger.js';
/**
* Background Helpers
* Belongs to Decentraleyes.
*
* @author Thomas Rientjes
* @since 2017-10-26
* @license MPL 2.0
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
import Constants from '../data/constants.js';
import ResourceMappings from '../data/resource/mappings.js';
import Storage from '../core/storage.js';
/**
* Public Functions
*/
const normalizeDomain = (domain) => {
domain = domain.toLowerCase().trim().replace(/[^A-Za-z0-9.-]/g, '');
if (domain.startsWith(Constants.Address.WWW_PREFIX)) {
domain = domain.slice(Constants.Address.WWW_PREFIX.length);
}
return domain;
};
const domainIsWhitelisted = async (domain, whitelistedDomains = null) => {
if (domain !== null) {
if (! whitelistedDomains) {
whitelistedDomains = await Storage.getSetting(Constants.Setting.WHITELISTED_DOMAINS);
}
return Boolean(whitelistedDomains[domain]);
}
return false;
};
const updateWhitelistedDomains = async (whitelistedDomains) => {
await Storage.updateSetting(Constants.Setting.WHITELISTED_DOMAINS, whitelistedDomains);
};
const addDomainToWhitelist = async (domain) => {
const whitelistedDomains = await Storage.getSetting(Constants.Setting.WHITELISTED_DOMAINS);
whitelistedDomains[domain] = true;
await updateWhitelistedDomains(whitelistedDomains);
chrome.runtime.sendMessage({
'topic': 'domain:added-to-whitelist', 'value': whitelistedDomains
}, () => {
if (chrome.runtime.lastError) { /**/ }
});
};
const removeDomainFromWhitelist = async (domain) => {
const whitelistedDomains = await Storage.getSetting(Constants.Setting.WHITELISTED_DOMAINS);
delete whitelistedDomains[domain];
await updateWhitelistedDomains(whitelistedDomains);
chrome.runtime.sendMessage({
'topic': 'domain:removed-from-whitelist', 'value': whitelistedDomains
}, () => {
if (chrome.runtime.lastError) { /**/ }
});
};
const extractDomainFromUrl = (url, normalize = true) => {
let extractedDomain = null;
if (typeof url !== 'string') {
return null;
}
if (url.startsWith(Constants.Address.CHROME)) {
return null;
}
try {
extractedDomain = new URL(url).hostname;
} catch {
return null;
}
if (extractedDomain === '') {
return null;
}
if (normalize === true) {
extractedDomain = normalizeDomain(extractedDomain);
}
return extractedDomain;
};
const determineValidHosts = () => {
const validHosts = [];
for (const mapping of Object.keys(ResourceMappings)) {
const supportedHost = Constants.Address.ANY_PROTOCOL + mapping + Constants.Address.ANY_PATH;
validHosts.push(supportedHost);
}
return validHosts;
};
const setPrefetchDisabled = (disable) => {
if (disable === false) {
chrome.privacy.network.networkPredictionEnabled.clear({});
} else {
chrome.privacy.network.networkPredictionEnabled.set({'value': false});
}
};
const determineIconPaths = (type) => {
let sizes, iconPaths;
sizes = ['16', '18', '19', '32', '36', '38', '64'];
iconPaths = {};
for (const size of sizes) {
iconPaths[size] = chrome.runtime.getURL(`images/icons/action/${type}/${size}.png`);
}
return iconPaths;
};
/**
* Exports
*/
export default {
normalizeDomain,
domainIsWhitelisted,
updateWhitelistedDomains,
addDomainToWhitelist,
removeDomainFromWhitelist,
extractDomainFromUrl,
determineValidHosts,
setPrefetchDisabled,
determineIconPaths
};
/**
* Runtime Messenger
* Belongs to Decentraleyes.
*
* @author Thomas Rientjes
* @since 2018-05-28
* @license MPL 2.0
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
import Constants from '../data/constants.js';
import Helpers from '../utilities/helpers.js';
import Storage from '../core/storage.js';
/**
* Private Functions
*/
const _handleMessageReceived = (message, sender, sendResponse) => {
let topic, value;
topic = message.topic;
value = message.value;
if (topic === 'extension:is-initialized') {
sendResponse({'value': true});
return Constants.MessageResponse.SYNCHRONOUS;
}
if (topic === 'tab-context:get') {
Storage.getTabContext(value).then((tabContext) => {
sendResponse({'value': tabContext});
});
return Constants.MessageResponse.ASYNCHRONOUS;
}
if (topic === 'settings:get') {
Storage.getSettings(value?.concise).then((settings) => {
sendResponse({'value': settings});
});
return Constants.MessageResponse.ASYNCHRONOUS;
}
if (topic === 'setting:update') {
Storage.updateSetting(value.key, value.value).then(() => {
sendResponse({'value': true});
});
return Constants.MessageResponse.ASYNCHRONOUS;
}
if (topic === 'whitelisted-domains:update') {
Helpers.updateWhitelistedDomains(value).then(() => {
sendResponse({'value': true});
});
return Constants.MessageResponse.ASYNCHRONOUS;
}
if (topic === 'statistics:get-amount-injected') {
Storage.getStatistic(Constants.Statistic.AMOUNT_INJECTED).then((amountInjected) => {
sendResponse({'value': amountInjected});
});
return Constants.MessageResponse.ASYNCHRONOUS;
}
if (topic === 'domain:extract-from-url') {
sendResponse({'value': Helpers.extractDomainFromUrl(value)});
return Constants.MessageResponse.SYNCHRONOUS;
}
if (topic === 'domain:normalize') {
sendResponse({'value': Helpers.normalizeDomain(value)});
return Constants.MessageResponse.SYNCHRONOUS;
}
if (topic === 'domain:add-to-whitelist') {
Helpers.addDomainToWhitelist(value).then(() => {
sendResponse({'value': true});
});
return Constants.MessageResponse.ASYNCHRONOUS;
}
if (topic === 'domain:remove-from-whitelist') {
Helpers.removeDomainFromWhitelist(value).then(() => {
sendResponse({'value': true});
});
return Constants.MessageResponse.ASYNCHRONOUS;
}
if (topic === 'domain:is-whitelisted') {
Helpers.domainIsWhitelisted(value).then((domainIsWhitelisted) => {
sendResponse({'value': domainIsWhitelisted});
});
return Constants.MessageResponse.ASYNCHRONOUS;
}
};
/**
* Event Handlers
*/
chrome.runtime.onMessage.addListener(_handleMessageReceived);
/**
* Browser API Wrappers
* Belongs to Decentraleyes.
*
* @author Thomas Rientjes
* @since 2017-12-03
* @license MPL 2.0
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
/**
* Public Constants
*/
const action = {
setBadgeBackgroundColor (details) {
chrome.action.setBadgeBackgroundColor(details);
},
setBadgeText (details) {
chrome.action.setBadgeText(details);
},
setBadgeTextColor (details) {
if (chrome.action.setBadgeTextColor !== undefined) {
chrome.action.setBadgeTextColor(details);
}
},
setIcon (details) {
chrome.action.setIcon(details);
},
async setTitle (details) {
const platformInformation = await chrome.runtime.getPlatformInfo();
if (platformInformation.os !== chrome.runtime.PlatformOs.ANDROID) {
await chrome.action.setTitle(details);
}
}
};
/**
* Exports
*/
export default {
action
};
/**
* Files
* Belongs to Decentraleyes.
*
* @author Thomas Rientjes
* @since 2014-07-24
* @license MPL 2.0
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
'use strict';
/**
* Files
*/
var files = {
// AngularJS
'resources/angularjs/1.0.1/angular.min.js.dec': true,
'resources/angularjs/1.0.2/angular.min.js.dec': true,
'resources/angularjs/1.0.3/angular.min.js.dec': true,
'resources/angularjs/1.0.4/angular.min.js.dec': true,
'resources/angularjs/1.0.5/angular.min.js.dec': true,
'resources/angularjs/1.0.6/angular.min.js.dec': true,
'resources/angularjs/1.0.8/angular.min.js.dec': true,
'resources/angularjs/1.2.0/angular.min.js.dec': true,
'resources/angularjs/1.2.1/angular.min.js.dec': true,
'resources/angularjs/1.2.10/angular.min.js.dec': true,
'resources/angularjs/1.2.15/angular.min.js.dec': true,
'resources/angularjs/1.2.16/angular.min.js.dec': true,
'resources/angularjs/1.2.20/angular.min.js.dec': true,
'resources/angularjs/1.2.23/angular.min.js.dec': true,
'resources/angularjs/1.2.26/angular.min.js.dec': true,
'resources/angularjs/1.2.28/angular.min.js.dec': true,
'resources/angularjs/1.2.29/angular.min.js.dec': true,
'resources/angularjs/1.3.0/angular.min.js.dec': true,
'resources/angularjs/1.3.3/angular.min.js.dec': true,
'resources/angularjs/1.3.8/angular.min.js.dec': true,
'resources/angularjs/1.3.10/angular.min.js.dec': true,
'resources/angularjs/1.3.11/angular.min.js.dec': true,
'resources/angularjs/1.3.14/angular.min.js.dec': true,
'resources/angularjs/1.3.15/angular.min.js.dec': true,
'resources/angularjs/1.4.0/angular.min.js.dec': true,
'resources/angularjs/1.4.2/angular.min.js.dec': true,
'resources/angularjs/1.4.8/angular.min.js.dec': true,
// Backbone.js
'resources/backbone.js/0.9.0/backbone-min.js.dec': true,
'resources/backbone.js/0.9.1/backbone-min.js.dec': true,
'resources/backbone.js/0.9.2/backbone-min.js.dec': true,
'resources/backbone.js/0.9.9/backbone-min.js.dec': true,
'resources/backbone.js/0.9.10/backbone-min.js.dec': true,
'resources/backbone.js/1.0.0/backbone-min.js.dec': true,
'resources/backbone.js/1.1.0/backbone-min.js.dec': true,
'resources/backbone.js/1.1.1/backbone-min.js.dec': true,
'resources/backbone.js/1.1.2/backbone-min.js.dec': true,
'resources/backbone.js/1.2.0/backbone-min.js.dec': true,
'resources/backbone.js/1.2.1/backbone-min.js.dec': true,
'resources/backbone.js/1.2.2/backbone-min.js.dec': true,
'resources/backbone.js/1.2.3/backbone-min.js.dec': true,
// Dojo
'resources/dojo/1.4.1/dojo/dojo.js.dec': true,
'resources/dojo/1.4.5/dojo/dojo.js.dec': true,
'resources/dojo/1.5.0/dojo/dojo.js.dec': true,
'resources/dojo/1.6.1/dojo/dojo.js.dec': true,
'resources/dojo/1.7.5/dojo/dojo.js.dec': true,
'resources/dojo/1.8.3/dojo/dojo.js.dec': true,
'resources/dojo/1.8.7/dojo/dojo.js.dec': true,
'resources/dojo/1.8.9/dojo/dojo.js.dec': true,
'resources/dojo/1.9.1/dojo/dojo.js.dec': true,
'resources/dojo/1.9.3/dojo/dojo.js.dec': true,
'resources/dojo/1.9.7/dojo/dojo.js.dec': true,
'resources/dojo/1.10.4/dojo/dojo.js.dec': true,
// Ember.js
'resources/ember.js/1.0.1/ember.min.js.dec': true,
'resources/ember.js/1.1.3/ember.min.js.dec': true,
'resources/ember.js/1.2.2/ember.min.js.dec': true,
'resources/ember.js/1.3.2/ember.min.js.dec': true,
'resources/ember.js/1.4.0/ember.min.js.dec': true,
'resources/ember.js/1.5.1/ember.min.js.dec': true,
'resources/ember.js/2.0.0/ember.min.js.dec': true,
'resources/ember.js/2.0.2/ember.min.js.dec': true,
'resources/ember.js/2.1.0/ember.min.js.dec': true,
// Ext Core
'resources/ext-core/3.0.0/ext-core.js.dec': true,
'resources/ext-core/3.1.0/ext-core.js.dec': true,
// jQuery
'resources/jquery/1.2.3/jquery.min.js.dec': true,
'resources/jquery/1.2.6/jquery.min.js.dec': true,
'resources/jquery/1.3.0/jquery.min.js.dec': true,
'resources/jquery/1.3.1/jquery.min.js.dec': true,
'resources/jquery/1.3.2/jquery.min.js.dec': true,
'resources/jquery/1.4.0/jquery.min.js.dec': true,
'resources/jquery/1.4.1/jquery.min.js.dec': true,
'resources/jquery/1.4.2/jquery.min.js.dec': true,
'resources/jquery/1.4.3/jquery.min.js.dec': true,
'resources/jquery/1.4.4/jquery.min.js.dec': true,
'resources/jquery/1.5.0/jquery.min.js.dec': true,
'resources/jquery/1.5.1/jquery.min.js.dec': true,
'resources/jquery/1.5.2/jquery.min.js.dec': true,
'resources/jquery/1.6.0/jquery.min.js.dec': true,
'resources/jquery/1.6.1/jquery.min.js.dec': true,
'resources/jquery/1.6.2/jquery.min.js.dec': true,
'resources/jquery/1.6.3/jquery.min.js.dec': true,
'resources/jquery/1.6.4/jquery.min.js.dec': true,
'resources/jquery/1.7.0/jquery.min.js.dec': true,
'resources/jquery/1.7.1/jquery.min.js.dec': true,
'resources/jquery/1.7.2/jquery.min.js.dec': true,
'resources/jquery/1.8.0/jquery.min.js.dec': true,
'resources/jquery/1.8.1/jquery.min.js.dec': true,
'resources/jquery/1.8.2/jquery.min.js.dec': true,
'resources/jquery/1.8.3/jquery.min.js.dec': true,
'resources/jquery/1.9.0/jquery.min.js.dec': true,
'resources/jquery/1.9.1/jquery.min.js.dec': true,
'resources/jquery/1.10.0/jquery.min.js.dec': true,
'resources/jquery/1.10.1/jquery.min.js.dec': true,
'resources/jquery/1.10.2/jquery.min.js.dec': true,
'resources/jquery/1.11.0/jquery.min.js.dec': true,
'resources/jquery/1.11.1/jquery.min.js.dec': true,
'resources/jquery/1.11.2/jquery.min.js.dec': true,
'resources/jquery/1.11.3/jquery.min.js.dec': true,
'resources/jquery/1.12.0/jquery.min.js.dec': true,
'resources/jquery/1.12.1/jquery.min.js.dec': true,
'resources/jquery/1.12.2/jquery.min.js.dec': true,
'resources/jquery/1.12.3/jquery.min.js.dec': true,
'resources/jquery/1.12.4/jquery.min.js.dec': true,
'resources/jquery/2.0.0/jquery.min.js.dec': true,
'resources/jquery/2.0.1/jquery.min.js.dec': true,
'resources/jquery/2.0.2/jquery.min.js.dec': true,
'resources/jquery/2.0.3/jquery.min.js.dec': true,
'resources/jquery/2.1.0/jquery.min.js.dec': true,
'resources/jquery/2.1.1/jquery.min.js.dec': true,
'resources/jquery/2.1.3/jquery.min.js.dec': true,
'resources/jquery/2.1.4/jquery.min.js.dec': true,
// jQuery UI
'resources/jqueryui/1.5.3/jquery-ui.min.js.dec': true,
'resources/jqueryui/1.6.0/jquery-ui.min.js.dec': true,
'resources/jqueryui/1.7.3/jquery-ui.min.js.dec': true,
'resources/jqueryui/1.8.24/jquery-ui.min.js.dec': true,
'resources/jqueryui/1.9.2/jquery-ui.min.js.dec': true,
'resources/jqueryui/1.10.4/jquery-ui.min.js.dec': true,
'resources/jqueryui/1.11.0/jquery-ui.min.js.dec': true,
'resources/jqueryui/1.11.1/jquery-ui.min.js.dec': true,
'resources/jqueryui/1.11.2/jquery-ui.min.js.dec': true,
'resources/jqueryui/1.11.3/jquery-ui.min.js.dec': true,
'resources/jqueryui/1.11.4/jquery-ui.min.js.dec': true,
// Modernizr
'resources/modernizr/2.6.2/modernizr.min.js.dec': true,
'resources/modernizr/2.7.1/modernizr.min.js.dec': true,
'resources/modernizr/2.7.2/modernizr.min.js.dec': true,
'resources/modernizr/2.8.2/modernizr.min.js.dec': true,
'resources/modernizr/2.8.3/modernizr.min.js.dec': true,
// MooTools
'resources/mootools/1.1.1/mootools-yui-compressed.js.dec': true,
'resources/mootools/1.1.2/mootools-yui-compressed.js.dec': true,
'resources/mootools/1.2.1/mootools-yui-compressed.js.dec': true,
'resources/mootools/1.2.3/mootools-yui-compressed.js.dec': true,
'resources/mootools/1.2.4/mootools-yui-compressed.js.dec': true,
'resources/mootools/1.2.5/mootools-yui-compressed.js.dec': true,
'resources/mootools/1.3.0/mootools-yui-compressed.js.dec': true,
'resources/mootools/1.3.1/mootools-yui-compressed.js.dec': true,
'resources/mootools/1.3.2/mootools-yui-compressed.js.dec': true,
'resources/mootools/1.4.1/mootools-yui-compressed.js.dec': true,
'resources/mootools/1.4.5/mootools-yui-compressed.js.dec': true,
'resources/mootools/1.5.0/mootools-yui-compressed.js.dec': true,
'resources/mootools/1.5.1/mootools-yui-compressed.js.dec': true,
// Prototype
'resources/prototype/1.6.0.2/prototype.js.dec': true,
'resources/prototype/1.6.0.3/prototype.js.dec': true,
'resources/prototype/1.6.1.0/prototype.js.dec': true,
'resources/prototype/1.7.0.0/prototype.js.dec': true,
'resources/prototype/1.7.1.0/prototype.js.dec': true,
'resources/prototype/1.7.2.0/prototype.js.dec': true,
'resources/prototype/1.7.3.0/prototype.js.dec': true,
// Scriptaculous
'resources/scriptaculous/1.8.1/scriptaculous.js.dec': true,
'resources/scriptaculous/1.8.2/scriptaculous.js.dec': true,
'resources/scriptaculous/1.8.3/scriptaculous.js.dec': true,
'resources/scriptaculous/1.9.0/scriptaculous.js.dec': true,
// SWFObject
'resources/swfobject/2.1/swfobject.js.dec': true,
'resources/swfobject/2.2/swfobject.js.dec': true,
// Underscore.js
'resources/underscore.js/1.3.0/underscore-min.js.dec': true,
'resources/underscore.js/1.3.1/underscore-min.js.dec': true,
'resources/underscore.js/1.3.3/underscore-min.js.dec': true,
'resources/underscore.js/1.4.0/underscore-min.js.dec': true,
'resources/underscore.js/1.4.1/underscore-min.js.dec': true,
'resources/underscore.js/1.4.2/underscore-min.js.dec': true,
'resources/underscore.js/1.4.3/underscore-min.js.dec': true,
'resources/underscore.js/1.4.4/underscore-min.js.dec': true,
'resources/underscore.js/1.5.0/underscore-min.js.dec': true,
'resources/underscore.js/1.5.1/underscore-min.js.dec': true,
'resources/underscore.js/1.5.2/underscore-min.js.dec': true,
'resources/underscore.js/1.6.0/underscore-min.js.dec': true,
'resources/underscore.js/1.7.0/underscore-min.js.dec': true,
'resources/underscore.js/1.8.0/underscore-min.js.dec': true,
'resources/underscore.js/1.8.1/underscore-min.js.dec': true,
'resources/underscore.js/1.8.2/underscore-min.js.dec': true,
'resources/underscore.js/1.8.3/underscore-min.js.dec': true,
// Web Font Loader
'resources/webfont/1.0.0/webfont.js.dec': true,
'resources/webfont/1.0.1/webfont.js.dec': true,
'resources/webfont/1.0.2/webfont.js.dec': true,
'resources/webfont/1.0.3/webfont.js.dec': true,
'resources/webfont/1.0.4/webfont.js.dec': true,
'resources/webfont/1.0.5/webfont.js.dec': true,
'resources/webfont/1.0.6/webfont.js.dec': true,
'resources/webfont/1.0.9/webfont.js.dec': true,
'resources/webfont/1.0.10/webfont.js.dec': true,
'resources/webfont/1.0.11/webfont.js.dec': true,
'resources/webfont/1.0.12/webfont.js.dec': true,
'resources/webfont/1.0.13/webfont.js.dec': true,
'resources/webfont/1.0.14/webfont.js.dec': true,
'resources/webfont/1.0.15/webfont.js.dec': true,
'resources/webfont/1.0.16/webfont.js.dec': true,
'resources/webfont/1.0.17/webfont.js.dec': true,
'resources/webfont/1.0.18/webfont.js.dec': true,
'resources/webfont/1.0.19/webfont.js.dec': true,
'resources/webfont/1.0.21/webfont.js.dec': true,
'resources/webfont/1.0.22/webfont.js.dec': true,
'resources/webfont/1.0.23/webfont.js.dec': true,
'resources/webfont/1.0.24/webfont.js.dec': true,
'resources/webfont/1.0.25/webfont.js.dec': true,
'resources/webfont/1.0.26/webfont.js.dec': true,
'resources/webfont/1.0.27/webfont.js.dec': true,
'resources/webfont/1.0.28/webfont.js.dec': true,
'resources/webfont/1.0.29/webfont.js.dec': true,
'resources/webfont/1.0.30/webfont.js.dec': true,
'resources/webfont/1.0.31/webfont.js.dec': true,
'resources/webfont/1.1.0/webfont.js.dec': true,
'resources/webfont/1.1.1/webfont.js.dec': true,
'resources/webfont/1.1.2/webfont.js.dec': true,
'resources/webfont/1.3.0/webfont.js.dec': true,
'resources/webfont/1.4.2/webfont.js.dec': true,
'resources/webfont/1.4.6/webfont.js.dec': true,
'resources/webfont/1.4.7/webfont.js.dec': true,
'resources/webfont/1.4.8/webfont.js.dec': true,
'resources/webfont/1.4.10/webfont.js.dec': true,
'resources/webfont/1.5.0/webfont.js.dec': true,
'resources/webfont/1.5.2/webfont.js.dec': true,
'resources/webfont/1.5.3/webfont.js.dec': true,
'resources/webfont/1.5.6/webfont.js.dec': true,
'resources/webfont/1.5.10/webfont.js.dec': true,
'resources/webfont/1.5.18/webfont.js.dec': true
};
/**
* Interceptor
* Belongs to Decentraleyes.
*
* @author Thomas Rientjes
* @since 2016-04-06
* @license MPL 2.0
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
'use strict';
/**
* Interceptor
*/
var interceptor = {};
/**
* Public Methods
*/
interceptor.handleRequest = function (requestDetails, tabIdentifier, tab) {
let validCandidate, tabDomain, targetDetails, targetPath;
validCandidate = requestAnalyzer.isValidCandidate(requestDetails, tab);
if (!validCandidate) {
return {
'cancel': false
};
}
try {
tabDomain = tab.url.match(WEB_DOMAIN_EXPRESSION)[1];
tabDomain = requestAnalyzer._normalizeDomain(tabDomain);
} catch (exception) {
tabDomain = 'example.org';
}
// Temporary list of undetectable tainted domains.
let undetectableTaintedDomains = {
'cdnjs.com': true,
'dropbox.com': true,
'minigames.mail.ru': true,
'report-uri.io': true,
'securityheaders.io': true,
'stefansundin.github.io': true,
'udacity.com': true
};
if (undetectableTaintedDomains[tabDomain] || (/yandex\./).test(tabDomain)) {
if (tabDomain !== 'yandex.ru') {
return interceptor._handleMissingCandidate(requestDetails.url);
}
}
targetDetails = requestAnalyzer.getLocalTarget(requestDetails);
targetPath = targetDetails.path;
if (!targetPath) {
return interceptor._handleMissingCandidate(requestDetails.url);
}
if (!files[targetPath]) {
return interceptor._handleMissingCandidate(requestDetails.url);
}
stateManager.requests[requestDetails.requestId] = {
tabIdentifier, targetDetails
};
return {
'redirectUrl': chrome.extension.getURL(targetPath)
};
};
/**
* Private Methods
*/
interceptor._handleMissingCandidate = function (requestUrl) {
if (interceptor.blockMissing === true) {
return {
'cancel': true
};
}
if (requestUrl.match(HTTP_EXPRESSION)) {
let secureRequestUrl = requestUrl.replace(HTTP_EXPRESSION, 'https://');
return {
'redirectUrl': secureRequestUrl
};
} else {
return {
'cancel': false
};
}
};
interceptor._handleStorageChanged = function (changes) {
if ('blockMissing' in changes) {
interceptor.blockMissing = changes.blockMissing.newValue;
}
};
/**
* Initializations
*/
interceptor.amountInjected = 0;
interceptor.blockMissing = false;
chrome.storage.local.get(['amountInjected', 'blockMissing'], function (items) {
interceptor.amountInjected = items.amountInjected || 0;
interceptor.blockMissing = items.blockMissing || false;
});
/**
* Event Handlers
*/
chrome.storage.onChanged.addListener(interceptor._handleStorageChanged);
/**
* Entry Point
* Belongs to Decentraleyes.
*
* @author Thomas Rientjes
* @since 2016-04-04
* @license MPL-2.0
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
'use strict';
/**
* Main
*/
var main = {};
/**
* Private Methods
*/
main._initializeOptions = function () {
let optionDefaults = {
'showIconBadge': true,
'blockMissing': false,
'disablePrefetch': true,
'stripMetadata': true,
'whitelistedDomains': {}
};
chrome.storage.local.get(optionDefaults, function (options) {
if (options === null) {
options = optionDefaults;
}
if (options.disablePrefetch !== false) {
chrome.privacy.network.networkPredictionEnabled.set({
'value': false
});
}
chrome.storage.local.set(options);
});
};
main._showReleaseNotes = function (details) {
let location = chrome.extension.getURL('pages/welcome/welcome.html');
if (details.reason === 'install' || details.reason === 'update') {
if (details.temporary !== true) {
chrome.storage.local.get({
'showReleaseNotes': true
}, function (options) {
if (options.showReleaseNotes === true) {
chrome.tabs.create({
'url': location,
'active': false
});
}
});
}
}
};
/**
* Initializations
*/
chrome.runtime.onInstalled.addListener(main._showReleaseNotes);
main._initializeOptions();
chrome.runtime.getPlatformInfo(function (information) {
main.operatingSystem = information.os;
});
if (typeof chrome.browserAction.setBadgeBackgroundColor !== 'function') {
chrome.browserAction.setBadgeBackgroundColor = function () {};
chrome.browserAction.setBadgeText = function () {};
chrome.browserAction.onClicked.addListener(function () {
chrome.tabs.create({
'url': chrome.extension.getURL('pages/popup/popup.html'),
'active': false
});
});
}
chrome.browserAction.setBadgeBackgroundColor({
'color': [74, 130, 108, 255]
});
/**
* Mappings
* Belongs to Decentraleyes.
*
* @author Thomas Rientjes
* @since 2014-05-30
* @license MPL 2.0
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
'use strict';
/**
* Mappings
*/
var mappings = {
// Google Hosted Libraries
'ajax.googleapis.com': {
'/ajax/libs/': {
'angularjs/{version}/angular.': resources.angular,
'dojo/{version}/dojo/dojo.': resources.dojo,
'ext-core/{version}/ext-core.': resources.extCore,
'ext-core/{version}/ext-core-debug.': resources.extCore,
'jquery/{version}/jquery.': resources.jQuery,
'jqueryui/{version}/jquery-ui.js': resources.jQueryUI,
'jqueryui/{version}/jquery-ui.min.js': resources.jQueryUI,
'mootools/{version}/mootools-yui-compressed.': resources.mootools,
'prototype/{version}/prototype.': resources.prototypeJS,
'scriptaculous/{version}/scriptaculous.': resources.scriptaculous,
'swfobject/{version}/swfobject.': resources.swfobject,
'webfont/{version}/webfont.': resources.webfont,
// Common Shorthand Notations [Deprecated]
'dojo/1/dojo/dojo.': {
'path': 'resources/dojo/1.6.1/dojo/dojo.js.dec',
'type': 'application/javascript'
},
'jquery/1/jquery.': {
'path': 'resources/jquery/1.11.1/jquery.min.js.dec',
'type': 'application/javascript'
},
'jqueryui/1/jquery-ui.js': {
'path': 'resources/jqueryui/1.10.4/jquery-ui.min.js.dec',
'type': 'application/javascript'
},
'jqueryui/1/jquery-ui.min.js': {
'path': 'resources/jqueryui/1.10.4/jquery-ui.min.js.dec',
'type': 'application/javascript'
},
'mootools/1/mootools-yui-compressed.': {
'path': 'resources/mootools/1.1.2/mootools-yui-compressed.js.dec',
'type': 'application/javascript'
},
'prototype/1/prototype.': {
'path': 'resources/prototype/1.7.1.0/prototype.js.dec',
'type': 'application/javascript'
},
'scriptaculous/1/scriptaculous.': {
'path': 'resources/scriptaculous/1.9.0/scriptaculous.js.dec',
'type': 'application/javascript'
},
'swfobject/2/swfobject.': {
'path': 'resources/swfobject/2.2/swfobject.js.dec',
'type': 'application/javascript'
},
'webfont/1/webfont.': {
'path': 'resources/webfont/1.5.18/webfont.js.dec',
'type': 'application/javascript'
}
}
},
// Microsoft Ajax CDN
'ajax.aspnetcdn.com': {
'/ajax/': {
'jquery/jquery-{version}.': resources.jQuery,
'modernizr/modernizr-{version}.': resources.modernizr
}
},
// Microsoft Ajax CDN [Deprecated]
'ajax.microsoft.com': {
'/ajax/': {
'jquery/jquery-{version}.': resources.jQuery,
'modernizr/modernizr-{version}.': resources.modernizr
}
},
// CDNJS (Cloudflare)
'cdnjs.cloudflare.com': {
'/ajax/libs/': {
'angular.js/{version}/angular.': resources.angular,
'backbone.js/{version}/backbone.': resources.backbone,
'backbone.js/{version}/backbone-min.': resources.backbone,
'dojo/{version}/dojo.': resources.dojo,
'ember.js/{version}/ember.': resources.ember,
'ext-core/{version}/ext-core.': resources.extCore,
'jquery/{version}/jquery.': resources.jQuery,
'jqueryui/{version}/jquery-ui.js': resources.jQueryUI,
'jqueryui/{version}/jquery-ui.min.js': resources.jQueryUI,
'modernizr/{version}/modernizr.': resources.modernizr,
'mootools/{version}/mootools-core': resources.mootools,
'scriptaculous/{version}/scriptaculous.': resources.scriptaculous,
'swfobject/{version}/swfobject.': resources.swfobject,
'underscore.js/{version}/underscore.': resources.underscore,
'underscore.js/{version}/underscore-min.': resources.underscore,
'webfont/{version}/webfont': resources.webfont
}
},
// jQuery CDN (MaxCDN)
'code.jquery.com': {
'/': {
'jquery-{version}.': resources.jQuery,
'ui/{version}/jquery-ui.js': resources.jQueryUI,
'ui/{version}/jquery-ui.min.js': resources.jQueryUI,
// Common Shorthand Notations [Deprecated]
'jquery-latest.': {
'path': 'resources/jquery/1.11.1/jquery.min.js.dec',
'type': 'application/javascript'
},
'jquery.': {
'path': 'resources/jquery/1.11.1/jquery.min.js.dec',
'type': 'application/javascript'
},
'jquery-1.3.min.js': {
'path': 'resources/jquery/1.3.0/jquery.min.js.dec',
'type': 'application/javascript'
},
'jquery-1.3.js': {
'path': 'resources/jquery/1.3.0/jquery.min.js.dec',
'type': 'application/javascript'
},
'jquery-1.4.min.js': {
'path': 'resources/jquery/1.4.0/jquery.min.js.dec',
'type': 'application/javascript'
},
'jquery-1.4.js': {
'path': 'resources/jquery/1.4.0/jquery.min.js.dec',
'type': 'application/javascript'
},
'jquery-1.5.min.js': {
'path': 'resources/jquery/1.5.0/jquery.min.js.dec',
'type': 'application/javascript'
},
'jquery-1.5.js': {
'path': 'resources/jquery/1.5.0/jquery.min.js.dec',
'type': 'application/javascript'
},
'jquery-1.6.min.js': {
'path': 'resources/jquery/1.6.0/jquery.min.js.dec',
'type': 'application/javascript'
},
'jquery-1.6.js': {
'path': 'resources/jquery/1.6.0/jquery.min.js.dec',
'type': 'application/javascript'
},
'jquery-1.7.min.js': {
'path': 'resources/jquery/1.7.0/jquery.min.js.dec',
'type': 'application/javascript'
},
'jquery-1.7.js': {
'path': 'resources/jquery/1.7.0/jquery.min.js.dec',
'type': 'application/javascript'
}
}
},
// jsDelivr (MaxCDN)
'cdn.jsdelivr.net': {
'/': {
'angularjs/{version}/angular.': resources.angular,
'backbonejs/{version}/backbone.': resources.backbone,
'backbonejs/{version}/backbone-min.': resources.backbone,
'dojo/{version}/dojo.': resources.dojo,
'emberjs/{version}/ember.': resources.ember,
'jquery/{version}/jquery.': resources.jQuery,
'jquery.ui/{version}/jquery-ui.js': resources.jQueryUI,
'jquery.ui/{version}/jquery-ui.min.js': resources.jQueryUI,
'mootools/{version}/mootools-': resources.mootools,
'swfobject/{version}/swfobject.': resources.swfobject,
'underscorejs/{version}/underscore.': resources.underscore,
'underscorejs/{version}/underscore-min.': resources.underscore,
'webfontloader/{version}/webfont': resources.webfont
}
},
// Yandex CDN
'yastatic.net': {
'/': {
'angularjs/{version}/angular.': resources.angular,
'backbone/{version}/backbone.': resources.backbone,
'backbone/{version}/backbone-min.': resources.backbone,
'dojo/{version}/dojo/dojo.': resources.dojo,
'ext-core/{version}/ext-core.': resources.extCore,
'jquery/{version}/jquery.': resources.jQuery,
'jquery-ui/{version}/jquery-ui.js': resources.jQueryUI,
'jquery-ui/{version}/jquery-ui.min.js': resources.jQueryUI,
'modernizr/{version}/modernizr.': resources.modernizr,
'prototype/{version}/prototype.': resources.prototypeJS,
'scriptaculous/{version}/scriptaculous.': resources.scriptaculous,
'swfobject/{version}/swfobject.': resources.swfobject,
'underscore/{version}/underscore.': resources.underscore,
'underscore/{version}/underscore-min.': resources.underscore
}
},
// Yandex CDN [Deprecated]
'yandex.st': {
'/': {
'angularjs/{version}/angular.': resources.angular,
'backbone/{version}/backbone.': resources.backbone,
'backbone/{version}/backbone-min.': resources.backbone,
'dojo/{version}/dojo/dojo.': resources.dojo,
'ext-core/{version}/ext-core.': resources.extCore,
'jquery/{version}/jquery.': resources.jQuery,
'jquery-ui/{version}/jquery-ui.js': resources.jQueryUI,
'jquery-ui/{version}/jquery-ui.min.js': resources.jQueryUI,
'modernizr/{version}/modernizr.': resources.modernizr,
'prototype/{version}/prototype.': resources.prototypeJS,
'scriptaculous/{version}/scriptaculous.': resources.scriptaculous,
'swfobject/{version}/swfobject.': resources.swfobject,
'underscore/{version}/underscore.': resources.underscore,
'underscore/{version}/underscore-min.': resources.underscore
}
},
// Baidu CDN
'libs.baidu.com': {
'/': {
'backbone/{version}/backbone.': resources.backbone,
'backbone/{version}/backbone-min.': resources.backbone,
'dojo/{version}/dojo.': resources.dojo,
'ext-core/{version}/ext-core.': resources.extCore,
'jquery/{version}/jquery.': resources.jQuery,
'jqueryui/{version}/jquery-ui.js': resources.jQueryUI,
'jqueryui/{version}/jquery-ui.min.js': resources.jQueryUI,
'mootools/{version}/mootools-yui-compressed.': resources.mootools,
'prototype/{version}/prototype.': resources.prototypeJS,
'scriptaculous/{version}/scriptaculous.': resources.scriptaculous,
'swfobject/{version}/swfobject.': resources.swfobject,
'underscore/{version}/underscore.': resources.underscore,
'underscore/{version}/underscore-min.': resources.underscore,
'webfont/{version}/webfont.': resources.webfont,
'webfont/{version}/webfont_debug.': resources.webfont
}
},
// Sina Public Resources
'lib.sinaapp.com': {
'/js/': {
'angular.js/angular-{version}/angular.': resources.angular,
'backbone/{version}/backbone.': resources.backbone,
'dojo/{version}/dojo.': resources.dojo,
'ext-core/{version}/ext-core.': resources.extCore,
'ext-core/{version}/ext-core-debug.': resources.extCore,
'jquery/{version}/jquery.': resources.jQuery,
'jquery-ui/{version}/jquery-ui.js': resources.jQueryUI,
'jquery-ui/{version}/jquery-ui.min.js': resources.jQueryUI,
'mootools/{version}/mootools.': resources.mootools,
'prototype/{version}/prototype.': resources.prototypeJS,
'scriptaculous/{version}/scriptaculous.': resources.scriptaculous,
'swfobject/{version}/swfobject.': resources.swfobject,
'underscore/{version}/underscore.': resources.underscore,
'underscore/{version}/underscore-min.': resources.underscore,
'webfont/{version}/webfont.': resources.webfont,
'webfont/{version}/webfont_debug.': resources.webfont
}
},
// UpYun Library
'upcdn.b0.upaiyun.com': {
'/libs/': {
'dojo/dojo-{version}.': resources.dojo,
'emberjs/emberjs-{version}.': resources.ember,
'jquery/jquery-{version}.': resources.jQuery,
'jqueryui/jquery.ui-{version}.js': resources.jQueryUI,
'jqueryui/jquery.ui-{version}.min.js': resources.jQueryUI,
'modernizr/modernizr-{version}.': resources.modernizr,
'mootoolscore/mootools.core-{version}.': resources.mootools
}
}
};
/**
* Request Analyzer
* Belongs to Decentraleyes.
*
* @author Thomas Rientjes
* @since 2016-04-11
* @license MPL 2.0
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
'use strict';
/**
* Request Analyzer
*/
var requestAnalyzer = {};
/**
* Public Methods
*/
requestAnalyzer.isValidCandidate = function (requestDetails, tabDetails) {
let initiatorHost;
try {
initiatorHost = tabDetails.url.match(WEB_DOMAIN_EXPRESSION)[1];
} catch (exception) {
initiatorHost = 'example.org';
}
if (initiatorHost && requestAnalyzer.whitelistedDomains[requestAnalyzer._normalizeDomain(initiatorHost)]) {
return false;
}
// Only requests of type GET can be valid candidates.
return requestDetails.method === 'GET';
};
requestAnalyzer.getLocalTarget = function (requestDetails) {
let destinationHost, destinationPath, hostMappings, basePath, resourceMappings;
destinationHost = requestDetails.url.match(WEB_DOMAIN_EXPRESSION)[1];
destinationPath = requestDetails.url.match(WEB_DOMAIN_EXPRESSION)[2];
// Use the proper mappings for the targeted host.
hostMappings = mappings[destinationHost];
// Resource mapping files are never locally available.
if (MAPPING_FILE_EXPRESSION.test(destinationPath)) {
return false;
}
basePath = requestAnalyzer._matchBasePath(hostMappings, destinationPath);
resourceMappings = hostMappings[basePath];
if (!resourceMappings) {
return false;
}
// Return either the local target's path or false.
return requestAnalyzer._findLocalTarget(resourceMappings, basePath, destinationHost, destinationPath);
};
/**
* Private Methods
*/
requestAnalyzer._matchBasePath = function (hostMappings, channelPath) {
for (let basePath of Object.keys(hostMappings)) {
if (channelPath.startsWith(basePath)) {
return basePath;
}
}
return false;
};
requestAnalyzer._findLocalTarget = function (resourceMappings, basePath, channelHost, channelPath) {
let resourcePath, versionNumber, resourcePattern;
resourcePath = channelPath.replace(basePath, '');
versionNumber = resourcePath.match(VERSION_EXPRESSION);
resourcePattern = resourcePath.replace(versionNumber, VERSION_PLACEHOLDER);
for (let resourceMold of Object.keys(resourceMappings)) {
if (resourcePattern.startsWith(resourceMold)) {
let targetPath, version;
targetPath = resourceMappings[resourceMold].path;
targetPath = targetPath.replace(VERSION_PLACEHOLDER, versionNumber);
version = versionNumber && versionNumber[0] || targetPath.match(VERSION_EXPRESSION);
// Prepare and return a local target.
return {
'source': channelHost,
'version': version,
'path': targetPath
};
}
}
return false;
};
requestAnalyzer._applyWhitelistedDomains = function () {
chrome.storage.local.get('whitelistedDomains', function (items) {
requestAnalyzer.whitelistedDomains = items.whitelistedDomains || {};
});
};
requestAnalyzer._normalizeDomain = function (domain) {
domain = domain.toLowerCase().trim();
if (domain.startsWith(WEB_PREFIX_VALUE)) {
domain = domain.slice(WEB_PREFIX_LENGTH);
}
return domain;
};
/**
* Initializations
*/
requestAnalyzer.whitelistedDomains = {};
requestAnalyzer._applyWhitelistedDomains();
/**
* Event Handlers
*/
chrome.storage.onChanged.addListener(requestAnalyzer._applyWhitelistedDomains);