config: lazy update arrays
Only set arrays if they are different
This commit is contained in:
parent
d05b124609
commit
9baca0e61b
2 changed files with 2 additions and 2 deletions
|
|
@ -78,7 +78,7 @@ const updateSection = (from: { [k: string]: any }, to: { [k: string]: any }, pat
|
||||||
for (const [k, v] of Object.entries(from)) {
|
for (const [k, v] of Object.entries(from)) {
|
||||||
if (to.hasOwnProperty(k)) {
|
if (to.hasOwnProperty(k)) {
|
||||||
if (isObject(v)) updateSection(v, to[k], `${path}${k}.`);
|
if (isObject(v)) updateSection(v, to[k], `${path}${k}.`);
|
||||||
else to[k].set(v);
|
else if (!Array.isArray(v) || JSON.stringify(to[k].get()) !== JSON.stringify(v)) to[k].set(v);
|
||||||
} else console.warn(`Unknown config key: ${path}${k}`);
|
} else console.warn(`Unknown config key: ${path}${k}`);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ export default class Thumbnailer {
|
||||||
static readonly #running = new Set<string>();
|
static readonly #running = new Set<string>();
|
||||||
|
|
||||||
static getThumbPath(path: string) {
|
static getThumbPath(path: string) {
|
||||||
const dir = path.slice(1, path.lastIndexOf("/")).replaceAll("/", "-");
|
const dir = path.slice(path.indexOf("/") + 1, path.lastIndexOf("/")).replaceAll("/", "-");
|
||||||
return `${this.thumbnailDir}/${dir}-${basename(path)}.jpg`;
|
return `${this.thumbnailDir}/${dir}-${basename(path)}.jpg`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue