mirror of
https://github.com/gethomepage/homepage.git
synced 2026-09-12 07:05:56 -07:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5873f8e7d5 | |||
| 6099837373 | |||
| f0bd255adb |
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "homepage",
|
"name": "homepage",
|
||||||
"version": "2.1.1",
|
"version": "2.1.2",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"preinstall": "npx only-allow pnpm",
|
"preinstall": "npx only-allow pnpm",
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import * as yaml from "js-yaml";
|
import * as yaml from "js-yaml";
|
||||||
|
|
||||||
const EMPTY_DOCUMENT_ERROR = "expected a document, but the input is empty";
|
const EMPTY_DOCUMENT_ERROR = "expected a document, but the input is empty";
|
||||||
const DEFAULT_SCHEMA = yaml.CORE_SCHEMA.withTags(yaml.timestampTag, yaml.mergeTag);
|
const DEFAULT_SCHEMA = yaml.CORE_SCHEMA.withTags(yaml.timestampTag, yaml.mergeTag, yaml.legacyMapTag);
|
||||||
|
|
||||||
export function loadYaml(input, options) {
|
export function loadYaml(input, options) {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -25,6 +25,16 @@ describe("utils/config/yaml", () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("preserves v4 handling of non-string keys", () => {
|
||||||
|
// an unsubstituted {{HOMEPAGE_VAR_*}} parses as a flow mapping key
|
||||||
|
expect(loadYaml("- Plex:\n widget:\n key: {{HOMEPAGE_VAR_PLEX_KEY}}\n")).toEqual([
|
||||||
|
{ Plex: { widget: { key: { "[object Object]": null } } } },
|
||||||
|
]);
|
||||||
|
expect(loadYaml("- Backups:\n - 2024-01-01:\n href: http://x\n")).toEqual([
|
||||||
|
{ Backups: [{ [String(new Date("2024-01-01T00:00:00.000Z"))]: { href: "http://x" } }] },
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
|
||||||
it("still rejects invalid YAML", () => {
|
it("still rejects invalid YAML", () => {
|
||||||
expect(() => loadYaml("value: [\n")).toThrow();
|
expect(() => loadYaml("value: [\n")).toThrow();
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user