Changed API endpoint
This commit is contained in:
parent
8c3cd95b52
commit
bbe3286150
12 changed files with 35 additions and 11 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -35,3 +35,5 @@ yarn-error.log*
|
|||
|
||||
out_functions
|
||||
out_publish
|
||||
|
||||
.env
|
||||
|
|
|
@ -1,4 +1,9 @@
|
|||
[build]
|
||||
command = "npm run build"
|
||||
functions = "out_functions"
|
||||
publish = "out_publish"
|
||||
publish = "out_publish"
|
||||
|
||||
[[headers]]
|
||||
for = "/*"
|
||||
[headers.values]
|
||||
X-Frame-Options = "DENY"
|
||||
X-XSS-Protection = "1; mode=block"
|
2
public/robots.txt
Normal file
2
public/robots.txt
Normal file
|
@ -0,0 +1,2 @@
|
|||
User-agent: *
|
||||
Disallow:
|
|
@ -13,6 +13,7 @@ const Navbar = styled.div`
|
|||
margin-bottom: 10px;
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 1;
|
||||
`;
|
||||
|
||||
export default Navbar;
|
||||
|
|
|
@ -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 (
|
||||
<>
|
||||
<Head>
|
||||
<title>ente.io | Privacy friendly alternative to Google Photos</title>
|
||||
</Head>
|
||||
<GlobalStyles />
|
||||
<Navbar>
|
||||
<FlexContainer>
|
||||
|
|
|
@ -34,7 +34,6 @@ export default class MyDocument extends Document {
|
|||
return (
|
||||
<Html lang='en'>
|
||||
<Head>
|
||||
<title>ente.io | Privacy friendly alternative to Google Photos</title>
|
||||
<meta
|
||||
name="description"
|
||||
content="ente is a privacy friendly alternative to Google Photos that supports end-to-end encryption. Because memories are precious."
|
||||
|
|
|
@ -6,8 +6,10 @@ export const config = {
|
|||
},
|
||||
};
|
||||
|
||||
const API_ENDPOINT = process.env.NEXT_PUBLIC_ENTE_ENDPOINT || "http://api.staging.ente.io";
|
||||
|
||||
export default createProxyMiddleware({
|
||||
target: "http://api.staging.ente.io",
|
||||
target: API_ENDPOINT,
|
||||
changeOrigin: true,
|
||||
pathRewrite: { '^/api': '/' },
|
||||
});
|
||||
|
|
|
@ -29,8 +29,9 @@ export default function Credentials() {
|
|||
const router = useRouter();
|
||||
const [keyAttributes, setKeyAttributes] = useState<keyAttributes>();
|
||||
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);
|
||||
|
|
|
@ -31,8 +31,9 @@ export default function Generate() {
|
|||
const [token, setToken] = useState<string>();
|
||||
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("/");
|
||||
|
|
|
@ -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');
|
||||
|
|
|
@ -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("/");
|
||||
|
|
|
@ -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,
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue