From 0dee368ecba76a6bed8f52c68d7aea6d5485c673 Mon Sep 17 00:00:00 2001 From: Fernando Lucchesi Date: Tue, 17 Oct 2023 19:34:29 +0200 Subject: [PATCH 1/3] =?UTF-8?q?=E2=9A=97=EF=B8=8F=20Experiment=20fix=20for?= =?UTF-8?q?=20CORS=20#1935?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/securityHeaders.js | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/web/securityHeaders.js b/web/securityHeaders.js index 45e2963ff..67db165ce 100644 --- a/web/securityHeaders.js +++ b/web/securityHeaders.js @@ -6,16 +6,13 @@ import { dataset } from './languages.js' const isProduction = process.env.NODE_ENV === 'production' -const envs = ['dev', 'preprod', 'prod', 'test'] +const envs = ['preprod', 'prod'] const localUrl = process.env.NODE_ENV === 'development' ? 'http://localhost:3333' : '' const globalUrl = dataset === 'global' ? 'https://equinor.sanity.studio' : '' const secretUrl = dataset === 'secret' ? 'https://equinor-restricted.sanity.studio' : '' -const studioUrlsOldCluster = envs.map((env) => `https://studio-${dataset}-energyvision-${env}.radix.equinor.com/`) -const studioUrls = envs.map((env) => `https://studio-${dataset}-equinor-web-sites-${env}.c2.radix.equinor.com/`) +const studioUrls = envs.map((env) => `https://studio-${dataset}-equinor-web-sites-${env}.c2.radix.equinor.com`) const studioV3Url = 'http://studiov3-global-development-equinor-web-sites-dev.c2.radix.equinor.com' -const xFrameUrls = [localUrl, ...studioUrlsOldCluster, ...studioUrls, studioV3Url, globalUrl, secretUrl] - .filter((e) => e) - .join(' ') +const xFrameUrls = [localUrl, ...studioUrls, studioV3Url, globalUrl, secretUrl].filter((e) => e).join(' ') const edsCdnUrl = 'https://cdn.eds.equinor.com ' const iframeSrcs = [ 'https://consentcdn.cookiebot.com', @@ -29,7 +26,7 @@ const iframeSrcs = [ 'https://vds.issgovernance.com', 'https://eac.plaii.no', 'https://livestream.com', - dataset === 'global-development' && 'https://careers.peopleclick.eu.com/', + dataset === 'global-development' && 'https://careers.peopleclick.eu.com', 'https://h61q9gi9.api.sanity.io', 'http://localhost:3333', ] From ed0eb9c8e2d3060391eaa26499a5bceb08ba8814 Mon Sep 17 00:00:00 2001 From: Fernando Lucchesi Date: Tue, 17 Oct 2023 19:43:09 +0200 Subject: [PATCH 2/3] =?UTF-8?q?=E2=9C=A8=20Improve=20errors=20and=20remove?= =?UTF-8?q?=20trailing=20slash=20/=20#1935?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sanityv3/resolveProductionUrl.js | 2 +- sanityv3/schemas/components/VideoSelector.tsx | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/sanityv3/resolveProductionUrl.js b/sanityv3/resolveProductionUrl.js index c803e33c5..fc389b760 100644 --- a/sanityv3/resolveProductionUrl.js +++ b/sanityv3/resolveProductionUrl.js @@ -9,7 +9,7 @@ const remoteUrl = () => { const env = window.location.hostname.includes('equinor-web-sites-preprod') ? 'preprod' : 'prod' switch (dataset) { case 'global': - return `https://web-equinor-web-sites-${env}.c2.radix.equinor.com/` + return `https://web-equinor-web-sites-${env}.c2.radix.equinor.com` case 'global-development': return 'https://web-global-development-equinor-web-sites-dev.c2.radix.equinor.com' case 'global-test': diff --git a/sanityv3/schemas/components/VideoSelector.tsx b/sanityv3/schemas/components/VideoSelector.tsx index 7daed95a8..cf7ebce7b 100644 --- a/sanityv3/schemas/components/VideoSelector.tsx +++ b/sanityv3/schemas/components/VideoSelector.tsx @@ -64,11 +64,15 @@ const VideoSelector = forwardRef(function VideoSelector( headers: { Authorization: `Basic ${SCREEN9_AUTH}`, }, - }).then((res) => - res.status !== 200 - ? setError(`Could not retrieve url from Screen9. Please report the error to the dev team.`) - : res.json(), - ) + }) + .then((res) => + res.status !== 200 + ? setError('Could not retrieve url from Screen9. Please report the error to the dev team.') + : res.json(), + ) + .catch((error) => { + setError(`Could not retrieve url from Screen9. Please report the error to the dev team. Error: ${error}`) + }) if (!data.error) { const video = { From f837aeee1a5c147256933c3ba0c7a6d147399eef Mon Sep 17 00:00:00 2001 From: Fernando Lucchesi Date: Thu, 19 Oct 2023 11:46:34 +0200 Subject: [PATCH 3/3] =?UTF-8?q?=F0=9F=90=9B=20Fix=20bug=20on=20GROQ=20quer?= =?UTF-8?q?y?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- search/IndexSanityContent/magazine/sanity.ts | 4 ++-- search/IndexSanityContent/topic/sanity.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/search/IndexSanityContent/magazine/sanity.ts b/search/IndexSanityContent/magazine/sanity.ts index 9c078d3a3..8ae03f927 100644 --- a/search/IndexSanityContent/magazine/sanity.ts +++ b/search/IndexSanityContent/magazine/sanity.ts @@ -28,10 +28,10 @@ export const query = /* groq */ `*[_type == "magazine" && _lang == $lang && !(_i "textBlocks": content[_type == "textBlock"]{ "_key": _key, "title": select( - "isBigText" == true => { + isBigText == true => pt::text(bigTitle), pt::text(title) - }), + ), "ingress": pt::text(ingress), "text": pt::text(text) // TODO: Do this manually to cover all cases }, diff --git a/search/IndexSanityContent/topic/sanity.ts b/search/IndexSanityContent/topic/sanity.ts index 8280a0e80..a55a88d56 100644 --- a/search/IndexSanityContent/topic/sanity.ts +++ b/search/IndexSanityContent/topic/sanity.ts @@ -12,10 +12,10 @@ export const query = /* groq */ `*[_type match "route_" + $lang + "*" && content "textBlocks": content->content[_type == "textBlock"]{ "_key": _key, "title": select( - "isBigText" == true => { + isBigText == true => pt::text(bigTitle), pt::text(title) - }), + ), "ingress": pt::text(ingress), "text": pt::text(text) // TODO: Do this manually to cover all cases },