Skip to content

Commit

Permalink
refs #2228 Support sharkey
Browse files Browse the repository at this point in the history
  • Loading branch information
h3poteto committed Nov 19, 2024
1 parent 0e54246 commit 1d9e8c3
Showing 1 changed file with 36 additions and 24 deletions.
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 1d9e8c3

Please sign in to comment.