Skip to content

Commit

Permalink
update servers
Browse files Browse the repository at this point in the history
  • Loading branch information
hrefhref committed Aug 15, 2018
1 parent 6641117 commit 9f9b369
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 22 deletions.
66 changes: 45 additions & 21 deletions lib/fd/server_name.ex
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,25 @@ defmodule Fd.ServerName do
11 => "SocialHome", # not AP yet but soon too
12 => "Funkwhale",
13 => "Plume",
14 => "Castling.Club",
15 => "Write.as",
14 => "castling.club",
15 => "write.as",
16 => "MicroblogPub",
}
@server_data %{
0 => %{
slug: "other",
notice: "Warning: Instances with an unknown server may for now not be real instances. the crawler is still under development and may stumble upon non-instances. This will be fixed soon."
},
1 => %{
name: "GNU Social",
slug: "gnusocial",
link: "https://gnu.io/social/",
source: "https://git.gnu.io/gnu/gnu-social/",
notice: "Statistics are not available",
protocols: ["ostatus"],
},
2 => %{
slug: "mastodon",
link: "https://joinmastodon.org",
source: "https://github.com/tootsuite/mastodon",
protocols: ["ostatus", "activitypub"],
Expand All @@ -39,6 +44,7 @@ defmodule Fd.ServerName do
],
},
3 => %{
slug: "pleroma",
link: "https://pleroma.social",
description: "Pleroma is an ActivityPub/OStatus server built on Elixir. New and rising!",
source: "https://git.pleroma.social/pleroma/pleroma",
Expand All @@ -49,6 +55,7 @@ defmodule Fd.ServerName do
],
},
4 => %{
slug: "peertube",
description: "PeerTube is a video streaming platform",
link: "https://joinpeertube.org",
source: "https://github.com/Chocobozzz/PeerTube",
Expand All @@ -58,67 +65,87 @@ defmodule Fd.ServerName do
],
},
5 => %{
slug: "hubzilla",
link: "https://hubzilla.org",
source: "https://github.com/redmatrix/hubzilla",
notice: "Statistics are not available for private instances",
protocols: ["ostatus", "zot"],
},
6 => %{
slug: "postactiv",
link: "https://www.postactiv.com",
source: "http://gitea.postactiv.com/postActiv/postActiv",
notice: "Statistics are not available",
protocols: ["ostatus"],
},
7 => %{
slug: "friendica",
link: "https://friendi.ca/",
source: "https://github.com/friendica/friendica",
notice: "Statistics are not available for private instances",
protocols: ["ostatus"],
},
8 => %{
slug: "kroeg",
description: "Experimental ActivityPub server in Rust",
link: "http://puckipedia.com/kroeg",
source: "https://git.puckipedia.com/kroeg",
protocols: ["activitypub"],
},
9 => %{
slug: "misskey",
source: "https://github.com/syuilo/misskey",
protocols: ["activitypub"],
},
10 => %{
slug: "ganggo",
hidden: true,
notice: "Not compatible ActivityPub yet",
source: "https://github.com/ganggo/ganggo"
},
11 => %{
slug: "socialhome",
hidden: true,
notice: "Not compatible ActivityPub yet",
source: "https://github.com/jaywink/socialhome",
},
12 => %{
slug: "funkwhale",
description: "A modern, convivial and free music server",
link: "https://funkwhale.audio/",
source: "https://code.eliotberriot.com/funkwhale",
protocols: ["activitypub"],
},
13 => %{
slug: "plume",
description: "A federated blog engine",
source: "https://github.com/Plume-org/Plume",
},

# Castling is closed source and single instance so we hide it :)
14 => %{
slug: "castlingclub",
hidden: true,
description: "A federated chess server",
link: "https://castling.club/",
protocols: ["activitypub"],
},
15 => %{
slug: "writeas",
description: "",
link: "https://write.as/",
description: "Simple, connected, privacy-focused blogging platform",
source: false,
protocols: ["activitypub"],
},
16 => %{
name: "microblog.pub",
slug: "microblogpub",
description: "A self-hosted, single-user, ActivityPub powered microblog",
link: "https://microblog.pub/",
source: "https://github.com/tsileo/microblog.pub",
protocols: ["activitypub"],
},
}

@protocols %{
Expand All @@ -133,20 +160,24 @@ defmodule Fd.ServerName do
}

for {id, name} <- @servers do
named = String.downcase(name)
path = named
|> String.downcase()
|> String.replace(" ", "")
data = Map.get(@server_data, id, nil)
{_, _, data} = Map.get(@server_data, id, nil)
|> Macro.escape
data = data |> Enum.into(%{})
path = Map.get(data, :slug)
display_name = Map.get(data, :name, name)
def to_path(unquote(id)), do: unquote(path)
def route_path(unquote(id)), do: "/" <> unquote(path)
def route_path(unquote(name)), do: "/" <> unquote(path)
def route_path(unquote(display_name)), do: "/" <> unquote(path)
def from_int(unquote(id)), do: unquote(name)
def to_int("/"<>unquote(path)), do: unquote(id)
def to_int(unquote(name)), do: unquote(id)
def to_int(unquote(named)), do: unquote(id)
def to_int(unquote(String.downcase(name))), do: unquote(id)
def to_int(unquote(display_name)), do: unquote(id)
def to_int(unquote(path)), do: unquote(id)
def exists?(unquote(name)), do: true
def exists?(unquote(named)), do: true
def data(unquote(id)), do: unquote(data)
def exists?(unquote(path)), do: true
def data(unquote(id)), do: unquote(Macro.escape(data))
end

def from_int(_), do: @default
Expand All @@ -157,6 +188,9 @@ defmodule Fd.ServerName do
def data(_), do: nil

def to_path(0), do: String.downcase(@default)
def route_path(0), do: "/" <> String.downcase(@default)
def route_path("Other"), do: "/" <> String.downcase(@default)


def list_names do
Enum.map(@servers, fn({_, name}) -> name end) ++ [@default]
Expand All @@ -174,22 +208,12 @@ defmodule Fd.ServerName do
|> Enum.map(fn({id, name}) ->
data(id)
|> Map.put(:id, id)
|> Map.put(:name, name)
|> Map.put_new(:name, name)
|> Map.put(:path, to_path(id))
|> Map.put_new(:hidden, false)
end)
|> Enum.sort_by(fn(%{id: id}) -> get_in(stats, ["per_server", id, "instances", "total"])||0 end, &>=/2)
end

def route_path(id) when is_integer(id) do
id |> from_int() |> route_path()
end

def route_path(name) when is_binary(name) do
name = name
|> String.downcase()
|> String.replace(" ", "")
"/" <> name
end

end
2 changes: 1 addition & 1 deletion lib/fd_web/templates/instance/_server_info.html.eex
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<%= if link = Map.get(@data, :link), do: [content_tag(:strong, link("Website", to: link)), raw("&nbsp;")] %>
<%= if link = Map.get(@data, :source), do: [content_tag(:strong, link("Source code", to: link)), raw("&nbsp;")] %>
<%= if Map.get(@data, :source) == false do %>
[content_tag(:strong, "Closed source / Commercial"), raw("&nbsp;")]
<%= [content_tag(:strong, "Closed source / Commercial"), raw("&nbsp;")] %>
<% end %>
<%= if other_stats = Map.get(@data, :other_stats) do %>
<br />
Expand Down

0 comments on commit 9f9b369

Please sign in to comment.