Files
Adaptix-Framework-AdaptixC2/AdaptixClient/Source/Client/AuthProfile.cpp
T
Mikhail Shashin 9320bb2736 Add project directory support and use it in file dialogs
Add a project directory field to AuthProfile, persist it via Storage, and automatically create the directory (defaulting to ~/AdaptixProjects/<Project> when not set).

Extend the connect dialog (DialogConnect) with a project directory input, automatic path suggestion based on project name, and an inline button to pick the directory via a folder chooser.

Update all relevant file/script save/open flows (AxScript, agents, listeners, downloads, screenshots, credentials, targets, file browser, and script BridgeApp prompts) to use AuthProfile::GetProjectDir() as their initial directory.
2025-12-19 10:24:28 +03:00

67 lines
1.9 KiB
C++

#include <Client/AuthProfile.h>
#include <QDir>
AuthProfile::AuthProfile()
{
this->valid = false;
}
AuthProfile::AuthProfile(const QString &project,
const QString &username,
const QString &password,
const QString &host,
const QString &port,
const QString &endpoint,
const QString &projectDir)
{
this->project = project.trimmed();
this->username = username.trimmed();
this->password = password;
this->projectDir = QDir::fromNativeSeparators(projectDir.trimmed());
this->host = host.trimmed();
this->port = port.trimmed();
this->endpoint = endpoint.trimmed();
this->valid = true;
}
AuthProfile::~AuthProfile() {}
QString AuthProfile::GetProject() { return this->project; };
QString AuthProfile::GetProjectDir() const
{
QString dirPath = this->projectDir.trimmed();
if (dirPath.isEmpty()) {
QDir home(QDir::homePath());
QString basePath = home.filePath("AdaptixProjects");
QDir baseDir(basePath);
dirPath = baseDir.filePath(this->project.trimmed());
}
QDir().mkpath(dirPath);
return dirPath;
}
QString AuthProfile::GetUsername() { return this->username; };
QString AuthProfile::GetPassword() { return this->password; };
QString AuthProfile::GetHost() { return this->host; };
QString AuthProfile::GetPort() { return this->port; };
QString AuthProfile::GetEndpoint() { return this->endpoint; };
QString AuthProfile::GetAccessToken() { return this->accessToken; };
QString AuthProfile::GetRefreshToken() { return this->refreshToken; };
QString AuthProfile::GetURL() const
{
return "https://" + host + ":" + port + endpoint;
};
void AuthProfile::SetAccessToken(const QString &token) { this->accessToken = token; };
void AuthProfile::SetRefreshToken(const QString &token) { this->refreshToken = token; }