ProtocolsModel bug fixes
This commit is contained in:
parent
3a49d5fdc4
commit
e0f42f4a0a
5 changed files with 17 additions and 8 deletions
|
@ -48,6 +48,9 @@ QVector<amnezia::Protocol> ContainerProps::protocolsForContainer(amnezia::Docker
|
||||||
case DockerContainer::Dns:
|
case DockerContainer::Dns:
|
||||||
return { };
|
return { };
|
||||||
|
|
||||||
|
case DockerContainer::Sftp:
|
||||||
|
return { Protocol::Sftp};
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return { defaultProtocol(container) };
|
return { defaultProtocol(container) };
|
||||||
}
|
}
|
||||||
|
@ -76,7 +79,7 @@ QMap<DockerContainer, QString> ContainerProps::containerHumanNames()
|
||||||
|
|
||||||
{DockerContainer::TorWebSite, QObject::tr("Web site in TOR network")},
|
{DockerContainer::TorWebSite, QObject::tr("Web site in TOR network")},
|
||||||
{DockerContainer::Dns, QObject::tr("DNS Service")},
|
{DockerContainer::Dns, QObject::tr("DNS Service")},
|
||||||
{DockerContainer::FileShare, QObject::tr("SMB file sharing service")},
|
//{DockerContainer::FileShare, QObject::tr("SMB file sharing service")},
|
||||||
{DockerContainer::Sftp, QObject::tr("Sftp file sharing service")}
|
{DockerContainer::Sftp, QObject::tr("Sftp file sharing service")}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -93,7 +96,7 @@ QMap<DockerContainer, QString> ContainerProps::containerDescriptions()
|
||||||
|
|
||||||
{DockerContainer::TorWebSite, QObject::tr("Web site in TOR network")},
|
{DockerContainer::TorWebSite, QObject::tr("Web site in TOR network")},
|
||||||
{DockerContainer::Dns, QObject::tr("DNS Service")},
|
{DockerContainer::Dns, QObject::tr("DNS Service")},
|
||||||
{DockerContainer::FileShare, QObject::tr("SMB file sharing service - is Window file sharing protocol")},
|
//{DockerContainer::FileShare, QObject::tr("SMB file sharing service - is Window file sharing protocol")},
|
||||||
{DockerContainer::Sftp, QObject::tr("Sftp file sharing service - is secure FTP service")}
|
{DockerContainer::Sftp, QObject::tr("Sftp file sharing service - is secure FTP service")}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -109,7 +112,7 @@ amnezia::ServiceType ContainerProps::containerService(DockerContainer c)
|
||||||
case DockerContainer::Ipsec : return ServiceType::Vpn;
|
case DockerContainer::Ipsec : return ServiceType::Vpn;
|
||||||
case DockerContainer::TorWebSite : return ServiceType::Other;
|
case DockerContainer::TorWebSite : return ServiceType::Other;
|
||||||
case DockerContainer::Dns : return ServiceType::Other;
|
case DockerContainer::Dns : return ServiceType::Other;
|
||||||
case DockerContainer::FileShare : return ServiceType::Other;
|
//case DockerContainer::FileShare : return ServiceType::Other;
|
||||||
case DockerContainer::Sftp : return ServiceType::Other;
|
case DockerContainer::Sftp : return ServiceType::Other;
|
||||||
default: return ServiceType::Other;
|
default: return ServiceType::Other;
|
||||||
}
|
}
|
||||||
|
@ -127,7 +130,7 @@ Protocol ContainerProps::defaultProtocol(DockerContainer c)
|
||||||
|
|
||||||
case DockerContainer::TorWebSite : return Protocol::TorWebSite;
|
case DockerContainer::TorWebSite : return Protocol::TorWebSite;
|
||||||
case DockerContainer::Dns : return Protocol::Dns;
|
case DockerContainer::Dns : return Protocol::Dns;
|
||||||
case DockerContainer::FileShare : return Protocol::FileShare;
|
//case DockerContainer::FileShare : return Protocol::FileShare;
|
||||||
case DockerContainer::Sftp : return Protocol::Sftp;
|
case DockerContainer::Sftp : return Protocol::Sftp;
|
||||||
default: return Protocol::Any;
|
default: return Protocol::Any;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ enum DockerContainer {
|
||||||
//non-vpn
|
//non-vpn
|
||||||
TorWebSite,
|
TorWebSite,
|
||||||
Dns,
|
Dns,
|
||||||
FileShare,
|
//FileShare,
|
||||||
Sftp
|
Sftp
|
||||||
};
|
};
|
||||||
Q_ENUM_NS(DockerContainer)
|
Q_ENUM_NS(DockerContainer)
|
||||||
|
|
|
@ -15,7 +15,7 @@ QString amnezia::scriptFolder(amnezia::DockerContainer container)
|
||||||
|
|
||||||
case DockerContainer::TorWebSite: return QLatin1String("website_tor");
|
case DockerContainer::TorWebSite: return QLatin1String("website_tor");
|
||||||
case DockerContainer::Dns: return QLatin1String("dns");
|
case DockerContainer::Dns: return QLatin1String("dns");
|
||||||
case DockerContainer::FileShare: return QLatin1String("file_share");
|
//case DockerContainer::FileShare: return QLatin1String("file_share");
|
||||||
case DockerContainer::Sftp: return QLatin1String("sftp");
|
case DockerContainer::Sftp: return QLatin1String("sftp");
|
||||||
default: return "";
|
default: return "";
|
||||||
}
|
}
|
||||||
|
|
|
@ -127,7 +127,13 @@ ErrorCode ServerController::runContainerScript(const ServerCredentials &credenti
|
||||||
const std::function<void (const QString &, QSharedPointer<QSsh::SshRemoteProcess>)> &cbReadStdErr)
|
const std::function<void (const QString &, QSharedPointer<QSsh::SshRemoteProcess>)> &cbReadStdErr)
|
||||||
{
|
{
|
||||||
QString fileName = "/opt/amnezia/" + Utils::getRandomString(16) + ".sh";
|
QString fileName = "/opt/amnezia/" + Utils::getRandomString(16) + ".sh";
|
||||||
ErrorCode e = uploadTextFileToContainer(container, credentials, script, fileName);
|
|
||||||
|
QString mkdir = "sudo docker exec -i $CONTAINER_NAME mkdir -p /opt/amnezia/";
|
||||||
|
ErrorCode e = runScript(credentials,
|
||||||
|
replaceVars(mkdir, genVarsForScript(credentials, container)), cbReadStdOut, cbReadStdErr);
|
||||||
|
if (e) return e;
|
||||||
|
|
||||||
|
e = uploadTextFileToContainer(container, credentials, script, fileName);
|
||||||
if (e) return e;
|
if (e) return e;
|
||||||
|
|
||||||
QString runner = QString("sudo docker exec -i $CONTAINER_NAME bash %1 ").arg(fileName);
|
QString runner = QString("sudo docker exec -i $CONTAINER_NAME bash %1 ").arg(fileName);
|
||||||
|
|
|
@ -24,7 +24,7 @@ QHash<int, QByteArray> ProtocolsModel::roleNames() const {
|
||||||
QVariant ProtocolsModel::data(const QModelIndex &index, int role) const
|
QVariant ProtocolsModel::data(const QModelIndex &index, int role) const
|
||||||
{
|
{
|
||||||
if (!index.isValid() || index.row() < 0
|
if (!index.isValid() || index.row() < 0
|
||||||
|| index.row() >= ContainerProps::allContainers().size()) {
|
|| index.row() >= ProtocolProps::allProtocols().size()) {
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue