mirror of
https://github.com/koodo-reader/koodo-reader.git
synced 2026-04-18 05:51:39 -04:00
- Added translation for "Enable Discord Rich Presence" and its description in Chinese. - Introduced a new setting option for enabling Discord Rich Presence in the settings panel. - Implemented functionality to update Discord Rich Presence with the current book information when reading. - Added methods to clear Discord Rich Presence when the reader is closed. - Updated the percentage display in the reading progress to show as a percentage.
27 lines
752 B
JavaScript
27 lines
752 B
JavaScript
/**
|
|
* Cross-platform replacement for the sed command in postinstall.
|
|
* Patches nan.h to comment out the #include nan_scriptorigin.h line.
|
|
*/
|
|
const fs = require("fs");
|
|
const path = require("path");
|
|
|
|
const nanHPath = path.join(__dirname, "..", "node_modules", "nan", "nan.h");
|
|
|
|
if (!fs.existsSync(nanHPath)) {
|
|
console.log("nan.h not found, skipping patch.");
|
|
process.exit(0);
|
|
}
|
|
|
|
let content = fs.readFileSync(nanHPath, "utf8");
|
|
const patched = content.replace(
|
|
/^#include [<"]nan_scriptorigin\.h[>"]/m,
|
|
"// #include nan_scriptorigin.h"
|
|
);
|
|
|
|
if (content === patched) {
|
|
console.log("nan.h already patched or pattern not found, skipping.");
|
|
} else {
|
|
fs.writeFileSync(nanHPath, patched, "utf8");
|
|
console.log("nan.h patched successfully.");
|
|
}
|