Merge branch 'add-csp-policy-for-pictures' into 'main'

Fix event integrations

See merge request framasoft/mobilizon!1319
This commit is contained in:
Thomas Citharel 2022-11-04 11:29:57 +00:00
commit 88256bddfe
4 changed files with 17 additions and 12 deletions

View File

@ -185,6 +185,9 @@ const { result: personMembershipsResult } = useQuery(
page: 1,
limit: 10,
groupId: route.query?.actorId,
}),
() => ({
enabled: currentActor.value?.id !== undefined,
})
);

View File

@ -166,7 +166,6 @@ import { useHead } from "@vueuse/head";
import { useRouter } from "vue-router";
import { useCurrentActorClient } from "@/composition/apollo/actor";
import { AbsintheGraphQLError } from "@/types/errors.model";
import { useGroup } from "@/composition/apollo/group";
import { MemberRole } from "@/types/enums";
import { PERSON_MEMBERSHIPS } from "@/graphql/actor";
import { Dialog } from "@/plugins/dialog";

View File

@ -169,9 +169,10 @@
<section class="my-4">
<component
v-for="(metadata, integration) in integrations"
:is="integration"
:is="metadataToComponent[integration]"
:key="integration"
:metadata="metadata"
class="my-2"
/>
</section>
<section
@ -272,7 +273,6 @@ import { Notifier } from "@/plugins/notifier";
import { AbsintheGraphQLErrors } from "@/types/errors.model";
import { useHead } from "@vueuse/head";
/* eslint-disable @typescript-eslint/no-unused-vars */
const IntegrationTwitch = defineAsyncComponent(
() => import("@/components/Event/Integrations/TwitchIntegration.vue")
);
@ -288,7 +288,6 @@ const IntegrationJitsiMeet = defineAsyncComponent(
const IntegrationEtherpad = defineAsyncComponent(
() => import("@/components/Event/Integrations/EtherpadIntegration.vue")
);
/* eslint-enable @typescript-eslint/no-unused-vars */
const EventMap = defineAsyncComponent(
() => import("@/components/Event/EventMap.vue")
);
@ -492,12 +491,12 @@ onFetchEventError(({ graphQLErrors }) =>
handleErrors(graphQLErrors as AbsintheGraphQLErrors)
);
const metadataToComponent: Record<string, string> = {
"mz:live:twitch:url": "IntegrationTwitch",
"mz:live:peertube:url": "IntegrationPeertube",
"mz:live:youtube:url": "IntegrationYoutube",
"mz:visio:jitsi_meet": "IntegrationJitsiMeet",
"mz:notes:etherpad:url": "IntegrationEtherpad",
const metadataToComponent: Record<string, any> = {
"mz:live:twitch:url": IntegrationTwitch,
"mz:live:peertube:url": IntegrationPeertube,
"mz:live:youtube:url": IntegrationYoutube,
"mz:visio:jitsi_meet": IntegrationJitsiMeet,
"mz:notes:etherpad:url": IntegrationEtherpad,
};
const integrations = computed((): Record<string, IEventMetadataDescription> => {
@ -514,7 +513,7 @@ const integrations = computed((): Record<string, IEventMetadataDescription> => {
if (component !== undefined) {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
acc[component] = metadata;
acc[metadata.key] = metadata;
}
return acc;
}, {});

View File

@ -166,8 +166,12 @@ defmodule Mobilizon.Web.Plugs.HTTPSecurityPlug do
global_search_policy = [Keyword.get(GlobalSearch.service().csp(), type, [])]
pictures_policy = [Keyword.get(Pictures.service().csp(), type, [])]
resource_providers = Config.get([Mobilizon.Service.ResourceProviders, :csp_policy, type], [])
Enum.join(
config_policy ++ front_end_analytics_policy ++ global_search_policy ++ pictures_policy,
config_policy ++
front_end_analytics_policy ++
global_search_policy ++ pictures_policy ++ resource_providers,
" "
)
end