Skip to content

Commit

Permalink
Merge pull request #2231 from h3poteto/iss-2228
Browse files Browse the repository at this point in the history
refs #2228 Support sharkey
  • Loading branch information
h3poteto authored Nov 19, 2024
2 parents 0e54246 + 95d1aa3 commit 34eaa69
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 24 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ The Rust version is [megalodon-rs](https://github.com/h3poteto/megalodon-rs).
- [x] Firefish <img src="https://cdn.simpleicons.org/firefish" alt="Firefish" width=16 height=16>
- [x] Gotosocial
- [x] Akkoma (Unofficial)
- [x] Sharkey (Unofficial)
- [x] Hometown (Unofficial)
- [x] Iceshrimp (Unofficial)

## Features

Expand Down
60 changes: 36 additions & 24 deletions megalodon/src/detector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,20 +59,24 @@ export const detector = async (url: string): Promise<'mastodon' | 'pleroma' | 'f
case NODEINFO_10: {
const res = await axios.get<Nodeinfo10>(link.href, options)
switch (res.data.software.name) {
case 'pleroma':
return 'pleroma'
case 'akkoma':
return 'pleroma'
case 'mastodon':
return 'mastodon'
case 'friendica':
return 'friendica'
case 'firefish':
return 'firefish'
case 'iceshrimp':
return 'firefish'
case 'friendica':
return 'friendica'
case 'gotosocial':
return 'gotosocial'
case 'hometown':
return 'mastodon'
case 'iceshrimp':
return 'firefish'
case 'mastodon':
return 'mastodon'
case 'pleroma':
return 'pleroma'
case 'sharkey':
return 'mastodon'
default:
if (res.data.metadata.upstream?.name && res.data.metadata.upstream.name.toLowerCase() === 'mastodon') {
return 'mastodon'
Expand All @@ -83,20 +87,24 @@ export const detector = async (url: string): Promise<'mastodon' | 'pleroma' | 'f
case NODEINFO_20: {
const res = await axios.get<Nodeinfo20>(link.href, options)
switch (res.data.software.name) {
case 'pleroma':
return 'pleroma'
case 'akkoma':
return 'pleroma'
case 'mastodon':
return 'mastodon'
case 'friendica':
return 'friendica'
case 'firefish':
return 'firefish'
case 'iceshrimp':
return 'firefish'
case 'friendica':
return 'friendica'
case 'gotosocial':
return 'gotosocial'
case 'hometown':
return 'mastodon'
case 'iceshrimp':
return 'firefish'
case 'mastodon':
return 'mastodon'
case 'pleroma':
return 'pleroma'
case 'sharkey':
return 'mastodon'
default:
if (res.data.metadata.upstream?.name && res.data.metadata.upstream.name.toLowerCase() === 'mastodon') {
return 'mastodon'
Expand All @@ -107,20 +115,24 @@ export const detector = async (url: string): Promise<'mastodon' | 'pleroma' | 'f
case NODEINFO_21: {
const res = await axios.get<Nodeinfo21>(link.href, options)
switch (res.data.software.name) {
case 'pleroma':
return 'pleroma'
case 'akkoma':
return 'pleroma'
case 'mastodon':
return 'mastodon'
case 'friendica':
return 'friendica'
case 'firefish':
return 'firefish'
case 'iceshrimp':
return 'firefish'
case 'friendica':
return 'friendica'
case 'gotosocial':
return 'gotosocial'
case 'hometown':
return 'mastodon'
case 'iceshrimp':
return 'firefish'
case 'mastodon':
return 'mastodon'
case 'pleroma':
return 'pleroma'
case 'sharkey':
return 'mastodon'
default:
if (res.data.metadata.upstream?.name && res.data.metadata.upstream.name.toLowerCase() === 'mastodon') {
return 'mastodon'
Expand Down

0 comments on commit 34eaa69

Please sign in to comment.