diff --git a/sphaira/include/ui/menus/ftp_menu.hpp b/sphaira/include/ui/menus/ftp_menu.hpp index e9d24c3..ad2a2c3 100644 --- a/sphaira/include/ui/menus/ftp_menu.hpp +++ b/sphaira/include/ui/menus/ftp_menu.hpp @@ -45,7 +45,7 @@ struct Menu final : MenuBase { // this should be private // private: - std::shared_ptr m_source; + std::shared_ptr m_source{}; Thread m_thread{}; Mutex m_mutex{}; // the below are shared across threads, lock with the above mutex! @@ -55,6 +55,7 @@ struct Menu final : MenuBase { const char* m_pass{}; unsigned m_port{}; bool m_anon{}; + bool m_was_ftp_enabled{}; }; } // namespace sphaira::ui::menu::ftp diff --git a/sphaira/source/ui/menus/ftp_menu.cpp b/sphaira/source/ui/menus/ftp_menu.cpp index 1b3485b..6f425aa 100644 --- a/sphaira/source/ui/menus/ftp_menu.cpp +++ b/sphaira/source/ui/menus/ftp_menu.cpp @@ -152,6 +152,12 @@ Menu::Menu() : MenuBase{"FTP Install (EXPERIMENTAL)"_i18n} { }}); mutexInit(&m_mutex); + m_was_ftp_enabled = App::GetFtpEnable(); + if (!m_was_ftp_enabled) { + log_write("[FTP] wasn't enabled, forcefully enabling\n"); + App::SetFtpEnable(true); + } + ftpsrv::InitInstallMode(this, OnInstallStart, OnInstallWrite, OnInstallClose); m_port = ftpsrv::GetPort(); @@ -171,6 +177,11 @@ Menu::~Menu() { m_source->Disable(); } + if (!m_was_ftp_enabled) { + log_write("[FTP] disabling on exit\n"); + App::SetFtpEnable(false); + } + log_write("closing data!!!!\n"); }