diff --git a/.gitignore b/.gitignore index 961d058fe..3eb23ec54 100644 --- a/.gitignore +++ b/.gitignore @@ -35,3 +35,5 @@ yarn-error.log* out_functions out_publish + +.env diff --git a/netlify.toml b/netlify.toml index a451de4f8..a1844535b 100644 --- a/netlify.toml +++ b/netlify.toml @@ -1,4 +1,9 @@ [build] command = "npm run build" - functions = "out_functions" - publish = "out_publish" \ No newline at end of file + publish = "out_publish" + +[[headers]] + for = "/*" + [headers.values] + X-Frame-Options = "DENY" + X-XSS-Protection = "1; mode=block" \ No newline at end of file diff --git a/public/robots.txt b/public/robots.txt new file mode 100644 index 000000000..6f27bb66a --- /dev/null +++ b/public/robots.txt @@ -0,0 +1,2 @@ +User-agent: * +Disallow: \ No newline at end of file diff --git a/src/components/Navbar.tsx b/src/components/Navbar.tsx index 4d524b276..f34ceba93 100644 --- a/src/components/Navbar.tsx +++ b/src/components/Navbar.tsx @@ -13,6 +13,7 @@ const Navbar = styled.div` margin-bottom: 10px; position: sticky; top: 0; + z-index: 1; `; export default Navbar; diff --git a/src/pages/_app.tsx b/src/pages/_app.tsx index 861378292..5499dc9ab 100644 --- a/src/pages/_app.tsx +++ b/src/pages/_app.tsx @@ -10,6 +10,7 @@ import { clearData, getData, LS_KEYS } from 'utils/storage/localStorage'; import { useRouter } from 'next/router'; import Container from 'components/Container'; import PowerSettings from 'components/power_settings'; +import Head from 'next/head'; const GlobalStyles = createGlobalStyle` html, body { @@ -82,6 +83,9 @@ export default function App({ Component, pageProps }) { return ( <> + + ente.io | Privacy friendly alternative to Google Photos + diff --git a/src/pages/_document.tsx b/src/pages/_document.tsx index 3313c609b..96c1ad3a4 100644 --- a/src/pages/_document.tsx +++ b/src/pages/_document.tsx @@ -34,7 +34,6 @@ export default class MyDocument extends Document { return ( - ente.io | Privacy friendly alternative to Google Photos (); const [loading, setLoading] = useState(false); - + useEffect(() => { + router.prefetch('/gallery'); const user = getData(LS_KEYS.USER); const keyAttributes = getData(LS_KEYS.KEY_ATTRIBUTES); const key = getKey(SESSION_KEYS.ENCRYPTION_KEY); diff --git a/src/pages/generate/index.tsx b/src/pages/generate/index.tsx index 4efbb153e..012b275ba 100644 --- a/src/pages/generate/index.tsx +++ b/src/pages/generate/index.tsx @@ -31,8 +31,9 @@ export default function Generate() { const [token, setToken] = useState(); const router = useRouter(); const key = getKey(SESSION_KEYS.ENCRYPTION_KEY); - + useEffect(() => { + router.prefetch('/gallery'); const user = getData(LS_KEYS.USER); if (!user?.token) { router.push("/"); diff --git a/src/pages/index.tsx b/src/pages/index.tsx index 0b1f5a0ee..db2514b9a 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -18,8 +18,9 @@ interface formValues { export default function Home() { const [loading, setLoading] = useState(false); const router = useRouter(); - + useEffect(() => { + router.prefetch('/verify'); const user = getData(LS_KEYS.USER); if (user?.email) { router.push('/verify'); diff --git a/src/pages/verify/index.tsx b/src/pages/verify/index.tsx index 02912113a..638f4f665 100644 --- a/src/pages/verify/index.tsx +++ b/src/pages/verify/index.tsx @@ -26,8 +26,10 @@ export default function Verify() { const [loading, setLoading] = useState(false); const [resend, setResend] = useState(0); const router = useRouter(); - + useEffect(() => { + router.prefetch('/credentials'); + router.prefetch('/generate'); const user = getData(LS_KEYS.USER); if (!user?.email) { router.push("/"); diff --git a/src/services/userService.ts b/src/services/userService.ts index 021360dea..22a96e0dc 100644 --- a/src/services/userService.ts +++ b/src/services/userService.ts @@ -1,16 +1,20 @@ import HTTPService from './HTTPService'; import { keyAttributes } from 'types'; +const dev = process.env.NODE_ENV === 'development'; +const API_ENDPOINT = process.env.NEXT_PUBLIC_ENTE_ENDPOINT || "https://api.staging.ente.io"; +const ENDPOINT = !dev ? API_ENDPOINT : '/api' + export const getOtt = (email: string) => { - return HTTPService.get('/api/users/ott', { email }) + return HTTPService.get(`${ENDPOINT}/users/ott`, { email }) } export const verifyOtt = (email: string, ott: string) => { - return HTTPService.get('/api/users/credentials', { email, ott }); + return HTTPService.get(`${ENDPOINT}/users/credentials`, { email, ott }); } export const putKeyAttributes = (token: string, keyAttributes: keyAttributes) => { - return HTTPService.put('/api/users/key-attributes', keyAttributes, null, { + return HTTPService.put(`${ENDPOINT}/users/key-attributes`, keyAttributes, null, { 'X-Auth-Token': token, }); }