mirror of
https://github.com/amnezia-vpn/amnezia-client.git
synced 2026-06-23 02:00:20 +07:00
added display of wireguard configs, such a config will be displayed as raw text
This commit is contained in:
@@ -91,11 +91,12 @@ void OpenVpnLogic::updateProtocolPage(const QJsonObject &openvpnConfig, DockerCo
|
||||
auto lastConfig = openvpnConfig.value(config_key::last_config).toString();
|
||||
auto lastConfigJson = QJsonDocument::fromJson(lastConfig.toUtf8()).object();
|
||||
QStringList lines = lastConfigJson.value(config_key::config).toString().replace("\r", "").split("\n");
|
||||
QString openVpnLastConfigText;
|
||||
for (const QString &l: lines) {
|
||||
m_openVpnLastConfigText.append(l + "\n");
|
||||
openVpnLastConfigText.append(l + "\n");
|
||||
}
|
||||
|
||||
emit openVpnLastConfigTextChanged(m_openVpnLastConfigText);
|
||||
set_openVpnLastConfigText(m_openVpnLastConfigText);
|
||||
set_isThirdPartyConfig(isThirdPartyConfig);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
#include "WireGuardLogic.h"
|
||||
#include "core/servercontroller.h"
|
||||
#include <functional>
|
||||
#include "../../uilogic.h"
|
||||
|
||||
using namespace amnezia;
|
||||
using namespace PageEnumNS;
|
||||
|
||||
WireGuardLogic::WireGuardLogic(UiLogic *logic, QObject *parent):
|
||||
PageProtocolLogicBase(logic, parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void WireGuardLogic::updateProtocolPage(const QJsonObject &wireGuardConfig, DockerContainer container, bool haveAuthData, bool isThirdPartyConfig)
|
||||
{
|
||||
qDebug() << "WireGuardLogic::updateProtocolPage";
|
||||
|
||||
auto lastConfigJsonDoc = QJsonDocument::fromJson(wireGuardConfig.value(config_key::last_config).toString().toUtf8());
|
||||
auto lastConfigJson = lastConfigJsonDoc.object();
|
||||
|
||||
QString wireGuardLastConfigText;
|
||||
QStringList lines = lastConfigJson.value(config_key::config).toString().replace("\r", "").split("\n");
|
||||
for (const QString &l: lines) {
|
||||
wireGuardLastConfigText.append(l + "\n");
|
||||
}
|
||||
|
||||
set_wireGuardLastConfigText(wireGuardLastConfigText);
|
||||
set_isThirdPartyConfig(isThirdPartyConfig);
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
#ifndef WIREGUARDLOGIC_H
|
||||
#define WIREGUARDLOGIC_H
|
||||
|
||||
#include "PageProtocolLogicBase.h"
|
||||
|
||||
class UiLogic;
|
||||
|
||||
class WireGuardLogic : public PageProtocolLogicBase
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
AUTO_PROPERTY(QString, wireGuardLastConfigText)
|
||||
AUTO_PROPERTY(bool, isThirdPartyConfig)
|
||||
|
||||
public:
|
||||
explicit WireGuardLogic(UiLogic *uiLogic, QObject *parent = nullptr);
|
||||
~WireGuardLogic() = default;
|
||||
|
||||
void updateProtocolPage(const QJsonObject &wireGuardConfig, DockerContainer container, bool haveAuthData, bool isThirdPartyConfig) override;
|
||||
|
||||
private:
|
||||
UiLogic *m_uiLogic;
|
||||
|
||||
};
|
||||
|
||||
#endif // WIREGUARDLOGIC_H
|
||||
Reference in New Issue
Block a user