-
-
Notifications
You must be signed in to change notification settings - Fork 271
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add Content-Security-Policy Header, allows setting frame-ancestor domains and moved font local #975
base: develop
Are you sure you want to change the base?
feat: add Content-Security-Policy Header, allows setting frame-ancestor domains and moved font local #975
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,11 +18,13 @@ import { MediaServerType } from '@server/constants/server'; | |
import type { PublicSettingsResponse } from '@server/interfaces/api/settingsInterfaces'; | ||
import type { AppInitialProps, AppProps } from 'next/app'; | ||
import App from 'next/app'; | ||
import { Inter } from 'next/font/google'; | ||
import Head from 'next/head'; | ||
import { useEffect, useState } from 'react'; | ||
import { IntlProvider } from 'react-intl'; | ||
import { ToastProvider } from 'react-toast-notifications'; | ||
import { SWRConfig } from 'swr'; | ||
const inter = Inter({ subsets: ['latin'] }); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe you could add a newline after the imports? |
||
|
||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
const loadLocaleData = (locale: AvailableLocale): Promise<any> => { | ||
|
@@ -137,47 +139,49 @@ const CoreApp: Omit<NextAppComponentType, 'origGetInitialProps'> = ({ | |
} | ||
|
||
return ( | ||
<SWRConfig | ||
value={{ | ||
fetcher: async (resource, init) => { | ||
const res = await fetch(resource, init); | ||
if (!res.ok) throw new Error(); | ||
return await res.json(); | ||
}, | ||
fallback: { | ||
'/api/v1/auth/me': user, | ||
}, | ||
}} | ||
> | ||
<LanguageContext.Provider value={{ locale: currentLocale, setLocale }}> | ||
<IntlProvider | ||
locale={currentLocale} | ||
defaultLocale="en" | ||
messages={loadedMessages} | ||
> | ||
<LoadingBar /> | ||
<SettingsProvider currentSettings={currentSettings}> | ||
<InteractionProvider> | ||
<ToastProvider components={{ Toast, ToastContainer }}> | ||
<Head> | ||
<title>{currentSettings.applicationTitle}</title> | ||
<meta | ||
name="viewport" | ||
content="initial-scale=1, viewport-fit=cover, width=device-width" | ||
></meta> | ||
<PWAHeader | ||
applicationTitle={currentSettings.applicationTitle} | ||
/> | ||
</Head> | ||
<StatusChecker /> | ||
<ServiceWorkerSetup /> | ||
<UserContext initialUser={user}>{component}</UserContext> | ||
</ToastProvider> | ||
</InteractionProvider> | ||
</SettingsProvider> | ||
</IntlProvider> | ||
</LanguageContext.Provider> | ||
</SWRConfig> | ||
<main className={inter.className}> | ||
<SWRConfig | ||
value={{ | ||
fetcher: async (resource, init) => { | ||
const res = await fetch(resource, init); | ||
if (!res.ok) throw new Error(); | ||
return await res.json(); | ||
}, | ||
fallback: { | ||
'/api/v1/auth/me': user, | ||
}, | ||
}} | ||
> | ||
<LanguageContext.Provider value={{ locale: currentLocale, setLocale }}> | ||
<IntlProvider | ||
locale={currentLocale} | ||
defaultLocale="en" | ||
messages={loadedMessages} | ||
> | ||
<LoadingBar /> | ||
<SettingsProvider currentSettings={currentSettings}> | ||
<InteractionProvider> | ||
<ToastProvider components={{ Toast, ToastContainer }}> | ||
<Head> | ||
<title>{currentSettings.applicationTitle}</title> | ||
<meta | ||
name="viewport" | ||
content="initial-scale=1, viewport-fit=cover, width=device-width" | ||
></meta> | ||
<PWAHeader | ||
applicationTitle={currentSettings.applicationTitle} | ||
/> | ||
</Head> | ||
<StatusChecker /> | ||
<ServiceWorkerSetup /> | ||
<UserContext initialUser={user}>{component}</UserContext> | ||
</ToastProvider> | ||
</InteractionProvider> | ||
</SettingsProvider> | ||
</IntlProvider> | ||
</LanguageContext.Provider> | ||
</SWRConfig> | ||
</main> | ||
); | ||
}; | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,13 +13,7 @@ class MyDocument extends Document { | |
render(): JSX.Element { | ||
return ( | ||
<Html> | ||
<Head> | ||
<link rel="preconnect" href="https://fonts.gstatic.com" /> | ||
<link | ||
rel="stylesheet" | ||
href="https://fonts.googleapis.com/css2?family=Inter:[email protected]&display=swap" | ||
/> | ||
</Head> | ||
<Head></Head> | ||
<body> | ||
<Main /> | ||
<NextScript /> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,6 +53,10 @@ | |
} | ||
|
||
@layer components { | ||
*:disabled { | ||
opacity: 0.7; | ||
} | ||
|
||
Comment on lines
+56
to
+59
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why this change? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Before, the text-box wasnt visibly disabled apart from not being able to interact with it, so this makes it a bit more visible There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Did you check that this does not have any other unexpected behavior? It could have undesired effects on some text fields. and other fields too* We usually do styling using TailwindCSS, inside the |
||
.searchbar { | ||
padding-top: env(safe-area-inset-top); | ||
height: calc(4rem + env(safe-area-inset-top)); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't you specify here that this is a space-separated list of domains?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are more possibilities to setting this than just space separated as this is directly put into the header.
But maybe we could link to the specification: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/frame-ancestors
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh ok. That's a good idea yes