From 7e3b07d83aae6547ce121f904971e6491c0c2cdd Mon Sep 17 00:00:00 2001 From: Victor Borges Date: Mon, 31 Mar 2025 10:54:03 -0300 Subject: patch steam release notes --- src/index.tsx | 39 ++++++++++++++++++++++++++------------- 1 file changed, 26 insertions(+), 13 deletions(-) (limited to 'src/index.tsx') diff --git a/src/index.tsx b/src/index.tsx index 87f3f72..28ae219 100755 --- a/src/index.tsx +++ b/src/index.tsx @@ -1,17 +1,20 @@ -import React, { useEffect, useState } from "react"; +import { useEffect, useState } from "react"; import { FaClipboardList } from "react-icons/fa"; import { definePlugin } from "decky-frontend-lib"; -import { marked } from "marked"; -import DOMPurify from "dompurify"; +import remarkHtml from "remark-html" +import remarkParse from "remark-parse" +import remarkGfm from "remark-gfm" +import { unified } from "unified" +import { patchPartnerEventStore } from "./PartnerEventStorePatch"; +import {staticClasses} from "@decky/ui"; function Content() { - const [changelog, setChangelog] = useState(null); + const [changelogHtml, setChangelogHtml] = useState(null); const [error, setError] = useState(null); const [isRefreshing, setIsRefreshing] = useState(false); const fetchChangelog = async (signal?: AbortSignal) => { - const url = - "https://api.github.com/repos/ublue-os/bazzite/releases/tags/41.20250106.2"; + const url = "https://api.github.com/repos/ublue-os/bazzite/releases/latest"; try { const response = await fetch(url, { headers: { @@ -25,7 +28,13 @@ function Content() { } const data = await response.json(); - setChangelog(data.body); + const html = await unified() + .use(remarkParse) + .use(remarkGfm) + .use(remarkHtml) + .process(data.body) + + setChangelogHtml(html.value as string); setError(null); } catch (err) { if (err instanceof DOMException && err.name === "AbortError") return; @@ -48,7 +57,7 @@ function Content() { const refreshChangelog = async () => { setIsRefreshing(true); - setChangelog(null); + setChangelogHtml(null); setError(null); try { @@ -115,7 +124,7 @@ function Content() {

{error}

- ) : changelog ? ( + ) : changelogHtml ? (
@@ -173,11 +182,15 @@ function Content() { } export default definePlugin(() => { + const patch = patchPartnerEventStore(); + return { name: "Bazzite Changelog Viewer", - title:
Bazzite Changelog
, + title:
Bazzite Buddy
, icon: , content: , - onDismount() {}, + onDismount() { + patch.unpatch(); + }, }; -}); \ No newline at end of file +}); -- cgit v1.2.3