diff --git a/js/src/graphql/config.ts b/js/src/graphql/config.ts
index 80e79b624..17402aa23 100644
--- a/js/src/graphql/config.ts
+++ b/js/src/graphql/config.ts
@@ -80,6 +80,9 @@ export const CONFIG = gql`
avatar
banner
}
+ instanceFeeds {
+ enabled
+ }
}
}
`;
@@ -113,6 +116,9 @@ export const ABOUT = gql`
}
version
federating
+ instanceFeeds {
+ enabled
+ }
}
}
`;
diff --git a/js/src/i18n/en_US.json b/js/src/i18n/en_US.json
index 3be39740e..7498744f6 100644
--- a/js/src/i18n/en_US.json
+++ b/js/src/i18n/en_US.json
@@ -984,5 +984,6 @@
"Unable to create the group. One of the pictures may be too heavy.": "Unable to create the group. One of the pictures may be too heavy.",
"Unable to update the profile. The avatar picture may be too heavy.": "Unable to update the profile. The avatar picture may be too heavy.",
"Unable to create the profile. The avatar picture may be too heavy.": "Unable to create the profile. The avatar picture may be too heavy.",
- "Error while loading the preview": "Error while loading the preview"
+ "Error while loading the preview": "Error while loading the preview",
+ "Instance feeds": "Instance feeds"
}
diff --git a/js/src/i18n/fr_FR.json b/js/src/i18n/fr_FR.json
index 32fdae799..64f62c690 100644
--- a/js/src/i18n/fr_FR.json
+++ b/js/src/i18n/fr_FR.json
@@ -1078,5 +1078,6 @@
"Unable to create the group. One of the pictures may be too heavy.": "Impossible de créer le groupe. Une des images est trop lourde.",
"Unable to update the profile. The avatar picture may be too heavy.": "Impossible de mettre à jour le profil. L'image d'avatar est probablement trop lourde.",
"Unable to create the profile. The avatar picture may be too heavy.": "Impossible de créer le profil. L'image d'avatar est probablement trop lourde.",
- "Error while loading the preview": "Erreur lors du chargement de l'aperçu"
+ "Error while loading the preview": "Erreur lors du chargement de l'aperçu",
+ "Instance feeds": "Flux de l'instance"
}
diff --git a/js/src/types/config.model.ts b/js/src/types/config.model.ts
index d4105a63f..6194115f8 100644
--- a/js/src/types/config.model.ts
+++ b/js/src/types/config.model.ts
@@ -94,4 +94,7 @@ export interface IConfig {
avatar: number;
banner: number;
};
+ instanceFeeds: {
+ enabled: boolean;
+ };
}
diff --git a/js/src/views/About/AboutInstance.vue b/js/src/views/About/AboutInstance.vue
index 590089348..8dcb96433 100644
--- a/js/src/views/About/AboutInstance.vue
+++ b/js/src/views/About/AboutInstance.vue
@@ -42,9 +42,13 @@
{{ $t("Instance languages") }} |
-
+ |
{{ formattedLanguageList }}
|
+ {{ $t("No information") }} |
{{ $t("Mobilizon version") }} |
@@ -72,6 +76,29 @@
{{ $t("Disabled") }} |
+
+ {{ $t("Instance feeds") }} |
+
+ {{ $t("RSS/Atom Feed") }}
+
+ {{ $t("ICS/WebCal Feed") }}
+ |
+ {{ $t("Disabled") }} |
+
@@ -177,5 +204,14 @@ section {
}
}
}
+ tr.instance-feeds {
+ height: 3rem;
+ td:first-child {
+ vertical-align: middle;
+ }
+ td:last-child {
+ height: 3rem;
+ }
+ }
}
diff --git a/js/tests/unit/specs/mocks/config.ts b/js/tests/unit/specs/mocks/config.ts
index 70ee08d75..1cfd467a0 100644
--- a/js/tests/unit/specs/mocks/config.ts
+++ b/js/tests/unit/specs/mocks/config.ts
@@ -108,6 +108,10 @@ export const configMock = {
avatar: 2_000_000,
banner: 4_000_000,
},
+ instanceFeeds: {
+ __typename: "InstanceFeeds",
+ enabled: false,
+ },
},
},
};
diff --git a/lib/graphql/resolvers/config.ex b/lib/graphql/resolvers/config.ex
index f7b15a063..a56a7d655 100644
--- a/lib/graphql/resolvers/config.ex
+++ b/lib/graphql/resolvers/config.ex
@@ -139,6 +139,9 @@ defmodule Mobilizon.GraphQL.Resolvers.Config do
default: Config.get([:instance, :upload_limit]),
avatar: Config.get([:instance, :avatar_upload_limit]),
banner: Config.get([:instance, :banner_upload_limit])
+ },
+ instance_feeds: %{
+ enabled: Config.get([:instance, :enable_instance_feeds])
}
}
end
diff --git a/lib/graphql/schema/config.ex b/lib/graphql/schema/config.ex
index 1feafb1bb..ac2353e47 100644
--- a/lib/graphql/schema/config.ex
+++ b/lib/graphql/schema/config.ex
@@ -63,6 +63,7 @@ defmodule Mobilizon.GraphQL.Schema.ConfigType do
field(:rules, :string, description: "The instance's rules")
field(:auth, :auth, description: "The instance auth methods")
+ field(:instance_feeds, :instance_feeds, description: "The instance's feed settings")
end
@desc """
@@ -294,6 +295,10 @@ defmodule Mobilizon.GraphQL.Schema.ConfigType do
field(:banner, :integer, description: "The banner limitation, in bytes")
end
+ object :instance_feeds do
+ field(:enabled, :boolean, description: "Whether the instance-wide feeds are enabled")
+ end
+
object :config_queries do
@desc "Get the instance config"
field :config, :config do
diff --git a/lib/mobilizon/addresses/address.ex b/lib/mobilizon/addresses/address.ex
index 5706748a6..c2d71bb20 100644
--- a/lib/mobilizon/addresses/address.ex
+++ b/lib/mobilizon/addresses/address.ex
@@ -83,8 +83,10 @@ defmodule Mobilizon.Addresses.Address do
def representation(nil), do: nil
def representation(%__MODULE__{} = address) do
- "#{address.street} #{address.postal_code} #{address.locality} #{address.region} #{
- address.country
- }"
+ String.trim(
+ "#{address.street} #{address.postal_code} #{address.locality} #{address.region} #{
+ address.country
+ }"
+ )
end
end
diff --git a/lib/service/metadata/instance.ex b/lib/service/metadata/instance.ex
index 5c88e4478..776a613d9 100644
--- a/lib/service/metadata/instance.ex
+++ b/lib/service/metadata/instance.ex
@@ -9,6 +9,8 @@ defmodule Mobilizon.Service.Metadata.Instance do
alias Mobilizon.Config
alias Mobilizon.Service.Metadata.Utils
alias Mobilizon.Web.Endpoint
+ alias Mobilizon.Web.Router.Helpers, as: Routes
+ import Mobilizon.Web.Gettext
@doc """
Build the list of tags for the instance
@@ -40,6 +42,26 @@ defmodule Mobilizon.Service.Metadata.Instance do
Tag.tag(:meta, property: "og:description", content: description),
Tag.tag(:meta, property: "og:type", content: "website"),
HTML.raw(instance_json_ld)
+ ] ++ maybe_add_instance_feeds(Config.get([:instance, :enable_instance_feeds]))
+ end
+
+ @spec maybe_add_instance_feeds(boolean()) :: list()
+ defp maybe_add_instance_feeds(true) do
+ [
+ Tag.tag(:link,
+ rel: "alternate",
+ type: "application/atom+xml",
+ title: gettext("%{name}'s feed", name: Config.instance_name()) |> HTML.raw(),
+ href: Routes.feed_url(Endpoint, :instance, :atom)
+ ),
+ Tag.tag(:link,
+ rel: "alternate",
+ type: "text/calendar",
+ title: gettext("%{name}'s feed", name: Config.instance_name()) |> HTML.raw(),
+ href: Routes.feed_url(Endpoint, :instance, :ics)
+ )
]
end
+
+ defp maybe_add_instance_feeds(false), do: []
end