mirror of
https://github.com/umami-software/umami.git
synced 2025-12-08 05:12:36 +01:00
Merge branch 'dev' of https://github.com/umami-software/umami into dev
This commit is contained in:
commit
c44f6f8c9c
8 changed files with 79 additions and 143 deletions
|
|
@ -9,18 +9,14 @@ import { MobileNav } from '@/app/(main)/MobileNav';
|
|||
export function App({ children }) {
|
||||
const { user, isLoading, error } = useLoginQuery();
|
||||
const config = useConfig();
|
||||
const { pathname, router } = useNavigation();
|
||||
const { pathname } = useNavigation();
|
||||
|
||||
if (isLoading || !config) {
|
||||
return <Loading placement="absolute" />;
|
||||
}
|
||||
|
||||
if (error) {
|
||||
if (process.env.cloudMode) {
|
||||
window.location.href = '/login';
|
||||
} else {
|
||||
router.push('/login');
|
||||
}
|
||||
window.location.href = '/login';
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ export function LogoutPage() {
|
|||
async function logout() {
|
||||
await post('/auth/logout');
|
||||
|
||||
router.push('/login');
|
||||
window.location.href = '/login';
|
||||
}
|
||||
|
||||
removeClientAuthToken();
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import * as detect from '../detect';
|
||||
import { getIpAddress } from '../ip';
|
||||
|
||||
const IP = '127.0.0.1';
|
||||
const BAD_IP = '127.127.127.127';
|
||||
|
|
@ -6,23 +6,23 @@ const BAD_IP = '127.127.127.127';
|
|||
test('getIpAddress: Custom header', () => {
|
||||
process.env.CLIENT_IP_HEADER = 'x-custom-ip-header';
|
||||
|
||||
expect(detect.getIpAddress(new Headers({ 'x-custom-ip-header': IP }))).toEqual(IP);
|
||||
expect(getIpAddress(new Headers({ 'x-custom-ip-header': IP }))).toEqual(IP);
|
||||
});
|
||||
|
||||
test('getIpAddress: CloudFlare header', () => {
|
||||
expect(detect.getIpAddress(new Headers({ 'cf-connecting-ip': IP }))).toEqual(IP);
|
||||
expect(getIpAddress(new Headers({ 'cf-connecting-ip': IP }))).toEqual(IP);
|
||||
});
|
||||
|
||||
test('getIpAddress: Standard header', () => {
|
||||
expect(detect.getIpAddress(new Headers({ 'x-forwarded-for': IP }))).toEqual(IP);
|
||||
expect(getIpAddress(new Headers({ 'x-forwarded-for': IP }))).toEqual(IP);
|
||||
});
|
||||
|
||||
test('getIpAddress: CloudFlare header is lower priority than standard header', () => {
|
||||
expect(
|
||||
detect.getIpAddress(new Headers({ 'cf-connecting-ip': BAD_IP, 'x-forwarded-for': IP })),
|
||||
).toEqual(IP);
|
||||
expect(getIpAddress(new Headers({ 'cf-connecting-ip': BAD_IP, 'x-forwarded-for': IP }))).toEqual(
|
||||
IP,
|
||||
);
|
||||
});
|
||||
|
||||
test('getIpAddress: No header', () => {
|
||||
expect(detect.getIpAddress(new Headers())).toEqual(null);
|
||||
expect(getIpAddress(new Headers())).toEqual(null);
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue