forked from Github/frigate
Security fixes (#8081)
* use safeloader * use json responses wherever possible * remove CORS and add CSRF token * formatting fixes * add envjs back * fix baseurl test
This commit is contained in:
@@ -18,6 +18,6 @@ describe('useApiHost', () => {
|
||||
<Test />
|
||||
</ApiProvider>
|
||||
);
|
||||
expect(screen.queryByText('http://base-url.local:5000/')).toBeInTheDocument();
|
||||
expect(screen.queryByText('http://localhost:3000/')).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,2 +1 @@
|
||||
import { API_HOST } from '../env';
|
||||
export const baseUrl = API_HOST || `${window.location.protocol}//${window.location.host}${window.baseUrl || '/'}`;
|
||||
export const baseUrl = `${window.location.protocol}//${window.location.host}${window.baseUrl || '/'}`;
|
||||
|
||||
@@ -5,6 +5,9 @@ import { WsProvider } from './ws';
|
||||
import axios from 'axios';
|
||||
|
||||
axios.defaults.baseURL = `${baseUrl}api/`;
|
||||
axios.defaults.headers.common = {
|
||||
'X-CSRF-TOKEN': 1,
|
||||
};
|
||||
|
||||
export function ApiProvider({ children, options }) {
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user