Skip to content

Commit

Permalink
feat(4chan): add button to go to thread (#8076)
Browse files Browse the repository at this point in the history
* feat(4chan): add button to go to thread

* chore(4chan): bump version

* chore(4chan): bump version properly

* chore(4chan): change URL to href

* revert(4chan): revert package lock
  • Loading branch information
beardotpy authored Feb 20, 2024
1 parent 436ec60 commit 9d71d8f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion websites/0-9/4chan/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"www.4chan.org",
"4chan.org"
],
"version": "1.0.1",
"version": "1.0.2",
"logo": "https://cdn.rcd.gg/PreMiD/websites/0-9/4chan/assets/logo.png",
"thumbnail": "https://cdn.rcd.gg/PreMiD/websites/0-9/4chan/assets/thumbnail.png",
"color": "#789922",
Expand Down
9 changes: 8 additions & 1 deletion websites/0-9/4chan/presence.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ presence.on("UpdateData", async () => {
largeImageKey: Assets.Logo,
startTimestamp: browsingTimestamp,
},
{ pathname } = document.location;
{ href, pathname } = document.location;

if (pathname === "/") presenceData.details = "Viewing the front page";
else if (pathname.startsWith("/faq"))
Expand All @@ -112,6 +112,13 @@ presence.on("UpdateData", async () => {
const threadNum = pathname.split("/").at(-1),
threadSubject = document.querySelector(".subject").textContent;

presenceData.buttons = [
{
label: "View Thread",
url: href,
},
];

if (threadSubject)
presenceData.state = `>>${threadNum} - "${threadSubject}"`;
else presenceData.state = `>>${threadNum}`;
Expand Down

0 comments on commit 9d71d8f

Please sign in to comment.