Skip to content

Commit

Permalink
feat(PlanetXO): Add presence (#8938)
Browse files Browse the repository at this point in the history
* New Presance for upcoming radio network in the UK.

Signed-off-by: Kieranl29 <59117519+DJKieranl29@users.noreply.github.com>

* Delete websites/P/PlanetXO directory

Signed-off-by: Kieranl29 <59117519+DJKieranl29@users.noreply.github.com>

* Add files via upload

Signed-off-by: Kieranl29 <59117519+DJKieranl29@users.noreply.github.com>

* Delete websites/P/PlanetXO directory

Signed-off-by: Kieranl29 <59117519+DJKieranl29@users.noreply.github.com>

* Add files via upload

Signed-off-by: Kieranl29 <59117519+DJKieranl29@users.noreply.github.com>

* Should be fixed. Should be compiled now.

Signed-off-by: Kieranl29 <59117519+DJKieranl29@users.noreply.github.com>

* Update presence.ts

Signed-off-by: Kieranl29 <59117519+DJKieranl29@users.noreply.github.com>

* Update presence.js

Signed-off-by: Kieranl29 <59117519+DJKieranl29@users.noreply.github.com>

* Delete websites/P/PlanetXO/dist directory

No one else has a dist folder, so i remove it :)

Signed-off-by: Kieranl29 <59117519+DJKieranl29@users.noreply.github.com>

* Delete websites/P/PlanetXO/tsconfig.json

no one else hassss

Signed-off-by: Kieranl29 <59117519+DJKieranl29@users.noreply.github.com>

* Bye Bye Lint Errors? 😟

Signed-off-by: Kieranl29 <59117519+DJKieranl29@users.noreply.github.com>

* Should be preferfect :)

Signed-off-by: Kieranl29 <59117519+DJKieranl29@users.noreply.github.com>

* fixedddd?

Signed-off-by: Kieranl29 <59117519+DJKieranl29@users.noreply.github.com>

* Update presence.ts - Fix in logic.

Signed-off-by: Kieranl29 <59117519+DJKieranl29@users.noreply.github.com>

* Update presence.ts - Dupliate logic fix

Signed-off-by: Kieranl29 <59117519+DJKieranl29@users.noreply.github.com>

* Update presence.ts - Removal of \

Signed-off-by: Kieranl29 <59117519+DJKieranl29@users.noreply.github.com>

* Updated Meta to allow for Mail Status

Signed-off-by: Kieranl29 <59117519+DJKieranl29@users.noreply.github.com>

* Update presence.ts - Add mail support.

Signed-off-by: Kieranl29 <59117519+DJKieranl29@users.noreply.github.com>

* Removed links to home page.

Signed-off-by: Kieranl29 <59117519+DJKieranl29@users.noreply.github.com>

* Update presence.ts

Signed-off-by: Kieranl29 <59117519+DJKieranl29@users.noreply.github.com>

* Update metadata.json Updated background to app, suggested by Bas950.

Signed-off-by: Kieranl29 <59117519+DJKieranl29@users.noreply.github.com>

* Update presence.ts

Signed-off-by: Kieranl29 <59117519+DJKieranl29@users.noreply.github.com>

* Update websites/P/PlanetXO/presence.ts

Co-authored-by: Bas van Zanten <bas.van.zanten007@gmail.com>
Signed-off-by: Kieranl29 <59117519+DJKieranl29@users.noreply.github.com>

* Update websites/P/PlanetXO/presence.ts

Co-authored-by: Bas van Zanten <bas.van.zanten007@gmail.com>
Signed-off-by: Kieranl29 <59117519+DJKieranl29@users.noreply.github.com>

* Update websites/P/PlanetXO/presence.ts

Co-authored-by: Bas van Zanten <bas.van.zanten007@gmail.com>
Signed-off-by: Kieranl29 <59117519+DJKieranl29@users.noreply.github.com>

* Update websites/P/PlanetXO/presence.ts

Signed-off-by: Bas van Zanten <bas.van.zanten007@gmail.com>

---------

Signed-off-by: Kieranl29 <59117519+DJKieranl29@users.noreply.github.com>
Signed-off-by: Bas van Zanten <bas.van.zanten007@gmail.com>
Co-authored-by: Bas van Zanten <bas.van.zanten007@gmail.com>
  • Loading branch information
DJKieranl29 and Bas950 authored Dec 9, 2024
1 parent 3425a30 commit f47f899
Show file tree
Hide file tree
Showing 2 changed files with 195 additions and 0 deletions.
42 changes: 42 additions & 0 deletions websites/P/PlanetXO/metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"$schema": "https://schemas.premid.app/metadata/1.11",
"apiVersion": 1,
"author": {
"id": "850028897118584843",
"name": "kieranl29"
},
"service": "PlanetXO",
"description": {
"en": "PlanetXO - Small Regional Radio Stations localised to regions of the UK."
},
"url": [
"planetxo.uk",
"blastradio.uk",
"xoradio.uk",
"panel.planetxo.uk",
"api.planetxo.uk",
"staff.planetxo.uk"
],
"version": "1.0.0",
"logo": "https://cdn.kaneproductions.co.uk/art/PlanetXO/shortlogo.png",
"thumbnail": "https://cdn.kaneproductions.co.uk/art/PlanetXO/pxobanner.jpg",
"color": "#8c52ff",
"category": "other",
"tags": [
"bot",
"discord",
"radio",
"online",
"hiring",
"socials",
"gossuip",
"news",
"hitstation",
"localised",
"uk",
"unitedkingdom",
"socialise",
"regulated",
"kaneproductions"
]
}
153 changes: 153 additions & 0 deletions websites/P/PlanetXO/presence.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
const presence = new Presence({
clientId: "1260572178068406282",
}),
browsingTimestamp = Math.floor(Date.now() / 1000);

presence.on("UpdateData", async () => {
const presenceData: PresenceData = {
largeImageKey:
"https://cdn.kaneproductions.co.uk/art/PlanetXO/shortlogo.png",
startTimestamp: browsingTimestamp,
};

if (document.location.hostname === "planetxo.uk") {
switch (document.location.href.split("/").slice(0, -1).join("/")) {
case "https://planetxo.uk": {
presenceData.details = "Viewing the map";
break;
}
case "https://planetxo.uk/xoradio": {
presenceData.details = "Viewing XO Radio";
presenceData.buttons = [
{
label: "Listen Along!",
url: "https://planetxo.uk/xoradio",
},
];
break;
}
case "https://planetxo.uk/panel/planetxo": {
presenceData.details = "Viewing the PlanetXO Global Panel";
break;
}
case "https://planetxo.uk/panel/admin": {
presenceData.details =
"Viewing the PlanetXO System Administrator Panel";
break;
}
case "https://planetxo.uk/blastradio": {
presenceData.details = "Viewing Blast Radio";
presenceData.buttons = [
{
label: "Listen Along!",
url: "https://planetxo.uk/blastradio",
},
];
break;
}
case "https://planetxo.uk/qtfm": {
presenceData.details = "Viewing QTFM";
presenceData.buttons = [
{
label: "Listen Along!",
url: "https://planetxo.uk/qtfm",
},
];
break;
}
case "https://planetxo.uk/lushradio": {
presenceData.details = "Viewing Lush Radio";
presenceData.buttons = [
{
label: "Listen Along!",
url: "https://planetxo.uk/lushradio",
},
];
break;
}
case "https://planetxo.uk/everyradio": {
presenceData.details = "Viewing Every Radio";
presenceData.buttons = [
{
label: "Listen Along!",
url: "https://planetxo.uk/everyradio",
},
];
break;
}
case "https://planetxo.uk/panel": {
presenceData.details = "Viewing PlanetXO Panel";
presenceData.buttons = [
{
label: "Join the Team?",
url: "https://planetxo.uk/vacancies.php",
},
];
break;
}
case "https://planetxo.uk/panel/xoradio": {
presenceData.details = "Viewing the Panel for XO Radio";
presenceData.buttons = [
{
label: "Listen Along!",
url: "https://planetxo.uk/xoradio",
},
];
break;
}
case "https://planetxo.uk/panel/blastradio": {
presenceData.details = "Viewing the Panel for Blast Radio";
presenceData.buttons = [
{
label: "Listen Along!",
url: "https://planetxo.uk/blastradio",
},
];
break;
}
case "https://planetxo.uk/panel/qtfm": {
presenceData.details = "Viewing the Panel for QTFM";
presenceData.buttons = [
{
label: "Listen Along!",
url: "https://planetxo.uk/qtfm",
},
];
break;
}
case "https://planetxo.uk/panel/lushradio": {
presenceData.details = "Viewing the Panel for Lush Radio";
presenceData.buttons = [
{
label: "Listen Along!",
url: "https://planetxo.uk/lushradio",
},
];
break;
}
case "https://planetxo.uk/panel/everyradio": {
presenceData.details = "Viewing the Panel for Every Radio";
presenceData.buttons = [
{
label: "Listen Along!",
url: "https://planetxo.uk/everyradio",
},
];
break;
}
default:
if (document.location.hostname === "planetxo.uk")
presenceData.details = "Viewing PlanetXO";
break;
}
}

if (document.location.hostname === "panel.planetxo.uk")
presenceData.details = "Viewing the Panel for PlanetXO";

if (document.location.hostname === "staff.planetxo.uk")
presenceData.details = "Viewing the Emails for PlanetXO";

if (presenceData.details) presence.setActivity(presenceData);
else presence.setActivity();
});

0 comments on commit f47f899

Please sign in to comment.