Skip to content

Commit

Permalink
fix(GitHub): resolve "undefined" (#7700)
Browse files Browse the repository at this point in the history
* fix(github): resolve 'undefined' issue while visiting a file or code

* chore(github): update version to 2.11.9

* feat: add file path
  • Loading branch information
Z3RO authored Oct 25, 2023
1 parent a5a910d commit 19f4eac
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion websites/G/GitHub/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"github.com",
"gist.github.com"
],
"version": "2.11.8",
"version": "2.11.9",
"logo": "https://cdn.rcd.gg/PreMiD/websites/G/GitHub/assets/logo.png",
"thumbnail": "https://cdn.rcd.gg/PreMiD/websites/G/GitHub/assets/thumbnail.png",
"color": "#000000",
Expand Down
14 changes: 11 additions & 3 deletions websites/G/GitHub/presence.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,18 @@ presence.on("UpdateData", async () => {
delete presenceData.buttons;
break;
}
const pathFolder = document
.querySelector("#repos-header-breadcrumb-wide > ol")
?.textContent.trim()
.split("/")
.slice(1)
.join("/"),
fileName = document.querySelector("#file-name-id-wide").textContent;
presenceData.details = `Browsing repository ${repository.owner}/${repository.name}`;
presenceData.state = `Viewing file ${document
.querySelector("h2#blob-path > strong")
?.textContent.trim()} at ${repository.target}`;
presenceData.state = `Viewing file ${(pathFolder
? `${pathFolder}/${fileName}`
: fileName
)?.trim()} at ${repository.target}`;
} else if (pathname.includes("/issues")) {
if (pathname.includes("/issues/")) {
if (pathname.includes("new")) {
Expand Down

0 comments on commit 19f4eac

Please sign in to comment.