Compare commits

..

No commits in common. "761078bf19349be0479f92b0fb0c58e1dde40d34" and "3a8d0409960591da948310a7f262c36fdc472063" have entirely different histories.

6 changed files with 10 additions and 13 deletions

View File

@ -571,18 +571,16 @@
"alpha2": "KP", "alpha2": "KP",
"name": "North Korea" "name": "North Korea"
}, },
{
"file": "e7d0.png",
"code": "KQ"
},
{ {
"file": "38dd.png", "file": "38dd.png",
"code": 410, "code": 410,
"alpha2": "KR", "alpha2": "KR",
"name": "South Korea" "name": "South Korea"
}, },
{
"file": "cd37.png",
"code": 414,
"alpha2": "KW",
"name": "Kuwait"
},
{ {
"file": "4ace.png", "file": "4ace.png",
"code": 398, "code": 398,

View File

@ -35,11 +35,10 @@ async function init() {
const countryImgs = await fs.readdir(`./assets/${type}`); const countryImgs = await fs.readdir(`./assets/${type}`);
const countriesByCode = Object.fromEntries(data[type].map((country) => [country.alpha2, country])); const countriesByCode = Object.fromEntries(data[type].map((country) => [country.alpha2, country]));
const imgCountries = await Promise.all(countryImgs.filter((file) => !['encoded', 'disabled'].includes(file)).map(async (file) => { const imgCountries = await Promise.all(countryImgs.map(async (file) => {
const code = file.match(/(\w+).png/)?.[1]; const code = file.match(/(\w+).png/)?.[1];
if (!code || !countriesByCode[code]) { if (!code || !countriesByCode[code]) {
console.warn(`No country for ${file} with code ${code}`);
return null; return null;
} }
@ -52,9 +51,9 @@ async function init() {
code, code,
...countriesByCode[code], ...countriesByCode[code],
}; };
})); }).filter(Boolean));
await fs.writeFile(`./assets/${type}-curated.json`, JSON.stringify(imgCountries.filter(Boolean), null, 4)); await fs.writeFile(`./assets/${type}-curated.json`, JSON.stringify(imgCountries, null, 4));
console.log('Done!'); console.log('Done!');
} }

View File

Before

Width:  |  Height:  |  Size: 341 KiB

After

Width:  |  Height:  |  Size: 341 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 341 KiB

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{ {
"name": "schat2-clive", "name": "schat2-clive",
"version": "1.23.1", "version": "1.23.0",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "schat2-clive", "name": "schat2-clive",
"version": "1.23.1", "version": "1.23.0",
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"bhttp": "^1.2.8", "bhttp": "^1.2.8",

View File

@ -1,6 +1,6 @@
{ {
"name": "schat2-clive", "name": "schat2-clive",
"version": "1.23.1", "version": "1.23.0",
"description": "Game host for SChat 2-powered chat sites", "description": "Game host for SChat 2-powered chat sites",
"main": "src/app.js", "main": "src/app.js",
"scripts": { "scripts": {