Enhance configuration and logging for user management commands
- Updated `.env.example` to include new settings for trusted proxies and networks for better security with X-Forwarded headers. - Modified `BlockUserCommandHandler` and `UnblockUserCommandHandler` to include logging for gateway update failures, ensuring better traceability of issues during user blocking/unblocking. - Adjusted tests for command handlers to incorporate logging functionality, improving test coverage and reliability. - Updated frontend configuration to dynamically set the server port based on environment variables.
This commit is contained in:
@@ -27,7 +27,7 @@ export function PublishInboundDialog({
|
||||
const [maxClients, setMaxClients] = useState(inbound.maxClients?.toString() ?? '')
|
||||
const [selectedRoles, setSelectedRoles] = useState<Set<string>>(new Set(inbound.allowedRoleIds))
|
||||
|
||||
const rolesQuery = useQuery({ queryKey: ['admin-roles-page'], queryFn: listRoles, enabled: open })
|
||||
const rolesQuery = useQuery({ queryKey: ['admin-roles'], queryFn: listRoles, enabled: open })
|
||||
|
||||
const mutation = useMutation({
|
||||
mutationFn: () =>
|
||||
@@ -35,6 +35,8 @@ export function PublishInboundDialog({
|
||||
onSuccess: async () => {
|
||||
toast.success(t('admin.nodes.publishSaved'))
|
||||
await queryClient.invalidateQueries({ queryKey: ['admin-inbounds', inbound.nodeId] })
|
||||
// Публикация/список ролей инбаунда влияет на то, что видит пользователь при создании конфига.
|
||||
await queryClient.invalidateQueries({ queryKey: ['available-inbounds'] })
|
||||
onOpenChange(false)
|
||||
},
|
||||
onError: (error) => toast.error(error instanceof HttpError ? error.detail : t('auth.genericError')),
|
||||
|
||||
@@ -51,6 +51,8 @@ export function NodeCard({ node }: { node: NodeDto }) {
|
||||
toast.success(t('admin.nodes.syncSuccess', { count: result.inboundsSynced }))
|
||||
await invalidateNodes()
|
||||
await queryClient.invalidateQueries({ queryKey: ['admin-inbounds', node.id] })
|
||||
// Синхронизация могла добавить/убрать инбаунды, доступные пользователю при создании конфига.
|
||||
await queryClient.invalidateQueries({ queryKey: ['available-inbounds'] })
|
||||
},
|
||||
onError: (error) => toast.error(error instanceof HttpError ? error.detail : t('auth.genericError')),
|
||||
})
|
||||
|
||||
@@ -33,7 +33,7 @@ export function RoleFormDialog({
|
||||
mutationFn: () => (role ? updateRole(role.id, Number(maxConfigs)) : createRole(name.trim(), Number(maxConfigs))),
|
||||
onSuccess: async () => {
|
||||
toast.success(role ? t('admin.roles.updated') : t('admin.roles.created'))
|
||||
await queryClient.invalidateQueries({ queryKey: ['admin-roles-page'] })
|
||||
await queryClient.invalidateQueries({ queryKey: ['admin-roles'] })
|
||||
setDialogOpen(false)
|
||||
setName('')
|
||||
setMaxConfigs('3')
|
||||
|
||||
Reference in New Issue
Block a user