forked from PreMiD/Presences
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Notespace): add presence (PreMiD#7921)
* new Signed-off-by: Mateusz Starkiewicz <[email protected]> * Update websites/N/Notespace/metadata.json Co-authored-by: Daniel Lau <[email protected]> Signed-off-by: Mateusz Starkiewicz <[email protected]> * Update websites/N/Notespace/presence.ts Co-authored-by: Daniel Lau <[email protected]> Signed-off-by: Mateusz Starkiewicz <[email protected]> * feat(Notespace): add new image keys and buttons * feat(Notespace): browsing start timestamp in presence.ts * feat(Notespace): forgot to yarn format --------- Signed-off-by: Mateusz Starkiewicz <[email protected]> Co-authored-by: Daniel Lau <[email protected]>
- Loading branch information
1 parent
e3b6a1f
commit 5db6dca
Showing
2 changed files
with
113 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"$schema": "https://schemas.premid.app/metadata/1.9", | ||
"author": { | ||
"id": "630812692659044352", | ||
"name": "itsmateo20" | ||
}, | ||
"service": "Notespace", | ||
"description": { | ||
"en": "Notespace is your learning platform. Here you will find tons of notes, videos and much more, all for free!", | ||
"pl": "Notespace to twoja plaforma do nauki. Znajdziesz tutaj mnóstwo notatek, filmów i wiele więcej, a to wszystko za darmo!" | ||
}, | ||
"url": "notespace.edu.pl", | ||
"version": "1.0.0", | ||
"logo": "https://i.imgur.com/W7Ybot8.png", | ||
"thumbnail": "https://i.imgur.com/Xw72bq6.png", | ||
"color": "#111111", | ||
"category": "other", | ||
"tags": [ | ||
"learning", | ||
"e-learning", | ||
"notes", | ||
"exams" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
const presence = new Presence({ | ||
clientId: "1193651901221306378", | ||
}), | ||
browsingTimestamp = Math.floor(Date.now() / 1000); | ||
|
||
const enum Assets { | ||
Icon = "https://i.imgur.com/W7Ybot8.png", | ||
} | ||
|
||
presence.on("UpdateData", async () => { | ||
const currentPath = document.location.pathname, | ||
presenceData: PresenceData = { | ||
details: "Twoja wiedza jest tu", | ||
largeImageKey: Assets.Icon, | ||
smallImageKey: Assets.Viewing, | ||
smallImageText: "Przegląda...", | ||
startTimestamp: browsingTimestamp, | ||
buttons: [ | ||
{ | ||
label: "Odwiedź stronę o nas", | ||
url: "https://notespace.edu.pl/o-nas", | ||
}, | ||
], | ||
}; | ||
|
||
if (currentPath.endsWith("/") || currentPath.includes("strona-glowna")) | ||
presenceData.details = "Przegląda stronę główną"; | ||
else if (currentPath.includes("kursy")) { | ||
presenceData.details = "Przegląda kursy"; | ||
presenceData.smallImageKey = Assets.Reading; | ||
presenceData.smallImageText = "Czyta..."; | ||
presenceData.state = document.querySelector("h1").textContent; | ||
} else if (currentPath.includes("kurs")) { | ||
presenceData.details = "Przegląda kurs"; | ||
presenceData.smallImageKey = Assets.Reading; | ||
presenceData.smallImageText = "Czyta..."; | ||
presenceData.state = document.querySelector("h1").textContent; | ||
} else if (currentPath.includes("ankieta")) { | ||
presenceData.details = "Przegląda strone ankiety"; | ||
presenceData.state = "Wypełnia ankietę"; | ||
presenceData.smallImageKey = Assets.Writing; | ||
presenceData.smallImageText = "Pisze..."; | ||
presenceData.buttons = [ | ||
{ label: "Odwiedź stronę o nas", url: "https://notespace.edu.pl/o-nas" }, | ||
{ label: "Wypełnij ankietę", url: "https://notespace.edu.pl/ankieta" }, | ||
]; | ||
} else if (currentPath.includes("o-nas")) | ||
presenceData.details = "Przegląda strone o nas"; | ||
else if (currentPath.includes("kontakt")) { | ||
presenceData.details = "Przegląda strone kontaktów"; | ||
presenceData.smallImageKey = Assets.Call; | ||
presenceData.smallImageText = "Kontaktuje się z nami..."; | ||
presenceData.buttons = [ | ||
{ label: "Odwiedź stronę o nas", url: "https://notespace.edu.pl/o-nas" }, | ||
{ | ||
label: "Skontaktuj się z nami", | ||
url: "https://notespace.edu.pl/kontakt", | ||
}, | ||
]; | ||
} else if (currentPath.includes("dokumenty")) | ||
presenceData.details = "Przegląda stronę dokumentów"; | ||
else if (currentPath.includes("polityka-prywatnosci")) { | ||
presenceData.details = "Przegląda dokument"; | ||
presenceData.state = "Polityka prywatności"; | ||
presenceData.smallImageKey = Assets.Reading; | ||
presenceData.smallImageText = "Czyta..."; | ||
presenceData.buttons = [ | ||
{ label: "Odwiedź stronę o nas", url: "https://notespace.edu.pl/o-nas" }, | ||
{ | ||
label: "Dowiedz sie o naszej polityce", | ||
url: "https://notespace.edu.pl/polityka-prywatnosci", | ||
}, | ||
]; | ||
} else if (currentPath.includes("polityka-cookies")) { | ||
presenceData.details = "Przegląda dokument"; | ||
presenceData.state = "Polityka cookies"; | ||
presenceData.smallImageKey = Assets.Reading; | ||
presenceData.smallImageText = "Czyta..."; | ||
presenceData.buttons = [ | ||
{ label: "Odwiedź stronę o nas", url: "https://notespace.edu.pl/o-nas" }, | ||
{ | ||
label: "Dowiedz sie o naszej polityce", | ||
url: "https://notespace.edu.pl/polityka-cookies", | ||
}, | ||
]; | ||
} | ||
|
||
presence.setActivity(presenceData); | ||
}); |