feat: extend Telegram dock commands and config hashing (#929)
Thanks @grp06. Co-authored-by: George Pickett <gpickett00@gmail.com>
This commit is contained in:
@@ -3,6 +3,7 @@ export {
|
||||
loadConfig,
|
||||
parseConfigJson5,
|
||||
readConfigFileSnapshot,
|
||||
resolveConfigSnapshotHash,
|
||||
writeConfigFile,
|
||||
} from "./io.js";
|
||||
export { migrateLegacyConfig } from "./legacy-migrate.js";
|
||||
|
||||
@@ -58,6 +58,18 @@ function hashConfigRaw(raw: string | null): string {
|
||||
.digest("hex");
|
||||
}
|
||||
|
||||
export function resolveConfigSnapshotHash(snapshot: {
|
||||
hash?: string;
|
||||
raw?: string | null;
|
||||
}): string | null {
|
||||
if (typeof snapshot.hash === "string") {
|
||||
const trimmed = snapshot.hash.trim();
|
||||
if (trimmed) return trimmed;
|
||||
}
|
||||
if (typeof snapshot.raw !== "string") return null;
|
||||
return hashConfigRaw(snapshot.raw);
|
||||
}
|
||||
|
||||
export type ConfigIoDeps = {
|
||||
fs?: typeof fs;
|
||||
json5?: typeof JSON5;
|
||||
|
||||
Reference in New Issue
Block a user