feat: add nodes bulk actions and revoke-only-passwords support

This commit is contained in:
masasibata 2026-02-10 18:23:13 +03:00
parent 93987d7452
commit 34595a5e5b
5 changed files with 39 additions and 4 deletions

View file

@ -17,11 +17,13 @@ from remnawave.models import (
RestartNodeResponseDto,
UpdateNodeRequestDto,
UpdateNodeResponseDto,
RestartAllNodesRequestBodyDto,
RestartAllNodesRequestBodyDto,
ResetNodeTrafficRequestDto,
ResetNodeTrafficResponseDto,
ProfileModificationRequestDto,
ProfileModificationResponseDto,
NodesBulkActionsRequestDto,
NodesBulkActionsResponseDto,
)
from remnawave.rapid import BaseController, delete, get, patch, post
@ -120,4 +122,12 @@ class NodesController(BaseController):
body: Annotated[ProfileModificationRequestDto, PydanticBody()],
) -> ProfileModificationResponseDto:
"""Modify Inbounds & Profile for many nodes"""
...
@post("/nodes/bulk-actions", response_class=NodesBulkActionsResponseDto)
async def nodes_bulk_actions(
self,
body: Annotated[NodesBulkActionsRequestDto, PydanticBody()],
) -> NodesBulkActionsResponseDto:
"""Perform actions for many nodes (ENABLE, DISABLE, RESTART, RESET_TRAFFIC)"""
...

View file

@ -35,6 +35,7 @@ TServiceEvents = Literal[
"service.panel_started",
"service.login_attempt_failed",
"service.login_attempt_success",
"service.subpage_config_changed",
]
TErrorsEvents = Literal[

View file

@ -196,6 +196,9 @@ from .nodes import (
ResetNodeTrafficResponseDto,
ProfileModificationRequestDto,
ProfileModificationResponseDto,
NodeBulkActionType,
NodesBulkActionsRequestDto,
NodesBulkActionsResponseDto,
)
from .nodes_usage_history import (
GetNodeUserUsageByRangeResponseDto,
@ -488,6 +491,9 @@ __all__ = [
"ResetNodeTrafficResponseDto",
"ProfileModificationRequestDto",
"ProfileModificationResponseDto",
"NodeBulkActionType",
"NodesBulkActionsRequestDto",
"NodesBulkActionsResponseDto",
# Hosts models
"CreateHostRequestDto",
"CreateHostResponseDto",

View file

@ -1,5 +1,5 @@
from datetime import datetime
from typing import Annotated, List, Optional, Union
from typing import Annotated, List, Optional, Union, Literal
from uuid import UUID
from pydantic import BaseModel, Field, StringConstraints, RootModel
@ -253,4 +253,18 @@ class ProfileModificationResponseDto(ProfileModificationResponseData):
# Для обратной совместимости
RestartAllNodesRequestDto = RestartAllNodesRequestBodyDto
NodesResponseDto = NodeResponseDto
NodesResponseDto = NodeResponseDto
NodeBulkActionType = Literal["ENABLE", "DISABLE", "RESTART", "RESET_TRAFFIC"]
class NodesBulkActionsRequestDto(BaseModel):
"""Request for performing bulk actions on nodes"""
uuids: List[UUID] = Field(min_length=1)
action: NodeBulkActionType = Field(description="Action to perform on nodes")
class NodesBulkActionsResponseDto(BaseModel):
"""Response after performing bulk actions on nodes"""
event_sent: bool = Field(alias="eventSent")

View file

@ -196,7 +196,11 @@ class RevokeUserRequestDto(BaseModel):
max_length=48,
pattern=r"^[a-zA-Z0-9_-]+$",
)
revoke_only_passwords: Optional[bool] = Field(
None,
serialization_alias="revokeOnlyPasswords",
description="Optional. If true, only passwords will be revoked without changing the short UUID.",
)
class SubscriptionRequestRecord(BaseModel):
"""Subscription request history record"""