1
0
mirror of https://codeberg.org/nobody/LocalCDN.git synced 2024-12-23 00:25:15 +01:00

Implemented: Import validation (#109)

This commit is contained in:
nobody 2020-09-25 16:15:50 +02:00
parent 7381d7c4f1
commit e9fd82a416
No known key found for this signature in database
GPG Key ID: 8F6DE3D614FCFD7A
2 changed files with 9 additions and 2 deletions

View File

@ -102,7 +102,9 @@ const SettingDefaults = {
[Setting.STORAGE_TYPE]: 'local',
[Setting.STRIP_METADATA]: true,
[Setting.WHITELISTED_DOMAINS]: {},
[Setting.XHR_TEST_DOMAIN]: Address.LOCALCDN
[Setting.XHR_TEST_DOMAIN]: Address.LOCALCDN,
[Setting.BADGE_COLOR]: '#4A826C',
[Setting.BADGE_TEXT_COLOR]: '#FFFFFF'
};
const WebRequest = {

View File

@ -69,7 +69,9 @@ storageManager.migrateData = function (target) {
[Setting.SHOW_ICON_BADGE]: data.showIconBadge,
[Setting.STRIP_METADATA]: data.stripMetadata,
[Setting.WHITELISTED_DOMAINS]: data.whitelistedDomains,
[Setting.XHR_TEST_DOMAIN]: data.xhrTestDomain
[Setting.XHR_TEST_DOMAIN]: data.xhrTestDomain,
[Setting.BADGE_COLOR]: data.badgeColor,
[Setting.BADGE_TEXT_COLOR]: data.badgeTextColor
});
});
};
@ -212,8 +214,11 @@ storageManager._validateDomainsAndStatistics = function (type, obj) {
};
storageManager._validateStrings = function (value) {
console.log(value);
if (/((2[0-9])[0-9]{2})-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])/.test(value)) {
return value;
} else if (/#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})/.test(value)) {
return value;
} else if (value === 'Default' || value === 'Light' || value === 'Grey') {
return value;
} else if (value === 'local' || value === 'sync') {