summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Borges <victor1882@outlook.com>2025-04-30 00:10:42 -0300
committerVictor Borges <victor1882@outlook.com>2025-04-30 00:10:42 -0300
commit09b26542752b4c6b13e91ceae3255b67bd98f82c (patch)
tree7018a39f3b71531ae74c168d5c5182b4740242f9
parent0e8fa29ac63933d3c4b5f9071c174cc2f26d99db (diff)
downloaddecky-bazzite-buddy-09b26542752b4c6b13e91ceae3255b67bd98f82c.tar.gz
decky-bazzite-buddy-09b26542752b4c6b13e91ceae3255b67bd98f82c.zip
add pagination support
-rw-r--r--.editorconfig7
-rw-r--r--package.json2
-rw-r--r--src/PartnerEventStorePatch.tsx365
-rwxr-xr-xsrc/index.tsx6
-rw-r--r--tsconfig.json2
5 files changed, 250 insertions, 132 deletions
diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 0000000..f666140
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,7 @@
+[*]
+charset = utf-8
+end_of_line = lf
+indent_size = 2
+indent_style = space
+insert_final_newline = true
+max_line_length = 120
diff --git a/package.json b/package.json
index e631f15..91742f9 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "bazzite-buddy",
- "version": "1.1.0",
+ "version": "1.2.0",
"description": "A plugin to easily view Bazzite changelogs within game mode, primarily for handhelds.",
"type": "module",
"scripts": {
diff --git a/src/PartnerEventStorePatch.tsx b/src/PartnerEventStorePatch.tsx
index 2307283..4674e5f 100644
--- a/src/PartnerEventStorePatch.tsx
+++ b/src/PartnerEventStorePatch.tsx
@@ -1,5 +1,5 @@
-import { findModuleExport } from "@decky/ui";
-import { afterPatch } from "decky-frontend-lib";
+import { findModuleExport, Patch } from "@decky/ui";
+import { replacePatch } from "decky-frontend-lib";
import remarkHtml from "remark-html"
import remarkParse from "remark-parse"
import remarkGfm from "remark-gfm"
@@ -32,6 +32,7 @@ const steamClanSteamID = "103582791470414830";
const steamClanID = "40893422";
const steamOSAppId = 1675200;
const githubReleasesURI = "https://api.github.com/repos/ublue-os/bazzite/releases";
+const generator = fetchReleases();
enum SteamEventType {
SmallUpdate = 12,
@@ -39,155 +40,263 @@ enum SteamEventType {
BigUpdate = 14,
}
+type SteamTags = {
+ require_tags?: string[]
+}
+
+enum SteamOSChannel {
+ Stable = "stablechannel",
+ Beta = "betachannel",
+ Preview = "previewchannel",
+}
+
const mutex = new Mutex();
-let releases: any[];
-let channel: string;
+const cachedGithubReleases: { gid: string, release: any }[] = [];
-export function patchPartnerEventStore() {
- return afterPatch(
+export function patchPartnerEventStore(): Patch[] {
+ const loadAdjacentPartnerEventsPatch = replacePatch(
PartnerEventStore.prototype,
- "InternalLoadAdjacentPartnerEvents",
- async function(args, ret) {
- let [, , , appId, , , c, ] = args;
+ "LoadAdjacentPartnerEvents",
+ async function(args) {
+ let [gidEvent, gidAnnouncement, appId, countBefore, countAfter, tags, token] = args;
+ const module = this;
if (appId !== steamOSAppId) {
- return ret;
+ return module.InternalLoadAdjacentPartnerEvents(gidEvent, void 0, gidAnnouncement, appId, countBefore, countAfter, tags, token);
}
- ret = await Promise.resolve(ret);
+ return mutex.runExclusive(async () => {
+ return LoadBazziteReleasesAsPartnerEvents(module, gidEvent?.GID || gidEvent?.AnnouncementGID, tags, countBefore, countAfter);
+ });
+ }
+ );
+
+ const loadAdjacentPartnerEventsByAnnouncementPatch = replacePatch(
+ PartnerEventStore.prototype,
+ "LoadAdjacentPartnerEventsByAnnouncement",
+ async function(args) {
+ let [gidEvent, gidAnnouncement, appId, countBefore, countAfter, tags, token] = args;
+ const module = this;
- if (!Array.isArray(ret)) {
- return ret;
+ if (appId !== steamOSAppId) {
+ return module.InternalLoadAdjacentPartnerEvents(void 0, gidEvent, gidAnnouncement, appId, countBefore, countAfter, tags, token);
}
- ret.length = 0;
+ return mutex.runExclusive(async () => {
+ return LoadBazziteReleasesAsPartnerEvents(module, gidEvent?.GID || gidEvent?.AnnouncementGID, tags, countBefore, countAfter);
+ });
+ }
+ );
+
+ const loadAdjacentPartnerEventsByEventPatch = replacePatch(
+ PartnerEventStore.prototype,
+ "LoadAdjacentPartnerEventsByEvent",
+ async function(args) {
+ let [gidEvent, gidAnnouncement, appId, countBefore, countAfter, tags, token] = args;
+ const module = this;
+
+ if (appId !== steamOSAppId) {
+ const clanId = gidAnnouncement || gidEvent.clanSteamID;
+
+ return gidEvent.bOldAnnouncement
+ ? module.InternalLoadAdjacentPartnerEvents(void 0, gidEvent.AnnouncementGID, clanId, appId, countBefore, countAfter, tags, token)
+ : module.InternalLoadAdjacentPartnerEvents(gidEvent.GID, gidEvent.AnnouncementGID, clanId, appId, countBefore, countAfter, tags, token);
+ }
+
+ return mutex.runExclusive(async () => {
+ return LoadBazziteReleasesAsPartnerEvents(module, gidEvent?.GID || gidEvent?.AnnouncementGID, tags, countBefore, countAfter);
+ });
+ }
+ );
+
+ return [
+ loadAdjacentPartnerEventsPatch,
+ loadAdjacentPartnerEventsByAnnouncementPatch,
+ loadAdjacentPartnerEventsByEventPatch
+ ]
+}
+
+async function LoadBazziteReleasesAsPartnerEvents(module: any, gid: any, tags: SteamTags, countBefore: number, countAfter: number) {
+ const ret: any[] = [];
+
+ // InternalLoadAdjacentPartnerEvents minified code, gets announcement from cache if it exists
+ if (module.m_mapAdjacentAnnouncementGIDs.has(gid)) {
+ // noinspection JSPrimitiveTypeWrapperUsage
+ let e = module.m_mapAdjacentAnnouncementGIDs.get(gid)
+ , r = new Array;
+ // noinspection CommaExpressionJS
+ if (e.forEach(((e: any) => {
+ if (module.m_mapAnnouncementBodyToEvent.has(e)) {
+ let t = module.m_mapAnnouncementBodyToEvent.get(e);
+ ret.push(module.m_mapExistingEvents.get(t))
+ } else
+ r.push(e)
+ }
+ )),
+ r.length > 0) {
+ (await module.LoadBatchPartnerEventsByEventGIDsOrAnnouncementGIDs(null, r, tags)).forEach(((e: any) => ret.push(e)))
+ }
+ }
+
+ if (cachedGithubReleases.length === 0) {
+ await fetchMoreReleases(countAfter, isBetaOrPreviewChannel(tags));
+ }
+
+ const releaseIndex = gid ? cachedGithubReleases.findIndex((e: any) => e.gid === gid) : -1;
+ let releases: { gid: any, release: any }[];
+
+ if (releaseIndex === -1) {
+ releases = cachedGithubReleases.slice(0, countAfter);
+ } else {
+ if (releaseIndex + countAfter + 1 > cachedGithubReleases.length) {
+ const toFetch = releaseIndex + countAfter + 1 - cachedGithubReleases.length;
+ await fetchMoreReleases(toFetch, isBetaOrPreviewChannel(tags));
+ }
+
+ releases = cachedGithubReleases.slice(Math.max(releaseIndex - countBefore + 1, 0), releaseIndex + countAfter + 1);
+ }
+
+ for (const { release } of releases) {
+ const releasePublishedAt = Math.floor((new Date(release.published_at)).getTime() / 1000);
+
+ const html = await unified()
+ .use(remarkParse)
+ .use(remarkGfm)
+ .use(remarkHtml)
+ .process(release.body);
- await mutex.runExclusive(async () => {
- if (releases && releases.length > 0)
- return;
+ const converter = new (html2bbcode.HTML2BBCode)();
+ const bbcode = converter.feed(html.value);
+
+ // haven't found a way to hide likes and comments yet
+ const event = {
+ "gid": String(release.id),
+ "clan_steamid": steamClanSteamID,
+ "event_name": release.name,
+ "event_type": SteamEventType.Update,
+ "appid": steamOSAppId,
+ "server_address": "",
+ "server_password": "",
+ // start and end time are only used for certain event_type, not used for updates, but fill it anyway
+ "rtime32_start_time": releasePublishedAt,
+ "rtime32_end_time": releasePublishedAt,
+ "comment_count": 0,
+ "creator_steamid": "0",
+ "last_update_steamid": "0",
+ "event_notes": "see announcement body",
+ "jsondata": "",
+ "announcement_body": {
+ "gid": String(release.id),
+ "clanid": steamClanID,
+ "posterid": "0",
+ "headline": `Bazzite ${release.tag_name}`,
+ "posttime": releasePublishedAt,
+ "updatetime": releasePublishedAt,
+ "body": bbcode.toString(),
+ "commentcount": 0,
+ "tags": [
+ "patchnotes",
+ isBetaOrPreviewChannel(tags) ? SteamOSChannel.Beta : SteamOSChannel.Stable,
+ ],
+ "language": 0,
+ "hidden": 0,
+ "forum_topic_id": "0",
+ "event_gid": "0",
+ "voteupcount": 0,
+ "votedowncount": 0,
+ "ban_check_result": 0,
+ "banned": 0
+ },
+ "published": 1,
+ "hidden": 0,
+ "rtime32_visibility_start": 0,
+ "rtime32_visibility_end": 0,
+ "broadcaster_accountid": 0,
+ "follower_count": 0,
+ "ignore_count": 0,
+ "forum_topic_id": "0",
+ "rtime32_last_modified": releasePublishedAt,
+ "news_post_gid": "0",
+ "rtime_mod_reviewed": 0,
+ "featured_app_tagid": 0,
+ "referenced_appids": [],
+ "build_id": 0,
+ "build_branch": "",
+ "unlisted": 0,
+ "votes_up": 0,
+ "votes_down": 0,
+ "comment_type": "ForumTopic",
+ "gidfeature": "0",
+ "gidfeature2": "0"
+ };
+
+ // InternalLoadAdjacentPartnerEvents minified code, maps announcement and add it to cache
+ if (!module.m_mapExistingEvents.has(event.gid)) {
+ let steamId = new SteamID(event.clan_steamid);
+ module.InsertEventModelFromClanEventData(steamId, event)
+ }
+
+ ret.push(module.m_mapExistingEvents.get(event.gid));
+ }
+
+ return ret;
+}
+
+async function fetchMoreReleases(count: number, beta: boolean) {
+ const releases = [];
+ let iterator;
+
+ do {
+ iterator = await generator.next();
+ const release = iterator.value;
+
+ if ((beta && release.prerelease) || (!beta && !release.prerelease))
+ releases.push(release);
+ } while (releases.length < count && !iterator.done)
+
+ for (const release of releases) {
+ cachedGithubReleases.push({ gid: String(release.id), release });
+ }
+}
+async function* fetchReleases() {
+ let currentPage = 1;
+ let done = false;
+
+ while (!done) {
let response: Response;
let responseJson: any;
try {
- response = await fetch(githubReleasesURI);
+ response = await fetch(githubReleasesURI + `?page=${currentPage++}&per_page=10`);
- if (!response.ok)
- return;
-
- responseJson = await response.json();
+ if (response.ok) {
+ responseJson = await response.json();
+ } else {
+ responseJson = [];
+ }
}
catch {
- responseJson = [];
+ responseJson = [];
}
if (!Array.isArray(responseJson) || responseJson.length == 0) {
- return;
- }
-
- responseJson.sort((a, b) => (new Date(b.created_at)).getTime() - (new Date(a.created_at)).getTime());
-
- if (c?.require_tags && c?.require_tags?.includes("stablechannel")) {
- releases = responseJson.filter(r => !r.prerelease);
- channel = "stablechannel";
- } else if (c?.require_tags && (c?.require_tags?.includes("betachannel") || c?.require_tags?.includes("previewchannel"))) {
- releases = responseJson.filter(r => r.prerelease);
- channel = "betachannel";
+ done = true;
} else {
- releases = responseJson;
- channel = "stablechannel";
- }
- });
-
- if (!releases || releases.length == 0)
- return ret;
-
- for (const release of releases) {
- const releaseCreatedAt = Math.floor((new Date(release.created_at)).getTime() / 1000);
-
- const html = await unified()
- .use(remarkParse)
- .use(remarkGfm)
- .use(remarkHtml)
- .process(release.body);
-
- const converter = new (html2bbcode.HTML2BBCode)();
- const bbcode = converter.feed(html.value);
-
- // @ts-ignore
- const event = {
- "gid": String(release.id),
- "clan_steamid": steamClanSteamID,
- "event_name": release.name,
- "event_type": SteamEventType.Update,
- "appid": steamOSAppId,
- "server_address": "",
- "server_password": "",
- "rtime32_start_time": releaseCreatedAt, // only used for certain event_type, not used for updates, but anyway
- "rtime32_end_time": releaseCreatedAt, // only used for certain event_type, not used for updates, but anyway
- "comment_count": 0,
- "creator_steamid": "0",
- "last_update_steamid": "0",
- "event_notes": "see announcement body",
- "jsondata": "{\n\t\"localized_subtitle\": [\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull\n\t]\n\t,\n\t\"localized_summary\": [\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull\n\t]\n\t,\n\t\"localized_title_image\": [\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull\n\t]\n\t,\n\t\"localized_capsule_image\": [\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull\n\t]\n\t,\n\t\"bSaleEnabled\": false,\n\t\"sale_show_creator\": false,\n\t\"sale_sections\": [\n\n\t]\n\t,\n\t\"sale_browsemore_text\": \"\",\n\t\"sale_browsemore_url\": \"\",\n\t\"sale_browsemore_color\": \"\",\n\t\"sale_browsemore_bgcolor\": \"\",\n\t\"localized_sale_header\": [\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull\n\t]\n\t,\n\t\"localized_sale_overlay\": [\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull\n\t]\n\t,\n\t\"localized_sale_product_banner\": [\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull\n\t]\n\t,\n\t\"localized_sale_product_mobile_banner\": [\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull\n\t]\n\t,\n\t\"localized_sale_logo\": [\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull\n\t]\n\t,\n\t\"sale_font\": \"\",\n\t\"sale_background_color\": \"\",\n\t\"sale_header_offset\": 150,\n\t\"referenced_appids\": [\n\n\t]\n\t,\n\t\"bBroadcastEnabled\": false,\n\t\"broadcastChatSetting\": \"hide\",\n\t\"default_broadcast_title\": \"#Broadcast_default_title_dev\",\n\t\"localized_broadcast_title\": [\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull\n\t]\n\t,\n\t\"localized_broadcast_left_image\": [\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull\n\t]\n\t,\n\t\"localized_broadcast_right_image\": [\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull\n\t]\n\t,\n\t\"broadcast_whitelist\": [\n\n\t]\n\t,\n\t\"bScheduleEnabled\": false,\n\t\"scheduleEntries\": [\n\n\t]\n\t,\n\t\"valve_access_log\": [\n\t\t{\n\t\t\t\"strSteamID\": \"76561197979253178\",\n\t\t\t\"rtUpdated\": 1741648377\n\t\t},\n\t\t{\n\t\t\t\"strSteamID\": \"76561198840299494\",\n\t\t\t\"rtUpdated\": 1741740761\n\t\t}\n\t]\n\t,\n\t\"clone_from_event_gid\": \"519706073503894980\",\n\t\"clone_from_sale_enabled\": false,\n\t\"automatically_push_updated_source\": true\n}",
- "announcement_body": {
- "gid": String(release.id),
- "clanid": steamClanID,
- "posterid": "0",
- "headline": `Bazzite ${release.name}`,
- "posttime": releaseCreatedAt,
- "updatetime": releaseCreatedAt,
- "body": bbcode.toString(),
- "commentcount": 0,
- "tags": [
- "patchnotes",
- channel,
- ],
- "language": 0,
- "hidden": 0,
- "forum_topic_id": "0",
- "event_gid": "0",
- "voteupcount": 0,
- "votedowncount": 0,
- "ban_check_result": 0,
- "banned": 0
- },
- "published": 1,
- "hidden": 0,
- "rtime32_visibility_start": 0,
- "rtime32_visibility_end": 0,
- "broadcaster_accountid": 0,
- "follower_count": 0,
- "ignore_count": 0,
- "forum_topic_id": "0",
- "rtime32_last_modified": releaseCreatedAt,
- "news_post_gid": "0",
- "rtime_mod_reviewed": 0,
- "featured_app_tagid": 0,
- "referenced_appids": [],
- "build_id": 0,
- "build_branch": "",
- "unlisted": 0,
- "votes_up": 0,
- "votes_down": 0,
- "comment_type": "ForumTopic", // haven't found a way to hide likes and comments
- "gidfeature": "0",
- "gidfeature2": "0"
- };
-
- // @ts-ignore
- if (!this.m_mapExistingEvents.has(event.gid)) {
- let steamId = new SteamID(event.clan_steamid);
-
- // @ts-ignore
- this.InsertEventModelFromClanEventData(steamId, event)
- }
-
- // @ts-ignore
- ret.push(this.m_mapExistingEvents.get(event.gid));
- }
+ responseJson.sort((a, b) => (new Date(b.created_at)).getTime() - (new Date(a.created_at)).getTime());
- return ret;
+ for (let release of responseJson) {
+ yield release;
+ }
+ }
}
- );
+
+ return undefined;
+}
+
+function isBetaOrPreviewChannel(tags: SteamTags): boolean {
+ return (tags?.require_tags
+ && (tags?.require_tags?.includes(SteamOSChannel.Beta)
+ || tags?.require_tags?.includes(SteamOSChannel.Preview)))
+ ?? false;
}
diff --git a/src/index.tsx b/src/index.tsx
index 28ae219..a381e1c 100755
--- a/src/index.tsx
+++ b/src/index.tsx
@@ -182,7 +182,7 @@ function Content() {
}
export default definePlugin(() => {
- const patch = patchPartnerEventStore();
+ const patches = patchPartnerEventStore();
return {
name: "Bazzite Changelog Viewer",
@@ -190,7 +190,9 @@ export default definePlugin(() => {
icon: <FaClipboardList />,
content: <Content />,
onDismount() {
- patch.unpatch();
+ patches.forEach(patch => {
+ patch.unpatch();
+ });
},
};
});
diff --git a/tsconfig.json b/tsconfig.json
index c7da3dd..69bd8f0 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -12,7 +12,7 @@
"noUnusedParameters": true,
"esModuleInterop": true,
"noImplicitReturns": true,
- "noImplicitThis": true,
+ "noImplicitThis": false,
"noImplicitAny": true,
"strict": true,
"allowSyntheticDefaultImports": true,