From 0f0e3de9353c06dfaabc00682b4c2fd9c5f48924 Mon Sep 17 00:00:00 2001 From: Minteck <46352972+Minteck@users.noreply.github.com> Date: Wed, 14 Jul 2021 01:12:14 +0200 Subject: Kartik Fox Nest! --- nest/abi.js | 86 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 nest/abi.js (limited to 'nest') diff --git a/nest/abi.js b/nest/abi.js new file mode 100644 index 0000000..b72f964 --- /dev/null +++ b/nest/abi.js @@ -0,0 +1,86 @@ +const fs = require('fs'); +var zlib = require('zlib'); + +module.exports = { + export(file, obj) { + fs.writeFileSync(file, zlib.deflateSync(Buffer.from(Buffer.from(JSON.stringify(obj)).toString("base64")).toString("base64"))) + }, + + load(file) { + data = fs.readFileSync(file) + uncomp = zlib.inflateSync(data); + + b1 = Buffer.from(uncomp, "base64").toString("utf-8"); + b2 = Buffer.from(b1, "base64").toString("utf-8"); + + item = Buffer.from(b2, "base64").toString("utf-8"); + decoded = JSON.parse(item); + + return decoded; + }, + + async generate(file) { + o = { + "_version": "", + "stats": { + "times": { + "single": 0, + "local": 0, + "online": 0 + }, + "results": { + "wins": 0, + "loses": 0 + }, + "ingame": { + "walls": 0, + "laps": 0, + "turns": 0 + } + }, + "auth": null, + "config": { + "lang": null, + "music": true, + "online": true, + "voice": false + } + } + + slpm = require('os-locale'); + slpw = await slpm(); + slpo = slpw.substr(0, 2); + slng = require('../lang/languages.json'); + if (Object.keys(slng).includes(slpo)) { + dlp = slpo; + } else { + dlp = "en"; + } + + o.config.lang = dlp; + + this.export(file, o); + }, + + convert(file, dotkartik) { + if (fs.existsSync(dotkartik + "/authentication.json")) { + auth = JSON.parse(fs.readFileSync(dotkartik + "/authentication.json")); + } else { + auth = null; + } + + o = { + "_version": "", + "stats": JSON.parse(fs.readFileSync(dotkartik + "/stats.json").toString()), + "auth": auth, + "config": { + "lang": fs.readFileSync(dotkartik + "/config/lang.txt").toString().trim(), + "music": fs.readFileSync(dotkartik + "/config/music.txt").toString().trim() === "1", + "online": fs.readFileSync(dotkartik + "/config/online.txt").toString().trim() === "1", + "voice": fs.readFileSync(dotkartik + "/config/voice.txt").toString().trim() === "1" + } + } + + this.export(file, o); + } +} \ No newline at end of file -- cgit From 44210691ee8444509ac466a362337af77f2bcd49 Mon Sep 17 00:00:00 2001 From: Minteck <46352972+Minteck@users.noreply.github.com> Date: Tue, 20 Jul 2021 01:30:23 +0200 Subject: Commit --- nest/abi.js | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) (limited to 'nest') diff --git a/nest/abi.js b/nest/abi.js index b72f964..5945705 100644 --- a/nest/abi.js +++ b/nest/abi.js @@ -1,6 +1,8 @@ const fs = require('fs'); var zlib = require('zlib'); +console.log("\n\nKartik Fox Nest, a compressed and simple data storage for Kartik.\n(c) Minteck, All Rights Reserved\n\n") + module.exports = { export(file, obj) { fs.writeFileSync(file, zlib.deflateSync(Buffer.from(Buffer.from(JSON.stringify(obj)).toString("base64")).toString("base64"))) @@ -19,7 +21,7 @@ module.exports = { return decoded; }, - async generate(file) { + generate(file) { o = { "_version": "", "stats": { @@ -40,25 +42,13 @@ module.exports = { }, "auth": null, "config": { - "lang": null, + "lang": "en", "music": true, "online": true, "voice": false } } - slpm = require('os-locale'); - slpw = await slpm(); - slpo = slpw.substr(0, 2); - slng = require('../lang/languages.json'); - if (Object.keys(slng).includes(slpo)) { - dlp = slpo; - } else { - dlp = "en"; - } - - o.config.lang = dlp; - this.export(file, o); }, -- cgit From d5a620cf09b835db2bccd99556525c90b458719f Mon Sep 17 00:00:00 2001 From: Minteck Date: Thu, 5 Aug 2021 17:21:23 +0200 Subject: i18n for 21.08 --- nest/abi.js | 150 ++++++++++++++++++++++++++++++------------------------------ 1 file changed, 75 insertions(+), 75 deletions(-) (limited to 'nest') diff --git a/nest/abi.js b/nest/abi.js index 5945705..e3396dc 100644 --- a/nest/abi.js +++ b/nest/abi.js @@ -1,76 +1,76 @@ -const fs = require('fs'); -var zlib = require('zlib'); - -console.log("\n\nKartik Fox Nest, a compressed and simple data storage for Kartik.\n(c) Minteck, All Rights Reserved\n\n") - -module.exports = { - export(file, obj) { - fs.writeFileSync(file, zlib.deflateSync(Buffer.from(Buffer.from(JSON.stringify(obj)).toString("base64")).toString("base64"))) - }, - - load(file) { - data = fs.readFileSync(file) - uncomp = zlib.inflateSync(data); - - b1 = Buffer.from(uncomp, "base64").toString("utf-8"); - b2 = Buffer.from(b1, "base64").toString("utf-8"); - - item = Buffer.from(b2, "base64").toString("utf-8"); - decoded = JSON.parse(item); - - return decoded; - }, - - generate(file) { - o = { - "_version": "", - "stats": { - "times": { - "single": 0, - "local": 0, - "online": 0 - }, - "results": { - "wins": 0, - "loses": 0 - }, - "ingame": { - "walls": 0, - "laps": 0, - "turns": 0 - } - }, - "auth": null, - "config": { - "lang": "en", - "music": true, - "online": true, - "voice": false - } - } - - this.export(file, o); - }, - - convert(file, dotkartik) { - if (fs.existsSync(dotkartik + "/authentication.json")) { - auth = JSON.parse(fs.readFileSync(dotkartik + "/authentication.json")); - } else { - auth = null; - } - - o = { - "_version": "", - "stats": JSON.parse(fs.readFileSync(dotkartik + "/stats.json").toString()), - "auth": auth, - "config": { - "lang": fs.readFileSync(dotkartik + "/config/lang.txt").toString().trim(), - "music": fs.readFileSync(dotkartik + "/config/music.txt").toString().trim() === "1", - "online": fs.readFileSync(dotkartik + "/config/online.txt").toString().trim() === "1", - "voice": fs.readFileSync(dotkartik + "/config/voice.txt").toString().trim() === "1" - } - } - - this.export(file, o); - } +const fs = require('fs'); +var zlib = require('zlib'); + +console.log("\n\nKartik Fox Nest, a compressed and simple data storage for Kartik.\n(c) Minteck, All Rights Reserved\n\n") + +module.exports = { + export(file, obj) { + fs.writeFileSync(file, zlib.deflateSync(Buffer.from(Buffer.from(JSON.stringify(obj)).toString("base64")).toString("base64"))) + }, + + load(file) { + data = fs.readFileSync(file) + uncomp = zlib.inflateSync(data); + + b1 = Buffer.from(uncomp, "base64").toString("utf-8"); + b2 = Buffer.from(b1, "base64").toString("utf-8"); + + item = Buffer.from(b2, "base64").toString("utf-8"); + decoded = JSON.parse(item); + + return decoded; + }, + + generate(file) { + o = { + "_version": "", + "stats": { + "times": { + "single": 0, + "local": 0, + "online": 0 + }, + "results": { + "wins": 0, + "loses": 0 + }, + "ingame": { + "walls": 0, + "laps": 0, + "turns": 0 + } + }, + "auth": null, + "config": { + "lang": "en", + "music": true, + "online": true, + "voice": false + } + } + + this.export(file, o); + }, + + convert(file, dotkartik) { + if (fs.existsSync(dotkartik + "/authentication.json")) { + auth = JSON.parse(fs.readFileSync(dotkartik + "/authentication.json")); + } else { + auth = null; + } + + o = { + "_version": "", + "stats": JSON.parse(fs.readFileSync(dotkartik + "/stats.json").toString()), + "auth": auth, + "config": { + "lang": fs.readFileSync(dotkartik + "/config/lang.txt").toString().trim(), + "music": fs.readFileSync(dotkartik + "/config/music.txt").toString().trim() === "1", + "online": fs.readFileSync(dotkartik + "/config/online.txt").toString().trim() === "1", + "voice": fs.readFileSync(dotkartik + "/config/voice.txt").toString().trim() === "1" + } + } + + this.export(file, o); + } } \ No newline at end of file -- cgit