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

Dev/mvp/ilya #16

Open
wants to merge 79 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
a856047
cmake added
yarikTri Oct 16, 2022
91017b7
Merge pull request #1 from yarikTri/main
yarikTri Oct 16, 2022
ff37d7d
some work done
yarikTri Oct 16, 2022
ca61f07
Make/Cmake fixed
yarikTri Oct 16, 2022
b7be684
Just to check CI
yarikTri Oct 16, 2022
6fdc99c
Just to check CI [build]
yarikTri Oct 16, 2022
028f47d
CI check (another container for build)
yarikTri Oct 16, 2022
aca24c9
CI check (another cmake_min_req)
yarikTri Oct 16, 2022
48f422e
CI check (another valgrind container)
yarikTri Oct 16, 2022
aabd2db
other CI containers
yarikTri Oct 16, 2022
c1e34b8
Merge pull request #2 from yarikTri/main
yarikTri Oct 16, 2022
dac09fa
Readme changed
yarikTri Oct 16, 2022
60ce04b
Merge pull request #3 from yarikTri/main
yarikTri Oct 16, 2022
94026c9
Readme fixed
yarikTri Oct 16, 2022
3e49801
Docker fixed?
yarikTri Oct 16, 2022
a227d0b
run: make build memtest
yarikTri Oct 16, 2022
41aa424
valgrind.log output added
yarikTri Oct 16, 2022
a41a6d9
valgrind.log output anyway
yarikTri Oct 16, 2022
1709027
Merge pull request #4 from yarikTri/main
yarikTri Oct 16, 2022
9d95cbf
smthg
yarikTri Oct 22, 2022
5d122b1
Merge pull request #5 from yarikTri/main
yarikTri Oct 22, 2022
0cb6a99
ci done
stepanpopov Oct 22, 2022
816993b
.github and .gitignore
stepanpopov Oct 22, 2022
c027330
Delete server/build directory
stepanpopov Oct 22, 2022
3760b94
cleaning done
yarikTri Oct 23, 2022
2f079ad
some cleaning done
yarikTri Oct 23, 2022
bac62eb
Dockerfile test
stepanpopov Oct 28, 2022
2725a23
Dockerfile test 2
stepanpopov Oct 28, 2022
867dc6e
ci dcoker test
Oct 29, 2022
92d881a
ci container test
yarikTri Oct 29, 2022
7b3da15
ci test
yarikTri Oct 29, 2022
09be69b
personal container built
yarikTri Oct 29, 2022
59c17e4
Небольшая уборка
yarikTri Nov 3, 2022
8f7f468
Client init
yarikTri Nov 19, 2022
28b7dcd
Merge branch 'main' of github.com:cpp-park-vk-education/2022_2_techno…
ruslann19 Nov 19, 2022
507eaa8
Added:
GodofRussia Nov 20, 2022
36a5191
handler changes
GodofRussia Nov 20, 2022
a79f78a
connection and server carcass added
Nov 20, 2022
deb45ee
changed .hpp file and .cpp realization
GodofRussia Nov 20, 2022
01beccf
small fixes
Nov 20, 2022
aa9332f
new small fixes
Nov 20, 2022
3c47288
finished handler files
GodofRussia Nov 20, 2022
1451b2e
gmock added
GodofRussia Nov 20, 2022
0a3740d
ci fixed
Nov 20, 2022
714f91a
gmockTests
GodofRussia Nov 20, 2022
0dabc1f
gmockTests-v2
GodofRussia Nov 20, 2022
c71370d
cmake fixed
stepanpopov Nov 20, 2022
51cebf3
carcass fixes
stepanpopov Nov 21, 2022
c351e46
gtests
GodofRussia Nov 21, 2022
2f49547
ci fixed
stepanpopov Nov 21, 2022
43ffca9
test added
stepanpopov Nov 21, 2022
7fd3929
Base started
yarikTri Nov 21, 2022
f1b8ce8
Client preparation
ruslann19 Nov 21, 2022
f0c5553
cmake fixed before merged
stepanpopov Nov 23, 2022
129f588
another cmakelists fix
stepanpopov Nov 23, 2022
e2a5bac
Merge pull request #10 from cpp-park-vk-education/dev/stepanpopov
stepanpopov Nov 23, 2022
3bff02d
Merge branch 'dev/rabbit_hole' into ilya
GodofRussia Nov 23, 2022
887dda2
Merge pull request #12 from cpp-park-vk-education/ilya
GodofRussia Nov 23, 2022
460e011
Conflicts fixing
ruslann19 Nov 23, 2022
bc4dfd5
Second attempt
ruslann19 Nov 23, 2022
add10d9
Merge branch 'dev/rabbit_hole' into dev/ruslan
ruslann19 Nov 23, 2022
002ad75
Merge pull request #11 from cpp-park-vk-education/dev/ruslan
ruslann19 Nov 23, 2022
5457315
CMake added
yarikTri Nov 23, 2022
c7e5789
Merge pull request #9 from cpp-park-vk-education/dev/yarik
yarikTri Nov 23, 2022
4a1199a
build fixed
stepanpopov Nov 23, 2022
300a113
coverage fail fixed
stepanpopov Nov 23, 2022
9c849b9
coverage report fixed
stepanpopov Dec 4, 2022
ac899d2
uml
yarikTri Dec 4, 2022
a2f8185
build fixed
yarikTri Dec 4, 2022
a298dc4
nothing really matters
GodofRussia Dec 10, 2022
56a22e3
server logic
GodofRussia Dec 10, 2022
f29a0dd
changed logic
GodofRussia Dec 11, 2022
05467fa
config make works
GodofRussia Dec 11, 2022
336976f
logic upd changed conf names
GodofRussia Dec 11, 2022
d49349f
optional added
GodofRussia Dec 12, 2022
d8bc36c
mvp server logic
GodofRussia Dec 12, 2022
cdd56c0
changed vpncontext
GodofRussia Dec 18, 2022
5cedc50
knkfnkwnfqwfw
GodofRussia Dec 19, 2022
40fbe2b
server amsterdam version
GodofRussia Dec 19, 2022
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
29 changes: 29 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
on: push

jobs:
check:
runs-on: ubuntu-latest
container: stepanpopov/rabbit_hole
steps:
- uses: actions/checkout@v2
- run: make check

build:
runs-on: ubuntu-latest
container: stepanpopov/rabbit_hole
needs: [check]
steps:
- uses: actions/checkout@v2
- run: make build
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
path: ./server/build/report

memtest:
runs-on: ubuntu-latest
container: stepanpopov/rabbit_hole
needs: [build]
steps:
- uses: actions/checkout@v2
- run: make memtest
16 changes: 16 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Cmake
*/build
*/**/build

# Executables
*.exe
*.out
*.app

#IDE
.idea
.vscode

# Logs
*.log
/server/logic/src/*.md
8 changes: 8 additions & 0 deletions CPPLINT.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
headers=h
linelength=110
filter=-whitespace/tab
filter=-runtime/int
filter=-legal/copyright
filter=-build/include_subdir
filter=-build/include
filter=-readability/casting
18 changes: 18 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM gcc:latest
RUN apt update -y && \
apt install -y cppcheck clang-tidy python3-pip libc6-dbg cmake libgtest-dev lcov libpqxx-dev
RUN pip install cpplint
RUN wget https://sourceware.org/pub/valgrind/valgrind-3.18.1.tar.bz2 && \
tar xfv valgrind-3.18.1.tar.bz2 && \
cd valgrind-3.18.1 && \
./autogen.sh && \
./configure && \
make && \
make install
RUN cd /root && \
wget https://boostorg.jfrog.io/artifactory/main/release/1.77.0/source/boost_1_77_0.tar.bz2 && \
tar -xjf boost_1_77_0.tar.bz2 && \
mv boost_1_77_0 /usr/local && \
cd /usr/local/boost_1_77_0 && \
./bootstrap.sh && \
./b2 --with-system --with-thread --with-date_time --with-regex --with-serialization stage
22 changes: 22 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
.PHONY: all build rebuild check memtest clean

all: clean check build memtest

clean:
rm -rf */build

check:
./scripts/linters/run.sh

build:
./scripts/build.sh -DMEMCHECK=OFF

rebuild: clean build

test:
./scripts/build.sh -DMEMCHECK=OFF
./scripts/tests.sh

memtest:
./scripts/build.sh -DMEMCHECK=ON
./scripts/tests.sh
6 changes: 6 additions & 0 deletions _sql/init_up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
CREATE TABLE users (
id serial not null unique,
name varchar(255) not null,
username varchar(255) not null unique,
password_hash varchar(255) not null
);
21 changes: 21 additions & 0 deletions client/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
cmake_minimum_required(VERSION 3.13 FATAL_ERROR)
project(client)

SET(CMAKE_CXX_STANDARD 17)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Werror -Wno-error=unused-parameter -Wno-error=unused-variable")

# set(BOOST_INCLUDE_DIRS "/usr/local/boost_1_77_0")
add_subdirectory(network)

# include_directories(${NETWORK_INCLUDE_DIRS} ${BOOST_INCLUDE_DIRS})

include_directories(${NETWORK_INCLUDE_DIRS})

add_executable(${PROJECT_NAME} main.cpp)

set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -coverage -lgcov" )

target_link_libraries(${PROJECT_NAME} PUBLIC ${NETWORK_LIBRARIES})

# enable_testing()
# add_subdirectory(tests)
62 changes: 62 additions & 0 deletions client/gui/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
cmake_minimum_required(VERSION 3.5)

project(gui VERSION 0.1 LANGUAGES CXX)

set(CMAKE_INCLUDE_CURRENT_DIR ON)

set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets)

set(PROJECT_SOURCES
include/*
main.cpp
widget.ui
)

if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
qt_add_executable(gui
MANUAL_FINALIZATION
${PROJECT_SOURCES}
)
# Define target properties for Android with Qt 6 as:
# set_property(TARGET gui APPEND PROPERTY QT_ANDROID_PACKAGE_SOURCE_DIR
# ${CMAKE_CURRENT_SOURCE_DIR}/android)
# For more information, see https://doc.qt.io/qt-6/qt-add-executable.html#target-creation
else()
if(ANDROID)
add_library(gui SHARED
${PROJECT_SOURCES}
)
# Define properties for Android with Qt 5 after find_package() calls as:
# set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android")
else()
add_executable(gui
${PROJECT_SOURCES}
)
endif()
endif()

target_link_libraries(gui PRIVATE Qt${QT_VERSION_MAJOR}::Widgets)

set_target_properties(gui PROPERTIES
MACOSX_BUNDLE_GUI_IDENTIFIER my.example.com
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
MACOSX_BUNDLE TRUE
WIN32_EXECUTABLE TRUE
)

install(TARGETS gui
BUNDLE DESTINATION .
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})

if(QT_VERSION_MAJOR EQUAL 6)
qt_finalize_executable(gui)
endif()
5 changes: 5 additions & 0 deletions client/gui/include/tools/utils.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#pragma once

#include <iostream>
#include <string>
#include <vector>
14 changes: 14 additions & 0 deletions client/gui/include/tools/vpncontext.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#pragma once

#include "utils.h"

enum VPNMode {
RunTotal = 1,
RunOptional,
Stopped
};

struct VPNContext {
VPNMode state = VPNMode::RunTotal;
std::vector<std::string> urlList;
};
44 changes: 44 additions & 0 deletions client/gui/include/user.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#ifndef USER_H
#define USER_H

#include "tools/utils.h"

class IUser {
public:
virtual void setId(int) = 0;
virtual void setName(std::string) = 0;
virtual void setEmail(std::string) = 0;
virtual void setPasswordHash(std::string) = 0;
virtual void setUrlList(std::vector<std::string>) = 0;

virtual int getId() const = 0;
virtual std::string getName() const = 0;
virtual std::string getEmail() const = 0;
virtual std::string getPasswordHash() const = 0;
virtual std::vector<std::string> getUrlList() const = 0;
};

class User : public IUser {
public:
void setId(int) override;
int getId() const override;

void setName(std::string) override;
std::string getName() const override;

void setEmail(std::string) override;
std::string getEmail() const override;

void setPasswordHash(std::string) override;
std::string getPasswordHash() const override;

void setUrlList(std::vector<std::string>) override;
std::vector<std::string> getUrlList() const override;

private:
int Id;
std::string name;
std::string password;
std::string email;
};
#endif // _USER_H_
38 changes: 38 additions & 0 deletions client/gui/include/windows/authorizer.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#ifndef AUTH_H
#define AUTH_H

#include "tools/utils.h"
#include "include/user.h"

#include <QWidget>
#include <QPushButton>


QT_BEGIN_NAMESPACE
namespace Ui {
class Authorizer;
}
QT_END_NAMESPACE

class IAuthorizer {
virtual void on_BtnAuth_clicked() = 0;
virtual void on_BtnCheckForm_clicked() = 0;
virtual void on_BtnBack_clicked() = 0;
};

class Authorizer : public QWidget, public IAuthorizer {
Q_OBJECT

public:
Widget(QWidget *parent = nullptr);
~Widget();

private slots:
void on_BtnRun_clicked() const override;
void on_BtnConfig_clicked() const override;
void on_BtnChangeMode_clicked() const override;

private:
Ui::Widget *ui;
};
#endif // AUTH_H
37 changes: 37 additions & 0 deletions client/gui/include/windows/mainwindow.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include "tools/utils.h"

#include <QMainWindow>

#include "authorizer.h"
#include "start_page.h"
#include "url_configuration.h"
#include "user_settings.h"


QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE

class MainWindow : public QMainWindow {
Q_OBJECT

public:
MainWindow(QWidget *parent = nullptr);
~MainWindow();

public slots:
void drawWidget();
void closeWindow();
void cleanWindow();
void drawUser();

private slots:
void on_BtnUser_clicked();

private:
Ui::MainWindow *ui;
};
#endif // MAINWINDOW_H
38 changes: 38 additions & 0 deletions client/gui/include/windows/start_page.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#ifndef STARTPAGE_H
#define STARTPAGE_H

#include "../tools/utils.h"
#include "include/user.h"

#include <QWidget>
#include <QPushButton>


QT_BEGIN_NAMESPACE
namespace Ui {
class StartPage;
}
QT_END_NAMESPACE

class IStartPage {
virtual void on_BtnRun_clicked() = 0;
virtual void on_BtnConfig_clicked() = 0;
virtual void on_BtnChangeMode_clicked() = 0;
};

class StartPage : public QWidget, public IStartPage {
Q_OBJECT

public:
Widget(QWidget *parent = nullptr);
~Widget();

private slots:
void on_BtnRun_clicked() const override;
void on_BtnConfig_clicked() const override;
void on_BtnChangeMode_clicked() const override;

private:
Ui::Widget *ui;
};
#endif // STARTPAGE_H
Loading