@riddix/hamh 2.1.0-alpha.445 → 2.1.0-alpha.446

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -149745,6 +149745,36 @@ function detectEnvironment2() {
149745
149745
  }
149746
149746
  function systemApi(version) {
149747
149747
  const router = express12.Router();
149748
+ router.get("/update-check", async (_req, res) => {
149749
+ try {
149750
+ const response = await fetch(
149751
+ "https://api.github.com/repos/riddix/home-assistant-matter-hub/releases/latest",
149752
+ {
149753
+ headers: { Accept: "application/vnd.github.v3+json" },
149754
+ signal: AbortSignal.timeout(1e4)
149755
+ }
149756
+ );
149757
+ if (!response.ok) {
149758
+ res.status(502).json({ error: "Failed to check for updates" });
149759
+ return;
149760
+ }
149761
+ const data = await response.json();
149762
+ const latestVersion = data.tag_name.replace(/^v/, "");
149763
+ const updateAvailable = version !== "0.0.0-dev" && latestVersion !== version;
149764
+ res.json({
149765
+ currentVersion: version,
149766
+ latestVersion,
149767
+ updateAvailable,
149768
+ releaseUrl: data.html_url,
149769
+ publishedAt: data.published_at,
149770
+ releaseNotes: data.body ? data.body.substring(0, 500) : void 0,
149771
+ environment: detectEnvironment2()
149772
+ });
149773
+ } catch (error) {
149774
+ logger141.error("Failed to check for updates:", error);
149775
+ res.status(500).json({ error: "Failed to check for updates" });
149776
+ }
149777
+ });
149748
149778
  router.get("/info", async (_req, res) => {
149749
149779
  try {
149750
149780
  const totalMem = os2.totalmem();