diff options
| author | xXJSONDeruloXx <danielhimebauch@gmail.com> | 2025-01-10 20:13:21 -0500 |
|---|---|---|
| committer | xXJSONDeruloXx <danielhimebauch@gmail.com> | 2025-01-10 20:13:21 -0500 |
| commit | 7b4de6ba79f2c0fec8056a5261d66d2edb66a4f8 (patch) | |
| tree | 0454842c401cb4064c72df2dc295393102e154f9 | |
| parent | d16216a6152cc763298f240467d323c1b2cf7c0e (diff) | |
| download | decky-bazzite-buddy-7b4de6ba79f2c0fec8056a5261d66d2edb66a4f8.tar.gz decky-bazzite-buddy-7b4de6ba79f2c0fec8056a5261d66d2edb66a4f8.zip | |
made changelog view pwetty
| -rw-r--r-- | package.json | 4 | ||||
| -rw-r--r-- | pnpm-lock.yaml | 87 | ||||
| -rwxr-xr-x | src/index.tsx | 48 |
3 files changed, 134 insertions, 5 deletions
diff --git a/package.json b/package.json index 879cd5c..486b5c5 100644 --- a/package.json +++ b/package.json @@ -31,8 +31,10 @@ "@rollup/plugin-commonjs": "^28.0.2", "@rollup/plugin-node-resolve": "^16.0.0", "@rollup/plugin-typescript": "^12.1.2", + "@types/dompurify": "^3.2.0", "@types/react": "18.3.3", "@types/react-dom": "18.3.0", + "@types/react-router": "^5.1.20", "@types/webpack": "^5.28.5", "rollup": "^4.30.1", "typescript": "^5.7.3" @@ -40,10 +42,12 @@ "dependencies": { "@decky/api": "^1.1.2", "decky-frontend-lib": "^3.25.0", + "dompurify": "^3.2.3", "marked": "^15.0.6", "react": "^19.0.0", "react-dom": "^19.0.0", "react-icons": "^5.4.0", + "react-router": "^7.1.1", "tslib": "^2.8.1" }, "pnpm": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index bd46fad..ca1b3ce 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -14,6 +14,9 @@ importers: decky-frontend-lib: specifier: ^3.25.0 version: 3.25.0 + dompurify: + specifier: ^3.2.3 + version: 3.2.3 marked: specifier: ^15.0.6 version: 15.0.6 @@ -26,6 +29,9 @@ importers: react-icons: specifier: ^5.4.0 version: 5.4.0(react@19.0.0) + react-router: + specifier: ^7.1.1 + version: 7.1.1(react-dom@19.0.0(react@19.0.0))(react@19.0.0) tslib: specifier: ^2.8.1 version: 2.8.1 @@ -45,12 +51,18 @@ importers: '@rollup/plugin-typescript': specifier: ^12.1.2 version: 12.1.2(rollup@4.30.1)(tslib@2.8.1)(typescript@5.7.3) + '@types/dompurify': + specifier: ^3.2.0 + version: 3.2.0 '@types/react': specifier: 18.3.3 version: 18.3.3 '@types/react-dom': specifier: 18.3.0 version: 18.3.0 + '@types/react-router': + specifier: ^5.1.20 + version: 5.1.20 '@types/webpack': specifier: ^5.28.5 version: 5.28.5 @@ -297,6 +309,13 @@ packages: cpu: [x64] os: [win32] + '@types/cookie@0.6.0': + resolution: {integrity: sha512-4Kh9a6B2bQciAhf7FSuMRRkUWecJgJu9nPnx3yzpsfXX/c50REIqpHY4C82bXP90qrLtXtkDxTZosYO3UpOwlA==} + + '@types/dompurify@3.2.0': + resolution: {integrity: sha512-Fgg31wv9QbLDA0SpTOXO3MaxySc4DKGLi8sna4/Utjo4r3ZRPdCt4UQee8BWr+Q5z21yifghREPJGYaEOEIACg==} + deprecated: This is a stub types definition. dompurify provides its own type definitions, so you do not need this installed. + '@types/eslint-scope@3.7.7': resolution: {integrity: sha512-MzMFlSLBqNF2gcHWO0G1vP/YQyfvrxZ0bF+u7mzUdZ1/xK4A4sru+nraZz5i3iEIk1l1uyicaDVTB4QbbEkAYg==} @@ -309,6 +328,9 @@ packages: '@types/glob@7.2.0': resolution: {integrity: sha512-ZUxbzKl0IfJILTS6t7ip5fQQM/J3TJYubDm3nMbgubNNYS62eXeUpoLUC8/7fJNiFYHTrGPQn7hspDUzIHX3UA==} + '@types/history@4.7.11': + resolution: {integrity: sha512-qjDJRrmvBMiTx+jyLxvLfJU7UznFuokDv4f3WRuriHKERccVpFU+8XMQUAbDzoiJCsmexxRExQeMwwCdamSKDA==} + '@types/json-schema@7.0.15': resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==} @@ -324,12 +346,18 @@ packages: '@types/react-dom@18.3.0': resolution: {integrity: sha512-EhwApuTmMBmXuFOikhQLIBUn6uFg81SwLMOAUgodJF14SOBOCMdU04gDoYi0WOJJHD144TL32z4yDqCW3dnkQg==} + '@types/react-router@5.1.20': + resolution: {integrity: sha512-jGjmu/ZqS7FjSH6owMcD5qpq19+1RS9DeVRqfl1FeBMxTDQAGwlMWOcs52NDoXaNKyG3d1cYQFMs9rCrb88o9Q==} + '@types/react@18.3.3': resolution: {integrity: sha512-hti/R0pS0q1/xx+TsI73XIqk26eBsISZ2R0wUijXIngRK9R/e7Xw/cXVxQK7R5JjW+SV4zGcn5hXjudkN/pLIw==} '@types/resolve@1.20.2': resolution: {integrity: sha512-60BCwRFOZCQhDncwQdxxeOEEkbc5dIMccYLwbxsS4TUNeVECQ/pBJ0j09mrHOl/JJvpRPGwO9SvE4nR2Nb/a4Q==} + '@types/trusted-types@2.0.7': + resolution: {integrity: sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw==} + '@types/webpack@5.28.5': resolution: {integrity: sha512-wR87cgvxj3p6D0Crt1r5avwqffqPXUkNlnQ1mjU93G7gCuFjufZR4I6j8cz5g1F1tTYpfOOFvly+cmIQwL9wvw==} @@ -485,6 +513,10 @@ packages: concat-map@0.0.1: resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==} + cookie@1.0.2: + resolution: {integrity: sha512-9Kr/j4O16ISv8zBBhJoi4bXOYNTkFLOqSL3UDB0njXxCXNezjeyVrJyGOWtgfs/q2km1gwBcfH8q1yEGoMYunA==} + engines: {node: '>=18'} + cross-spawn@7.0.6: resolution: {integrity: sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==} engines: {node: '>= 8'} @@ -507,6 +539,9 @@ packages: resolution: {integrity: sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==} engines: {node: '>=8'} + dompurify@3.2.3: + resolution: {integrity: sha512-U1U5Hzc2MO0oW3DF+G9qYN0aT7atAou4AgI0XjWz061nyBPbdxkfdhfy5uMgGn6+oLFCfn44ZGbdDqCzVmlOWA==} + eastasianwidth@0.2.0: resolution: {integrity: sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==} @@ -822,6 +857,16 @@ packages: peerDependencies: react: '*' + react-router@7.1.1: + resolution: {integrity: sha512-39sXJkftkKWRZ2oJtHhCxmoCrBCULr/HAH4IT5DHlgu/Q0FCPV0S4Lx+abjDTx/74xoZzNYDYbOZWlJjruyuDQ==} + engines: {node: '>=20.0.0'} + peerDependencies: + react: '>=18' + react-dom: '>=18' + peerDependenciesMeta: + react-dom: + optional: true + react@19.0.0: resolution: {integrity: sha512-V8AVnmPIICiWpGfm6GLzCR/W5FXLchHop40W4nXBmdlEceh16rCN8O8LNWm5bh5XUX91fh7KpA+W0TgMKmgTpQ==} engines: {node: '>=0.10.0'} @@ -888,6 +933,9 @@ packages: serialize-javascript@6.0.2: resolution: {integrity: sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g==} + set-cookie-parser@2.7.1: + resolution: {integrity: sha512-IOc8uWeOZgnb3ptbCURJWNjWUPcO3ZnTTdzsurqERrP6nPyv+paC55vJM0LpOlT2ne+Ix+9+CRG1MNLlyZ4GjQ==} + shebang-command@2.0.0: resolution: {integrity: sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==} engines: {node: '>=8'} @@ -967,6 +1015,9 @@ packages: tslib@2.8.1: resolution: {integrity: sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==} + turbo-stream@2.4.0: + resolution: {integrity: sha512-FHncC10WpBd2eOmGwpmQsWLDoK4cqsA/UT/GqNoaKOQnT8uzhtCbg3EoUDMvqpOSAI0S26mr0rkjzbOO6S3v1g==} + typescript@5.7.3: resolution: {integrity: sha512-84MVSjMEHP+FQRPy3pX9sTVV/INIex71s9TL2Gm5FG/WG1SqXeKyZ0k7/blY/4FdOzI12CBy1vGc4og/eus0fw==} engines: {node: '>=14.17'} @@ -1227,6 +1278,12 @@ snapshots: '@rollup/rollup-win32-x64-msvc@4.30.1': optional: true + '@types/cookie@0.6.0': {} + + '@types/dompurify@3.2.0': + dependencies: + dompurify: 3.2.3 + '@types/eslint-scope@3.7.7': dependencies: '@types/eslint': 9.6.1 @@ -1244,6 +1301,8 @@ snapshots: '@types/minimatch': 5.1.2 '@types/node': 22.10.5 + '@types/history@4.7.11': {} + '@types/json-schema@7.0.15': {} '@types/minimatch@5.1.2': {} @@ -1258,6 +1317,11 @@ snapshots: dependencies: '@types/react': 18.3.3 + '@types/react-router@5.1.20': + dependencies: + '@types/history': 4.7.11 + '@types/react': 18.3.3 + '@types/react@18.3.3': dependencies: '@types/prop-types': 15.7.14 @@ -1265,6 +1329,9 @@ snapshots: '@types/resolve@1.20.2': {} + '@types/trusted-types@2.0.7': + optional: true + '@types/webpack@5.28.5': dependencies: '@types/node': 22.10.5 @@ -1444,6 +1511,8 @@ snapshots: concat-map@0.0.1: {} + cookie@1.0.2: {} + cross-spawn@7.0.6: dependencies: path-key: 3.1.1 @@ -1471,6 +1540,10 @@ snapshots: dependencies: path-type: 4.0.0 + dompurify@3.2.3: + optionalDependencies: + '@types/trusted-types': 2.0.7 + eastasianwidth@0.2.0: {} electron-to-chromium@1.5.80: {} @@ -1742,6 +1815,16 @@ snapshots: dependencies: react: 19.0.0 + react-router@7.1.1(react-dom@19.0.0(react@19.0.0))(react@19.0.0): + dependencies: + '@types/cookie': 0.6.0 + cookie: 1.0.2 + react: 19.0.0 + set-cookie-parser: 2.7.1 + turbo-stream: 2.4.0 + optionalDependencies: + react-dom: 19.0.0(react@19.0.0) + react@19.0.0: {} require-from-string@2.0.2: {} @@ -1831,6 +1914,8 @@ snapshots: dependencies: randombytes: 2.1.0 + set-cookie-parser@2.7.1: {} + shebang-command@2.0.0: dependencies: shebang-regex: 3.0.0 @@ -1898,6 +1983,8 @@ snapshots: tslib@2.8.1: {} + turbo-stream@2.4.0: {} + typescript@5.7.3: {} undici-types@6.20.0: {} diff --git a/src/index.tsx b/src/index.tsx index d6428a1..c5b9e1a 100755 --- a/src/index.tsx +++ b/src/index.tsx @@ -1,6 +1,8 @@ import { definePlugin } from "decky-frontend-lib"; import React, { useEffect, useState } from "react"; import { FaClipboardList } from "react-icons/fa"; +import { marked } from "marked"; +import DOMPurify from "dompurify"; function Content() { const [changelog, setChangelog] = useState<string | null>(null); @@ -77,14 +79,50 @@ function Content() { {error} </p> ) : changelog ? ( - <pre + <div style={{ - whiteSpace: "pre-wrap", - wordWrap: "break-word", + backgroundColor: "#1e1e1e", + padding: "10px", + borderRadius: "5px", + color: "#ffffff", + fontFamily: "Arial, sans-serif", + fontSize: "14px", + lineHeight: "1.6", }} > - {changelog} - </pre> + <style> + {` + h1, h2, h3 { + color: #61dafb; + margin: 0 0 10px; + } + p { + margin: 0 0 10px; + } + ul, ol { + margin: 10px 0 10px 20px; + } + li { + margin: 5px 0; + } + pre { + background-color: #282c34; + padding: 10px; + border-radius: 5px; + overflow-x: auto; + color: #dcdcdc; + } + a { + color: #61dafb; + text-decoration: none; + } + a:hover { + text-decoration: underline; + } + `} + </style> + <div dangerouslySetInnerHTML={{ __html: DOMPurify.sanitize(marked(changelog)) }}></div> + </div> ) : ( <p aria-live="polite">Loading...</p> )} |
