add option to download and install if remote package install not possible

This commit is contained in:
Chee Yee
2023-02-13 21:24:04 -08:00
parent 2784994260
commit 0aef91ada2
14 changed files with 274 additions and 134 deletions
+4
View File
@@ -107,3 +107,7 @@ STR_CANT_COPY_TO_SUBDIR_MSG=Cannot copy parent directory to sub subdirectory
STR_UNSUPPORTED_OPERATION_MSG=Operation not supported
STR_HTTP_PORT=Http Port
STR_REINSTALL_CONFIRM_MSG=The content has already been installed. Do you want to continue installing
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.
+71 -15
View File
@@ -251,7 +251,7 @@ namespace Actions
std::copy(multi_selected_local_files.begin(), multi_selected_local_files.end(), std::back_inserter(files));
else
files.push_back(selected_local_file);
for (std::vector<DirEntry>::iterator it = files.begin(); it != files.end(); ++it)
{
FS::RmRecursive(it->path);
@@ -430,7 +430,7 @@ namespace Actions
{
file_transfering = true;
std::vector<DirEntry> files;
if (multi_selected_local_files.size()>0)
if (multi_selected_local_files.size() > 0)
std::copy(multi_selected_local_files.begin(), multi_selected_local_files.end(), std::back_inserter(files));
else
files.push_back(selected_local_file);
@@ -578,7 +578,7 @@ namespace Actions
{
file_transfering = true;
std::vector<DirEntry> files;
if (multi_selected_remote_files.size()>0)
if (multi_selected_remote_files.size() > 0)
std::copy(multi_selected_remote_files.begin(), multi_selected_remote_files.end(), std::back_inserter(files));
else
files.push_back(selected_remote_file);
@@ -625,11 +625,36 @@ namespace Actions
int skipped = 0;
std::vector<DirEntry> files;
if (multi_selected_remote_files.size()>0)
if (multi_selected_remote_files.size() > 0)
std::copy(multi_selected_remote_files.begin(), multi_selected_remote_files.end(), std::back_inserter(files));
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))
{
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;
}
}
for (std::vector<DirEntry>::iterator it = files.begin(); it != files.end(); ++it)
{
if (stop_activity)
@@ -651,10 +676,20 @@ namespace Actions
{
if (BE32(header.pkg_magic) == PKG_MAGIC)
{
if (INSTALLER::InstallRemotePkg(it->path, &header) == 0)
failed++;
if (download_and_install)
{
if (DownloadAndInstallPkg(it->path, &header) == 0)
failed++;
else
success++;
}
else
success++;
{
if (INSTALLER::InstallRemotePkg(it->path, &header) == 0)
failed++;
else
success++;
}
}
else
skipped++;
@@ -670,6 +705,7 @@ namespace Actions
lang_strings[STR_INSTALL_SUCCESS], success, lang_strings[STR_INSTALL_FAILED], failed,
lang_strings[STR_INSTALL_SKIPPED], skipped);
}
finish:
activity_inprogess = false;
multi_selected_remote_files.clear();
Windows::SetModalMode(false);
@@ -696,7 +732,7 @@ namespace Actions
int ret;
std::vector<DirEntry> files;
if (multi_selected_local_files.size()>0)
if (multi_selected_local_files.size() > 0)
std::copy(multi_selected_local_files.begin(), multi_selected_local_files.end(), std::back_inserter(files));
else
files.push_back(selected_local_file);
@@ -774,7 +810,7 @@ namespace Actions
{
FS::MkDirs(extract_zip_folder, true);
std::vector<DirEntry> files;
if (multi_selected_local_files.size()>0)
if (multi_selected_local_files.size() > 0)
std::copy(multi_selected_local_files.begin(), multi_selected_local_files.end(), std::back_inserter(files));
else
files.push_back(selected_local_file);
@@ -819,7 +855,7 @@ namespace Actions
if (zf != NULL)
{
std::vector<DirEntry> files;
if (multi_selected_local_files.size()>0)
if (multi_selected_local_files.size() > 0)
std::copy(multi_selected_local_files.begin(), multi_selected_local_files.end(), std::back_inserter(files));
else
files.push_back(selected_local_file);
@@ -828,7 +864,7 @@ namespace Actions
{
if (stop_activity)
break;
int res = ZipUtil::ZipAddPath(zf, it->path, strlen(it->directory)+1, Z_DEFAULT_COMPRESSION);
int res = ZipUtil::ZipAddPath(zf, it->path, strlen(it->directory) + 1, Z_DEFAULT_COMPRESSION);
if (res <= 0)
{
sprintf(status_message, "%s", lang_strings[STR_ERROR_CREATE_ZIP]);
@@ -954,7 +990,7 @@ namespace Actions
sceRtcGetTick(&now, &tick);
sprintf(filename, "%s/%lu.pkg", DATA_PATH, tick.mytick);
std::string full_url = std::string(install_pkg_url);
std::string full_url = std::string(install_pkg_url.url);
if (full_url.find("https://drive.google.com") != std::string::npos)
full_url = GetGoogleDownloadUrl(full_url);
@@ -971,7 +1007,7 @@ namespace Actions
std::string path = full_url.substr(path_pos);
WebDAV::WebDavClient tmp_client;
tmp_client.Connect(host.c_str(), "", "0", false);
tmp_client.Connect(host.c_str(), install_pkg_url.username, install_pkg_url.password, false);
sprintf(activity_message, "%s URL to %s", lang_strings[STR_DOWNLOADING], filename);
int s = sizeof(pkg_header);
@@ -1142,7 +1178,7 @@ namespace Actions
long idle;
while (remoteclient != nullptr && remoteclient->clientType() == CLIENT_TYPE_FTP && remoteclient->IsConnected())
{
FtpClient *client = (FtpClient*) remoteclient;
FtpClient *client = (FtpClient *)remoteclient;
idle = client->GetIdleTime();
if (idle > 60000000)
{
@@ -1417,7 +1453,7 @@ namespace Actions
continue;
}
}
snprintf(activity_message, 1024, "%s %s", lang_strings[STR_MOVING], it->path);
int res = CopyOrMoveRemoteFile(it->path, new_path, false);
if (res == 0)
@@ -1556,4 +1592,24 @@ namespace Actions
Windows::SetModalMode(false);
}
}
int DownloadAndInstallPkg(const std::string &filename, pkg_header *header)
{
char local_file[2000];
OrbisDateTime now;
OrbisTick tick;
sceRtcGetCurrentClockLocalTime(&now);
sceRtcGetTick(&now, &tick);
sprintf(local_file, "%s/%lu.pkg", DATA_PATH, tick.mytick);
sprintf(activity_message, "%s %s to %s", lang_strings[STR_DOWNLOADING], filename.c_str(), local_file);
remoteclient->Size(filename, &bytes_to_download);
bytes_transfered = 0;
file_transfering = true;
int ret = remoteclient->Get(local_file, filename);
if (ret == 0)
return 0;
return INSTALLER::InstallLocalPkg(local_file, header, true);
}
}
+2
View File
@@ -2,6 +2,7 @@
#define ACTIONS_H
#include <pthread.h>
#include "installer.h"
#include "common.h"
#define CONFIRM_NONE -1
@@ -102,6 +103,7 @@ namespace Actions
void MoveRemoteFiles();
void *CopyRemoteFilesThread(void *argp);
void CopyRemoteFiles();
int DownloadAndInstallPkg(const std::string &filename, pkg_header *header);
}
#endif
+1 -1
View File
@@ -22,7 +22,7 @@ char display_site[32];
char language[128];
std::vector<std::string> sites;
std::map<std::string, RemoteSettings> site_settings;
char install_pkg_url[512];
PackageUrlInfo install_pkg_url;
char favorite_urls[MAX_FAVORITE_URLS][512];
bool auto_delete_tmp_pkg;
RemoteClient *remoteclient;
+8 -1
View File
@@ -43,6 +43,13 @@ struct RemoteSettings
bool is_ftp;
};
struct PackageUrlInfo
{
char url[512];
char username[33];
char password[25];
};
extern std::vector<std::string> sites;
extern std::map<std::string, RemoteSettings> site_settings;
extern char local_directory[255];
@@ -53,7 +60,7 @@ extern char display_site[32];
extern char language[128];
extern RemoteSettings *remote_settings;
extern RemoteClient *remoteclient;
extern char install_pkg_url[512];
extern PackageUrlInfo install_pkg_url;
extern char favorite_urls[MAX_FAVORITE_URLS][512];
extern bool auto_delete_tmp_pkg;
+34
View File
@@ -19,6 +19,7 @@
#include "lang.h"
#include "rtc.h"
#include "fs.h"
#include "webdavclient.h"
#define BGFT_HEAP_SIZE (1 * 1024 * 1024)
@@ -137,6 +138,39 @@ namespace INSTALLER
return "";
}
bool canInstallRemotePkg(const std::string &url)
{
if (remoteclient->clientType() == CLIENT_TYPE_WEBDAV)
{
if (strlen(remote_settings->username) > 0)
{
sprintf(confirm_message, "%s %s", lang_strings[STR_REMOTE_NOT_SUPPORT_MSG], lang_strings[STR_DOWNLOAD_INSTALL_MSG]);
return false;
}
else
return true;
}
else
{
size_t scheme_pos = url.find_first_of("://");
size_t path_pos = url.find_first_of("/", scheme_pos + 3);
std::string host = url.substr(0, path_pos);
std::string path = url.substr(path_pos);
WebDAV::WebDavClient tmp_client;
tmp_client.Connect(host.c_str(), "", "", false);
WebDAV::dict_t response_headers{};
int ret = tmp_client.GetHeaders(path.c_str(), &response_headers);
if (!ret)
{
sprintf(confirm_message, "%s %s", lang_strings[STR_CANNOT_CONNECT_REMOTE_MSG], lang_strings[STR_DOWNLOAD_INSTALL_MSG]);
return false;
}
return true;
}
return false;
}
int InstallRemotePkg(const std::string &filename, pkg_header *header)
{
std::string url = getRemoteUrl(filename);
+2
View File
@@ -110,6 +110,8 @@ namespace INSTALLER
int Init(void);
void Exit(void);
bool canInstallRemotePkg(const std::string &url);
std::string getRemoteUrl(const std::string filename);
int InstallRemotePkg(const std::string &filename, pkg_header *header);
int InstallLocalPkg(const std::string &filename, pkg_header *header, bool remove_after_install=false);
}
+113 -109
View File
@@ -10,115 +10,119 @@ char lang_identifiers[LANG_STRINGS_NUM][LANG_ID_SIZE] = {
// This is properly populated so that emulator won't crash if an user launches it without language INI files.
char lang_strings[LANG_STRINGS_NUM][LANG_STR_SIZE] = {
"Connection Settings", // STR_CONNECTION_SETTINGS
"Site", // STR_SITE
"Local", // STR_LOCAL
"Remote", // STR_REMOTE
"Messages", // STR_MESSAGES
"Update Software", // STR_UPDATE_SOFTWARE
"Connect", // STR_CONNECT
"Disconnect", // STR_DISCONNECT
"Search", // STR_SEARCH
"Refresh", // STR_REFRESH
"Server", // STR_SERVER
"Username", // STR_USERNAME
"Password", // STR_PASSWORD
"Port", // STR_PORT
"Pasv", // STR_PASV
"Directory", // STR_DIRECTORY
"Filter", // STR_FILTER
"Yes", // STR_YES
"No", // STR_NO
"Cancel", // STR_CANCEL
"Continue", // STR_CONTINUE
"Close", // STR_CLOSE
"Folder", // STR_FOLDER
"File", // STR_FILE
"Type", // STR_TYPE
"Name", // STR_NAME
"Size", // STR_SIZE
"Date", // STR_DATE
"New Folder", // STR_NEW_FOLDER
"Rename", // STR_RENAME
"Delete", // STR_DELETE
"Upload", // STR_UPLOAD
"Download", // STR_DOWNLOAD
"Select All", // STR_SELECT_ALL
"Clear All", // STR_CLEAR_ALL
"Uploading", // STR_UPLOADING
"Downloading", // STR_DOWNLOADING
"Overwrite", // STR_OVERWRITE
"Don't Overwrite", // STR_DONT_OVERWRITE
"Ask for Confirmation", // STR_ASK_FOR_CONFIRM
"Don't Ask for Confirmation", // STR_DONT_ASK_CONFIRM
"Always use this option and don't ask again", // STR_ALLWAYS_USE_OPTION
"Actions", // STR_ACTIONS
"Confirm", // STR_CONFIRM
"Overwrite Options", // STR_OVERWRITE_OPTIONS
"Properties", // STR_PROPERTIES
"Progress", // STR_PROGRESS
"Updates", // STR_UPDATES
"Are you sure you want to delete this file(s)/folder(s)?", // STR_DEL_CONFIRM_MSG
"Canceling. Waiting for last action to complete", // STR_CANCEL_ACTION_MSG
"Failed to upload file", // STR_FAIL_UPLOAD_MSG
"Failed to download file", // STR_FAIL_DOWNLOAD_MSG
"Failed to read contents of directory or folder does not exist.", // STR_FAIL_READ_LOCAL_DIR_MSG
"426 Connection closed.", // STR_CONNECTION_CLOSE_ERR_MSG
"426 Remote Server has terminated the connection.", // STR_REMOTE_TERM_CONN_MSG
"300 Failed Login. Please check your username or password.", // STR_FAIL_LOGIN_MSG
"426 Failed. Connection timeout.", // STR_FAIL_TIMEOUT_MSG
"Failed to delete directory", // STR_FAIL_DEL_DIR_MSG
"Deleting", // STR_DELETING
"Failed to delete file", // STR_FAIL_DEL_FILE_MSG
"Deleted", // STR_DELETED
"Link", // STR_LINK
"Share", // STR_SHARE
"310 Failed", // STR_FAILED
"310 Failed to create file on local", // STR_FAIL_CREATE_LOCAL_FILE_MSG
"Install", // STR_INSTALL
"Installing", // STR_INSTALLING
"Success", // STR_INSTALL_SUCCESS
"Failed", // STR_INSTALL_FAILED
"Skipped", // STR_INSTALL_SKIPPED
"Checking connection to remote HTTP Server", // STR_CHECK_HTTP_MSG
"Failed connecting to HTTP Server", // STR_FAILED_HTTP_CHECK
"Remote is not a HTTP Server", // STR_REMOTE_NOT_HTTP
"Package not in the /data or /mnt/usbX folder", // STR_INSTALL_FROM_DATA_MSG
"Package is already installed", // STR_ALREADY_INSTALLED_MSG
"Install from URL", // STR_INSTALL_FROM_URL
"Could not read package header info", // STR_CANNOT_READ_PKG_HDR_MSG
"Favorite URLs", // STR_FAVORITE_URLS
"Slot", // STR_SLOT
"Edit", // STR_EDIT
"One Time Url", // STR_ONETIME_URL
"Not a valid Package", // STR_NOT_A_VALID_PACKAGE
"Waiting for Package to finish installing", // STR_WAIT_FOR_INSTALL_MSG
"Failed to install pkg file. Please delete the tmp pkg manually", // STR_FAIL_INSTALL_TMP_PKG_MSG
"Failed to obtain google download URL", // STR_FAIL_TO_OBTAIN_GG_DL_MSG
"Auto delete temporary downloaded pkg file after install", // STR_AUTO_DELETE_TMP_PKG
"Protocol not supported", // STR_PROTOCOL_NOT_SUPPORTED
"Could not resolve hostname", // STR_COULD_NOT_RESOLVE_HOST
"Extract", // STR_EXTRACT
"Extracting", // STR_EXTRACTING
"Failed to extract", // STR_FAILED_TO_EXTRACT
"Extract Location", // STR_EXTRACT_LOCATION
"Compress", // STR_COMPRESS
"Zip Filename", // STR_ZIP_FILE_PATH
"Compressing", // STR_COMPRESSING
"Error occured while creating zip", // STR_ERROR_CREATE_ZIP
"Unsupported compressed file format", // STR_UNSUPPORTED_FILE_FORMAT
"Cut", // STR_CUT
"Copy", // STR_COPY
"Paste", // STR_PASTE
"Moving", // STR_MOVING
"Copying", // STR_COPYING
"Failed to move file", // STR_FAIL_MOVE_MSG
"Failed to copy file", // STR_FAIL_COPY_MSG
"Cannot move parent directory to sub subdirectory", // STR_CANT_MOVE_TO_SUBDIR_MSG
"Cannot copy parent directory to sub subdirectory", // STR_CANT_COPY_TO_SUBDIR_MSG
"Operation not supported", // STR_UNSUPPORTED_OPERATION_MSG
"Http Port", // STR_HTTP_PORT
"The content has already been installed. Do you want to continue installing", // STR_REINSTALL_CONFIRM_MSG
"Connection Settings", // STR_CONNECTION_SETTINGS
"Site", // STR_SITE
"Local", // STR_LOCAL
"Remote", // STR_REMOTE
"Messages", // STR_MESSAGES
"Update Software", // STR_UPDATE_SOFTWARE
"Connect", // STR_CONNECT
"Disconnect", // STR_DISCONNECT
"Search", // STR_SEARCH
"Refresh", // STR_REFRESH
"Server", // STR_SERVER
"Username", // STR_USERNAME
"Password", // STR_PASSWORD
"Port", // STR_PORT
"Pasv", // STR_PASV
"Directory", // STR_DIRECTORY
"Filter", // STR_FILTER
"Yes", // STR_YES
"No", // STR_NO
"Cancel", // STR_CANCEL
"Continue", // STR_CONTINUE
"Close", // STR_CLOSE
"Folder", // STR_FOLDER
"File", // STR_FILE
"Type", // STR_TYPE
"Name", // STR_NAME
"Size", // STR_SIZE
"Date", // STR_DATE
"New Folder", // STR_NEW_FOLDER
"Rename", // STR_RENAME
"Delete", // STR_DELETE
"Upload", // STR_UPLOAD
"Download", // STR_DOWNLOAD
"Select All", // STR_SELECT_ALL
"Clear All", // STR_CLEAR_ALL
"Uploading", // STR_UPLOADING
"Downloading", // STR_DOWNLOADING
"Overwrite", // STR_OVERWRITE
"Don't Overwrite", // STR_DONT_OVERWRITE
"Ask for Confirmation", // STR_ASK_FOR_CONFIRM
"Don't Ask for Confirmation", // STR_DONT_ASK_CONFIRM
"Always use this option and don't ask again", // STR_ALLWAYS_USE_OPTION
"Actions", // STR_ACTIONS
"Confirm", // STR_CONFIRM
"Overwrite Options", // STR_OVERWRITE_OPTIONS
"Properties", // STR_PROPERTIES
"Progress", // STR_PROGRESS
"Updates", // STR_UPDATES
"Are you sure you want to delete this file(s)/folder(s)?", // STR_DEL_CONFIRM_MSG
"Canceling. Waiting for last action to complete", // STR_CANCEL_ACTION_MSG
"Failed to upload file", // STR_FAIL_UPLOAD_MSG
"Failed to download file", // STR_FAIL_DOWNLOAD_MSG
"Failed to read contents of directory or folder does not exist.", // STR_FAIL_READ_LOCAL_DIR_MSG
"426 Connection closed.", // STR_CONNECTION_CLOSE_ERR_MSG
"426 Remote Server has terminated the connection.", // STR_REMOTE_TERM_CONN_MSG
"300 Failed Login. Please check your username or password.", // STR_FAIL_LOGIN_MSG
"426 Failed. Connection timeout.", // STR_FAIL_TIMEOUT_MSG
"Failed to delete directory", // STR_FAIL_DEL_DIR_MSG
"Deleting", // STR_DELETING
"Failed to delete file", // STR_FAIL_DEL_FILE_MSG
"Deleted", // STR_DELETED
"Link", // STR_LINK
"Share", // STR_SHARE
"310 Failed", // STR_FAILED
"310 Failed to create file on local", // STR_FAIL_CREATE_LOCAL_FILE_MSG
"Install", // STR_INSTALL
"Installing", // STR_INSTALLING
"Success", // STR_INSTALL_SUCCESS
"Failed", // STR_INSTALL_FAILED
"Skipped", // STR_INSTALL_SKIPPED
"Checking connection to remote HTTP Server", // STR_CHECK_HTTP_MSG
"Failed connecting to HTTP Server", // STR_FAILED_HTTP_CHECK
"Remote is not a HTTP Server", // STR_REMOTE_NOT_HTTP
"Package not in the /data or /mnt/usbX folder", // STR_INSTALL_FROM_DATA_MSG
"Package is already installed", // STR_ALREADY_INSTALLED_MSG
"Install from URL", // STR_INSTALL_FROM_URL
"Could not read package header info", // STR_CANNOT_READ_PKG_HDR_MSG
"Favorite URLs", // STR_FAVORITE_URLS
"Slot", // STR_SLOT
"Edit", // STR_EDIT
"One Time Url", // STR_ONETIME_URL
"Not a valid Package", // STR_NOT_A_VALID_PACKAGE
"Waiting for Package to finish installing", // STR_WAIT_FOR_INSTALL_MSG
"Failed to install pkg file. Please delete the tmp pkg manually", // STR_FAIL_INSTALL_TMP_PKG_MSG
"Failed to obtain google download URL", // STR_FAIL_TO_OBTAIN_GG_DL_MSG
"Auto delete temporary downloaded pkg file after install", // STR_AUTO_DELETE_TMP_PKG
"Protocol not supported", // STR_PROTOCOL_NOT_SUPPORTED
"Could not resolve hostname", // STR_COULD_NOT_RESOLVE_HOST
"Extract", // STR_EXTRACT
"Extracting", // STR_EXTRACTING
"Failed to extract", // STR_FAILED_TO_EXTRACT
"Extract Location", // STR_EXTRACT_LOCATION
"Compress", // STR_COMPRESS
"Zip Filename", // STR_ZIP_FILE_PATH
"Compressing", // STR_COMPRESSING
"Error occured while creating zip", // STR_ERROR_CREATE_ZIP
"Unsupported compressed file format", // STR_UNSUPPORTED_FILE_FORMAT
"Cut", // STR_CUT
"Copy", // STR_COPY
"Paste", // STR_PASTE
"Moving", // STR_MOVING
"Copying", // STR_COPYING
"Failed to move file", // STR_FAIL_MOVE_MSG
"Failed to copy file", // STR_FAIL_COPY_MSG
"Cannot move parent directory to sub subdirectory", // STR_CANT_MOVE_TO_SUBDIR_MSG
"Cannot copy parent directory to sub subdirectory", // STR_CANT_COPY_TO_SUBDIR_MSG
"Operation not supported", // STR_UNSUPPORTED_OPERATION_MSG
"Http Port", // STR_HTTP_PORT
"The content has already been installed. Do you want to continue installing", // STR_REINSTALL_CONFIRM_MSG
"Remote server requires at least a username.", // STR_REMOTE_NOT_SUPPORT_MSG
"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
};
bool needs_extended_font = false;
+7 -3
View File
@@ -112,7 +112,11 @@
FUNC(STR_CANT_COPY_TO_SUBDIR_MSG) \
FUNC(STR_UNSUPPORTED_OPERATION_MSG) \
FUNC(STR_HTTP_PORT) \
FUNC(STR_REINSTALL_CONFIRM_MSG)
FUNC(STR_REINSTALL_CONFIRM_MSG) \
FUNC(STR_REMOTE_NOT_SUPPORT_MSG) \
FUNC(STR_CANNOT_CONNECT_REMOTE_MSG) \
FUNC(STR_DOWNLOAD_INSTALL_MSG) \
FUNC(STR_CHECKING_REMOTE_SERVER_MSG)
#define GET_VALUE(x) x,
#define GET_STRING(x) #x,
@@ -122,9 +126,9 @@ enum
FOREACH_STR(GET_VALUE)
};
#define LANG_STRINGS_NUM 109
#define LANG_STRINGS_NUM 113
#define LANG_ID_SIZE 64
#define LANG_STR_SIZE 256
#define LANG_STR_SIZE 384
extern char lang_identifiers[LANG_STRINGS_NUM][LANG_ID_SIZE];
extern char lang_strings[LANG_STRINGS_NUM][LANG_STR_SIZE];
extern bool needs_extended_font;
+16
View File
@@ -117,6 +117,7 @@ namespace WebDAV
bool is_performed = request.perform();
this->http_code = request.status_code();
this->result = request.result();
if (callback != nullptr)
callback(is_performed);
@@ -161,6 +162,7 @@ namespace WebDAV
bool is_performed = request.perform();
this->http_code = request.status_code();
this->result = request.result();
if (callback != nullptr)
callback(is_performed);
@@ -218,6 +220,7 @@ bool
bool is_performed = request.perform();
this->http_code = request.status_code();
this->result = request.result();
if (callback != nullptr)
callback(is_performed);
if (!is_performed)
@@ -265,6 +268,7 @@ bool
bool is_performed = request.perform();
this->http_code = request.status_code();
this->result = request.result();
if (callback != nullptr)
callback(is_performed);
@@ -315,6 +319,7 @@ bool
bool is_performed = request.perform();
this->http_code = request.status_code();
this->result = request.result();
if (callback != nullptr)
callback(is_performed);
return is_performed;
@@ -360,6 +365,7 @@ bool
bool is_performed = request.perform();
this->http_code = request.status_code();
this->result = request.result();
if (callback != nullptr)
callback(is_performed);
@@ -407,6 +413,7 @@ bool
bool is_performed = request.perform();
this->http_code = request.status_code();
this->result = request.result();
if (callback != nullptr)
callback(is_performed);
@@ -471,6 +478,7 @@ bool
auto is_performed = request.perform();
this->http_code = request.status_code();
this->result = request.result();
if (!is_performed)
return 0;
@@ -516,6 +524,7 @@ bool
bool is_performed = request.perform();
this->http_code = request.status_code();
this->result = request.result();
return is_performed;
}
@@ -546,6 +555,7 @@ bool
#endif
bool is_performed = request.perform();
this->http_code = request.status_code();
this->result = request.result();
if (!is_performed)
return dict_t{};
@@ -621,6 +631,7 @@ bool
#endif
bool is_performed = request.perform();
this->http_code = request.status_code();
this->result = request.result();
return is_performed;
}
@@ -667,6 +678,7 @@ bool
bool is_performed = request.perform();
this->http_code = request.status_code();
this->result = request.result();
if (!is_performed)
return dict_items_t{};
@@ -814,6 +826,7 @@ bool
bool is_performed = request.perform();
this->http_code = request.status_code();
this->result = request.result();
return is_performed;
}
@@ -847,6 +860,7 @@ bool
bool is_performed = request.perform();
this->http_code = request.status_code();
this->result = request.result();
return is_performed;
}
@@ -879,6 +893,7 @@ bool
bool is_performed = request.perform();
this->http_code = request.status_code();
this->result = request.result();
return is_performed;
}
@@ -954,6 +969,7 @@ bool
bool is_performed = request.perform();
this->http_code = request.status_code();
this->result = request.result();
return is_performed;
}
+1
View File
@@ -380,6 +380,7 @@ namespace WebDAV
dict_t options();
long http_code;
int result;
int check_enabled = 0;
};
} // namespace WebDAV
+7 -1
View File
@@ -96,6 +96,7 @@ namespace WebDAV
this->set(CURLOPT_FOLLOWLOCATION, 1);
this->set(CURLOPT_COOKIEJAR, "/data/ps4-webdav-client/cookies.txt");
this->set(CURLOPT_COOKIEFILE, "/data/ps4-webdav-client/cookies.txt");
this->set(CURLOPT_CONNECTTIMEOUT, 15L);
if (!this->proxy_enabled())
return;
@@ -151,7 +152,8 @@ namespace WebDAV
{
if (this->handle == nullptr)
return false;
auto is_performed = check_code(curl_easy_perform(this->handle));
this->res = curl_easy_perform(this->handle);
auto is_performed = this->res == CURLE_OK;
if (!is_performed)
return false;
this->http_code = 0;
@@ -195,4 +197,8 @@ namespace WebDAV
return this->http_code;
}
int Request::result() const noexcept
{
return this->res;
}
} // namespace WebDAV
+2
View File
@@ -57,12 +57,14 @@ namespace WebDAV
bool perform() noexcept;
long status_code() const noexcept;
int result() const noexcept;
void *handle;
private:
const dict_t options;
dict_t response_header = {};
long http_code;
int res;
bool proxy_enabled() const noexcept;
bool cert_required() const noexcept;
auto swap(Request &other) noexcept -> void;
+6 -4
View File
@@ -1186,12 +1186,12 @@ namespace Windows
if (ImGui::Button(lang_strings[STR_ONETIME_URL], ImVec2(535, 0)))
{
ResetImeCallbacks();
sprintf(install_pkg_url, "%s", "");
ime_single_field = install_pkg_url;
sprintf(install_pkg_url.url, "%s", "");
ime_single_field = install_pkg_url.url;
ime_field_size = 511;
ime_after_update = AfterPackageUrlCallback;
ime_callback = SingleValueImeCallback;
Dialog::initImeDialog("URL", install_pkg_url, 511, ORBIS_TYPE_BASIC_LATIN, 600, 340);
Dialog::initImeDialog("URL", install_pkg_url.url, 511, ORBIS_TYPE_BASIC_LATIN, 600, 340);
gui_mode = GUI_MODE_IME;
select_url_inprogress = false;
SetModalMode(false);
@@ -1224,7 +1224,9 @@ namespace Windows
ImGui::PushStyleVar(ImGuiStyleVar_ButtonTextAlign, ImVec2(0.0f, 1.0f));
if (ImGui::Button(favorite_urls[j], ImVec2(875, 0)))
{
sprintf(install_pkg_url, "%s", favorite_urls[j]);
sprintf(install_pkg_url.url, "%s", favorite_urls[j]);
memset(install_pkg_url.username, 0, sizeof(install_pkg_url.username));
memset(install_pkg_url.password, 0, sizeof(install_pkg_url.password));
selected_action = ACTION_INSTALL_URL_PKG;
SetModalMode(false);
select_url_inprogress = false;