Expose instance feed config option in the API and show it on About page

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2021-04-19 12:40:51 +02:00
parent cd874e1bfc
commit bcf52ccdf7
No known key found for this signature in database
GPG key ID: A061B9DDE0CA0773
8 changed files with 62 additions and 3 deletions

View file

@ -80,6 +80,9 @@ export const CONFIG = gql`
avatar
banner
}
instanceFeeds {
enabled
}
}
}
`;
@ -113,6 +116,9 @@ export const ABOUT = gql`
}
version
federating
instanceFeeds {
enabled
}
}
}
`;

View file

@ -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"
}

View file

@ -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"
}

View file

@ -94,4 +94,7 @@ export interface IConfig {
avatar: number;
banner: number;
};
instanceFeeds: {
enabled: boolean;
};
}

View file

@ -42,9 +42,13 @@
<table class="table is-fullwidth">
<tr>
<td>{{ $t("Instance languages") }}</td>
<td :title="this.config ? this.config.languages.join(', ') : ''">
<td
v-if="config.languages.length > 0"
:title="this.config ? this.config.languages.join(', ') : ''"
>
{{ formattedLanguageList }}
</td>
<td v-else>{{ $t("No information") }}</td>
</tr>
<tr>
<td>{{ $t("Mobilizon version") }}</td>
@ -72,6 +76,29 @@
</td>
<td v-else>{{ $t("Disabled") }}</td>
</tr>
<tr class="instance-feeds">
<td>{{ $t("Instance feeds") }}</td>
<td v-if="config.instanceFeeds.enabled" class="buttons">
<b-button
tag="a"
size="is-small"
icon-left="rss"
href="/feed/instance/atom"
target="_blank"
>{{ $t("RSS/Atom Feed") }}</b-button
>
<b-button
tag="a"
size="is-small"
icon-left="calendar-sync"
href="/feed/instance/ics"
target="_blank"
>{{ $t("ICS/WebCal Feed") }}</b-button
>
</td>
<td v-else>{{ $t("Disabled") }}</td>
</tr>
</table>
</section>
</div>
@ -177,5 +204,14 @@ section {
}
}
}
tr.instance-feeds {
height: 3rem;
td:first-child {
vertical-align: middle;
}
td:last-child {
height: 3rem;
}
}
}
</style>

View file

@ -108,6 +108,10 @@ export const configMock = {
avatar: 2_000_000,
banner: 4_000_000,
},
instanceFeeds: {
__typename: "InstanceFeeds",
enabled: false,
},
},
},
};

View file

@ -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

View file

@ -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