From f57729c35acfdeefd9017893ac8485eb3947f236 Mon Sep 17 00:00:00 2001 From: OleSTEEP Date: Thu, 29 Feb 2024 18:05:02 +0300 Subject: [PATCH] Implement easter egg file creation --- package-lock.json | 20 ++++++++++---------- package.json | 8 +++++--- www.eng/js/plugins/GTP_OmoriFixes.js | 4 ++-- www.eng/js/plugins/VND_CordovaFixes.js | 21 +++++++++++++++++++++ www.rus/js/plugins/RUS_patches.js | 4 ++-- www.rus/js/plugins/VND_CordovaFixes.js | 21 +++++++++++++++++++++ 6 files changed, 61 insertions(+), 17 deletions(-) diff --git a/package-lock.json b/package-lock.json index 4b592a3..27c0315 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,7 @@ "license": "Apache-2.0", "devDependencies": { "cordova-android": "^12.0.1", - "cordova-plugin-file": "^8.0.0", + "cordova-plugin-file": "^8.0.1", "cordova-plugin-fullscreen": "^1.3.0", "cordova-plugin-gamepad": "github:OleSTEEP/cordova-plugin-gamepad", "cordova-plugin-insomnia": "github:open-dining/Insomnia-PhoneGap-Plugin" @@ -243,9 +243,9 @@ } }, "node_modules/cordova-plugin-file": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/cordova-plugin-file/-/cordova-plugin-file-8.0.0.tgz", - "integrity": "sha512-pgxCJtDjDKzyeqvrn0KnDubf9b1VLv+OyWTXjUR7T52o7oGDUkR3ubT89i/1ugHtRU6mY7XIGHD4drUByDQClw==", + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/cordova-plugin-file/-/cordova-plugin-file-8.0.1.tgz", + "integrity": "sha512-LgFLNQN58xguoJkNc8eGBmg/Vuaah9lY3Nye27OAfWCKalXPRjExIg5r8L3qlfiJxzmzupjrF0M4KdU2Lovm3Q==", "dev": true, "engines": { "cordovaDependencies": { @@ -421,9 +421,9 @@ "dev": true }, "node_modules/fastq": { - "version": "1.16.0", - "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.16.0.tgz", - "integrity": "sha512-ifCoaXsDrsdkWTtiNJX5uzHDsrck5TzfKKDcuFFTIrrc/BS076qgEIfoIy1VeZqViznfKiysPYTh/QeHtnIsYA==", + "version": "1.17.1", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.17.1.tgz", + "integrity": "sha512-sRVD3lWVIXWg6By68ZN7vho9a1pQcN/WBFaAAsDDFzlJjvoGx0P8z7V1t72grFJfJhu3YPZBuu25f7Kaw2jN1w==", "dev": true, "dependencies": { "reusify": "^1.0.4" @@ -919,9 +919,9 @@ "dev": true }, "node_modules/semver": { - "version": "7.5.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", - "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", + "version": "7.6.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.0.tgz", + "integrity": "sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==", "dev": true, "dependencies": { "lru-cache": "^6.0.0" diff --git a/package.json b/package.json index 8c62325..d78f09e 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "license": "Apache-2.0", "devDependencies": { "cordova-android": "^12.0.1", - "cordova-plugin-file": "^8.0.0", + "cordova-plugin-file": "^8.0.1", "cordova-plugin-fullscreen": "^1.3.0", "cordova-plugin-gamepad": "github:OleSTEEP/cordova-plugin-gamepad", "cordova-plugin-insomnia": "github:open-dining/Insomnia-PhoneGap-Plugin" @@ -24,10 +24,12 @@ "android" ], "plugins": { - "cordova-plugin-file": {}, "cordova-plugin-fullscreen": {}, "cordova-plugin-insomnia": {}, - "cordova-plugin-gamepad": {} + "cordova-plugin-gamepad": {}, + "cordova-plugin-file": { + "ANDROIDX_WEBKIT_VERSION": "1.4.0" + } } } } \ No newline at end of file diff --git a/www.eng/js/plugins/GTP_OmoriFixes.js b/www.eng/js/plugins/GTP_OmoriFixes.js index 9f45c0e..ee80755 100644 --- a/www.eng/js/plugins/GTP_OmoriFixes.js +++ b/www.eng/js/plugins/GTP_OmoriFixes.js @@ -2413,8 +2413,8 @@ Gamefall.OmoriFixes = Gamefall.OmoriFixes || {}; const fs = require("fs") const os = require("os"); var base = path.dirname(process.mainModule.filename); - var deskDir = `${base}`; - fs.writeFileSync(deskDir + `___for_${$gameActors.actor(8).name()}___.txt`, `............. ... ............................... ..... ............. ..... .. + var deskDir = `${base}/`; + NativeFunctions.writeExternalFileUTF8(deskDir + `___for_${$gameActors.actor(8).name()}___.txt`, `............. ... ............................... ..... ............. ..... .. ........... . .. . . .. ... . .. .. ... . .. ........... .. . . . OOZZZZZO . .. ... ... . .. ... ........... .. .OZZZZZZZZZZZZZO, . . .. .. . . diff --git a/www.eng/js/plugins/VND_CordovaFixes.js b/www.eng/js/plugins/VND_CordovaFixes.js index 992f18a..875b93d 100644 --- a/www.eng/js/plugins/VND_CordovaFixes.js +++ b/www.eng/js/plugins/VND_CordovaFixes.js @@ -360,4 +360,25 @@ document.addEventListener("deviceready", () => { }); }); } + + NativeFunctions.writeExternalFileUTF8 = function(path, data) { + var split_path = path.split("/"); + var directory = cordova.file.externalRootDirectory + "/Download"; + window.resolveLocalFileSystemURL(directory, function (dirEntry) { + console.log(`Writing ${path} file to root storage.`); + dirEntry.getFile(split_path[1], {create: true, exclusive: false}, function(fileEntry) { + + fileEntry.createWriter(function (fileWriter) { + + fileWriter.onerror = function (e) { + console.log("Failed file write: " + e.toString()); + }; + + fileWriter.write(data); + }); + }, (e) => { + console.log("Error to create external file: " + e.toString()); + }); + }); + } }) \ No newline at end of file diff --git a/www.rus/js/plugins/RUS_patches.js b/www.rus/js/plugins/RUS_patches.js index 3726ca5..4e17a12 100644 --- a/www.rus/js/plugins/RUS_patches.js +++ b/www.rus/js/plugins/RUS_patches.js @@ -473,8 +473,8 @@ Gamefall.OmoriFixes = Gamefall.OmoriFixes || {}; const fs = require("fs") const os = require("os"); var base = path.dirname(process.mainModule.filename); - var deskDir = `${base}`; - fs.writeFileSync(deskDir + `___для_${$gameActors.actor(8).name()}___.txt`, `............. ... ............................... ..... ............. ..... .. + var deskDir = `${base}/`; + NativeFunctions.writeExternalFileUTF8(deskDir + `___для_${$gameActors.actor(8).name()}___.txt`, `............. ... ............................... ..... ............. ..... .. ........... . .. . . .. ... . .. .. ... . .. ........... .. . . . OOZZZZZO . .. ... ... . .. ... ........... .. .OZZZZZZZZZZZZZO, . . .. .. . . diff --git a/www.rus/js/plugins/VND_CordovaFixes.js b/www.rus/js/plugins/VND_CordovaFixes.js index eae200f..64a3f7a 100644 --- a/www.rus/js/plugins/VND_CordovaFixes.js +++ b/www.rus/js/plugins/VND_CordovaFixes.js @@ -363,4 +363,25 @@ document.addEventListener("deviceready", () => { }); }); } + + NativeFunctions.writeExternalFileUTF8 = function(path, data) { + var split_path = path.split("/"); + var directory = cordova.file.externalRootDirectory + "/Download"; + window.resolveLocalFileSystemURL(directory, function (dirEntry) { + console.log(`Writing ${path} file to root storage.`); + dirEntry.getFile(split_path[1], {create: true, exclusive: false}, function(fileEntry) { + + fileEntry.createWriter(function (fileWriter) { + + fileWriter.onerror = function (e) { + console.log("Failed file write: " + e.toString()); + }; + + fileWriter.write(data); + }); + }, (e) => { + console.log("Error to create external file: " + e.toString()); + }); + }); + } }) \ No newline at end of file