From 13279b6040e94b2f5c0ec31df1d960c886376adf Mon Sep 17 00:00:00 2001 From: Chee Yee Date: Sat, 1 Mar 2025 03:27:29 -0800 Subject: [PATCH] disable rpi for github --- source/installer.cpp | 3 +- source/server/http_server.cpp | 6 +++ source/windows.cpp | 71 +++++++++++++++++++---------------- 3 files changed, 46 insertions(+), 34 deletions(-) diff --git a/source/installer.cpp b/source/installer.cpp index 5857545..4a2b5d4 100644 --- a/source/installer.cpp +++ b/source/installer.cpp @@ -202,7 +202,8 @@ namespace INSTALLER std::string getRemoteUrl(const std::string path, bool encodeUrl) { if (strlen(remote_settings->username) == 0 && strlen(remote_settings->password) == 0 && - (remoteclient->clientType() == CLIENT_TYPE_WEBDAV || remoteclient->clientType() == CLIENT_TYPE_HTTP_SERVER)) + (remoteclient->clientType() == CLIENT_TYPE_WEBDAV || + (remoteclient->clientType() == CLIENT_TYPE_HTTP_SERVER && strcmp(remote_settings->http_server_type, HTTP_SERVER_GITHUB) != 0))) { std::string full_url = WebDAVClient::GetHttpUrl(remote_settings->server + path); size_t scheme_pos = full_url.find("://"); diff --git a/source/server/http_server.cpp b/source/server/http_server.cpp index b336454..e3c4ca6 100644 --- a/source/server/http_server.cpp +++ b/source/server/http_server.cpp @@ -11,7 +11,9 @@ #include "clients/webdav.h" #include "clients/apache.h" #include "clients/archiveorg.h" +#include "clients/github.h" #include "clients/iis.h" +#include "clients/myrient.h" #include "clients/nginx.h" #include "clients/npxserve.h" #include "clients/rclone.h" @@ -252,6 +254,10 @@ namespace HttpServer tmp_client = new RCloneClient(); else if (strcmp(remote_settings->http_server_type, HTTP_SERVER_ARCHIVEORG) == 0) tmp_client = new ArchiveOrgClient(); + else if (strcmp(remote_settings->http_server_type, HTTP_SERVER_MYRIENT) == 0) + tmp_client = new MyrientClient(); + else if (strcmp(remote_settings->http_server_type, HTTP_SERVER_GITHUB) == 0) + tmp_client = new GithubClient(); } if (tmp_client->clientType() != CLIENT_TYPE_GOOGLE) diff --git a/source/windows.cpp b/source/windows.cpp index bb70c42..e0d8561 100644 --- a/source/windows.cpp +++ b/source/windows.cpp @@ -439,42 +439,45 @@ namespace Windows } } - ImGui::SameLine(); - ImGui::SetCursorPosX(ImGui::GetCursorPosX() + 5); - ImGui::TextColored(colors[ImGuiCol_ButtonHovered], "%s:", lang_strings[STR_ENABLE_RPI]); - ImGui::SameLine(); + if (strcmp(remote_settings->http_server_type, HTTP_SERVER_GITHUB) != 0) + { + ImGui::SameLine(); + ImGui::SetCursorPosX(ImGui::GetCursorPosX() + 5); + ImGui::TextColored(colors[ImGuiCol_ButtonHovered], "%s:", lang_strings[STR_ENABLE_RPI]); + ImGui::SameLine(); - if (ImGui::Checkbox("###enable_rpi", &remote_settings->enable_rpi)) - { - CONFIG::SaveConfig(); - } - if (ImGui::IsItemHovered()) - { - ImGui::SetNextWindowSize(ImVec2(450, 110)); - ImGui::BeginTooltip(); - ImGui::PushTextWrapPos(ImGui::GetCursorPos().x + 440); - ImGui::Text("%s", lang_strings[STR_ENABLE_RPI_FTP_SMB_MSG]); - ImGui::PopTextWrapPos(); - ImGui::EndTooltip(); - } + if (ImGui::Checkbox("###enable_rpi", &remote_settings->enable_rpi)) + { + CONFIG::SaveConfig(); + } + if (ImGui::IsItemHovered()) + { + ImGui::SetNextWindowSize(ImVec2(450, 110)); + ImGui::BeginTooltip(); + ImGui::PushTextWrapPos(ImGui::GetCursorPos().x + 440); + ImGui::Text("%s", lang_strings[STR_ENABLE_RPI_FTP_SMB_MSG]); + ImGui::PopTextWrapPos(); + ImGui::EndTooltip(); + } - ImGui::SameLine(); - ImGui::SetCursorPosX(ImGui::GetCursorPosX() + 5); - ImGui::TextColored(colors[ImGuiCol_ButtonHovered], "%s:", lang_strings[STR_ENABLE_DISK_CACHE]); - ImGui::SameLine(); + ImGui::SameLine(); + ImGui::SetCursorPosX(ImGui::GetCursorPosX() + 5); + ImGui::TextColored(colors[ImGuiCol_ButtonHovered], "%s:", lang_strings[STR_ENABLE_DISK_CACHE]); + ImGui::SameLine(); - if (ImGui::Checkbox("###enable_disk_cache", &remote_settings->enable_disk_cache)) - { - CONFIG::SaveConfig(); - } - if (ImGui::IsItemHovered()) - { - ImGui::SetNextWindowSize(ImVec2(550, 110)); - ImGui::BeginTooltip(); - ImGui::PushTextWrapPos(ImGui::GetCursorPos().x + 540); - ImGui::Text("%s", lang_strings[STR_ENABLE_DISC_CACHE_MSG]); - ImGui::PopTextWrapPos(); - ImGui::EndTooltip(); + if (ImGui::Checkbox("###enable_disk_cache", &remote_settings->enable_disk_cache)) + { + CONFIG::SaveConfig(); + } + if (ImGui::IsItemHovered()) + { + ImGui::SetNextWindowSize(ImVec2(550, 110)); + ImGui::BeginTooltip(); + ImGui::PushTextWrapPos(ImGui::GetCursorPos().x + 540); + ImGui::Text("%s", lang_strings[STR_ENABLE_DISC_CACHE_MSG]); + ImGui::PopTextWrapPos(); + ImGui::EndTooltip(); + } } ImGui::PopStyleVar(); @@ -2650,6 +2653,8 @@ namespace Windows else if (strncasecmp(remote_settings->server, "https://github.com/", 19) == 0) { snprintf(remote_settings->http_server_type, 24, "%s", HTTP_SERVER_GITHUB); + remote_settings->enable_rpi = false; + remote_settings->enable_disk_cache = false; } } }