diff --git a/client/core/controllers/serverController.cpp b/client/core/controllers/serverController.cpp index afb6263d..8b250f18 100644 --- a/client/core/controllers/serverController.cpp +++ b/client/core/controllers/serverController.cpp @@ -225,6 +225,24 @@ ErrorCode ServerController::uploadFileToHost(const ServerCredentials &credential return ErrorCode::NoError; } +ErrorCode ServerController::rebootServer(const ServerCredentials &credentials) +{ + QString script = QString("sudo reboot"); + + QString stdOut; + auto cbReadStdOut = [&](const QString &data, libssh::Client &) { + stdOut += data; + return ErrorCode::NoError; + }; + + auto cbReadStdErr = [&](const QString &data, libssh::Client &) { + stdOut += data + "\n"; + return ErrorCode::NoError; + }; + + return runScript(credentials, script, cbReadStdOut, cbReadStdErr); +} + ErrorCode ServerController::removeAllContainers(const ServerCredentials &credentials) { return runScript(credentials, amnezia::scriptData(SharedScriptType::remove_all_containers)); diff --git a/client/core/controllers/serverController.h b/client/core/controllers/serverController.h index 175d96da..16569dbb 100644 --- a/client/core/controllers/serverController.h +++ b/client/core/controllers/serverController.h @@ -22,6 +22,7 @@ public: typedef QList> Vars; + ErrorCode rebootServer(const ServerCredentials &credentials); ErrorCode removeAllContainers(const ServerCredentials &credentials); ErrorCode removeContainer(const ServerCredentials &credentials, DockerContainer container); ErrorCode setupContainer(const ServerCredentials &credentials, DockerContainer container, QJsonObject &config, diff --git a/client/core/scripts_registry.cpp b/client/core/scripts_registry.cpp index 61ae8962..101e6dfa 100644 --- a/client/core/scripts_registry.cpp +++ b/client/core/scripts_registry.cpp @@ -33,6 +33,7 @@ QString amnezia::scriptName(SharedScriptType type) case SharedScriptType::check_connection: return QLatin1String("check_connection.sh"); case SharedScriptType::check_server_is_busy: return QLatin1String("check_server_is_busy.sh"); case SharedScriptType::check_user_in_sudo: return QLatin1String("check_user_in_sudo.sh"); + default: return QString(); } } @@ -46,6 +47,7 @@ QString amnezia::scriptName(ProtocolScriptType type) case ProtocolScriptType::openvpn_template: return QLatin1String("template.ovpn"); case ProtocolScriptType::wireguard_template: return QLatin1String("template.conf"); case ProtocolScriptType::awg_template: return QLatin1String("template.conf"); + default: return QString(); } } diff --git a/client/translations/amneziavpn_fa_IR.ts b/client/translations/amneziavpn_fa_IR.ts index e843f807..18ddff48 100644 --- a/client/translations/amneziavpn_fa_IR.ts +++ b/client/translations/amneziavpn_fa_IR.ts @@ -133,12 +133,12 @@ HomeContainersListView - + Unable change protocol while there is an active connection امکان تغییر پروتکل در هنگام متصل بودن وجود ندارد - + The selected protocol is not supported on the current platform پروتکل انتخاب شده بر روی این پلتفرم پشتیبانی نمی‎‎شود @@ -150,7 +150,7 @@ ImportController - + Scanned %1 of %2. ارزیابی %1 از %2. @@ -190,26 +190,31 @@ Already installed containers were found on the server. All installed containers + Server '%1' was rebooted + + + + Server '%1' was removed سرور %1 حذف شد - + All containers from server '%1' have been removed تمام کانتینترها از سرور %1 حذف شدند - + %1 has been removed from the server '%2' %1 از سرور %2 حذف شد - + Please login as the user لطفا به عنوان کاربر وارد شوید - + Server added successfully سرور با موفقیت اضافه شد @@ -277,17 +282,17 @@ Already installed containers were found on the server. All installed containers PageHome - + VPN protocol پروتکل وی‎پی‎ان - + Servers سرورها - + Unable change server while there is an active connection امکان تغییر سرور در هنگام متصل بودن وجود ندارد @@ -1220,57 +1225,62 @@ Already installed containers were found on the server. All installed containers PageSettingsDns - + + Default server does not support custom dns + + + + DNS servers سرورهای DNS - + If AmneziaDNS is not used or installed اگر AmneziaDNS نصب نباشد یا استفاده نشود - + Primary DNS DNS اصلی - + Secondary DNS DNS ثانویه - + Restore default بازگشت به پیش‎فرض - + Restore default DNS settings? بازگشت به تنظیمات پیش‎فرض DNS؟ - + Continue ادامه - + Cancel کنسل - + Settings have been reset تنظیمات ریست شد - + Save ذخیره - + Settings saved ذخیره تنظیمات @@ -1288,52 +1298,52 @@ Already installed containers were found on the server. All installed containers ذخیره گزارشات - + Open folder with logs باز کردن پوشه گزارشات - + Save ذخیره - + Logs files (*.log) Logs files (*.log) - + Logs file saved فایل گزارشات ذخیره شد - + Save logs to file ذخیره گزارشات در فایل - + Clear logs? پاک کردن گزارشات؟ - + Continue ادامه - + Cancel کنسل - + Logs have been cleaned up گزارشات پاک شدند - + Clear logs پاک کردن گزارشات @@ -1346,17 +1356,17 @@ Already installed containers were found on the server. All installed containers تمام کانتینرهای نصب شده به نرم‎افزار اضافه شدند - + Clear Amnezia cache پاک کردن حافظه داخلی Amnezia - + May be needed when changing other settings وقتی تنظیمات دیگر را تغییر دهید ممکن است نیاز باشد - + Clear cached profiles? پاک کردن پروفایل ذخیره شده؟ @@ -1371,56 +1381,81 @@ Already installed containers were found on the server. All installed containers - - - + + + + Continue ادامه - - - + + + + Cancel کنسل - + Check the server for previously installed Amnezia services چک کردن سرویس‎های نصب شده Amnezia بر روی سرور - + Add them to the application if they were not displayed اضافه کردن آنها به نرم‎افزار اگر نمایش داده نشده‎اند - + + Reboot server + + + + + Do you want to reboot the server? + + + + + ?????????????????????????????? + + + + + Do you want to remove the server? + + + + + Do you want to clear server from Amnezia software? + + + + Remove server from application حذف کردن سرور از نرم‎افزار - Remove server? - حذف سرور؟ + حذف سرور؟ - + All installed AmneziaVPN services will still remain on the server. تمام سرویس‎های نصب‎شده Amnezia همچنان بر روی سرور باقی خواهند ماند. - + Clear server from Amnezia software پاک کردن سرور از نرم‎افزار Amnezia - Clear server from Amnezia software? - سرور از نرم‎افزار Amnezia پاک شود؟ + سرور از نرم‎افزار Amnezia پاک شود؟ - + All containers will be deleted on the server. This means that configuration files, keys and certificates will be deleted. تمام کانتینرها از سرور پاک شوند، به این معنی که تمام فایل‎های پیکربندی، کلیدها و مجوزها حذف خواهند شد. @@ -1501,90 +1536,95 @@ Already installed containers were found on the server. All installed containers PageSettingsSplitTunneling - + + Default server does not support split tunneling function + + + + Addresses from the list should be accessed via VPN دسترسی به آدرس‎های لیست از طریق وی‎پی‎ان - + Addresses from the list should not be accessed via VPN دسترسی به آدرس‎های لیست بدون وی‎پی‎ان - + Split tunneling جداسازی ترافیک - + Mode حالت - + Remove حذف - + Continue ادامه - + Cancel کنسل - + Site or IP سایت یا آی‎پی - + Import/Export Sites بارگذاری / خروجی‎گرفتن از سایت‎ها - + Import بارگذاری - + Save site list ذخیره لیست سایت‎ها - + Save sites ذخیره سایت‎ها - - - + + + Sites files (*.json) Sites files (*.json) - + Import a list of sites بارگذاری لیست سایت‎ها - + Replace site list جایگزین کردن لیست سایت - - + + Open sites file باز کردن فایل سایت‎ها - + Add imported sites to existing ones اضافه کردن سایت‎های بارگذاری شده به سایت‎های موجود @@ -1711,22 +1751,22 @@ and will not be shared or disclosed to the Amnezia or any third parties سطح کنترل اینترنت در منطقه شما چگونه است؟ - + Set up a VPN yourself یک وی‎پی‎ان برای خودتان بسازید - + I want to choose a VPN protocol می‎خواهم پروتکل وی‎پی‎ان را انتخاب کنم - + Continue ادامه - + Set up later بعدا تنظیم شود @@ -1734,7 +1774,7 @@ and will not be shared or disclosed to the Amnezia or any third parties PageSetupWizardInstalling - + The server has already been added to the application سرور در حال حاضر به نرم‎افزار اضافه شده است @@ -1747,33 +1787,33 @@ and will not be shared or disclosed to the Amnezia or any third parties занят установкой других протоколов или сервисов. Установка Amnesia - + Amnezia has detected that your server is currently برنامه Amnezia تشخیص داده است که سرور در حال حاضر - + busy installing other software. Amnezia installation مشغول نصب نرم‎افزار دیگری است. نصب Amnezia - + will pause until the server finishes installing other software متوقف شده تا زمانی که سرور نصب نرم‎افزار دیگر را تمام کند - + Installing در حال نصب - + Cancel installation لغو عملیات نصب - + Usually it takes no more than 5 minutes معمولا بیش از 5 دقیقه طول نمی‎کشد @@ -1896,27 +1936,27 @@ and will not be shared or disclosed to the Amnezia or any third parties PageSetupWizardViewConfig - + New connection ارتباط جدید - + Do not use connection code from public sources. It could be created to intercept your data. از کد اتصالی که در منابع عمومی هست استفاده نکنید. ممکن است برای شنود اطلاعات شما ایجاد شده باشد. - + Collapse content جمع کردن محتوا - + Show content نمایش محتوا - + Connect اتصال @@ -2958,22 +2998,22 @@ This means that AmneziaWG keeps the fast performance of the original while addin SettingsController - + Software version نسخه نرم‎افزار - + All settings have been reset to default values تمام تنظیمات به مقادیر پیش فرض ریست شد - + Cached profiles cleared پروفایل ذخیره شده پاک شد - + Backup file is corrupted فایل بک‎آپ خراب شده است @@ -3105,7 +3145,7 @@ This means that AmneziaWG keeps the fast performance of the original while addin VpnConnection - + Mbps Mbps diff --git a/client/translations/amneziavpn_ru.ts b/client/translations/amneziavpn_ru.ts index c4c9fe58..a73768b5 100644 --- a/client/translations/amneziavpn_ru.ts +++ b/client/translations/amneziavpn_ru.ts @@ -132,12 +132,12 @@ HomeContainersListView - + Unable change protocol while there is an active connection Невозможно изменить протокол при активном соединении - + The selected protocol is not supported on the current platform Выбранный протокол не поддерживается на данном устройстве @@ -149,7 +149,7 @@ ImportController - + Scanned %1 of %2. Отсканировано %1 из%2. @@ -188,26 +188,31 @@ Already installed containers were found on the server. All installed containers + Server '%1' was rebooted + + + + Server '%1' was removed Сервер '%1' был удален - + All containers from server '%1' have been removed Все протоколы и сервисы были удалены с сервера '%1' - + %1 has been removed from the server '%2' %1 был удален с сервера '%2' - + Please login as the user Пожалуйста, войдите в систему от имени пользователя - + Server added successfully Сервер успешно добавлен @@ -275,17 +280,17 @@ Already installed containers were found on the server. All installed containers PageHome - + VPN protocol VPN протокол - + Servers Серверы - + Unable change server while there is an active connection Невозможно изменить сервер при активном соединении @@ -1218,57 +1223,62 @@ Already installed containers were found on the server. All installed containers PageSettingsDns - + + Default server does not support custom dns + + + + DNS servers DNS сервер - + If AmneziaDNS is not used or installed Эти адреса будут использоваться, если не включен или не установлен AmneziaDNS - + Primary DNS Первичный DNS - + Secondary DNS Вторичный DNS - + Restore default Восстановить по умолчанию - + Restore default DNS settings? Восстановить настройки DNS по умолчанию? - + Continue Продолжить - + Cancel Отменить - + Settings have been reset Настройки сброшены - + Save Сохранить - + Settings saved Сохранить настройки @@ -1286,52 +1296,52 @@ Already installed containers were found on the server. All installed containers Сохранять логи - + Open folder with logs Открыть папку с логами - + Save Сохранить - + Logs files (*.log) Logs files (*.log) - + Logs file saved Файл с логами сохранен - + Save logs to file Сохранить логи в файл - + Clear logs? Очистить логи? - + Continue Продолжить - + Cancel Отменить - + Logs have been cleaned up Логи удалены - + Clear logs Удалить логи @@ -1344,17 +1354,17 @@ Already installed containers were found on the server. All installed containers Все установленные протоколы и сервисы были добавлены в приложение - + Clear Amnezia cache Очистить кэш Amnezia - + May be needed when changing other settings Может понадобиться при изменении других настроек - + Clear cached profiles? Удалить кэш Amnezia? @@ -1369,56 +1379,81 @@ Already installed containers were found on the server. All installed containers - - - + + + + Continue Продолжить - - - + + + + Cancel Отменить - + Check the server for previously installed Amnezia services Проверить сервер на наличие ранее установленных сервисов Amnezia - + Add them to the application if they were not displayed Добавить их в приложение, если они не были отображены - + + Reboot server + + + + + Do you want to reboot the server? + + + + + ?????????????????????????????? + + + + + Do you want to remove the server? + + + + + Do you want to clear server from Amnezia software? + + + + Remove server from application Удалить сервер из приложения - Remove server? - Удалить сервер? + Удалить сервер? - + All installed AmneziaVPN services will still remain on the server. Все установленные сервисы и протоколы Amnezia всё ещё останутся на сервере. - + Clear server from Amnezia software Очистить сервер от протоколов и сервисов Amnezia - Clear server from Amnezia software? - Удалить все сервисы и протоколы Amnezia с сервера? + Удалить все сервисы и протоколы Amnezia с сервера? - + All containers will be deleted on the server. This means that configuration files, keys and certificates will be deleted. На сервере будут удалены все данные, связанные с Amnezia: протоколы, сервисы, конфигурационные файлы, ключи и сертификаты. @@ -1499,90 +1534,95 @@ Already installed containers were found on the server. All installed containers PageSettingsSplitTunneling - + + Default server does not support split tunneling function + + + + Addresses from the list should be accessed via VPN Только адреса из списка должны открываться через VPN - + Addresses from the list should not be accessed via VPN Адреса из списка не должны открываться через VPN - + Split tunneling Раздельное VPN-туннелирование - + Mode Режим - + Remove Удалить - + Continue Продолжить - + Cancel Отменить - + Site or IP Сайт или IP - + Import/Export Sites Импорт/экспорт Сайтов - + Import Импорт - + Save site list Сохранить список сайтов - + Save sites Сохранить - - - + + + Sites files (*.json) Sites files (*.json) - + Import a list of sites Импортировать список с сайтами - + Replace site list Заменить список сайтов - - + + Open sites file Открыть список с сайтами - + Add imported sites to existing ones Добавить импортированные сайты к существующим @@ -1709,22 +1749,22 @@ and will not be shared or disclosed to the Amnezia or any third parties Какой уровень контроля интернета в вашем регионе? - + Set up a VPN yourself Настроить VPN самостоятельно - + I want to choose a VPN protocol Выбрать VPN-протокол - + Continue Продолжить - + Set up later Настроить позднее @@ -1732,7 +1772,7 @@ and will not be shared or disclosed to the Amnezia or any third parties PageSetupWizardInstalling - + The server has already been added to the application Сервер уже был добавлен в приложение @@ -1745,33 +1785,33 @@ and will not be shared or disclosed to the Amnezia or any third parties занят установкой других протоколов или сервисов. Установка Amnesia - + Amnezia has detected that your server is currently Amnezia обнаружила, что ваш сервер в настоящее время - + busy installing other software. Amnezia installation занят установкой другого программного обеспечения. Установка Amnezia - + will pause until the server finishes installing other software будет приостановлена до тех пор, пока сервер не завершит установку - + Installing Установка - + Cancel installation - + Usually it takes no more than 5 minutes Обычно это занимает не более 5 минут @@ -1894,27 +1934,27 @@ and will not be shared or disclosed to the Amnezia or any third parties PageSetupWizardViewConfig - + New connection Новое соединение - + Do not use connection code from public sources. It could be created to intercept your data. Не используйте код подключения из публичных источников. Его могли создать, чтобы перехватывать ваши данные. - + Collapse content Свернуть - + Show content Показать содержимое ключа - + Connect Подключиться @@ -2925,22 +2965,22 @@ This means that AmneziaWG keeps the fast performance of the original while addin SettingsController - + Software version Версия ПО - + All settings have been reset to default values Все настройки были сброшены к значению "По умолчанию" - + Cached profiles cleared Кэш профиля очищен - + Backup file is corrupted Backup файл поврежден @@ -3072,7 +3112,7 @@ This means that AmneziaWG keeps the fast performance of the original while addin VpnConnection - + Mbps Mbps diff --git a/client/translations/amneziavpn_zh_CN.ts b/client/translations/amneziavpn_zh_CN.ts index 7143c76b..4e823b6d 100644 --- a/client/translations/amneziavpn_zh_CN.ts +++ b/client/translations/amneziavpn_zh_CN.ts @@ -135,12 +135,12 @@ HomeContainersListView - + Unable change protocol while there is an active connection 已建立连接时无法更改服务器配置 - + The selected protocol is not supported on the current platform 当前平台不支持所选协议 @@ -152,7 +152,7 @@ ImportController - + Scanned %1 of %2. 扫描 %1 of %2. @@ -199,16 +199,21 @@ Already installed containers were found on the server. All installed containers + Server '%1' was rebooted + + + + Server '%1' was removed 已移除服务器 '%1' - + All containers from server '%1' have been removed 服务器 '%1' 的所有容器已移除 - + %1 has been removed from the server '%2' %1 已从服务器 '%2' 上移除 @@ -229,12 +234,12 @@ Already installed containers were found on the server. All installed containers 协议已从 - + Please login as the user 请以用户身份登录 - + Server added successfully 增加服务器成功 @@ -302,17 +307,17 @@ Already installed containers were found on the server. All installed containers PageHome - + VPN protocol VPN协议 - + Servers 服务器 - + Unable change server while there is an active connection 已建立连接时无法更改服务器配置 @@ -1297,57 +1302,62 @@ And if you don't like the app, all the more support it - the donation will PageSettingsDns - + + Default server does not support custom dns + + + + DNS servers DNS服务器 - + If AmneziaDNS is not used or installed 如果未使用或未安装AmneziaDNS - + Primary DNS 首选 DNS - + Secondary DNS 备用 DNS - + Restore default 恢复默认配置 - + Restore default DNS settings? 是否恢复默认DNS配置? - + Continue 继续 - + Cancel 取消 - + Settings have been reset 已重置 - + Save 保存 - + Settings saved 配置已保存 @@ -1365,52 +1375,52 @@ And if you don't like the app, all the more support it - the donation will 记录日志 - + Open folder with logs 打开日志文件夹 - + Save 保存 - + Logs files (*.log) - + Logs file saved 日志文件已保存 - + Save logs to file 保存日志到文件 - + Clear logs? 清理日志? - + Continue 继续 - + Cancel 取消 - + Logs have been cleaned up 日志已清理 - + Clear logs 清理日志 @@ -1428,76 +1438,101 @@ And if you don't like the app, all the more support it - the donation will 未发现新安装的容器 - + Clear Amnezia cache 清除 Amnezia 缓存 - + May be needed when changing other settings 更改其他设置时可能需要缓存 - + Clear cached profiles? 清除缓存? + + + Do you want to reboot the server? + + + + + ?????????????????????????????? + + + + + Do you want to remove the server? + + + + + Do you want to clear server from Amnezia software? + + - - - + + + + Continue 继续 - - - + + + + Cancel 取消 - + Check the server for previously installed Amnezia services 检查服务器上,是否存在之前安装的 Amnezia 服务 - + Add them to the application if they were not displayed 如果存在且未显示,则添加到应用软件 - + + Reboot server + + + + Remove server from application 移除本地服务器信息 - Remove server? - 移除本地服务器信息? + 移除本地服务器信息? - + All installed AmneziaVPN services will still remain on the server. 所有已安装的 AmneziaVPN 服务仍将保留在服务器上。 - + Clear server from Amnezia software 清理Amnezia中服务器信息 - Clear server from Amnezia software? - 清理Amnezia中服务器信息 + 清理Amnezia中服务器信息 - + All containers will be deleted on the server. This means that configuration files, keys and certificates will be deleted. 服务器上的所有容器都将被删除。配置文件、密钥和证书也将被删除。 @@ -1598,90 +1633,95 @@ And if you don't like the app, all the more support it - the donation will 网站级VPN分流 - + + Default server does not support split tunneling function + + + + Addresses from the list should be accessed via VPN 仅使用VPN访问 - + Addresses from the list should not be accessed via VPN 不使用VPN访问 - + Split tunneling 隧道分离 - + Mode 规则 - + Remove 移除 - + Continue 继续 - + Cancel 取消 - + Site or IP 网站或IP地址 - + Import/Export Sites 导入/导出网站 - + Import 导入 - + Save site list 保存网址 - + Save sites 保存网址 - - - + + + Sites files (*.json) - + Import a list of sites 导入网址列表 - + Replace site list 替换网址列表 - - + + Open sites file 打开网址文件 - + Add imported sites to existing ones 将导入的网址添加到现有网址中 @@ -1808,22 +1848,22 @@ and will not be shared or disclosed to the Amnezia or any third parties 您所在地区的互联网管控力度如何? - + Set up a VPN yourself 自己架设VPN - + I want to choose a VPN protocol 我想选择VPN协议 - + Continue 继续 - + Set up later 稍后设置 @@ -1832,27 +1872,27 @@ and will not be shared or disclosed to the Amnezia or any third parties PageSetupWizardInstalling - + Usually it takes no more than 5 minutes 通常不超过5分钟 - + The server has already been added to the application 服务器已添加到应用软件中 - + Amnezia has detected that your server is currently Amnezia 检测到您的服务器当前 - + busy installing other software. Amnezia installation 正安装其他软件。Amnezia安装 - + Cancel installation @@ -1865,12 +1905,12 @@ and will not be shared or disclosed to the Amnezia or any third parties 正安装其他软件。Amnezia安装 - + will pause until the server finishes installing other software 将暂停,直到其他软件安装完成。 - + Installing 安装中 @@ -1993,27 +2033,27 @@ and will not be shared or disclosed to the Amnezia or any third parties PageSetupWizardViewConfig - + New connection 新连接 - + Do not use connection code from public sources. It could be created to intercept your data. 请勿使用公共来源的连接码。它可以被创建来拦截您的数据。 - + Collapse content 折叠内容 - + Show content 显示内容 - + Connect 连接 @@ -3069,22 +3109,22 @@ While it offers a blend of security, stability, and speed, it's essential t SettingsController - + Software version 软件版本 - + Backup file is corrupted 备份文件已损坏 - + All settings have been reset to default values 所配置恢复为默认值 - + Cached profiles cleared 缓存的配置文件已清除 @@ -3220,7 +3260,7 @@ While it offers a blend of security, stability, and speed, it's essential t VpnConnection - + Mbps diff --git a/client/ui/controllers/installController.cpp b/client/ui/controllers/installController.cpp index d4582429..1c510782 100644 --- a/client/ui/controllers/installController.cpp +++ b/client/ui/controllers/installController.cpp @@ -296,6 +296,15 @@ void InstallController::updateContainer(QJsonObject config) emit installationErrorOccurred(errorString(errorCode)); } +void InstallController::rebootCurrentlyProcessedServer() +{ + int serverIndex = m_serversModel->getCurrentlyProcessedServerIndex(); + QString serverName = m_serversModel->data(serverIndex, ServersModel::Roles::NameRole).toString(); + + m_serversModel->rebootServer(); + emit rebootCurrentlyProcessedServerFinished(tr("Server '%1' was rebooted").arg(serverName)); +} + void InstallController::removeCurrentlyProcessedServer() { int serverIndex = m_serversModel->getCurrentlyProcessedServerIndex(); diff --git a/client/ui/controllers/installController.h b/client/ui/controllers/installController.h index cd0e6b22..a67912cf 100644 --- a/client/ui/controllers/installController.h +++ b/client/ui/controllers/installController.h @@ -31,6 +31,7 @@ public slots: void updateContainer(QJsonObject config); void removeCurrentlyProcessedServer(); + void rebootCurrentlyProcessedServer(); void removeAllContainers(); void removeCurrentlyProcessedContainer(); @@ -53,6 +54,7 @@ signals: void scanServerFinished(bool isInstalledContainerFound); + void rebootCurrentlyProcessedServerFinished(const QString &finishedMessage); void removeCurrentlyProcessedServerFinished(const QString &finishedMessage); void removeAllContainersFinished(const QString &finishedMessage); void removeCurrentlyProcessedContainerFinished(const QString &finishedMessage); diff --git a/client/ui/models/servers_model.cpp b/client/ui/models/servers_model.cpp index ad9b0059..85410293 100644 --- a/client/ui/models/servers_model.cpp +++ b/client/ui/models/servers_model.cpp @@ -435,6 +435,15 @@ ErrorCode ServersModel::removeAllContainers() return errorCode; } +ErrorCode ServersModel::rebootServer() +{ + ServerController serverController(m_settings); + auto credentials = m_settings->serverCredentials(m_currentlyProcessedServerIndex); + + ErrorCode errorCode = serverController.rebootServer(credentials); + return errorCode; +} + ErrorCode ServersModel::removeContainer(const int containerIndex) { ServerController serverController(m_settings); diff --git a/client/ui/models/servers_model.h b/client/ui/models/servers_model.h index 38f2bdd4..5ea590eb 100644 --- a/client/ui/models/servers_model.h +++ b/client/ui/models/servers_model.h @@ -88,6 +88,7 @@ public slots: ErrorCode removeContainer(const int containerIndex); ErrorCode removeAllContainers(); + ErrorCode rebootServer(); void setDefaultContainer(const int containerIndex); DockerContainer getDefaultContainer(); diff --git a/client/ui/qml/Pages2/PageSettingsServerData.qml b/client/ui/qml/Pages2/PageSettingsServerData.qml index 3eb07ce9..083cb094 100644 --- a/client/ui/qml/Pages2/PageSettingsServerData.qml +++ b/client/ui/qml/Pages2/PageSettingsServerData.qml @@ -38,6 +38,10 @@ PageType { PageController.showNotificationMessage(finishedMessage) } + function onRebootCurrentlyProcessedServerFinished(finishedMessage) { + PageController.showNotificationMessage(finishedMessage) + } + function onRemoveAllContainersFinished(finishedMessage) { PageController.closePage() // close deInstalling page PageController.showNotificationMessage(finishedMessage) @@ -128,6 +132,39 @@ PageType { visible: content.isServerWithWriteAccess } + LabelWithButtonType { + visible: content.isServerWithWriteAccess + Layout.fillWidth: true + + text: qsTr("Reboot server") + textColor: "#EB5757" + + clickedFunction: function() { + questionDrawer.headerText = qsTr("Do you want to reboot the server?") + questionDrawer.descriptionText = qsTr("The reboot process may take approximately 30 seconds. Are you sure you wish to proceed?") + questionDrawer.yesButtonText = qsTr("Continue") + questionDrawer.noButtonText = qsTr("Cancel") + + questionDrawer.yesButtonFunction = function() { + questionDrawer.visible = false + PageController.showBusyIndicator(true) + if (ServersModel.isDefaultServerCurrentlyProcessed() && ConnectionController.isConnected) { + ConnectionController.closeConnection() + } + InstallController.rebootCurrentlyProcessedServer() + PageController.showBusyIndicator(false) + } + questionDrawer.noButtonFunction = function() { + questionDrawer.visible = false + } + questionDrawer.visible = true + } + } + + DividerType { + visible: content.isServerWithWriteAccess + } + LabelWithButtonType { Layout.fillWidth: true @@ -135,7 +172,7 @@ PageType { textColor: "#EB5757" clickedFunction: function() { - questionDrawer.headerText = qsTr("Remove server?") + questionDrawer.headerText = qsTr("Do you want to remove the server?") questionDrawer.descriptionText = qsTr("All installed AmneziaVPN services will still remain on the server.") questionDrawer.yesButtonText = qsTr("Continue") questionDrawer.noButtonText = qsTr("Cancel") @@ -166,7 +203,7 @@ PageType { textColor: "#EB5757" clickedFunction: function() { - questionDrawer.headerText = qsTr("Clear server from Amnezia software?") + questionDrawer.headerText = qsTr("Do you want to clear server from Amnezia software?") questionDrawer.descriptionText = qsTr("All containers will be deleted on the server. This means that configuration files, keys and certificates will be deleted.") questionDrawer.yesButtonText = qsTr("Continue") questionDrawer.noButtonText = qsTr("Cancel") @@ -188,7 +225,7 @@ PageType { DividerType { visible: content.isServerWithWriteAccess - } + } QuestionDrawer { id: questionDrawer