Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(Heroku): add presence #6744

Merged
merged 13 commits into from
Sep 8, 2022
Prev Previous commit
Next Next commit
feat: implement 'brand', 'data', 'elements'
  • Loading branch information
theusaf committed Sep 1, 2022
commit 73c60acd38f2936312a4208a141b62dc49b5e5bc
29 changes: 15 additions & 14 deletions websites/H/Heroku/dist/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,28 @@
"en": "Heroku is a cloud platform that lets companies build, deliver, monitor and scale apps."
},
"url": [
"id.heroku.com",
"dashboard.heroku.com",
"www.heroku.com",
"blog.heroku.com",
"brand.heroku.com",
"dashboard.heroku.com",
"data.heroku.com",
"devcenter.heroku.com",
"elements.heroku.com",
"help.heroku.com",
"data.heroku.com",
"status.heroku.com",
"dataclips.heroku.com",
"sso.heroku.com",
"blog.heroku.com",
"brand.heroku.com"
"status.heroku.com"
],
"version": "1.0.0",
"logo": "https://i.imgur.com/V7ZULKG.png",
"thumbnail": "https://i.imgur.com/06zNE4U.png",
"color": "#000",
"category": "other",
"tags": [
"hosting",
"application",
"web"
]
}
"settings": [
{
"id": "showNames",
"value": false,
"multiLanguage": false,
"title": "Show Application Names"
}
],
"tags": ["hosting", "application", "web"]
}
39 changes: 38 additions & 1 deletion websites/H/Heroku/presence.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const presence = new Presence({
}),
browsingTimestamp = Math.floor(Date.now() / 1e3);
theusaf marked this conversation as resolved.
Show resolved Hide resolved

presence.on("UpdateData", () => {
presence.on("UpdateData", async () => {
const presenceData: PresenceData = {
startTimestamp: browsingTimestamp,
},
Expand Down Expand Up @@ -42,6 +42,43 @@ presence.on("UpdateData", () => {
}
break;
}
case "brand.heroku.com": {
presenceData.details = "Browsing";
presenceData.state = "Brand";
break;
}
case "elements.heroku.com": {
presenceData.details = "Browsing Elements";
presenceData.state = document.title.match(
/(.*?)(?=(?: - Heroku Elements|$))/
)[1];
break;
}
case "data.heroku.com": {
presenceData.details = "Browsing Data";
if (pathname === "/") {
presenceData.state = "Looking at datastores";
} else if (pathname === "/dataclips") {
presenceData.state = "Looking at dataclips";
} else if (pathname.startsWith("/datastores/")) {
if (await presence.getSetting<boolean>("showNames")) {
theusaf marked this conversation as resolved.
Show resolved Hide resolved
presenceData.state = `Viewing datastore '${document.title.match(
/(.*?)(?=(?: \| Heroku Data|$))/
)}'`;
} else {
presenceData.state = "Viewing a datastore";
}
} else if (pathname.startsWith("/dataclips/")) {
if (await presence.getSetting<boolean>("showNames")) {
presenceData.state = `Viewing dataclip '${document.title.match(
/(.*?)(?=(?: \| Heroku Data|$))/
)}'`;
} else {
presenceData.state = "Viewing a dataclip";
}
}
break;
}
}

if (presenceData.details) {
Expand Down