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 avatar
banner banner
} }
instanceFeeds {
enabled
}
} }
} }
`; `;
@ -113,6 +116,9 @@ export const ABOUT = gql`
} }
version version
federating 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 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 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.", "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 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 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.", "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; avatar: number;
banner: number; banner: number;
}; };
instanceFeeds: {
enabled: boolean;
};
} }

View File

@ -42,9 +42,13 @@
<table class="table is-fullwidth"> <table class="table is-fullwidth">
<tr> <tr>
<td>{{ $t("Instance languages") }}</td> <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 }} {{ formattedLanguageList }}
</td> </td>
<td v-else>{{ $t("No information") }}</td>
</tr> </tr>
<tr> <tr>
<td>{{ $t("Mobilizon version") }}</td> <td>{{ $t("Mobilizon version") }}</td>
@ -72,6 +76,29 @@
</td> </td>
<td v-else>{{ $t("Disabled") }}</td> <td v-else>{{ $t("Disabled") }}</td>
</tr> </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> </table>
</section> </section>
</div> </div>
@ -177,5 +204,14 @@ section {
} }
} }
} }
tr.instance-feeds {
height: 3rem;
td:first-child {
vertical-align: middle;
}
td:last-child {
height: 3rem;
}
}
} }
</style> </style>

View File

@ -108,6 +108,10 @@ export const configMock = {
avatar: 2_000_000, avatar: 2_000_000,
banner: 4_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]), default: Config.get([:instance, :upload_limit]),
avatar: Config.get([:instance, :avatar_upload_limit]), avatar: Config.get([:instance, :avatar_upload_limit]),
banner: Config.get([:instance, :banner_upload_limit]) banner: Config.get([:instance, :banner_upload_limit])
},
instance_feeds: %{
enabled: Config.get([:instance, :enable_instance_feeds])
} }
} }
end end

View File

@ -63,6 +63,7 @@ defmodule Mobilizon.GraphQL.Schema.ConfigType do
field(:rules, :string, description: "The instance's rules") field(:rules, :string, description: "The instance's rules")
field(:auth, :auth, description: "The instance auth methods") field(:auth, :auth, description: "The instance auth methods")
field(:instance_feeds, :instance_feeds, description: "The instance's feed settings")
end end
@desc """ @desc """
@ -294,6 +295,10 @@ defmodule Mobilizon.GraphQL.Schema.ConfigType do
field(:banner, :integer, description: "The banner limitation, in bytes") field(:banner, :integer, description: "The banner limitation, in bytes")
end end
object :instance_feeds do
field(:enabled, :boolean, description: "Whether the instance-wide feeds are enabled")
end
object :config_queries do object :config_queries do
@desc "Get the instance config" @desc "Get the instance config"
field :config, :config do field :config, :config do