Fix for gitlab

This commit is contained in:
Mutzi 2022-09-04 02:34:44 +02:00
parent ea8330c8c6
commit 8dfa446e2a
2 changed files with 3 additions and 5 deletions

View File

@ -3,7 +3,7 @@
<component name="CMakeSharedSettings"> <component name="CMakeSharedSettings">
<configurations> <configurations>
<configuration PROFILE_NAME="Debug" ENABLED="true" CONFIG_NAME="Debug" GENERATION_OPTIONS="-G Ninja --toolchain C:\vcpkg\scripts\buildsystems\vcpkg.cmake -DCMAKE_INSTALL_PREFIX=./cmake_install" /> <configuration PROFILE_NAME="Debug" ENABLED="true" CONFIG_NAME="Debug" GENERATION_OPTIONS="-G Ninja --toolchain C:\vcpkg\scripts\buildsystems\vcpkg.cmake -DCMAKE_INSTALL_PREFIX=./cmake_install" />
<configuration PROFILE_NAME="Release" ENABLED="true" CONFIG_NAME="Release" GENERATION_OPTIONS="-G Ninja --toolchain C:\vcpkg\scripts\buildsystems\vcpkg.cmake -DCMAKE_INSTALL_PREFIX=./cmake_install" /> <configuration PROFILE_NAME="Release" ENABLED="false" CONFIG_NAME="Release" GENERATION_OPTIONS="-G Ninja --toolchain C:\vcpkg\scripts\buildsystems\vcpkg.cmake -DCMAKE_INSTALL_PREFIX=./cmake_install" />
</configurations> </configurations>
</component> </component>
</project> </project>

View File

@ -3,8 +3,6 @@
#pragma ide diagnostic ignored "readability-make-member-function-const" #pragma ide diagnostic ignored "readability-make-member-function-const"
#pragma ide diagnostic ignored "readability-convert-member-functions-to-static" #pragma ide diagnostic ignored "readability-convert-member-functions-to-static"
#include <utility>
#include "controllers/controllers.h" #include "controllers/controllers.h"
#include "dto/dto.h" #include "dto/dto.h"
@ -16,9 +14,9 @@ const std::string GITLAB_API_URL = "https://ssh.gitlab.mattv.de";
std::string get_redirect_uri(req_type req) { std::string get_redirect_uri(req_type req) {
auto host_header = req->headers().find("host"); auto host_header = req->headers().find("host");
std::stringstream ss; std::stringstream ss;
ss << (req->isOnSecureConnection() ? "https" : "http") ss << (req->path().starts_with("127") ? (req->isOnSecureConnection() ? "https" : "http") : "https")
<< "://" << "://"
<< (host_header != req->headers().end() ? host_header->second : "127.0.0.1:1234") << (host_header != req->headers().end() ? host_header->second : "127.0.0.1:2345")
<< "/api/auth/gitlab_callback"; << "/api/auth/gitlab_callback";
return drogon::utils::urlEncode(ss.str()); return drogon::utils::urlEncode(ss.str());
} }