Skip to content

fix(dashboard): replace self-calling restart logic with standalone endpoint#259

Merged
Akinator31 merged 1 commit intomainfrom
258-fix-restart-button
Nov 27, 2025
Merged

fix(dashboard): replace self-calling restart logic with standalone endpoint#259
Akinator31 merged 1 commit intomainfrom
258-fix-restart-button

Conversation

@Akinator31
Copy link
Copy Markdown
Member

This pull request refactors the bot start/stop logic in the API to centralize the implementation, simplify handler code, and remove unused internal token-based API calls. The main changes include extracting bot lifecycle management into reusable functions, updating handlers to use these new utilities, and cleaning up unused code and fields.

Bot lifecycle management refactor:

  • Added start_bot and stop_bot utility functions in rustmail/src/api/utils/bot.rs, along with StartBotResponse and StopBotResponse enums to standardize responses.
  • Updated handle_start_bot, handle_stop_bot, and handle_restart_bot handlers to use the new utility functions, simplifying their logic and improving maintainability.
  • Exported the new bot utilities in rustmail/src/api/utils/mod.rs.

Removal of internal token logic and related code:

  • Removed the internal_token field from BotState and its initialization, as well as related token generation code in rustmail/src/bot.rs and rustmail/src/types/bot.rs.
  • Deleted the unused ping_internal utility and its module export.
  • Simplified the auth_middleware by removing internal token checks and associated imports.

These changes make the bot API more modular and easier to maintain, while removing unused or redundant logic.

@Akinator31 Akinator31 self-assigned this Nov 27, 2025
@Akinator31 Akinator31 linked an issue Nov 27, 2025 that may be closed by this pull request
@Akinator31 Akinator31 merged commit 097cae0 into main Nov 27, 2025
6 checks passed
@Akinator31 Akinator31 deleted the 258-fix-restart-button branch November 27, 2025 15:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix restart button

1 participant