fix: address PR review findings for widget-only integration refactor
- Fix npm scoped package support (filter time metadata keys, make description optional, exclude falsy releases from version selection) - Fix timetable date formatting (use Intl.DateTimeFormat for stable MM/DD/YYYY output) and named zod import - Guard migration 0000 against unknown provider keys - Fix migration 0003 to delete integration links by integrationId - Reset immich album carousel index when photo list changes - Add bounded limit to timetable router input - Remove stale misspelled noProviderSeleceted translation key - Fix provider name visibility in release widget settings - Update docs: add ArchiveTeam Warrior note, fix typos, correct showPhotoInfo default
This commit is contained in:
44 files changed
+46
-76
No files matched your search
@@ -46,8 +46,8 @@ export const getLatestRelease = (
|
||||
versionRegex?: string,
|
||||
): ReleaseProviderResponse | null => {
|
||||
const validReleases = releases.filter((result) => {
|
||||
if (result.latestRelease) return versionRegex ? new RegExp(versionRegex).test(result.latestRelease) : true;
|
||||
return true;
|
||||
if (!result.latestRelease) return false;
|
||||
return versionRegex ? new RegExp(versionRegex).test(result.latestRelease) : true;
|
||||
});
|
||||
|
||||
return validReleases.length === 0
|
||||
@@ -443,16 +443,20 @@ const getGitlabDetailsAsync = async (baseUrl: string, encodedIdentifier: string)
|
||||
};
|
||||
};
|
||||
|
||||
const npmTimeMetadataKeys = new Set(["created", "modified"]);
|
||||
|
||||
const npmReleasesSchema = z.object({
|
||||
time: z
|
||||
.record(
|
||||
z.string(),
|
||||
z.string().transform((value) => new Date(value)),
|
||||
)
|
||||
.transform((version) =>
|
||||
Object.entries(version).map(([key, value]) => ({ latestRelease: key, latestReleaseAt: value })),
|
||||
.transform((entries) =>
|
||||
Object.entries(entries)
|
||||
.filter(([key]) => !npmTimeMetadataKeys.has(key))
|
||||
.map(([key, value]) => ({ latestRelease: key, latestReleaseAt: value })),
|
||||
),
|
||||
versions: z.record(z.string(), z.object({ description: z.string() })),
|
||||
versions: z.record(z.string(), z.object({ description: z.string().optional() })),
|
||||
name: z.string(),
|
||||
});
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import dayjs from "dayjs";
|
||||
import z from "zod/v4";
|
||||
import { z } from "zod/v4";
|
||||
|
||||
import { ResponseError } from "@homarr/common/server";
|
||||
import { fetchWithTrustedCertificatesAsync } from "@homarr/core/infrastructure/http";
|
||||
@@ -88,7 +88,18 @@ const getTimetableAsync = async (
|
||||
options: { stationId: string; limit: number },
|
||||
): Promise<Timetable> => {
|
||||
const now = new Date();
|
||||
const [date, time] = now.toLocaleString("en-CH", { timeZone: "Europe/Zurich" }).split(", ") as [string, string];
|
||||
const date = new Intl.DateTimeFormat("en-US", {
|
||||
timeZone: "Europe/Zurich",
|
||||
month: "2-digit",
|
||||
day: "2-digit",
|
||||
year: "numeric",
|
||||
}).format(now);
|
||||
const time = new Intl.DateTimeFormat("en-GB", {
|
||||
timeZone: "Europe/Zurich",
|
||||
hour: "2-digit",
|
||||
minute: "2-digit",
|
||||
hour12: false,
|
||||
}).format(now);
|
||||
const response = await fetchWithTrustedCertificatesAsync(
|
||||
buildUrl(baseUrl, "/timetable/api/stationboard.json", {
|
||||
stop: options.stationId,
|
||||
@@ -96,7 +107,7 @@ const getTimetableAsync = async (
|
||||
show_delays: 1,
|
||||
show_tracks: 1,
|
||||
date,
|
||||
time: time.substring(0, 5),
|
||||
time,
|
||||
}),
|
||||
);
|
||||
if (!response.ok) throw new ResponseError(response);
|
||||
|
||||
Reference in new issue
Block a user