Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
case "zh_CN":
opts.text = SCRIPT_INFO["name-CN"] + " 从 v" + myOldVersion + " 升级到 v" + scriptInfo.version + "。";
opts.text += upgradeNotification.text.zh_CN;
break;
default:
opts.text = SCRIPT_INFO.name + " is upgraded from v" + myOldVersion + " to v" + scriptInfo.version + ". ";
opts.text += upgradeNotification.text.en_US;
break;
}
GM.notification(opts);
}
}
}
if (compareVersions(myOldVersion, scriptInfo.version) !== 0) {
prefs.factoryCheck = true;
// preSPinit.push(jsonRuleLoader.updateRule(true)); // rule is always updated after upgrade
preSPinit.push(GM.setValue("version", scriptInfo.version));
logger.info(`[UpdateCheck] version is updated ${myOldVersion} => ${scriptInfo.version}`);
}
let forceJsonUpdate = false;
if (prefs.factoryCheck === true || prefs.factoryCheck === undefined) {
const hasDifferent = assignDifferentProperty(prefs, prefsFactory);
if (hasDifferent) {
logger.info("[UpdateCheck] prefs is updated", prefs);
}
prefs.factoryCheck = false;
preSPinit.push(GM.setValue("prefs", prefs));
if (compareVersions(myOldVersion, scriptInfo.rewriteStorage) === -1) {
preSPinit.push(GM.setValue("SITEINFO_D", SITEINFO_D));
if (compareVersions(myOldVersion, scriptInfo.rewriteStorage) === -1) {
if (_.isString(prefs)) prefs = JSON.parse(prefs);
if (_.isString(SITEINFO_D)) SITEINFO_D = JSON.parse(SITEINFO_D);
if (_.isString(autoMatch)) autoMatch = JSON.parse(autoMatch);
}
if (typeof prefs.debug !== "undefined") {
logger.setLevel(prefs.debug ? "debug" : "info");
}
let jsonRule = jsonRuleLoader.getRule();
const preSPinit = [];
// check the consistency of script settings
if (compareVersions(myOldVersion, scriptInfo.version) < 0) {
// update rule if the script is upgraded or it is installed for the first time
if (upgradeNotification) {
if (upgradeNotification.show(myOldVersion, scriptInfo.version) || compareVersions(myOldVersion, "1.0.0") === 0) {
const opts = {
text: "",
title: upgradeNotification.title,
image: upgradeNotification.image,
onload: upgradeNotification.onload
};
switch (i8n()) {
case "zh_CN":
opts.text = SCRIPT_INFO["name-CN"] + " 从 v" + myOldVersion + " 升级到 v" + scriptInfo.version + "。";
opts.text += upgradeNotification.text.zh_CN;
break;
default:
opts.text = SCRIPT_INFO.name + " is upgraded from v" + myOldVersion + " to v" + scriptInfo.version + ". ";
opts.text += upgradeNotification.text.en_US;
break;
(function() {
logger.setLevel("debug");
// use charset from currentDocument
const gotConfig = {
html: true,
encoding: document.characterSet
};
logger.debug(`Script Manager: ${SCRIPT_MANAGER.name} v${SCRIPT_MANAGER.version}`);
logger.debug("Browser: ", BROWSER);
if (BROWSER.name === "firefox") {
if ((SCRIPT_MANAGER.name === "Violentmonkey" && compareVersions(SCRIPT_MANAGER.version, "2.12.3") <= 0) || SCRIPT_MANAGER.name === "Tampermonkey") {
// `options.cookie`, dirty fix for TM and VM on Firefox
// TODO: remove when TM releases new version
logger.warn(`${SCRIPT_MANAGER.name} v${SCRIPT_MANAGER.version} has a flaw on Firefox, which may affect this script`);
logger.warn("Check https://github.com/Tampermonkey/tampermonkey/issues/786 and https://github.com/violentmonkey/violentmonkey/issues/606 to learn more");
gotConfig.cookie = true;
}
}
const got = gotStock.create(gotConfig);
const scriptInfo = SCRIPT_INFO;
const upgradeNotification = NOTIFICATION;
// ----------------------------------
// all rules
let SSRules = [];
// ----------------------------------
export function parseFile(
fileData,
{ templateName, packageName, app, rnVersion }
) {
let kotlinPackage;
let javaPackage;
// TODO: figure out a better way to handle one off breaking changes
if (rnVersion && compareVersions(rnVersion, "0.47.2") < 0) {
kotlinPackage = `
override fun createJSModules(): List> {
return emptyList()
}
`;
javaPackage = `
@Override
public List> createJSModules() {
return Collections.emptyList();
}
`;
} else {
kotlinPackage = "";
let info = {};
// workaround for https://github.com/Fyrd/caniuse/issues/1939
let useSingleVersionWorkaround = Object.keys(browserVersions).length === 1;
for (let version of Object.keys(browserVersions)) {
let flag = CaniuseReport.$normalizeSupportFlag(browserVersions[version]);
// collect total share values
info[flag] = info[flag] || {min: version, max: version, share: 0};
info[flag].share += versionsUsage[version] || (useSingleVersionWorkaround && versionsUsage['0']) || 0;
// find min and max version with given support flag
if (compareVersions(info[flag].min, version) === 1) {
info[flag].min = version;
} else if (compareVersions(info[flag].max, version) === -1) {
info[flag].max = version;
}
}
return {
browserKey,
browserName: BROWSERS[browserKey] || capitalizeFirst(browserKey),
noSupport: info.n || {},
partialSupport: info.p || {},
hasSupport: info.y || {}
};
}
latestVersion('insales-uploader').then(version => {
let pkgDiff = compareVersions(version, pkg.version);
if (pkgDiff <= 0) {
resolve();
}else{
console.log( log_edit('Внимание! Доступна новая версия insales-uploader ') + `=> ${version}`);
console.log( log_notice('Список изменений доступен по ссылке: ') + 'https://github.com/VladimirIvanin/insales-uploader/blob/master/CHANGELOG.md' );
resolve();
}
}).catch(() => {
resolve();
export function parseInputSpec(inputSpec, onWarning) {
let spec = { ...inputSpec };
if (!spec.$schema) {
onWarning(`The input spec does not specify a "$schema", defaulting to "${DEFAULT_SCHEMA}"`);
spec.$schema = DEFAULT_SCHEMA;
}
const schema = schemaParser(spec.$schema);
const isVegaLite = schema.library === 'vega-lite';
const libVersion = isVegaLite ? vegaLite.version : vega.version;
if (versionCompare(schema.version, libVersion) > 0) {
onWarning(
`The input spec uses "${schema.library}" ${schema.version}, but ` +
`current version of "${schema.library}" is ${libVersion}.`
);
}
const hostConfig = spec._hostConfig;
if (hostConfig !== undefined) {
delete spec.hostConfig;
if (typeof hostConfig !== 'object') {
throw new Error('_hostConfig must be an object');
}
}
const hideWarnings = hostConfig && !!hostConfig.hideWarnings;
if (hideWarnings) {
const sortedVersions = Object.entries(versionTree).sort(([a], [b]) => compareVersions(b, a));
_parseSchema() {
if (!this.spec.$schema) {
this._onWarning(i18n.translate('visTypeVega.vegaParser.inputSpecDoesNotSpecifySchemaWarningMessage', {
defaultMessage: 'The input spec does not specify a {schemaParam}, defaulting to {defaultSchema}',
values: { defaultSchema: `"${DEFAULT_SCHEMA}"`, schemaParam: '"$schema"' },
}));
this.spec.$schema = DEFAULT_SCHEMA;
}
const schema = schemaParser(this.spec.$schema);
const isVegaLite = schema.library === 'vega-lite';
const libVersion = isVegaLite ? vegaLite.version : vega.version;
if (versionCompare(schema.version, libVersion) > 0) {
this._onWarning(i18n.translate('visTypeVega.vegaParser.notValidLibraryVersionForInputSpecWarningMessage', {
defaultMessage: 'The input spec uses {schemaLibrary} {schemaVersion}, but current version of {schemaLibrary} is {libraryVersion}.',
values: {
schemaLibrary: schema.library,
schemaVersion: schema.version,
libraryVersion: libVersion,
},
}));
}
return isVegaLite;
}
if (now - lastCheck < 86400000) {
return;
}
const uri = 'https://api.github.com/repos/kiibohd/configurator/releases/latest';
const response = await fetch(uri, {
method: 'GET',
headers: {
'User-Agent': 'Kiibohd Configurator',
Accept: 'application/json; charset=utf-8'
}
}).then(r => r.json());
const version = electron.remote.app.getVersion();
const latest = response.tag_name;
const newerAvail = compareVersions(latest, version) > 0;
updateNewerVersionAvail(newerAvail);
if (newerAvail) {
return {
version: latest,
url: response.html_url
};
}
}