-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
feat(PsychonautWiki): add activity #10349
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
Merged
+80
−0
Merged
Changes from all commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
da0d372
Add Psychonaut Wiki activity
Zinibow 5c775e8
Fixed Code
Zinibow 7ac34b8
Fixed Website Detection
Zinibow 420cfc6
Fixed Random Stuff
Zinibow 3dab617
Fixed Logos And Timestamps
Zinibow c4071aa
Fixed Random
Zinibow cb8fa1a
Removed Comment
Zinibow 2e276cf
Fix ESLints Dumb Errors
Zinibow 18d41e5
Fix ESLints Dumb Errors V2
Zinibow 3ae0964
Fix ESLints Dumb Errors
Zinibow f708327
Fix ESLints Dumb Errors V2
Zinibow 51c7ec1
Fix ESLints Dumb Errors FINAL
Zinibow b9547e3
Fix ESLints Dumb Errors Final V2
Zinibow cdc9ec9
Added Editing Articles
Zinibow 8f48264
Fixed All ESLint Issues
Zinibow 879003f
Fixed ESLint V2
Zinibow dcf3a43
Did Recommended Changes
Zinibow f540062
Did Recommended Changes V2
Zinibow ad4c52a
Added API Version
Zinibow 7c3088a
Fixed API Version
Zinibow f12dce8
Removed Useless Website Matching
Zinibow a35775e
Removed Useless Website Matching V2
Zinibow a5209fb
Merge branch 'PreMiD:main' into Psychonaut-Wiki
Zinibow 7a2ff25
Fixed ESLint Issues
Zinibow 286a04d
Fixed Random Stuff
Zinibow 0186397
Added Space In Folder Names
Zinibow 56569cc
Fixed service
Zinibow e53cd2b
Fixed Accidental Changes To Other Folders
Zinibow d175b45
Fixed Accidental Changes To Other Folders V2
Zinibow 6cfa92e
Fixed Folder Names
Zinibow 0d994f7
Changed Version
Zinibow 06bc1ca
Fixed Version And Removed Useless Folders
Zinibow 8a5016b
Update websites/P/Psychonaut Wiki/metadata.json
Zinibow File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,27 @@ | ||
| { | ||
| "$schema": "https://schemas.premid.app/metadata/1.16", | ||
Zinibow marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| "apiVersion": 1, | ||
| "author": { | ||
| "id": "538604507064696832", | ||
| "name": "talon2" | ||
| }, | ||
| "service": "Psychonaut Wiki", | ||
| "altnames": [ | ||
| "PsychonautWiki" | ||
| ], | ||
| "description": { | ||
| "en": "PsychonautWiki is an encyclopedia that documents all aspects of psychonautic theory from an evidence-based perspective. It provides education, encourages safe practices, and emphasizes that substances should not be abused. Do not do drugs." | ||
| }, | ||
| "url": "psychonautwiki.org", | ||
| "regExp": "^https?[:][/][/]([a-z0-9-]+[.])*psychonautwiki[.]org[/]", | ||
| "version": "1.0.0", | ||
| "logo": "https://i.imgur.com/GPxHYOV.png", | ||
| "thumbnail": "https://i.imgur.com/QwNGXcq.png", | ||
| "color": "#808080", | ||
| "category": "other", | ||
| "tags": [ | ||
| "drugs", | ||
| "harm-reduction", | ||
| "psychonaut" | ||
| ] | ||
| } | ||
This file contains hidden or 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,53 @@ | ||
| const browsingTimestamp = Math.floor(Date.now() / 1000) | ||
|
|
||
| const presence = new Presence({ | ||
| clientId: '1432152324163502130', | ||
| }) | ||
|
|
||
| presence.on('UpdateData', async () => { | ||
| const { pathname, search } = document.location | ||
| const params = new URLSearchParams(search) | ||
|
|
||
| let articleName: string | null = null | ||
|
|
||
| // /w/index.php?title=ArticleName | ||
| if (params.has('title')) { | ||
| articleName = decodeURIComponent(params.get('title')!) | ||
| .replace(/_/g, ' ') | ||
| .trim() | ||
| } | ||
| // /wiki/ArticleName | ||
| else if (pathname.startsWith('/wiki/')) { | ||
| articleName = decodeURIComponent(pathname.slice(6)) | ||
| .replace(/_/g, ' ') | ||
| .trim() | ||
| } | ||
|
|
||
| const action = params.get('action') | ||
| const isEditing | ||
| = params.has('veaction') | ||
| || action === 'edit' | ||
| || action === 'submit' | ||
|
|
||
| const presenceData: PresenceData = { | ||
| largeImageKey: 'https://i.imgur.com/GPxHYOV.png', | ||
| startTimestamp: browsingTimestamp, | ||
| } | ||
|
|
||
| if (isEditing) { | ||
| presenceData.details = articleName | ||
| ? `Editing article "${articleName}"` | ||
| : 'Editing article' | ||
| } | ||
| else if (pathname === '/wiki/Main_Page') { | ||
| presenceData.details = 'Browsing the Main Page' | ||
| } | ||
| else if (articleName) { | ||
| presenceData.details = `Browsing the article "${articleName}"` | ||
| } | ||
| else { | ||
| presenceData.details = 'Browsing the Wiki' | ||
| } | ||
|
|
||
| presence.setActivity(presenceData) | ||
| }) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.