option to enable/disable remote package install

This commit is contained in:
Chee Yee
2023-02-13 22:25:02 -08:00
parent 36c4b7dcbb
commit c315d58d19
7 changed files with 66 additions and 23 deletions
+3
View File
@@ -111,3 +111,6 @@ STR_REMOTE_NOT_SUPPORT_MSG=Remote server requires at least a username.
STR_CANNOT_CONNECT_REMOTE_MSG=Remote HTTP Server not reachable.
STR_DOWNLOAD_INSTALL_MSG=Remote Package Install not possible. Would you like to download package and install?
STR_CHECKING_REMOTE_SERVER_MSG=Checking remote server for Remote Package Install.
STR_ENABLE_RPI=RPI
STR_ENABLE_RPI_FTP_SMB_MSG=This option enables Remote Package Installation. This requires a HTTP Server setup on the same host sharing the same folder.
STR_ENABLE_RPI_WEBDAV_MSG=This option enables Remote Package Installation. This requires a WebDAV Server with anonymous access that does not need username/password.
+26 -19
View File
@@ -630,31 +630,38 @@ namespace Actions
else
files.push_back(selected_remote_file);
std::string url = INSTALLER::getRemoteUrl(files.begin()->path);
bool download_and_install = false;
sprintf(activity_message, "%s", lang_strings[STR_CHECKING_REMOTE_SERVER_MSG]);
if (!INSTALLER::canInstallRemotePkg(url))
if (remote_settings->enable_rpi)
{
confirm_state = CONFIRM_WAIT;
action_to_take = selected_action;
activity_inprogess = false;
while (confirm_state == CONFIRM_WAIT)
std::string url = INSTALLER::getRemoteUrl(files.begin()->path);
sprintf(activity_message, "%s", lang_strings[STR_CHECKING_REMOTE_SERVER_MSG]);
file_transfering = false;
if (!INSTALLER::canInstallRemotePkg(url))
{
sceKernelUsleep(100000);
}
activity_inprogess = true;
selected_action = action_to_take;
confirm_state = CONFIRM_WAIT;
action_to_take = selected_action;
activity_inprogess = false;
while (confirm_state == CONFIRM_WAIT)
{
sceKernelUsleep(100000);
}
activity_inprogess = true;
selected_action = action_to_take;
if (confirm_state == CONFIRM_YES)
{
download_and_install = true;
}
else
{
goto finish;
if (confirm_state == CONFIRM_YES)
{
download_and_install = true;
}
else
{
goto finish;
}
}
}
else
{
download_and_install = true;
}
for (std::vector<DirEntry>::iterator it = files.begin(); it != files.end(); ++it)
{
if (stop_activity)
+4
View File
@@ -74,6 +74,9 @@ namespace CONFIG
setting.http_port = ReadInt(sites[i].c_str(), CONFIG_REMOTE_SERVER_HTTP_PORT, 80);
WriteInt(sites[i].c_str(), CONFIG_REMOTE_SERVER_HTTP_PORT, setting.http_port);
setting.enable_rpi = ReadBool(sites[i].c_str(), CONFIG_ENABLE_RPI, false);
WriteBool(sites[i].c_str(), CONFIG_ENABLE_RPI, setting.enable_rpi);
site_settings.insert(std::make_pair(sites[i], setting));
}
@@ -101,6 +104,7 @@ namespace CONFIG
WriteString(last_site, CONFIG_REMOTE_SERVER_USER, remote_settings->username);
WriteString(last_site, CONFIG_REMOTE_SERVER_PASSWORD, remote_settings->password);
WriteInt(last_site, CONFIG_REMOTE_SERVER_HTTP_PORT, remote_settings->http_port);
WriteBool(last_site, CONFIG_ENABLE_RPI, remote_settings->enable_rpi);
WriteString(CONFIG_GLOBAL, CONFIG_LAST_SITE, last_site);
WriteBool(CONFIG_GLOBAL, CONFIG_AUTO_DELETE_TMP_PKG, auto_delete_tmp_pkg);
WriteIniFile(CONFIG_INI_FILE);
+2
View File
@@ -20,6 +20,7 @@
#define CONFIG_REMOTE_SERVER_USER "remote_server_user"
#define CONFIG_REMOTE_SERVER_PASSWORD "remote_server_password"
#define CONFIG_REMOTE_SERVER_HTTP_PORT "remote_server_http_port"
#define CONFIG_ENABLE_RPI "remote_server_enable_rpi"
#define CONFIG_FAVORITE_URLS "favorite_urls"
#define MAX_FAVORITE_URLS 30
@@ -41,6 +42,7 @@ struct RemoteSettings
int http_port;
bool is_smb;
bool is_ftp;
bool enable_rpi;
};
struct PackageUrlInfo
+5
View File
@@ -123,6 +123,11 @@ char lang_strings[LANG_STRINGS_NUM][LANG_STR_SIZE] = {
"Remote HTTP Server not reachable.", // STR_CANNOT_CONNECT_REMOTE_MSG
"Remote Package Install not possible. Would you like to download package and install?", // STR_DOWNLOAD_INSTALL_MSG
"Checking remote server for Remote Package Install.", // STR_CHECKING_REMOTE_SERVER_MSG
"RPI", // STR_ENABLE_RPI
"This option enables Remote Package Installation. "
"This requires a HTTP Server setup on the same host sharing the same folder.", // STR_ENABLE_RPI_FTP_SMB_MSG
"This option enables Remote Package Installation. "
"This requires a WebDAV Server with anonymous access that does not need username/password.", // STR_ENABLE_RPI_WEBDAV_MSG
};
bool needs_extended_font = false;
+5 -2
View File
@@ -116,7 +116,10 @@
FUNC(STR_REMOTE_NOT_SUPPORT_MSG) \
FUNC(STR_CANNOT_CONNECT_REMOTE_MSG) \
FUNC(STR_DOWNLOAD_INSTALL_MSG) \
FUNC(STR_CHECKING_REMOTE_SERVER_MSG)
FUNC(STR_CHECKING_REMOTE_SERVER_MSG) \
FUNC(STR_ENABLE_RPI) \
FUNC(STR_ENABLE_RPI_FTP_SMB_MSG) \
FUNC(STR_ENABLE_RPI_WEBDAV_MSG)
#define GET_VALUE(x) x,
#define GET_STRING(x) #x,
@@ -126,7 +129,7 @@ enum
FOREACH_STR(GET_VALUE)
};
#define LANG_STRINGS_NUM 113
#define LANG_STRINGS_NUM 116
#define LANG_ID_SIZE 64
#define LANG_STR_SIZE 384
extern char lang_identifiers[LANG_STRINGS_NUM][LANG_ID_SIZE];
+21 -2
View File
@@ -300,7 +300,7 @@ namespace Windows
ImGui::PushStyleVar(ImGuiStyleVar_ButtonTextAlign, ImVec2(0.0f, 1.0f));
sprintf(id, "%s##server", remote_settings->server);
pos = ImGui::GetCursorPos();
if (ImGui::Button(id, ImVec2(650, 0)))
if (ImGui::Button(id, ImVec2(550, 0)))
{
ime_single_field = remote_settings->server;
ResetImeCallbacks();
@@ -344,7 +344,26 @@ namespace Windows
gui_mode = GUI_MODE_IME;
}
if (remote_settings->is_smb || remote_settings->is_ftp)
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, 135));
ImGui::BeginTooltip();
ImGui::PushTextWrapPos(ImGui::GetCursorPos().x + 440);
ImGui::Text("%s", (remote_settings->is_smb || remote_settings->is_ftp) ? lang_strings[STR_ENABLE_RPI_FTP_SMB_MSG] : lang_strings[STR_ENABLE_RPI_WEBDAV_MSG]);
ImGui::PopTextWrapPos();
ImGui::EndTooltip();
}
if ((remote_settings->is_smb || remote_settings->is_ftp) && remote_settings->enable_rpi)
{
ImGui::SameLine();
ImGui::SetCursorPosX(ImGui::GetCursorPosX() + 5);