Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added changelog drawer #825

Draft
wants to merge 38 commits into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
871037f
added changelog drawer
Nethius May 25, 2024
a71ca29
Merge branch 'dev' into feature/app-update
aiamnezia Oct 30, 2024
efdd47a
Created a scaffold for Linux installation
aiamnezia Nov 28, 2024
99f610e
implement Linux updating
aiamnezia Nov 29, 2024
12587b4
Merge branch 'dev' into feature/app-update
Dec 4, 2024
42e4768
Add debug logs about installer in service
Dec 4, 2024
506f96c
Add client side of installation logic for Windows and MacOS
aiamnezia Dec 10, 2024
e748ac3
Add service side of installation logic for Windows
aiamnezia Dec 10, 2024
9aef463
ru readme
pokamest Dec 6, 2024
086d6c4
Update README_RU.md
KsZnak Dec 6, 2024
061c63d
Add files via upload
KsZnak Dec 7, 2024
e20f8be
chore: added clang-format config files (#1293)
Nethius Dec 8, 2024
1858bb9
Update README_RU.md
KsZnak Dec 8, 2024
8d2fe39
Update README.md
KsZnak Dec 8, 2024
321f072
feature: added subscription expiration date for premium v2 (#1261)
Nethius Dec 9, 2024
9e7cf7f
feature/xray user management (#972)
CyAn84 Dec 10, 2024
6a21994
Fix formatting
aiamnezia Dec 10, 2024
a73234e
Add some logs
aiamnezia Dec 11, 2024
bac71ed
Add logs from installattion shell on Windows
aiamnezia Dec 11, 2024
3b300a2
Fix installation for Windows and MacOS
aiamnezia Dec 11, 2024
9df9314
Merge branch 'dev' into feature/app-update
aiamnezia Dec 11, 2024
2029c10
Optimized code
aiamnezia Dec 12, 2024
8de7ad6
Move installer running to client side for Ubuntu
Dec 19, 2024
caa5132
Merge branch 'dev' into feature/app-update
Dec 19, 2024
11f9c7b
Move installer launch logic to client side for Windows
aiamnezia Dec 19, 2024
fe9be23
Clean service code
aiamnezia Dec 19, 2024
4437684
Add linux_install script to resources
Dec 24, 2024
89df1df
Add logs for UpdateController
Dec 24, 2024
5d334e3
Add draft for MacOS installation
Dec 24, 2024
4588aa3
Merge branch 'dev' into feature/app-update
Dec 24, 2024
eb6c40f
Disable updates checking for Android and iOS
aiamnezia Dec 25, 2024
4408246
chore: fixed macos update script
Nethius Jan 2, 2025
af0fe75
Merge branch 'dev' of github.com:amnezia-vpn/amnezia-client into HEAD
Nethius Jan 2, 2025
cda9b5d
chore: remove duplicate lines
Nethius Jan 2, 2025
694b789
chore: post merge fixes
Nethius Jan 2, 2025
98a5219
Merge branch 'dev' of github.com:amnezia-vpn/amnezia-client into HEAD
Nethius Jan 9, 2025
574773f
chore: add missing ifdef
Nethius Jan 9, 2025
49990f0
decrease version for testing
aiamnezia Jan 10, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.25.0 FATAL_ERROR)

set(PROJECT AmneziaVPN)

project(${PROJECT} VERSION 4.8.3.0
project(${PROJECT} VERSION 4.8.2.0
DESCRIPTION "AmneziaVPN"
HOMEPAGE_URL "https://amnezia.org/"
)
Expand Down
11 changes: 11 additions & 0 deletions client/amnezia_application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -463,4 +463,15 @@ void AmneziaApplication::initControllers()

m_systemController.reset(new SystemController(m_settings));
m_engine->rootContext()->setContextProperty("SystemController", m_systemController.get());

m_updateController.reset(new UpdateController(m_settings));
m_engine->rootContext()->setContextProperty("UpdateController", m_updateController.get());

#if !defined(Q_OS_ANDROID) && !defined(Q_OS_IOS)
connect(m_updateController.get(), &UpdateController::updateFound, this, [this]() {
QTimer::singleShot(1000, this, [this]() { m_pageController->showChangelogDrawer(); });
});

m_updateController->checkForUpdates();
#endif
}
2 changes: 2 additions & 0 deletions client/amnezia_application.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "ui/controllers/sitesController.h"
#include "ui/controllers/systemController.h"
#include "ui/controllers/appSplitTunnelingController.h"
#include "ui/controllers/updateController.h"
#include "ui/models/containers_model.h"
#include "ui/models/languageModel.h"
#include "ui/models/protocols/cloakConfigModel.h"
Expand Down Expand Up @@ -134,6 +135,7 @@ class AmneziaApplication : public AMNEZIA_BASE_CLASS
QScopedPointer<SitesController> m_sitesController;
QScopedPointer<SystemController> m_systemController;
QScopedPointer<AppSplitTunnelingController> m_appSplitTunnelingController;
QScopedPointer<UpdateController> m_updateController;

QNetworkAccessManager *m_nam;

Expand Down
44 changes: 44 additions & 0 deletions client/client_scripts/linux_installer.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/bin/bash

EXTRACT_DIR="$1"
INSTALLER_PATH="$2"

# Create and clean extract directory
rm -rf "$EXTRACT_DIR"
mkdir -p "$EXTRACT_DIR"

# Extract ZIP archive
unzip "$INSTALLER_PATH" -d "$EXTRACT_DIR"
if [ $? -ne 0 ]; then
echo 'Failed to extract ZIP archive'
exit 1
fi

# Find and extract TAR archive
TAR_FILE=$(find "$EXTRACT_DIR" -name '*.tar' -type f)
if [ -z "$TAR_FILE" ]; then
echo 'TAR file not found'
exit 1
fi

tar -xf "$TAR_FILE" -C "$EXTRACT_DIR"
if [ $? -ne 0 ]; then
echo 'Failed to extract TAR archive'
exit 1
fi

rm -f "$TAR_FILE"

# Find and run installer
INSTALLER=$(find "$EXTRACT_DIR" -type f -executable)
if [ -z "$INSTALLER" ]; then
echo 'Installer not found'
exit 1
fi

"$INSTALLER"
EXIT_CODE=$?

# Cleanup
rm -rf "$EXTRACT_DIR"
exit $EXIT_CODE
56 changes: 56 additions & 0 deletions client/client_scripts/mac_installer.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#!/bin/bash

EXTRACT_DIR="$1"
INSTALLER_PATH="$2"

# Create and clean extract directory
rm -rf "$EXTRACT_DIR"
mkdir -p "$EXTRACT_DIR"

# Mount the DMG
MOUNT_POINT="$EXTRACT_DIR/mounted_dmg"
hdiutil attach "$INSTALLER_PATH" -mountpoint "$MOUNT_POINT"
if [ $? -ne 0 ]; then
echo "Failed to mount DMG"
exit 1
fi

# Check if the application exists in the mounted DMG
if [ ! -d "$MOUNT_POINT/AmneziaVPN.app" ]; then
echo "Error: AmneziaVPN.app not found in the mounted DMG."
hdiutil detach "$MOUNT_POINT" #-quiet
exit 1
fi

# Run the application
echo "Running AmneziaVPN.app from the mounted DMG..."
open "$MOUNT_POINT/AmneziaVPN.app"

# Get the PID of the app launched from the DMG
APP_PATH="$MOUNT_POINT/AmneziaVPN.app"
PID=$(pgrep -f "$APP_PATH")

if [ -z "$PID" ]; then
echo "Failed to retrieve PID for AmneziaVPN.app"
hdiutil detach "$MOUNT_POINT"
exit 1
fi

# Wait for the specific PID to exit
echo "Waiting for AmneziaVPN.app to exit..."
while kill -0 "$PID" 2>/dev/null; do
sleep 1
done

# Unmount the DMG
hdiutil detach "$EXTRACT_DIR/mounted_dmg"
if [ $? -ne 0 ]; then
echo "Failed to unmount DMG"
exit 1
fi

# Optional: Remove the DMG file
rm "$INSTALLER_PATH"

echo "Installation completed successfully"
exit 0
25 changes: 25 additions & 0 deletions client/core/scripts_registry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,15 @@ QString amnezia::scriptName(ProtocolScriptType type)
}
}

QString amnezia::scriptName(ClientScriptType type)
{
switch (type) {
case ClientScriptType::linux_installer: return QLatin1String("linux_installer.sh");
case ClientScriptType::mac_installer: return QLatin1String("mac_installer.sh");
default: return QString();
}
}

QString amnezia::scriptData(amnezia::SharedScriptType type)
{
QString fileName = QString(":/server_scripts/%1").arg(amnezia::scriptName(type));
Expand Down Expand Up @@ -81,3 +90,19 @@ QString amnezia::scriptData(amnezia::ProtocolScriptType type, DockerContainer co
data.replace("\r", "");
return data;
}

QString amnezia::scriptData(ClientScriptType type)
{
QString fileName = QString(":/client_scripts/%1").arg(amnezia::scriptName(type));
QFile file(fileName);
if (!file.open(QIODevice::ReadOnly)) {
qDebug() << "Warning: script missing" << fileName;
return "";
}
QByteArray data = file.readAll();
if (data.isEmpty()) {
qDebug() << "Warning: script is empty" << fileName;
}
data.replace("\r", "");
return data;
}
81 changes: 45 additions & 36 deletions client/core/scripts_registry.h
Original file line number Diff line number Diff line change
@@ -1,44 +1,53 @@
#ifndef SCRIPTS_REGISTRY_H
#define SCRIPTS_REGISTRY_H

#include <QLatin1String>
#include "core/defs.h"
#include "containers/containers_defs.h"
#include "core/defs.h"
#include <QLatin1String>

namespace amnezia {

enum SharedScriptType {
// General scripts
prepare_host,
install_docker,
build_container,
remove_container,
remove_all_containers,
setup_host_firewall,
check_connection,
check_server_is_busy,
check_user_in_sudo
};
enum ProtocolScriptType {
// Protocol scripts
dockerfile,
run_container,
configure_container,
container_startup,
openvpn_template,
wireguard_template,
awg_template,
xray_template
};


QString scriptFolder(DockerContainer container);

QString scriptName(SharedScriptType type);
QString scriptName(ProtocolScriptType type);

QString scriptData(SharedScriptType type);
QString scriptData(ProtocolScriptType type, DockerContainer container);
namespace amnezia
{

enum SharedScriptType {
// General scripts
prepare_host,
install_docker,
build_container,
remove_container,
remove_all_containers,
setup_host_firewall,
check_connection,
check_server_is_busy,
check_user_in_sudo
};

enum ProtocolScriptType {
// Protocol scripts
dockerfile,
run_container,
configure_container,
container_startup,
openvpn_template,
wireguard_template,
awg_template,
xray_template
};

enum ClientScriptType {
// Client-side scripts
linux_installer,
mac_installer
};

QString scriptFolder(DockerContainer container);

QString scriptName(SharedScriptType type);
QString scriptName(ProtocolScriptType type);
QString scriptName(ClientScriptType type);

QString scriptData(SharedScriptType type);
QString scriptData(ProtocolScriptType type, DockerContainer container);
QString scriptData(ClientScriptType type);
}

#endif // SCRIPTS_REGISTRY_H
6 changes: 5 additions & 1 deletion client/resources.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@
<file>images/tray/active.png</file>
<file>images/tray/default.png</file>
<file>images/tray/error.png</file>
<file>client_scripts/linux_installer.sh</file>
<file>client_scripts/mac_installer.sh</file>
<file>server_scripts/openvpn_cloak/Dockerfile</file>
<file>server_scripts/awg/configure_container.sh</file>
<file>server_scripts/awg/Dockerfile</file>
<file>server_scripts/awg/run_container.sh</file>
Expand Down Expand Up @@ -172,10 +175,11 @@
<file>ui/qml/Controls2/TopCloseButtonType.qml</file>
<file>ui/qml/Controls2/VerticalRadioButton.qml</file>
<file>ui/qml/Controls2/WarningType.qml</file>
<file>ui/qml/Components/ChangelogDrawer.qml</file>
<file>ui/qml/Modules/Style/qmldir</file>
<file>ui/qml/Filters/ContainersModelFilters.qml</file>
<file>ui/qml/main2.qml</file>
<file>ui/qml/Modules/Style/AmneziaStyle.qml</file>
<file>ui/qml/Modules/Style/qmldir</file>
<file>ui/qml/Pages2/PageDeinstalling.qml</file>
<file>ui/qml/Pages2/PageDevMenu.qml</file>
<file>ui/qml/Pages2/PageHome.qml</file>
Expand Down
1 change: 1 addition & 0 deletions client/ui/controllers/pageController.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ public slots:
void escapePressed();
void closeTopDrawer();

void showChangelogDrawer();
private:
QSharedPointer<ServersModel> m_serversModel;

Expand Down
2 changes: 1 addition & 1 deletion client/ui/controllers/systemController.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class SystemController : public QObject
{
Q_OBJECT
public:
explicit SystemController(const std::shared_ptr<Settings> &setting, QObject *parent = nullptr);
explicit SystemController(const std::shared_ptr<Settings> &settings, QObject *parent = nullptr);

static void saveFile(const QString &fileName, const QString &data);
static bool readFile(const QString &fileName, QByteArray &data);
Expand Down
Loading
Loading