-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
feat(Moodle UTC): add activity #10360
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
base: main
Are you sure you want to change the base?
Changes from all commits
81c66d6
8524d46
43d63ad
7bd82ba
9d49c90
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| { | ||
| "$schema": "https://schemas.premid.app/metadata/1.16", | ||
| "apiVersion": 1, | ||
| "author": { | ||
| "id": "357901042895028226", | ||
| "name": "revaliiuwu" | ||
| }, | ||
| "service": "Moodle UTC", | ||
| "description": { | ||
| "en": "Affiche l'activité sur le Moodle de l'UTC" | ||
| }, | ||
| "url": "moodle.utc.fr", | ||
| "regExp": "moodle\\.utc\\.fr", | ||
| "version": "1.0.0", | ||
| "logo": "https://i.imgur.com/oMApXis.png", | ||
Check failureCode scanning / PMD Makes sure all images (logo and URLs) are exactly 512x512 pixels Error
Image URL dimensions must be exactly 512x512 pixels, got 802x791 for URL: https://i.imgur.com/oMApXis.png
|
||
| "thumbnail": "https://i.imgur.com/45X0M1t.jpeg", | ||
| "color": "#ffcc00", | ||
| "category": "other", | ||
| "tags": [ | ||
| "utc", | ||
| "education" | ||
| ] | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| import { ActivityType } from 'premid' | ||
|
|
||
| const presence = new Presence({ | ||
| clientId: '1459651066508345394' | ||
| }) | ||
|
Comment on lines
+4
to
+5
Check failureCode scanning / ESLint Require or disallow trailing commas Error
Missing trailing comma.
|
||
|
|
||
| const startTimestamp = Math.floor(Date.now() / 1000) | ||
|
|
||
| presence.on('UpdateData', async () => { | ||
| const presenceData: PresenceData = { | ||
| type: ActivityType.Watching, | ||
| largeImageKey: 'https://i.imgur.com/oMApXis.png', | ||
Check failureCode scanning / PMD Makes sure all images (logo and URLs) are exactly 512x512 pixels Error
Image URL dimensions must be exactly 512x512 pixels, got 802x791 for URL: https://i.imgur.com/oMApXis.png
|
||
| largeImageText: 'Moodle UTC', | ||
| startTimestamp | ||
| } | ||
|
Comment on lines
+14
to
+15
Check failureCode scanning / ESLint Require or disallow trailing commas Error
Missing trailing comma.
|
||
|
|
||
| const path = document.location.pathname; | ||
Check failureCode scanning / ESLint Require or disallow semicolons instead of ASI Error
Extra semicolon.
|
||
|
|
||
| if (path.includes('/course/view.php')) { | ||
| const courseTitle = document.querySelector('h1')?.textContent || 'Un cours'; | ||
Check failureCode scanning / ESLint Require or disallow semicolons instead of ASI Error
Extra semicolon.
|
||
| presenceData.details = courseTitle; | ||
Check failureCode scanning / ESLint Require or disallow semicolons instead of ASI Error
Extra semicolon.
|
||
| presenceData.state = 'En train d\'étudier'; | ||
Check failureCode scanning / ESLint Require or disallow semicolons instead of ASI Error
Extra semicolon.
|
||
| } else if (path === '/' || path.includes('/my/')) { | ||
Check failureCode scanning / ESLint Enforce consistent brace style for blocks Error
Closing curly brace appears on the same line as the subsequent block.
|
||
| presenceData.details = 'Sur l\'accueil'; | ||
Check failureCode scanning / ESLint Require or disallow semicolons instead of ASI Error
Extra semicolon.
|
||
| presenceData.state = 'Choisit son prochain cours'; | ||
Check failureCode scanning / ESLint Require or disallow semicolons instead of ASI Error
Extra semicolon.
|
||
| } else { | ||
Check failureCode scanning / ESLint Enforce consistent brace style for blocks Error
Closing curly brace appears on the same line as the subsequent block.
|
||
| presenceData.details = 'Navigue sur Moodle'; | ||
Check failureCode scanning / ESLint Require or disallow semicolons instead of ASI Error
Extra semicolon.
|
||
| presenceData.state = 'UTC - Compiègne'; | ||
Check failureCode scanning / ESLint Require or disallow semicolons instead of ASI Error
Extra semicolon.
|
||
| } | ||
|
|
||
| presence.setActivity(presenceData); | ||
Check failureCode scanning / ESLint Require or disallow semicolons instead of ASI Error
Extra semicolon.
|
||
| }); | ||
Check failureCode scanning / ESLint Require or disallow semicolons instead of ASI Error
Extra semicolon.
|
||
Check failure
Code scanning / PMD
Validates that activity URLs have valid DNS records Error