-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
feat(Hangar): add activity #10892
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?
feat(Hangar): add activity #10892
Changes from 61 commits
a814446
79ebda5
ca4f99b
12b42ef
3f286a8
6322f39
eb6aa7f
bcd8090
bd20caa
9cfea9b
34a9709
e93f5cc
2c9c1b4
b0602a4
2774cd1
3c55c35
9d922c4
4a4a125
277b5be
190501b
2ef9335
cd069f1
3bed5aa
cb26c12
9322980
ee47959
480aad6
901b31d
f70dc1e
de54b80
5a8abbb
2d11fba
27cb815
e883f2d
801ffa9
56e4b14
c574861
16e471f
b94cf71
3c7da61
60e90f6
8ab65fe
be9e570
3964dfe
77bd561
6d2a1b9
b7b6bcf
ad2f8e3
850c6f9
62181a6
8833a93
b0f9fab
b250105
d3b883c
f613f2e
8bae70e
51f6b78
c15bb53
ef56e55
8cf4ac8
15092e2
f53630d
f3ced89
1033fd4
fccc864
28f2719
727eef1
2ff2a6b
49138a5
874ff61
5f6e309
f3ff3fc
f5ee898
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.8", | ||
|
n4kushi marked this conversation as resolved.
|
||
| "author": { | ||
| "id": "1004301145348526090", | ||
| "name": "RuaLia" | ||
| }, | ||
| "service": "hangar", | ||
| "description": { | ||
| "en": "Shows your current activity on the Hangar platform.", | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should be the description of the website, not the activity. |
||
| "tr": "Hangar platformundaki güncel aktivitenizi Discord'da gösterir." | ||
|
Comment on lines
+9
to
+10
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should be the description of the website, not the activity.
Comment on lines
+9
to
+10
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should be the description of the website, not the activity. |
||
| }, | ||
| "url": "usehangar.gg", | ||
|
github-advanced-security[bot] marked this conversation as resolved.
Fixed
|
||
| "regExp": "^https?[:][/][/](www[.])?usehangar[.]gg[/]", | ||
| "version": "1.0.0", | ||
| "logo": "https://i.imgur.com/w5FbdFC.png", | ||
| "thumbnail": "https://i.imgur.com/w5FbdFC.png", | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thumbnail should be a landscape promotional image or screenshot not the logo |
||
| "color": "#111111", | ||
| "category": "socials", | ||
| "tags": [ | ||
| "community", | ||
| "forum", | ||
| "socials" | ||
| ] | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| import { ActivityType, Assets, getTimestamps } from 'premid' | ||
Check failureCode scanning / ESLint Disallow unused variables Error
'ActivityType' is defined but never used.
Check failureCode scanning / ESLint Disallow unused variables Error
'Assets' is defined but never used.
Check failureCode scanning / ESLint Disallow unused variables Error
'getTimestamps' is defined but never used.
|
||
|
github-advanced-security[bot] marked this conversation as resolved.
Fixed
github-advanced-security[bot] marked this conversation as resolved.
Fixed
github-advanced-security[bot] marked this conversation as resolved.
Fixed
|
||
|
|
||
| const presence = new Presence({ | ||
| clientId: '1004301145348526090', | ||
| }) | ||
|
|
||
| const startTimestamp = Math.floor(Date.now() / 1000) | ||
|
|
||
| presence.on('UpdateData', async () => { | ||
| const title = document.title || 'Hangar' | ||
| const path = window.location.pathname | ||
| let data: PresenceData = { | ||
|
github-advanced-security[bot] marked this conversation as resolved.
Fixed
|
||
| type: 'WATCHING', | ||
Check failureCode scanning / PMD Makes sure the TypeScript files are correct Error
Type 'string' is not assignable to type 'ActivityType | undefined'.
|
||
|
github-advanced-security[bot] marked this conversation as resolved.
Fixed
|
||
| largeImageKey: 'logo', | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use image URL instead of asset name |
||
| largeImageText: 'usehangar.gg', | ||
| startTimestamp, | ||
| details: 'Browsing Hangar', | ||
| state: 'Viewing pages', | ||
| } | ||
|
|
||
| if (path === '/' || path === '/feed') { | ||
| data.details = 'Browsing the homepage' | ||
| data.state = 'Viewing the feed' | ||
| } | ||
| else if (path.startsWith('/hub/')) { | ||
| const hubName = title.split(' | ')[0] || 'A Hub' | ||
|
|
||
| data = { | ||
| type: 3, | ||
| largeImageKey: 'logo', | ||
| largeImageText: 'usehangar.gg', | ||
| startTimestamp, | ||
| details: 'Viewing a Hub', | ||
| state: hubName, | ||
| smallImageKey: 'logo', | ||
| smallImageText: 'Hangar', | ||
| } | ||
| } | ||
| else if (path.startsWith('/profile/')) { | ||
| const user = title.split(' | ')[0] || 'A profile' | ||
|
|
||
| data = { | ||
| type: 3, | ||
| largeImageKey: 'logo', | ||
| largeImageText: 'usehangar.gg', | ||
| startTimestamp, | ||
| details: 'Viewing a profile', | ||
| state: user, | ||
| } | ||
| } | ||
| else if (path.startsWith('/post/')) { | ||
| const postTitle = title.split(' | ')[0] || 'A post' | ||
|
|
||
| data = { | ||
| type: 3, | ||
| largeImageKey: 'logo', | ||
| largeImageText: 'usehangar.gg', | ||
| startTimestamp, | ||
| details: 'Reading a post', | ||
| state: postTitle, | ||
| } | ||
| } | ||
|
|
||
| presence.setActivity(data) | ||
| }) | ||
Uh oh!
There was an error while loading. Please reload this page.