Basic Smithereen support

This commit is contained in:
Inex Code 2021-07-30 19:54:37 +03:00
parent 88f1c54f8e
commit 1c5faa1ee1
3 changed files with 5 additions and 2 deletions

View file

@ -18,7 +18,7 @@ defmodule Backend.Crawler.ApiCrawler do
# {domain, type} e.g. {"gab.com", "reject"}
@type federation_restriction :: {String.t(), String.t()}
@type instance_type :: :mastodon | :pleroma | :gab | :misskey | :gnusocial
@type instance_type :: :mastodon | :pleroma | :gab | :misskey | :gnusocial | :smithereen
defstruct [
:version,

View file

@ -12,7 +12,7 @@ defmodule Backend.Crawler.Crawlers.Mastodon do
@impl ApiCrawler
def is_instance_type?(domain, result) do
# We might already know that this is a Pleroma instance from nodeinfo
if result != nil and Map.get(result, :instance_type) == :pleroma do
if result != nil and ( Map.get(result, :instance_type) == :pleroma or Map.get(result, :instance_type) == :smithereen ) do
true
else
case get_and_decode("https://#{domain}/api/v1/instance") do
@ -230,6 +230,7 @@ defmodule Backend.Crawler.Crawlers.Mastodon do
defp get_instance_type(instance_stats) do
cond do
Map.get(instance_stats, "version") |> String.downcase() =~ "pleroma" -> :pleroma
Map.get(instance_stats, "version") |> String.downcase() =~ "smithereen" -> :smithereen
is_gab?(instance_stats) -> :gab
true -> :mastodon
end

View file

@ -20,6 +20,7 @@ export const QUALITATIVE_COLOR_SCHEME = [
"#AD99FF",
"#0E5A8A",
"#0A6640",
"#AAB42F",
"#A66321",
"#A82A2A",
];
@ -56,4 +57,5 @@ export const INSTANCE_TYPES = [
"hubzilla",
"plume",
"wordpress",
"smithereen",
];