mirror of
https://github.com/k1tbyte/Wand-Enhancer.git
synced 2026-08-28 17:01:04 +00:00
13759b1db6
- reduce ASAR IO overhead with streamed archive reads, buffered copies, faster relative-path handling and placeholder integrity records - fix in-place app.asar.unpacked packing/extraction self-copy cases that caused locked-file failures - tighten JS patch discovery with candidate bundle filters and search hints - require prebuilt remote-panel dist artifacts and clean up embedded bridge/script packaging - add unified build entrypoints for PowerShell, cmd and bash and move native CMake output under .tmp - add release metadata validation, changelog section extraction, pre-commit hook and GitHub Actions validation/release pipelines - make CHANGELOG the source of truth for release notes and document the tag-driven release flow - add updater release notes UI with latest/full changelog loading and localize the new update strings - modularize bridge renderer scripts, add installed apps and game status sync, and support remote launch/stop commands - centralize bridge protocol, IPC and WebSocket constants and improve LAN IP selection for QR pairing - refactor remote panel controls/state enums, persist accent color, polish library/session UI and refresh assets
65 lines
1.2 KiB
JavaScript
65 lines
1.2 KiB
JavaScript
function isRecord(value) {
|
|
return typeof value === 'object' && value !== null;
|
|
}
|
|
|
|
function safeString(value, fallback = '') {
|
|
return typeof value === 'string' && value.length ? value : fallback;
|
|
}
|
|
|
|
function firstString(...values) {
|
|
for (const value of values) {
|
|
if (typeof value !== 'string') {
|
|
continue;
|
|
}
|
|
|
|
const trimmed = value.trim();
|
|
if (trimmed.length > 0) {
|
|
return trimmed;
|
|
}
|
|
}
|
|
|
|
return '';
|
|
}
|
|
|
|
function cloneValue(value) {
|
|
if (Array.isArray(value)) {
|
|
return value.map(cloneValue);
|
|
}
|
|
|
|
if (!isRecord(value)) {
|
|
return value;
|
|
}
|
|
|
|
const result = {};
|
|
for (const [key, entry] of Object.entries(value)) {
|
|
result[key] = cloneValue(entry);
|
|
}
|
|
|
|
return result;
|
|
}
|
|
|
|
function isValidPort(value) {
|
|
return Number.isFinite(value) && value > 0 && value < 65536;
|
|
}
|
|
|
|
function toStringId(value) {
|
|
if (typeof value === 'string' && value.trim()) {
|
|
return value.trim();
|
|
}
|
|
|
|
if (typeof value === 'number' && Number.isFinite(value)) {
|
|
return String(value);
|
|
}
|
|
|
|
return null;
|
|
}
|
|
|
|
module.exports = {
|
|
cloneValue,
|
|
firstString,
|
|
isRecord,
|
|
isValidPort,
|
|
safeString,
|
|
toStringId,
|
|
};
|