mirror of
https://github.com/umami-software/umami.git
synced 2026-02-13 00:55:37 +01:00
Compare commits
No commits in common. "f5896f071bf3e69c245fa5de8dac9f470e3bdc85" and "b0c1f9041ddd137a5aef54131bf0ef2a42138cf8" have entirely different histories.
f5896f071b
...
b0c1f9041d
4 changed files with 12 additions and 25 deletions
2
pnpm-lock.yaml
generated
2
pnpm-lock.yaml
generated
|
|
@ -328,8 +328,6 @@ importers:
|
|||
specifier: ^5.9.3
|
||||
version: 5.9.3
|
||||
|
||||
dist: {}
|
||||
|
||||
packages:
|
||||
|
||||
'@ampproject/remapping@2.3.0':
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
import { redirect } from 'next/navigation';
|
||||
import { useEffect } from 'react';
|
||||
import { LAST_TEAM_CONFIG } from '@/lib/constants';
|
||||
import { getItem } from '@/lib/storage';
|
||||
import { getItem, removeItem } from '@/lib/storage';
|
||||
|
||||
export default function RootPage() {
|
||||
useEffect(() => {
|
||||
|
|
@ -11,6 +11,8 @@ export default function RootPage() {
|
|||
if (lastTeam) {
|
||||
redirect(`/teams/${lastTeam}/websites`);
|
||||
} else {
|
||||
removeItem(LAST_TEAM_CONFIG);
|
||||
|
||||
redirect(`/websites`);
|
||||
}
|
||||
}, []);
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@ import {
|
|||
Text,
|
||||
} from '@umami/react-zen';
|
||||
import { ArrowRight } from 'lucide-react';
|
||||
import type { Key } from 'react';
|
||||
import {
|
||||
useConfig,
|
||||
useLoginQuery,
|
||||
|
|
@ -34,8 +33,7 @@ import {
|
|||
Users,
|
||||
} from '@/components/icons';
|
||||
import { Switch } from '@/components/svg';
|
||||
import { DOCS_URL, LAST_TEAM_CONFIG } from '@/lib/constants';
|
||||
import { removeItem } from '@/lib/storage';
|
||||
import { DOCS_URL } from '@/lib/constants';
|
||||
|
||||
export interface TeamsButtonProps {
|
||||
showText?: boolean;
|
||||
|
|
@ -46,7 +44,7 @@ export function NavButton({ showText = true }: TeamsButtonProps) {
|
|||
const { user } = useLoginQuery();
|
||||
const { cloudMode } = useConfig();
|
||||
const { formatMessage, labels } = useMessages();
|
||||
const { teamId, router } = useNavigation();
|
||||
const { teamId } = useNavigation();
|
||||
const { isMobile } = useMobile();
|
||||
const team = user?.teams?.find(({ id }) => id === teamId);
|
||||
const selectedKeys = new Set([teamId || 'user']);
|
||||
|
|
@ -56,16 +54,7 @@ export function NavButton({ showText = true }: TeamsButtonProps) {
|
|||
return cloudMode ? `${process.env.cloudUrl}${url}` : url;
|
||||
};
|
||||
|
||||
const handleAction = async (key: Key) => {
|
||||
if (key === 'user') {
|
||||
removeItem(LAST_TEAM_CONFIG);
|
||||
if (cloudMode) {
|
||||
window.location.href = '/';
|
||||
} else {
|
||||
router.push('/');
|
||||
}
|
||||
}
|
||||
};
|
||||
const handleAction = async () => {};
|
||||
|
||||
return (
|
||||
<MenuTrigger>
|
||||
|
|
@ -95,16 +84,16 @@ export function NavButton({ showText = true }: TeamsButtonProps) {
|
|||
</Pressable>
|
||||
<Popover placement="bottom start">
|
||||
<Column minWidth="300px">
|
||||
<Menu autoFocus="last">
|
||||
<Menu autoFocus="last" onAction={handleAction}>
|
||||
<SubmenuTrigger>
|
||||
<MenuItem id="teams" showChecked={false} showSubMenuIcon>
|
||||
<IconLabel icon={<Switch />} label={formatMessage(labels.switchAccount)} />
|
||||
</MenuItem>
|
||||
<Popover placement={isMobile ? 'bottom start' : 'right top'}>
|
||||
<Column minWidth="300px">
|
||||
<Menu selectionMode="single" selectedKeys={selectedKeys} onAction={handleAction}>
|
||||
<Menu selectionMode="single" selectedKeys={selectedKeys}>
|
||||
<MenuSection title={formatMessage(labels.myAccount)}>
|
||||
<MenuItem id="user">
|
||||
<MenuItem id="user" href={getUrl('/')}>
|
||||
<IconLabel icon={<User />} label={user.username} />
|
||||
</MenuItem>
|
||||
</MenuSection>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import crypto from 'node:crypto';
|
||||
import { v4, v5, v7 } from 'uuid';
|
||||
import { v4, v5 } from 'uuid';
|
||||
|
||||
const ALGORITHM = 'aes-256-gcm';
|
||||
const IV_LENGTH = 16;
|
||||
|
|
@ -57,9 +57,7 @@ export function secret() {
|
|||
}
|
||||
|
||||
export function uuid(...args: any) {
|
||||
if (args.length) {
|
||||
return v5(hash(...args, secret()), v5.DNS);
|
||||
}
|
||||
if (!args.length) return v4();
|
||||
|
||||
return process.env.USE_UUIDV7 ? v7() : v4();
|
||||
return v5(hash(...args, secret()), v5.DNS);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue