Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

anytv-i18n

Package Overview
Dependencies
Maintainers
3
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

anytv-i18n - npm Package Compare versions

Comparing version 2.1.2 to 2.2.0

translations/.gitkeep

48

index.js

@@ -233,2 +233,5 @@ 'use strict';

this.locale_folder = path__default['default'].resolve(this.config.get('locale_dir'));
this.metadata_file = this.locale_folder + '/meta.json';
this.ensure_dir_existence(this.locale_folder);

@@ -345,10 +348,39 @@

this.debug('getting languages');
const service_version = this.config.get('service_version');
const response = await axios__default['default'].get(this.languages_url);
let meta = {};
const languages = response.data;
try {
// force download
if (process.env.REFRESH_TRANSLATIONS) {
throw new Error('force-refresh');
}
this.languages = languages.data.languages;
// load languages and version from meta.json
meta = JSON.parse(
await fs_promises.readFile(this.metadata_file)
);
// redownload on version mismatch
if (meta.version !== service_version) {
throw new Error('version-mismatch');
}
/**
* Since we have a valid updated meta.json, we'll assume the
* previous download was successful
*/
return;
}
catch (error) {
// download from server on error or REFRESH_TRANSLATIONS
const response = await axios__default['default'].get(this.languages_url);
meta = response.data.data;
}
meta.version = service_version;
this.languages = meta.languages;
let default_lang = this.config.get('default');

@@ -361,3 +393,3 @@

return new Promise(resolve => {
await new Promise(resolve => {
async__default['default'].each(

@@ -369,2 +401,8 @@ this.languages,

});
// save meta.json
await fs_promises.writeFile(
this.metadata_file,
JSON.stringify(meta)
);
}

@@ -371,0 +409,0 @@

2

package.json
{
"name": "anytv-i18n",
"version": "2.1.2",
"version": "2.2.0",
"description": "A module for globalization",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc