Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b4f6a8f763 | |||
| acfdd00f4f | |||
| ac55a1e5a6 | |||
| ffdfa6d04d | |||
| 7855c9a7f4 | |||
| f4625bce73 | |||
| 6b0808e48f | |||
| e8eb3fa9da | |||
| df6a068bd3 | |||
| c1307d4221 | |||
| 832c60862b |
+6
-1
@@ -70,7 +70,7 @@ add_executable(ezremote_client
|
||||
|
||||
add_self(ezremote_client)
|
||||
|
||||
add_pkg(ezremote_client ${CMAKE_SOURCE_DIR}/data "RMTC00001" "ezRemote Client" "01.10" 32 0)
|
||||
add_pkg(ezremote_client ${CMAKE_SOURCE_DIR}/data "RMTC00001" "ezRemote Client" "01.13" 32 0)
|
||||
|
||||
target_link_libraries(ezremote_client
|
||||
c
|
||||
@@ -93,6 +93,11 @@ target_link_libraries(ezremote_client
|
||||
minizip
|
||||
un7zip
|
||||
unrar
|
||||
bz2
|
||||
b2
|
||||
lzma
|
||||
lz4
|
||||
archive
|
||||
json-c
|
||||
ssh2
|
||||
kernel
|
||||
|
||||
@@ -172,6 +172,7 @@ Romanian
|
||||
Ryukyuan
|
||||
Thai
|
||||
Turkish
|
||||
Ukrainian
|
||||
```
|
||||
User must modify the file **/data/ezremote-client/config.ini** located in the ps4 hard drive and update the **language** setting to with the **exact** values from the list above.
|
||||
|
||||
|
||||
@@ -156,3 +156,4 @@ STR_CANT_EXTRACT_URL_MSG=Couldn't extract download url
|
||||
STR_FAIL_INSTALL_FROM_URL_MSG=Failed to install from URL
|
||||
STR_INVALID_URL=InValid URL
|
||||
STR_ALLDEBRID_API_KEY_MISSING_MSG=To use this function, an API Key needs to be configured in the ezRemote Client settings
|
||||
STR_LANGUAGE=Language
|
||||
@@ -0,0 +1,132 @@
|
||||
STR_CONNECTION_SETTINGS=Налаштування підключення
|
||||
STR_SITE=Сайт
|
||||
STR_LOCAL=Локальний
|
||||
STR_REMOTE=Дистанційний
|
||||
STR_MESSAGES=Повідомлення
|
||||
STR_UPDATE_SOFTWARE=Оновлення ПО
|
||||
STR_CONNECT=Підключитися
|
||||
STR_DISCONNECT=Від'єднатися
|
||||
STR_SEARCH=Пошук
|
||||
STR_REFRESH=Оновити
|
||||
STR_SERVER=Сервер
|
||||
STR_USERNAME=Ім'я користувача
|
||||
STR_PASSWORD=Пароль
|
||||
STR_PORT=Порт
|
||||
STR_PASV=Пасв
|
||||
STR_DIRECTORY=Каталог
|
||||
STR_FILTER=Фільтир
|
||||
STR_YES=Так
|
||||
STR_NO=Ні
|
||||
STR_CANCEL=Відмінити
|
||||
STR_CONTINUE=Продовжити
|
||||
STR_CLOSE=Закрити
|
||||
STR_FOLDER=Тека
|
||||
STR_FILE=Файл
|
||||
STR_TYPE=Тип
|
||||
STR_NAME=Ім'я
|
||||
STR_SIZE=Розмір
|
||||
STR_DATE=Дата
|
||||
STR_NEW_FOLDER=Нова тека
|
||||
STR_RENAME=Перейменувати
|
||||
STR_DELETE=Видалити
|
||||
STR_UPLOAD=Викласти
|
||||
STR_DOWNLOAD=Завантажити
|
||||
STR_SELECT_ALL=Вибрати Все
|
||||
STR_CLEAR_ALL=Очистити Все
|
||||
STR_UPLOADING=Викладання
|
||||
STR_DOWNLOADING=Завантаження
|
||||
STR_OVERWRITE=Перезапис
|
||||
STR_DONT_OVERWRITE=Не Перезаписувати
|
||||
STR_ASK_FOR_CONFIRM=Запросити Підтвердження
|
||||
STR_DONT_ASK_CONFIRM=Не Запрошувати Підтвердження
|
||||
STR_ALLWAYS_USE_OPTION=Завжди використовувати цю опцію і не перепитувати
|
||||
STR_ACTIONS=Дії
|
||||
STR_CONFIRM=Підтвердити
|
||||
STR_OVERWRITE_OPTIONS=Налаштування Перезапису
|
||||
STR_PROPERTIES=Властивості
|
||||
STR_PROGRESS=Прогрес
|
||||
STR_UPDATES=Оновлення
|
||||
STR_DEL_CONFIRM_MSG=Ви впевнені що хочете видалити цей файл(и)/теку(и)?
|
||||
STR_CANCEL_ACTION_MSG=Скасування. Очікування завершення останньої дії
|
||||
STR_FAIL_UPLOAD_MSG=Помилка при викладанні файлу
|
||||
STR_FAIL_DOWNLOAD_MSG=Помилка при завантаженні файлу
|
||||
STR_FAIL_READ_LOCAL_DIR_MSG=Не вдалося прочитати вміст/каталог або тека не існує.
|
||||
STR_CONNECTION_CLOSE_ERR_MSG=426 З'єднання закрито.
|
||||
STR_REMOTE_TERM_CONN_MSG=426 Віддалений сервер розірвав з'єднання.
|
||||
STR_FAIL_LOGIN_MSG=300 Помилка входу. Будь ласка перевірте ім'я користувача або пароль.
|
||||
STR_FAIL_TIMEOUT_MSG=426 Не вдалося. Тайм-аут з'єднання.
|
||||
STR_FAIL_DEL_DIR_MSG=Не вдалося видалити каталог.
|
||||
STR_DELETING=Видалення
|
||||
STR_FAIL_DEL_FILE_MSG=Не вдалося видалити файл
|
||||
STR_DELETED=Видалено
|
||||
STR_LINK=Посилання
|
||||
STR_SHARE=Поділитися
|
||||
STR_FAILED=310 Не вдалося
|
||||
STR_FAIL_CREATE_LOCAL_FILE_MSG=310 Не вдалося створити файл локально
|
||||
STR_INSTALL=Встановити
|
||||
STR_INSTALLING=Встановлення
|
||||
STR_INSTALL_SUCCESS=Успішно
|
||||
STR_INSTALL_FAILED=Не вдалося
|
||||
STR_INSTALL_SKIPPED=Пропушено
|
||||
STR_CHECK_HTTP_MSG=Перевірка з'єднання с віддаленим HTTP-сервером
|
||||
STR_FAILED_HTTP_CHECK=Не вдалося встановити з'єднання з HTTP-сервером
|
||||
STR_REMOTE_NOT_HTTP=Спроба підключитися не до HTTP-сервера
|
||||
STR_INSTALL_FROM_DATA_MSG=Пакет не у теці /data або /mnt/usbX
|
||||
STR_ALREADY_INSTALLED_MSG=Пакет уже встановлено
|
||||
STR_INSTALL_FROM_URL=Встановити з посилання
|
||||
STR_CANNOT_READ_PKG_HDR_MSG=Не вдалося прочитати інформацію про заголовок пакета
|
||||
STR_FAVORITE_URLS=Улюблені посилання
|
||||
STR_SLOT=Слот
|
||||
STR_EDIT=Редагувати
|
||||
STR_ONETIME_URL=Одноразове посилання
|
||||
STR_NOT_A_VALID_PACKAGE=Недійсний пакет
|
||||
STR_WAIT_FOR_INSTALL_MSG=Зачекайте на заваршення встановлення пакету
|
||||
STR_FAIL_INSTALL_TMP_PKG_MSG=Не вдалося встановити файловий пакет. Будь ласка видаліть тимчасовий пакет вручну
|
||||
STR_AUTO_DELETE_TMP_PKG=Автоматичне видлення тимчасових завантажених пакетів після встановлення
|
||||
STR_PROTOCOL_NOT_SUPPORTED=Протакол не підтримується
|
||||
STR_COULD_NOT_RESOLVE_HOST=Не вдалося розпізнати ім'я хоста
|
||||
STR_EXTRACT=Витяг
|
||||
STR_EXTRACTING=Витягування
|
||||
STR_FAILED_TO_EXTRACT=Не вдалося витягнути
|
||||
STR_EXTRACT_LOCATION=Розташування витягу
|
||||
STR_COMPRESS=Стиснути
|
||||
STR_ZIP_FILE_PATH=Ім'я zip-файлу
|
||||
STR_COMPRESSING=Стискання
|
||||
STR_ERROR_CREATE_ZIP=Виникла помилка під час створення zip-файлу
|
||||
STR_UNSUPPORTED_FILE_FORMAT=Непідтримуваний формат стисненого файлу
|
||||
STR_CUT=Вирізати
|
||||
STR_COPY=Копіювати
|
||||
STR_PASTE=Вставит
|
||||
STR_MOVING=Перемістити
|
||||
STR_COPYING=Копіювання
|
||||
STR_FAIL_MOVE_MSG=Не вдалося перемістити файл
|
||||
STR_FAIL_COPY_MSG=Не вдалося копіювати файл
|
||||
STR_CANT_MOVE_TO_SUBDIR_MSG=Неможливо перемістити головний каталогдо підкаталогу
|
||||
STR_CANT_COPY_TO_SUBDIR_MSG=Неможливо копіювати головний каталогдо підкаталогу
|
||||
STR_UNSUPPORTED_OPERATION_MSG=Операція не підтримується
|
||||
STR_HTTP_PORT=HTTP Порт
|
||||
STR_REINSTALL_CONFIRM_MSG=Вміст вже встановлено. Ви хочете продовжити встановлення
|
||||
STR_REMOTE_NOT_SUPPORT_MSG=Віддалене встановлення пакетів не підтримується захищенимисерверами.
|
||||
STR_CANNOT_CONNECT_REMOTE_MSG=Віддалений HTTP-сервер недоступний.
|
||||
STR_DOWNLOAD_INSTALL_MSG=Віддалене встановлення пакета неможливе. Бажаєте замість цього завантажити пакунок і встановити?
|
||||
STR_CHECKING_REMOTE_SERVER_MSG=Перевірка віддаленого сервера на можливість віддаленого встановлення пакетів.
|
||||
STR_FILES=Файли
|
||||
STR_EDITOR=Редактор
|
||||
STR_SAVE=Зберегти
|
||||
STR_MAX_EDIT_FILE_SIZE_MSG=Неможливо редагувати файли, розмір яких перевищує
|
||||
STR_DELETE_LINE=Видалити Виділений Рядок
|
||||
STR_INSERT_LINE=Вставити нижче виділеного рядка
|
||||
STR_MODIFIED=Модифіковано
|
||||
STR_FAIL_GET_TOKEN_MSG=Не вдалося отримати токен доступу від
|
||||
STR_GET_TOKEN_SUCCESS_MSG=Успішний вхід. Ви можете закрити браузер і повернутися до програми
|
||||
STR_NEW_FILE=Новий Файл
|
||||
STR_SETTINGS=Налаштування
|
||||
STR_GLOBAL=Глобальні
|
||||
STR_COPY_LINE=Копіювати виділений рядок
|
||||
STR_PASTE_LINE=Вставити в виділений рядок
|
||||
STR_SHOW_HIDDEN_FILES=Показати приховані файли
|
||||
STR_SET_DEFAULT_DIRECTORY=Встановити теку за замовчуванням
|
||||
STR_SET_DEFAULT_DIRECTORY_MSG=встановлено директорією за замовчуванням
|
||||
STR_NFS_EXP_PATH_MISSING_MSG=В URL-адресі відсутній шлях до експорту NFS
|
||||
STR_FAIL_INIT_NFS_CONTEXT=Не вдалося ініціювати контекст NFS
|
||||
STR_FAIL_MOUNT_NFS_MSG=Не вдалося змонтувати NFS ресурс
|
||||
+1
-1
File diff suppressed because one or more lines are too long
+4
-1
@@ -28,6 +28,7 @@
|
||||
#include "web/request.hpp"
|
||||
#include "web/urn.hpp"
|
||||
#include "system.h"
|
||||
#include "sfo.h"
|
||||
#include "zip_util.h"
|
||||
|
||||
namespace Actions
|
||||
@@ -709,7 +710,9 @@ namespace Actions
|
||||
else
|
||||
{
|
||||
std::string url = INSTALLER::getRemoteUrl(it->path, true);
|
||||
if (INSTALLER::InstallRemotePkg(url, &header, true) == 0)
|
||||
std::string title = INSTALLER::GetRemotePkgTitle(remoteclient, it->path, &header);
|
||||
|
||||
if (INSTALLER::InstallRemotePkg(url, &header, title, true) == 0)
|
||||
failed++;
|
||||
else
|
||||
success++;
|
||||
|
||||
@@ -132,14 +132,31 @@ int FtpClient::Connect(const std::string &url, const std::string &user, const st
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::string cmd = "USER " + user;
|
||||
std::string cmd;
|
||||
if (user.length() > 0)
|
||||
{
|
||||
cmd = "USER " + user;
|
||||
}
|
||||
else
|
||||
{
|
||||
cmd = "USER anonymous";
|
||||
}
|
||||
|
||||
if (!FtpSendCmd(cmd, '3', mp_ftphandle))
|
||||
{
|
||||
if (mp_ftphandle->ctrl != NULL)
|
||||
return 1;
|
||||
if (*LastResponse() == '2')
|
||||
{
|
||||
mp_ftphandle->is_connected = true;
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
Quit();
|
||||
sprintf(mp_ftphandle->response, "%s", lang_strings[STR_FAIL_LOGIN_MSG]);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
cmd = "PASS " + pass;
|
||||
@@ -1276,29 +1293,29 @@ int FtpClient::GetRange(const std::string &path, DataSink &sink, uint64_t size,
|
||||
}
|
||||
|
||||
char buf[FTP_CLIENT_BUFSIZ];
|
||||
int count = 0;
|
||||
size_t bytes_remaining = size;
|
||||
int count = 0;
|
||||
size_t bytes_remaining = size;
|
||||
|
||||
do
|
||||
{
|
||||
size_t bytes_to_read = std::min<size_t>(FTP_CLIENT_BUFSIZ, bytes_remaining);
|
||||
count = FtpRead(buf, bytes_to_read, nData);
|
||||
if (count > 0)
|
||||
{
|
||||
bytes_remaining -= count;
|
||||
bool ok = sink.write((char*)buf, count);
|
||||
do
|
||||
{
|
||||
size_t bytes_to_read = std::min<size_t>(FTP_CLIENT_BUFSIZ, bytes_remaining);
|
||||
count = FtpRead(buf, bytes_to_read, nData);
|
||||
if (count > 0)
|
||||
{
|
||||
bytes_remaining -= count;
|
||||
bool ok = sink.write((char *)buf, count);
|
||||
if (!ok)
|
||||
{
|
||||
FtpClose(nData);
|
||||
mp_ftphandle->offset = 0;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
} while (1);
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
} while (1);
|
||||
FtpClose(nData);
|
||||
mp_ftphandle->offset = 0;
|
||||
|
||||
@@ -1317,7 +1334,7 @@ int FtpClient::GetRange(const std::string &path, void *buffer, uint64_t size, ui
|
||||
char buf[8192];
|
||||
int l = 0;
|
||||
uint64_t remaining = size;
|
||||
char *p = (char*) buffer;
|
||||
char *p = (char *)buffer;
|
||||
while ((l = FtpRead(buf, 8192, nData)) > 0)
|
||||
{
|
||||
if (l <= remaining)
|
||||
@@ -1336,7 +1353,6 @@ int FtpClient::GetRange(const std::string &path, void *buffer, uint64_t size, ui
|
||||
mp_ftphandle->offset = 0;
|
||||
|
||||
return 1;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "clients/remote_client.h"
|
||||
#include "http/httplib.h"
|
||||
|
||||
#define FTP_CLIENT_MAX_FILENAME_LEN 128
|
||||
#define FTP_CLIENT_MAX_FILENAME_LEN 255
|
||||
|
||||
typedef int (*FtpCallbackXfer)(int64_t xfered, void *arg);
|
||||
|
||||
|
||||
@@ -34,7 +34,14 @@ int SmbClient::Connect(const std::string &url, const std::string &user, const st
|
||||
sprintf(response, "Failed to init SMB context");
|
||||
return 0;
|
||||
}
|
||||
|
||||
smb_url = smb2_parse_url(smb2, url.c_str());
|
||||
if (smb_url == NULL || smb_url->share == NULL || strlen(smb_url->share) == 0)
|
||||
{
|
||||
sprintf(response, "Invalid SMB Url");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (pass.length() > 0)
|
||||
smb2_set_password(smb2, pass.c_str());
|
||||
smb2_set_security_mode(smb2, SMB2_NEGOTIATE_SIGNING_ENABLED);
|
||||
|
||||
+7
-1
@@ -25,6 +25,7 @@ char remote_directory[255];
|
||||
char app_ver[6];
|
||||
char last_site[32];
|
||||
char display_site[32];
|
||||
std::vector<std::string> langs;
|
||||
char language[128];
|
||||
std::vector<std::string> sites;
|
||||
std::vector<std::string> http_servers;
|
||||
@@ -152,6 +153,10 @@ namespace CONFIG
|
||||
sites = {"Site 1", "Site 2", "Site 3", "Site 4", "Site 5", "Site 6", "Site 7", "Site 8", "Site 9", "Site 10",
|
||||
"Site 11", "Site 12", "Site 13", "Site 14", "Site 15", "Site 16", "Site 17", "Site 18", "Site 19", "Site 20"};
|
||||
|
||||
langs = { "Default", "Arabic", "Catalan", "Croatian", "Dutch", "English", "Euskera", "French", "Galego", "German", "Greek",
|
||||
"Hungarian", "Indonesian", "Italiano", "Japanese", "Korean", "Polish", "Portuguese_BR", "Russian", "Romanian", "Ryukyuan", "Spanish", "Turkish",
|
||||
"Simplified Chinese", "Traditional Chinese", "Thai", "Ukrainian"};
|
||||
|
||||
http_servers = {HTTP_SERVER_APACHE, HTTP_SERVER_MS_IIS, HTTP_SERVER_NGINX, HTTP_SERVER_NPX_SERVE, HTTP_SERVER_RCLONE};
|
||||
text_file_extensions = { ".txt", ".ini", ".log", ".json", ".xml", ".html", ".xhtml", ".conf", ".config" };
|
||||
image_file_extensions = { ".bmp", ".jpg", ".jpeg", ".png", ".webp" };
|
||||
@@ -167,7 +172,7 @@ namespace CONFIG
|
||||
WriteInt(CONFIG_GLOBAL, CONFIG_VERSION, CONFIG_VERSION_NUM);
|
||||
|
||||
// Load global config
|
||||
sprintf(language, "%s", ReadString(CONFIG_GLOBAL, CONFIG_LANGUAGE, ""));
|
||||
sprintf(language, "%s", ReadString(CONFIG_GLOBAL, CONFIG_LANGUAGE, "Default"));
|
||||
WriteString(CONFIG_GLOBAL, CONFIG_LANGUAGE, language);
|
||||
|
||||
sprintf(local_directory, "%s", ReadString(CONFIG_GLOBAL, CONFIG_LOCAL_DIRECTORY, "/"));
|
||||
@@ -385,6 +390,7 @@ namespace CONFIG
|
||||
WriteString(CONFIG_GLOBAL, CONFIG_ALLDEBRID_API_KEY, encrypted_api_key.c_str());
|
||||
WriteBool(CONFIG_GLOBAL, CONFIG_AUTO_DELETE_TMP_PKG, auto_delete_tmp_pkg);
|
||||
WriteBool(CONFIG_GLOBAL, CONFIG_SHOW_HIDDEN_FILES, show_hidden_files);
|
||||
WriteString(CONFIG_GLOBAL, CONFIG_LANGUAGE, language);
|
||||
WriteInt(CONFIG_HTTP_SERVER, CONFIG_HTTP_SERVER_PORT, http_server_port);
|
||||
WriteString(CONFIG_HTTP_SERVER, CONFIG_HTTP_SERVER_COMPRESSED_FILE_PATH, compressed_file_path);
|
||||
WriteBool(CONFIG_HTTP_SERVER, CONFIG_HTTP_SERVER_ENABLED, web_server_enabled);
|
||||
|
||||
@@ -126,6 +126,7 @@ extern char remote_directory[255];
|
||||
extern char app_ver[6];
|
||||
extern char last_site[32];
|
||||
extern char display_site[32];
|
||||
extern std::vector<std::string> langs;
|
||||
extern char language[128];
|
||||
extern RemoteSettings *remote_settings;
|
||||
extern RemoteClient *remoteclient;
|
||||
|
||||
+108
-9
@@ -21,7 +21,9 @@
|
||||
#include "lang.h"
|
||||
#include "system.h"
|
||||
#include "fs.h"
|
||||
#include "sfo.h"
|
||||
#include "clients/webdavclient.h"
|
||||
#include "clients/remote_client.h"
|
||||
|
||||
#define BGFT_HEAP_SIZE (1 * 1024 * 1024)
|
||||
|
||||
@@ -99,6 +101,96 @@ namespace INSTALLER
|
||||
s_bgft_initialized = false;
|
||||
}
|
||||
|
||||
std::string GetRemotePkgTitle(RemoteClient *client, const std::string &path, pkg_header *header)
|
||||
{
|
||||
size_t entry_count = BE32(header->pkg_entry_count);
|
||||
uint32_t entry_table_offset = BE32(header->pkg_table_offset);
|
||||
uint64_t entry_table_size = entry_count * sizeof(pkg_table_entry);
|
||||
void *entry_table_data = malloc(entry_table_size);
|
||||
|
||||
int ret = client->GetRange(path, entry_table_data, entry_table_size, entry_table_offset);
|
||||
if (ret == 0)
|
||||
{
|
||||
free(entry_table_data);
|
||||
return "";
|
||||
}
|
||||
|
||||
pkg_table_entry *entries = (pkg_table_entry *)entry_table_data;
|
||||
void* param_sfo_data = nullptr;
|
||||
uint32_t param_sfo_offset = 0;
|
||||
uint32_t param_sfo_size = 0;
|
||||
for (size_t i = 0; i < entry_count; ++i)
|
||||
{
|
||||
if (BE32(entries[i].id) == PKG_ENTRY_ID__PARAM_SFO)
|
||||
{
|
||||
param_sfo_offset = BE32(entries[i].offset);
|
||||
param_sfo_size = BE32(entries[i].size);
|
||||
break;
|
||||
}
|
||||
}
|
||||
free(entry_table_data);
|
||||
|
||||
std::string title;
|
||||
if (param_sfo_offset > 0 && param_sfo_size > 0)
|
||||
{
|
||||
param_sfo_data = malloc(param_sfo_size);
|
||||
int ret = client->GetRange(path, param_sfo_data, param_sfo_size, param_sfo_offset);
|
||||
if (ret)
|
||||
{
|
||||
const char* tmp_title = SFO::GetString((const char*)param_sfo_data, param_sfo_size, "TITLE");
|
||||
if (tmp_title != nullptr)
|
||||
title = std::string(tmp_title);
|
||||
}
|
||||
free(param_sfo_data);
|
||||
}
|
||||
|
||||
return title;
|
||||
}
|
||||
|
||||
std::string GetLocalPkgTitle(const std::string &path, pkg_header *header)
|
||||
{
|
||||
size_t entry_count = BE32(header->pkg_entry_count);
|
||||
uint32_t entry_table_offset = BE32(header->pkg_table_offset);
|
||||
uint64_t entry_table_size = entry_count * sizeof(pkg_table_entry);
|
||||
void *entry_table_data = malloc(entry_table_size);
|
||||
|
||||
FILE *fd = FS::OpenRead(path);
|
||||
FS::Seek(fd, entry_table_offset);
|
||||
FS::Read(fd, entry_table_data, entry_table_size);
|
||||
|
||||
pkg_table_entry *entries = (pkg_table_entry *)entry_table_data;
|
||||
void* param_sfo_data = NULL;
|
||||
uint32_t param_sfo_offset = 0;
|
||||
uint32_t param_sfo_size = 0;
|
||||
void *icon0_png_data = NULL;
|
||||
uint32_t icon0_png_offset = 0;
|
||||
uint32_t icon0_png_size = 0;
|
||||
for (size_t i = 0; i < entry_count; ++i)
|
||||
{
|
||||
if (BE32(entries[i].id) == PKG_ENTRY_ID__PARAM_SFO)
|
||||
{
|
||||
param_sfo_offset = BE32(entries[i].offset);
|
||||
param_sfo_size = BE32(entries[i].size);
|
||||
break;
|
||||
}
|
||||
}
|
||||
free(entry_table_data);
|
||||
|
||||
std::string title;
|
||||
if (param_sfo_offset > 0 && param_sfo_size > 0)
|
||||
{
|
||||
param_sfo_data = malloc(param_sfo_size);
|
||||
FS::Seek(fd, param_sfo_offset);
|
||||
FS::Read(fd, param_sfo_data, param_sfo_size);
|
||||
const char* tmp_title = SFO::GetString((const char*)param_sfo_data, param_sfo_size, "TITLE");
|
||||
if (tmp_title != nullptr)
|
||||
title = std::string(tmp_title);
|
||||
free(param_sfo_data);
|
||||
}
|
||||
|
||||
return title;
|
||||
}
|
||||
|
||||
std::string getRemoteUrl(const std::string path, bool encodeUrl)
|
||||
{
|
||||
if (strlen(remote_settings->username) == 0 && strlen(remote_settings->password) == 0 &&
|
||||
@@ -145,7 +237,7 @@ namespace INSTALLER
|
||||
return true;
|
||||
}
|
||||
|
||||
int InstallRemotePkg(const std::string &url, pkg_header *header, bool prompt)
|
||||
int InstallRemotePkg(const std::string &url, pkg_header *header, std::string title, bool prompt)
|
||||
{
|
||||
if (url.empty())
|
||||
return 0;
|
||||
@@ -153,6 +245,7 @@ namespace INSTALLER
|
||||
int ret;
|
||||
std::string cid = std::string((char *)header->pkg_content_id);
|
||||
cid = cid.substr(cid.find_first_of("-") + 1, 9);
|
||||
std::string display_title = title.length() > 0 ? title : cid;
|
||||
int user_id;
|
||||
ret = sceUserServiceGetForegroundUser(&user_id);
|
||||
const char *package_type;
|
||||
@@ -196,7 +289,7 @@ namespace INSTALLER
|
||||
params.entitlementType = 5;
|
||||
params.id = (char *)header->pkg_content_id;
|
||||
params.contentUrl = url.c_str();
|
||||
params.contentName = cid.c_str();
|
||||
params.contentName = display_title.c_str();
|
||||
params.iconPath = "";
|
||||
params.playgoScenarioId = "0";
|
||||
params.option = ORBIS_BGFT_TASK_OPT_DISABLE_CDN_QUERY_PARAM;
|
||||
@@ -215,7 +308,7 @@ namespace INSTALLER
|
||||
{
|
||||
if (prompt)
|
||||
{
|
||||
sprintf(confirm_message, "%s - %s?", cid.c_str(), lang_strings[STR_REINSTALL_CONFIRM_MSG]);
|
||||
sprintf(confirm_message, "%s - %s?", display_title.c_str(), lang_strings[STR_REINSTALL_CONFIRM_MSG]);
|
||||
confirm_state = CONFIRM_WAIT;
|
||||
action_to_take = selected_action;
|
||||
activity_inprogess = false;
|
||||
@@ -251,7 +344,7 @@ namespace INSTALLER
|
||||
goto err;
|
||||
}
|
||||
|
||||
Util::Notify("%s queued", cid.c_str());
|
||||
Util::Notify("%s queued", display_title.c_str());
|
||||
|
||||
if (prompt)
|
||||
{
|
||||
@@ -299,6 +392,9 @@ namespace INSTALLER
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::string title = GetLocalPkgTitle(path, &header);
|
||||
std::string display_title = title.length() > 0 ? title : std::string(titleId);
|
||||
|
||||
OrbisBgftTaskProgress progress_info;
|
||||
OrbisBgftDownloadParamEx download_params;
|
||||
memset(&download_params, 0, sizeof(download_params));
|
||||
@@ -306,7 +402,7 @@ namespace INSTALLER
|
||||
download_params.params.entitlementType = 5;
|
||||
download_params.params.id = (char *)header.pkg_content_id;
|
||||
download_params.params.contentUrl = filepath;
|
||||
download_params.params.contentName = path.c_str();
|
||||
download_params.params.contentName = display_title.c_str();
|
||||
;
|
||||
download_params.params.iconPath = "";
|
||||
download_params.params.playgoScenarioId = "0";
|
||||
@@ -331,7 +427,7 @@ namespace INSTALLER
|
||||
if (ret)
|
||||
return 0;
|
||||
|
||||
Util::Notify("%s queued", path.c_str());
|
||||
Util::Notify("%s queued", display_title.c_str());
|
||||
|
||||
file_transfering = true;
|
||||
bytes_to_download = 100;
|
||||
@@ -373,6 +469,9 @@ namespace INSTALLER
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::string title = GetLocalPkgTitle(path, header);
|
||||
std::string display_title = title.length() > 0 ? title : std::string(titleId);
|
||||
|
||||
OrbisBgftTaskProgress progress_info;
|
||||
int prog = 0;
|
||||
OrbisBgftDownloadParamEx download_params;
|
||||
@@ -381,7 +480,7 @@ namespace INSTALLER
|
||||
download_params.params.entitlementType = 5;
|
||||
download_params.params.id = (char *)header->pkg_content_id;
|
||||
download_params.params.contentUrl = filepath;
|
||||
download_params.params.contentName = filename.c_str();
|
||||
download_params.params.contentName = display_title.c_str();
|
||||
;
|
||||
download_params.params.iconPath = "";
|
||||
download_params.params.playgoScenarioId = "0";
|
||||
@@ -394,7 +493,7 @@ namespace INSTALLER
|
||||
ret = sceBgftServiceIntDownloadRegisterTaskByStorageEx(&download_params, &task_id);
|
||||
if (ret == 0x80990088 || ret == 0x80990015)
|
||||
{
|
||||
sprintf(confirm_message, "%s - %s?", path.c_str(), lang_strings[STR_REINSTALL_CONFIRM_MSG]);
|
||||
sprintf(confirm_message, "%s - %s?", display_title.c_str(), lang_strings[STR_REINSTALL_CONFIRM_MSG]);
|
||||
confirm_state = CONFIRM_WAIT;
|
||||
action_to_take = selected_action;
|
||||
activity_inprogess = false;
|
||||
@@ -429,7 +528,7 @@ namespace INSTALLER
|
||||
|
||||
if (!remove_after_install)
|
||||
{
|
||||
Util::Notify("%s queued", filename.c_str());
|
||||
Util::Notify("%s queued", display_title.c_str());
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
+5
-1
@@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "clients/remote_client.h"
|
||||
|
||||
#define SWAP16(x) \
|
||||
((uint16_t)((((uint16_t)(x)&UINT16_C(0x00FF)) << 8) | \
|
||||
(((uint16_t)(x)&UINT16_C(0xFF00)) >> 8)))
|
||||
@@ -121,9 +123,11 @@ namespace INSTALLER
|
||||
|
||||
bool canInstallRemotePkg(const std::string &url);
|
||||
std::string getRemoteUrl(const std::string path, bool encodeUrl = false);
|
||||
int InstallRemotePkg(const std::string &path, pkg_header *header, bool prompt = false);
|
||||
int InstallRemotePkg(const std::string &path, pkg_header *header, std::string title, bool prompt = false);
|
||||
int InstallLocalPkg(const std::string &path);
|
||||
int InstallLocalPkg(const std::string &path, pkg_header *header, bool remove_after_install = false);
|
||||
bool ExtractLocalPkg(const std::string &path, const std::string sfo_path, const std::string icon_path);
|
||||
bool ExtractRemotePkg(const std::string &path, const std::string sfo_path, const std::string icon_path);
|
||||
std::string GetRemotePkgTitle(RemoteClient *client, const std::string &path, pkg_header *header);
|
||||
std::string GetLocalPkgTitle(const std::string &path, pkg_header *header);
|
||||
}
|
||||
+2
-1
@@ -168,6 +168,7 @@ char lang_strings[LANG_STRINGS_NUM][LANG_STR_SIZE] = {
|
||||
"Failed to install from URL", // STR_FAIL_INSTALL_FROM_URL_MSG
|
||||
"InValid URL", // STR_INVALID_URL
|
||||
"To use this function, an API Key needs to be configured in the ezRemote Client settings", // STR_ALLDEBRID_API_KEY_MISSING_MSG
|
||||
"Language", // STR_LANGUAGE
|
||||
};
|
||||
|
||||
bool needs_extended_font = false;
|
||||
@@ -181,7 +182,7 @@ namespace Lang
|
||||
|
||||
std::string lang = std::string(language);
|
||||
lang = Util::Trim(lang, " ");
|
||||
if (lang.size() > 0)
|
||||
if (lang.size() > 0 && lang.compare("Default") != 0)
|
||||
{
|
||||
sprintf(langFile, "/app0/assets/langs/%s.ini", lang.c_str());
|
||||
}
|
||||
|
||||
+161
-160
@@ -3,165 +3,166 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#define FOREACH_STR(FUNC) \
|
||||
FUNC(STR_CONNECTION_SETTINGS) \
|
||||
FUNC(STR_SITE) \
|
||||
FUNC(STR_LOCAL) \
|
||||
FUNC(STR_REMOTE) \
|
||||
FUNC(STR_MESSAGES) \
|
||||
FUNC(STR_UPDATE_SOFTWARE) \
|
||||
FUNC(STR_CONNECT) \
|
||||
FUNC(STR_DISCONNECT) \
|
||||
FUNC(STR_SEARCH) \
|
||||
FUNC(STR_REFRESH) \
|
||||
FUNC(STR_SERVER) \
|
||||
FUNC(STR_USERNAME) \
|
||||
FUNC(STR_PASSWORD) \
|
||||
FUNC(STR_PORT) \
|
||||
FUNC(STR_PASV) \
|
||||
FUNC(STR_DIRECTORY) \
|
||||
FUNC(STR_FILTER) \
|
||||
FUNC(STR_YES) \
|
||||
FUNC(STR_NO) \
|
||||
FUNC(STR_CANCEL) \
|
||||
FUNC(STR_CONTINUE) \
|
||||
FUNC(STR_CLOSE) \
|
||||
FUNC(STR_FOLDER) \
|
||||
FUNC(STR_FILE) \
|
||||
FUNC(STR_TYPE) \
|
||||
FUNC(STR_NAME) \
|
||||
FUNC(STR_SIZE) \
|
||||
FUNC(STR_DATE) \
|
||||
FUNC(STR_NEW_FOLDER) \
|
||||
FUNC(STR_RENAME) \
|
||||
FUNC(STR_DELETE) \
|
||||
FUNC(STR_UPLOAD) \
|
||||
FUNC(STR_DOWNLOAD) \
|
||||
FUNC(STR_SELECT_ALL) \
|
||||
FUNC(STR_CLEAR_ALL) \
|
||||
FUNC(STR_UPLOADING) \
|
||||
FUNC(STR_DOWNLOADING) \
|
||||
FUNC(STR_OVERWRITE) \
|
||||
FUNC(STR_DONT_OVERWRITE) \
|
||||
FUNC(STR_ASK_FOR_CONFIRM) \
|
||||
FUNC(STR_DONT_ASK_CONFIRM) \
|
||||
FUNC(STR_ALLWAYS_USE_OPTION) \
|
||||
FUNC(STR_ACTIONS) \
|
||||
FUNC(STR_CONFIRM) \
|
||||
FUNC(STR_OVERWRITE_OPTIONS) \
|
||||
FUNC(STR_PROPERTIES) \
|
||||
FUNC(STR_PROGRESS) \
|
||||
FUNC(STR_UPDATES) \
|
||||
FUNC(STR_DEL_CONFIRM_MSG) \
|
||||
FUNC(STR_CANCEL_ACTION_MSG) \
|
||||
FUNC(STR_FAIL_UPLOAD_MSG) \
|
||||
FUNC(STR_FAIL_DOWNLOAD_MSG) \
|
||||
FUNC(STR_FAIL_READ_LOCAL_DIR_MSG) \
|
||||
FUNC(STR_CONNECTION_CLOSE_ERR_MSG) \
|
||||
FUNC(STR_REMOTE_TERM_CONN_MSG) \
|
||||
FUNC(STR_FAIL_LOGIN_MSG) \
|
||||
FUNC(STR_FAIL_TIMEOUT_MSG) \
|
||||
FUNC(STR_FAIL_DEL_DIR_MSG) \
|
||||
FUNC(STR_DELETING) \
|
||||
FUNC(STR_FAIL_DEL_FILE_MSG) \
|
||||
FUNC(STR_DELETED) \
|
||||
FUNC(STR_LINK) \
|
||||
FUNC(STR_SHARE) \
|
||||
FUNC(STR_FAILED) \
|
||||
FUNC(STR_FAIL_CREATE_LOCAL_FILE_MSG) \
|
||||
FUNC(STR_INSTALL) \
|
||||
FUNC(STR_INSTALLING) \
|
||||
FUNC(STR_INSTALL_SUCCESS) \
|
||||
FUNC(STR_INSTALL_FAILED) \
|
||||
FUNC(STR_INSTALL_SKIPPED) \
|
||||
FUNC(STR_CHECK_HTTP_MSG) \
|
||||
FUNC(STR_FAILED_HTTP_CHECK) \
|
||||
FUNC(STR_REMOTE_NOT_HTTP) \
|
||||
FUNC(STR_INSTALL_FROM_DATA_MSG) \
|
||||
FUNC(STR_ALREADY_INSTALLED_MSG) \
|
||||
FUNC(STR_INSTALL_FROM_URL) \
|
||||
FUNC(STR_CANNOT_READ_PKG_HDR_MSG) \
|
||||
FUNC(STR_FAVORITE_URLS) \
|
||||
FUNC(STR_SLOT) \
|
||||
FUNC(STR_EDIT) \
|
||||
FUNC(STR_ONETIME_URL) \
|
||||
FUNC(STR_NOT_A_VALID_PACKAGE) \
|
||||
FUNC(STR_WAIT_FOR_INSTALL_MSG) \
|
||||
FUNC(STR_FAIL_INSTALL_TMP_PKG_MSG) \
|
||||
FUNC(STR_FAIL_TO_OBTAIN_GG_DL_MSG) \
|
||||
FUNC(STR_AUTO_DELETE_TMP_PKG) \
|
||||
FUNC(STR_PROTOCOL_NOT_SUPPORTED) \
|
||||
FUNC(STR_COULD_NOT_RESOLVE_HOST) \
|
||||
FUNC(STR_EXTRACT) \
|
||||
FUNC(STR_EXTRACTING) \
|
||||
FUNC(STR_FAILED_TO_EXTRACT) \
|
||||
FUNC(STR_EXTRACT_LOCATION) \
|
||||
FUNC(STR_COMPRESS) \
|
||||
FUNC(STR_ZIP_FILE_PATH) \
|
||||
FUNC(STR_COMPRESSING) \
|
||||
FUNC(STR_ERROR_CREATE_ZIP) \
|
||||
FUNC(STR_UNSUPPORTED_FILE_FORMAT) \
|
||||
FUNC(STR_CUT) \
|
||||
FUNC(STR_COPY) \
|
||||
FUNC(STR_PASTE) \
|
||||
FUNC(STR_MOVING) \
|
||||
FUNC(STR_COPYING) \
|
||||
FUNC(STR_FAIL_MOVE_MSG) \
|
||||
FUNC(STR_FAIL_COPY_MSG) \
|
||||
FUNC(STR_CANT_MOVE_TO_SUBDIR_MSG) \
|
||||
FUNC(STR_CANT_COPY_TO_SUBDIR_MSG) \
|
||||
FUNC(STR_UNSUPPORTED_OPERATION_MSG) \
|
||||
FUNC(STR_HTTP_PORT) \
|
||||
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) \
|
||||
FUNC(STR_ENABLE_RPI) \
|
||||
FUNC(STR_ENABLE_RPI_FTP_SMB_MSG) \
|
||||
FUNC(STR_ENABLE_RPI_WEBDAV_MSG) \
|
||||
FUNC(STR_FILES) \
|
||||
FUNC(STR_EDITOR) \
|
||||
FUNC(STR_SAVE) \
|
||||
FUNC(STR_MAX_EDIT_FILE_SIZE_MSG) \
|
||||
FUNC(STR_DELETE_LINE) \
|
||||
FUNC(STR_INSERT_LINE) \
|
||||
FUNC(STR_MODIFIED) \
|
||||
FUNC(STR_FAIL_GET_TOKEN_MSG) \
|
||||
FUNC(STR_GET_TOKEN_SUCCESS_MSG) \
|
||||
FUNC(STR_PERM_DRIVE) \
|
||||
FUNC(STR_PERM_DRIVE_APPDATA) \
|
||||
FUNC(STR_PERM_DRIVE_FILE) \
|
||||
FUNC(STR_PERM_DRIVE_METADATA) \
|
||||
FUNC(STR_PERM_DRIVE_METADATA_RO) \
|
||||
FUNC(STR_GOOGLE_LOGIN_FAIL_MSG) \
|
||||
FUNC(STR_GOOGLE_LOGIN_TIMEOUT_MSG) \
|
||||
FUNC(STR_NEW_FILE) \
|
||||
FUNC(STR_SETTINGS) \
|
||||
FUNC(STR_CLIENT_ID) \
|
||||
FUNC(STR_CLIENT_SECRET) \
|
||||
FUNC(STR_GLOBAL) \
|
||||
FUNC(STR_GOOGLE) \
|
||||
FUNC(STR_COPY_LINE) \
|
||||
FUNC(STR_PASTE_LINE) \
|
||||
FUNC(STR_SHOW_HIDDEN_FILES) \
|
||||
FUNC(STR_SET_DEFAULT_DIRECTORY) \
|
||||
FUNC(STR_SET_DEFAULT_DIRECTORY_MSG) \
|
||||
FUNC(STR_VIEW_IMAGE) \
|
||||
FUNC(STR_VIEW_PKG_INFO) \
|
||||
FUNC(STR_NFS_EXP_PATH_MISSING_MSG) \
|
||||
FUNC(STR_FAIL_INIT_NFS_CONTEXT) \
|
||||
FUNC(STR_FAIL_MOUNT_NFS_MSG) \
|
||||
FUNC(STR_WEB_SERVER) \
|
||||
FUNC(STR_ENABLE) \
|
||||
FUNC(STR_COMPRESSED_FILE_PATH) \
|
||||
FUNC(STR_COMPRESSED_FILE_PATH_MSG) \
|
||||
FUNC(STR_ALLDEBRID) \
|
||||
FUNC(STR_API_KEY) \
|
||||
FUNC(STR_CANT_EXTRACT_URL_MSG) \
|
||||
FUNC(STR_FAIL_INSTALL_FROM_URL_MSG) \
|
||||
FUNC(STR_INVALID_URL) \
|
||||
FUNC(STR_ALLDEBRID_API_KEY_MISSING_MSG)
|
||||
#define FOREACH_STR(FUNC) \
|
||||
FUNC(STR_CONNECTION_SETTINGS) \
|
||||
FUNC(STR_SITE) \
|
||||
FUNC(STR_LOCAL) \
|
||||
FUNC(STR_REMOTE) \
|
||||
FUNC(STR_MESSAGES) \
|
||||
FUNC(STR_UPDATE_SOFTWARE) \
|
||||
FUNC(STR_CONNECT) \
|
||||
FUNC(STR_DISCONNECT) \
|
||||
FUNC(STR_SEARCH) \
|
||||
FUNC(STR_REFRESH) \
|
||||
FUNC(STR_SERVER) \
|
||||
FUNC(STR_USERNAME) \
|
||||
FUNC(STR_PASSWORD) \
|
||||
FUNC(STR_PORT) \
|
||||
FUNC(STR_PASV) \
|
||||
FUNC(STR_DIRECTORY) \
|
||||
FUNC(STR_FILTER) \
|
||||
FUNC(STR_YES) \
|
||||
FUNC(STR_NO) \
|
||||
FUNC(STR_CANCEL) \
|
||||
FUNC(STR_CONTINUE) \
|
||||
FUNC(STR_CLOSE) \
|
||||
FUNC(STR_FOLDER) \
|
||||
FUNC(STR_FILE) \
|
||||
FUNC(STR_TYPE) \
|
||||
FUNC(STR_NAME) \
|
||||
FUNC(STR_SIZE) \
|
||||
FUNC(STR_DATE) \
|
||||
FUNC(STR_NEW_FOLDER) \
|
||||
FUNC(STR_RENAME) \
|
||||
FUNC(STR_DELETE) \
|
||||
FUNC(STR_UPLOAD) \
|
||||
FUNC(STR_DOWNLOAD) \
|
||||
FUNC(STR_SELECT_ALL) \
|
||||
FUNC(STR_CLEAR_ALL) \
|
||||
FUNC(STR_UPLOADING) \
|
||||
FUNC(STR_DOWNLOADING) \
|
||||
FUNC(STR_OVERWRITE) \
|
||||
FUNC(STR_DONT_OVERWRITE) \
|
||||
FUNC(STR_ASK_FOR_CONFIRM) \
|
||||
FUNC(STR_DONT_ASK_CONFIRM) \
|
||||
FUNC(STR_ALLWAYS_USE_OPTION) \
|
||||
FUNC(STR_ACTIONS) \
|
||||
FUNC(STR_CONFIRM) \
|
||||
FUNC(STR_OVERWRITE_OPTIONS) \
|
||||
FUNC(STR_PROPERTIES) \
|
||||
FUNC(STR_PROGRESS) \
|
||||
FUNC(STR_UPDATES) \
|
||||
FUNC(STR_DEL_CONFIRM_MSG) \
|
||||
FUNC(STR_CANCEL_ACTION_MSG) \
|
||||
FUNC(STR_FAIL_UPLOAD_MSG) \
|
||||
FUNC(STR_FAIL_DOWNLOAD_MSG) \
|
||||
FUNC(STR_FAIL_READ_LOCAL_DIR_MSG) \
|
||||
FUNC(STR_CONNECTION_CLOSE_ERR_MSG) \
|
||||
FUNC(STR_REMOTE_TERM_CONN_MSG) \
|
||||
FUNC(STR_FAIL_LOGIN_MSG) \
|
||||
FUNC(STR_FAIL_TIMEOUT_MSG) \
|
||||
FUNC(STR_FAIL_DEL_DIR_MSG) \
|
||||
FUNC(STR_DELETING) \
|
||||
FUNC(STR_FAIL_DEL_FILE_MSG) \
|
||||
FUNC(STR_DELETED) \
|
||||
FUNC(STR_LINK) \
|
||||
FUNC(STR_SHARE) \
|
||||
FUNC(STR_FAILED) \
|
||||
FUNC(STR_FAIL_CREATE_LOCAL_FILE_MSG) \
|
||||
FUNC(STR_INSTALL) \
|
||||
FUNC(STR_INSTALLING) \
|
||||
FUNC(STR_INSTALL_SUCCESS) \
|
||||
FUNC(STR_INSTALL_FAILED) \
|
||||
FUNC(STR_INSTALL_SKIPPED) \
|
||||
FUNC(STR_CHECK_HTTP_MSG) \
|
||||
FUNC(STR_FAILED_HTTP_CHECK) \
|
||||
FUNC(STR_REMOTE_NOT_HTTP) \
|
||||
FUNC(STR_INSTALL_FROM_DATA_MSG) \
|
||||
FUNC(STR_ALREADY_INSTALLED_MSG) \
|
||||
FUNC(STR_INSTALL_FROM_URL) \
|
||||
FUNC(STR_CANNOT_READ_PKG_HDR_MSG) \
|
||||
FUNC(STR_FAVORITE_URLS) \
|
||||
FUNC(STR_SLOT) \
|
||||
FUNC(STR_EDIT) \
|
||||
FUNC(STR_ONETIME_URL) \
|
||||
FUNC(STR_NOT_A_VALID_PACKAGE) \
|
||||
FUNC(STR_WAIT_FOR_INSTALL_MSG) \
|
||||
FUNC(STR_FAIL_INSTALL_TMP_PKG_MSG) \
|
||||
FUNC(STR_FAIL_TO_OBTAIN_GG_DL_MSG) \
|
||||
FUNC(STR_AUTO_DELETE_TMP_PKG) \
|
||||
FUNC(STR_PROTOCOL_NOT_SUPPORTED) \
|
||||
FUNC(STR_COULD_NOT_RESOLVE_HOST) \
|
||||
FUNC(STR_EXTRACT) \
|
||||
FUNC(STR_EXTRACTING) \
|
||||
FUNC(STR_FAILED_TO_EXTRACT) \
|
||||
FUNC(STR_EXTRACT_LOCATION) \
|
||||
FUNC(STR_COMPRESS) \
|
||||
FUNC(STR_ZIP_FILE_PATH) \
|
||||
FUNC(STR_COMPRESSING) \
|
||||
FUNC(STR_ERROR_CREATE_ZIP) \
|
||||
FUNC(STR_UNSUPPORTED_FILE_FORMAT) \
|
||||
FUNC(STR_CUT) \
|
||||
FUNC(STR_COPY) \
|
||||
FUNC(STR_PASTE) \
|
||||
FUNC(STR_MOVING) \
|
||||
FUNC(STR_COPYING) \
|
||||
FUNC(STR_FAIL_MOVE_MSG) \
|
||||
FUNC(STR_FAIL_COPY_MSG) \
|
||||
FUNC(STR_CANT_MOVE_TO_SUBDIR_MSG) \
|
||||
FUNC(STR_CANT_COPY_TO_SUBDIR_MSG) \
|
||||
FUNC(STR_UNSUPPORTED_OPERATION_MSG) \
|
||||
FUNC(STR_HTTP_PORT) \
|
||||
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) \
|
||||
FUNC(STR_ENABLE_RPI) \
|
||||
FUNC(STR_ENABLE_RPI_FTP_SMB_MSG) \
|
||||
FUNC(STR_ENABLE_RPI_WEBDAV_MSG) \
|
||||
FUNC(STR_FILES) \
|
||||
FUNC(STR_EDITOR) \
|
||||
FUNC(STR_SAVE) \
|
||||
FUNC(STR_MAX_EDIT_FILE_SIZE_MSG) \
|
||||
FUNC(STR_DELETE_LINE) \
|
||||
FUNC(STR_INSERT_LINE) \
|
||||
FUNC(STR_MODIFIED) \
|
||||
FUNC(STR_FAIL_GET_TOKEN_MSG) \
|
||||
FUNC(STR_GET_TOKEN_SUCCESS_MSG) \
|
||||
FUNC(STR_PERM_DRIVE) \
|
||||
FUNC(STR_PERM_DRIVE_APPDATA) \
|
||||
FUNC(STR_PERM_DRIVE_FILE) \
|
||||
FUNC(STR_PERM_DRIVE_METADATA) \
|
||||
FUNC(STR_PERM_DRIVE_METADATA_RO) \
|
||||
FUNC(STR_GOOGLE_LOGIN_FAIL_MSG) \
|
||||
FUNC(STR_GOOGLE_LOGIN_TIMEOUT_MSG) \
|
||||
FUNC(STR_NEW_FILE) \
|
||||
FUNC(STR_SETTINGS) \
|
||||
FUNC(STR_CLIENT_ID) \
|
||||
FUNC(STR_CLIENT_SECRET) \
|
||||
FUNC(STR_GLOBAL) \
|
||||
FUNC(STR_GOOGLE) \
|
||||
FUNC(STR_COPY_LINE) \
|
||||
FUNC(STR_PASTE_LINE) \
|
||||
FUNC(STR_SHOW_HIDDEN_FILES) \
|
||||
FUNC(STR_SET_DEFAULT_DIRECTORY) \
|
||||
FUNC(STR_SET_DEFAULT_DIRECTORY_MSG) \
|
||||
FUNC(STR_VIEW_IMAGE) \
|
||||
FUNC(STR_VIEW_PKG_INFO) \
|
||||
FUNC(STR_NFS_EXP_PATH_MISSING_MSG) \
|
||||
FUNC(STR_FAIL_INIT_NFS_CONTEXT) \
|
||||
FUNC(STR_FAIL_MOUNT_NFS_MSG) \
|
||||
FUNC(STR_WEB_SERVER) \
|
||||
FUNC(STR_ENABLE) \
|
||||
FUNC(STR_COMPRESSED_FILE_PATH) \
|
||||
FUNC(STR_COMPRESSED_FILE_PATH_MSG) \
|
||||
FUNC(STR_ALLDEBRID) \
|
||||
FUNC(STR_API_KEY) \
|
||||
FUNC(STR_CANT_EXTRACT_URL_MSG) \
|
||||
FUNC(STR_FAIL_INSTALL_FROM_URL_MSG) \
|
||||
FUNC(STR_INVALID_URL) \
|
||||
FUNC(STR_ALLDEBRID_API_KEY_MISSING_MSG) \
|
||||
FUNC(STR_LANGUAGE)
|
||||
|
||||
#define GET_VALUE(x) x,
|
||||
#define GET_STRING(x) #x,
|
||||
@@ -171,7 +172,7 @@ enum
|
||||
FOREACH_STR(GET_VALUE)
|
||||
};
|
||||
|
||||
#define LANG_STRINGS_NUM 158
|
||||
#define LANG_STRINGS_NUM 159
|
||||
#define LANG_ID_SIZE 64
|
||||
#define LANG_STR_SIZE 384
|
||||
extern char lang_identifiers[LANG_STRINGS_NUM][LANG_ID_SIZE];
|
||||
|
||||
@@ -1105,10 +1105,11 @@ namespace HttpServer
|
||||
BaseClient *baseclient = new BaseClient();
|
||||
baseclient->Connect(host, "", "");
|
||||
baseclient->Head(path, &header, sizeof(pkg_header));
|
||||
std::string title = INSTALLER::GetRemotePkgTitle(baseclient, path, &header);
|
||||
delete(baseclient);
|
||||
|
||||
std::string remote_install_url = std::string("http://localhost:") + std::to_string(http_server_port) + "/rmt_inst/Site%2099/" + hash;
|
||||
int rc = INSTALLER::InstallRemotePkg(remote_install_url, &header);
|
||||
int rc = INSTALLER::InstallRemotePkg(remote_install_url, &header, title);
|
||||
if (rc == 0)
|
||||
{
|
||||
failed(res, 200, lang_strings[STR_FAIL_INSTALL_FROM_URL_MSG]);
|
||||
|
||||
+25
-2
@@ -1062,7 +1062,7 @@ namespace Windows
|
||||
ime_after_update = AfterExtractFolderCallback;
|
||||
Dialog::initImeDialog(lang_strings[STR_EXTRACT_LOCATION], extract_zip_folder, 255, ORBIS_TYPE_BASIC_LATIN, 600, 350);
|
||||
gui_mode = GUI_MODE_IME;
|
||||
file_transfering = true;
|
||||
file_transfering = false;
|
||||
SetModalMode(false);
|
||||
ImGui::CloseCurrentPopup();
|
||||
}
|
||||
@@ -1610,6 +1610,29 @@ namespace Windows
|
||||
{
|
||||
ImGui::TextColored(colors[ImGuiCol_ButtonHovered], "%s", lang_strings[STR_GLOBAL]);
|
||||
ImGui::Separator();
|
||||
ImGui::SetCursorPosX(ImGui::GetCursorPosX() + 15);
|
||||
ImGui::Text("%s", lang_strings[STR_LANGUAGE]);
|
||||
ImGui::SameLine();
|
||||
ImGui::SetCursorPosX(ImGui::GetCursorPosX() + 15);
|
||||
ImGui::SetNextItemWidth(690);
|
||||
if (ImGui::BeginCombo("##Language", language, ImGuiComboFlags_PopupAlignLeft | ImGuiComboFlags_HeightLargest))
|
||||
{
|
||||
for (int n = 0; n < langs.size(); n++)
|
||||
{
|
||||
const bool is_selected = strcmp(langs[n].c_str(), language) == 0;
|
||||
if (ImGui::Selectable(langs[n].c_str(), is_selected))
|
||||
{
|
||||
sprintf(language, "%s", langs[n].c_str());
|
||||
}
|
||||
|
||||
// Set the initial focus when opening the combo (scrolling + keyboard navigation focus)
|
||||
if (is_selected)
|
||||
ImGui::SetItemDefaultFocus();
|
||||
}
|
||||
ImGui::EndCombo();
|
||||
}
|
||||
ImGui::Separator();
|
||||
|
||||
ImGui::SetCursorPosX(ImGui::GetCursorPosX() + 15);
|
||||
ImGui::Text("%s", lang_strings[STR_AUTO_DELETE_TMP_PKG]);
|
||||
ImGui::SameLine();
|
||||
@@ -2000,7 +2023,7 @@ namespace Windows
|
||||
activity_inprogess = true;
|
||||
sprintf(activity_message, "%s", "");
|
||||
stop_activity = false;
|
||||
file_transfering = true;
|
||||
file_transfering = false;
|
||||
selected_action = ACTION_NONE;
|
||||
Actions::ExtractLocalZips();
|
||||
break;
|
||||
|
||||
+222
-117
@@ -9,18 +9,23 @@
|
||||
#include <minizip/zip.h>
|
||||
#include <un7zip.h>
|
||||
#include <unrar.h>
|
||||
#include <archive.h>
|
||||
#include <archive_entry.h>
|
||||
|
||||
#include "common.h"
|
||||
#include "fs.h"
|
||||
#include "ime_dialog.h"
|
||||
#include "lang.h"
|
||||
#include "system.h"
|
||||
#include "windows.h"
|
||||
#include "zip_util.h"
|
||||
|
||||
#define TRANSFER_SIZE (128 * 1024)
|
||||
#define TRANSFER_SIZE (16 * 1024)
|
||||
|
||||
namespace ZipUtil
|
||||
{
|
||||
static char filename_extracted[256];
|
||||
static char password[128];
|
||||
|
||||
void callback_7zip(const char *fileName, unsigned long fileSize, unsigned fileNum, unsigned numFiles)
|
||||
{
|
||||
@@ -217,153 +222,253 @@ namespace ZipUtil
|
||||
return 1;
|
||||
}
|
||||
|
||||
CompressFileType getCompressFileType(const std::string &file)
|
||||
/* duplicate a path name, possibly converting to lower case */
|
||||
static char *pathdup(const char *path)
|
||||
{
|
||||
char buf[8];
|
||||
char *str;
|
||||
size_t i, len;
|
||||
|
||||
memset(buf, 0, 8);
|
||||
int ret = FS::Head(file, buf, 8);
|
||||
if (ret == 0)
|
||||
return COMPRESS_FILE_TYPE_UNKNOWN;
|
||||
if (path == NULL || path[0] == '\0')
|
||||
return (NULL);
|
||||
|
||||
if (strncmp(buf, (const char *)MAGIC_7Z_1, 6) == 0)
|
||||
return COMPRESS_FILE_TYPE_7Z;
|
||||
else if (strncmp(buf, (const char *)MAGIC_RAR_1, 7) == 0 || strncmp(buf, (const char *)MAGIC_RAR_2, 8) == 0)
|
||||
return COMPRESS_FILE_TYPE_RAR;
|
||||
else if (strncmp(buf, (const char *)MAGIC_ZIP_1, 4) == 0 || strncmp(buf, (const char *)MAGIC_ZIP_2, 4) == 0 || strncmp(buf, (const char *)MAGIC_ZIP_3, 4) == 0)
|
||||
return COMPRESS_FILE_TYPE_ZIP;
|
||||
len = strlen(path);
|
||||
while (len && path[len - 1] == '/')
|
||||
len--;
|
||||
if ((str = (char*) malloc(len + 1)) == NULL) {
|
||||
errno = ENOMEM;
|
||||
}
|
||||
memcpy(str, path, len);
|
||||
|
||||
return COMPRESS_FILE_TYPE_UNKNOWN;
|
||||
str[len] = '\0';
|
||||
|
||||
return (str);
|
||||
}
|
||||
|
||||
int ExtractZip(const DirEntry &file, const std::string &dir)
|
||||
/* concatenate two path names */
|
||||
static char *pathcat(const char *prefix, const char *path)
|
||||
{
|
||||
file_transfering = true;
|
||||
unz_global_info global_info;
|
||||
unz_file_info file_info;
|
||||
unzFile zipfile = unzOpen(file.path);
|
||||
std::string dest_dir = std::string(dir);
|
||||
if (dest_dir[dest_dir.length() - 1] != '/')
|
||||
{
|
||||
dest_dir = dest_dir + "/";
|
||||
}
|
||||
if (zipfile == NULL)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
unzGetGlobalInfo(zipfile, &global_info);
|
||||
unzGoToFirstFile(zipfile);
|
||||
uint64_t curr_extracted_bytes = 0;
|
||||
uint64_t curr_file_bytes = 0;
|
||||
int num_files = global_info.number_entry;
|
||||
char fname[512];
|
||||
char ext_fname[512];
|
||||
char read_buffer[TRANSFER_SIZE];
|
||||
char *str;
|
||||
size_t prelen, len;
|
||||
|
||||
for (int zip_idx = 0; zip_idx < num_files; ++zip_idx)
|
||||
{
|
||||
if (stop_activity)
|
||||
break;
|
||||
unzGetCurrentFileInfo(zipfile, &file_info, fname, 512, NULL, 0, NULL, 0);
|
||||
sprintf(ext_fname, "%s%s", dest_dir.c_str(), fname);
|
||||
const size_t filename_length = strlen(ext_fname);
|
||||
bytes_transfered = 0;
|
||||
bytes_to_download = file_info.uncompressed_size;
|
||||
if (ext_fname[filename_length - 1] != '/')
|
||||
{
|
||||
snprintf(activity_message, 255, "%s %s: %s", lang_strings[STR_EXTRACTING], file.name, fname);
|
||||
curr_file_bytes = 0;
|
||||
unzOpenCurrentFile(zipfile);
|
||||
FS::MkDirs(ext_fname, true);
|
||||
FILE *f = fopen(ext_fname, "wb");
|
||||
while (curr_file_bytes < file_info.uncompressed_size)
|
||||
{
|
||||
int rbytes = unzReadCurrentFile(zipfile, read_buffer, TRANSFER_SIZE);
|
||||
if (rbytes > 0)
|
||||
{
|
||||
fwrite(read_buffer, 1, rbytes, f);
|
||||
curr_extracted_bytes += rbytes;
|
||||
curr_file_bytes += rbytes;
|
||||
bytes_transfered = curr_file_bytes;
|
||||
}
|
||||
}
|
||||
fclose(f);
|
||||
unzCloseCurrentFile(zipfile);
|
||||
}
|
||||
else
|
||||
{
|
||||
FS::MkDirs(ext_fname, true);
|
||||
}
|
||||
if ((zip_idx + 1) < num_files)
|
||||
{
|
||||
unzGoToNextFile(zipfile);
|
||||
}
|
||||
prelen = prefix ? strlen(prefix) + 1 : 0;
|
||||
len = strlen(path) + 1;
|
||||
if ((str = (char*) malloc(prelen + len)) == NULL) {
|
||||
errno = ENOMEM;
|
||||
}
|
||||
unzClose(zipfile);
|
||||
return 1;
|
||||
if (prefix) {
|
||||
memcpy(str, prefix, prelen); /* includes zero */
|
||||
str[prelen - 1] = '/'; /* splat zero */
|
||||
}
|
||||
memcpy(str + prelen, path, len); /* includes zero */
|
||||
|
||||
return (str);
|
||||
}
|
||||
|
||||
int Extract7Zip(const DirEntry &file, const std::string &dir)
|
||||
/*
|
||||
* Extract a directory.
|
||||
*/
|
||||
static void extract_dir(struct archive *a, struct archive_entry *e, const std::string &path)
|
||||
{
|
||||
file_transfering = false;
|
||||
FS::MkDirs(dir, true);
|
||||
sprintf(filename_extracted, "%s", file.name);
|
||||
int res = Extract7zFileEx(file.path, dir.c_str(), callback_7zip, DEFAULT_IN_BUF_SIZE);
|
||||
return res == 0;
|
||||
int mode;
|
||||
|
||||
if (path[0] == '\0')
|
||||
return;
|
||||
|
||||
FS::MkDirs(path);
|
||||
archive_read_data_skip(a);
|
||||
}
|
||||
|
||||
int ExtractRar(const DirEntry &file, const std::string &dir)
|
||||
/*
|
||||
* Extract to a file descriptor
|
||||
*/
|
||||
static int extract2fd(struct archive *a, const std::string &pathname, int fd)
|
||||
{
|
||||
file_transfering = false;
|
||||
HANDLE hArcData; // Archive Handle
|
||||
struct RAROpenArchiveDataEx rarOpenArchiveData;
|
||||
struct RARHeaderDataEx rarHeaderData;
|
||||
char destPath[256];
|
||||
ssize_t len;
|
||||
unsigned char buffer[TRANSFER_SIZE];
|
||||
|
||||
memset(&rarOpenArchiveData, 0, sizeof(rarOpenArchiveData));
|
||||
memset(&rarHeaderData, 0, sizeof(rarHeaderData));
|
||||
/* loop over file contents and write to fd */
|
||||
for (int n = 0; ; n++) {
|
||||
len = archive_read_data(a, buffer, sizeof buffer);
|
||||
|
||||
sprintf(destPath, "%s", dir.c_str());
|
||||
rarOpenArchiveData.ArcName = (char *)file.path;
|
||||
rarOpenArchiveData.CmtBuf = NULL;
|
||||
rarOpenArchiveData.CmtBufSize = 0;
|
||||
rarOpenArchiveData.OpenMode = RAR_OM_EXTRACT;
|
||||
hArcData = RAROpenArchiveEx(&rarOpenArchiveData);
|
||||
if (len == 0)
|
||||
return 1;
|
||||
|
||||
if (rarOpenArchiveData.OpenResult != ERAR_SUCCESS)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
while (RARReadHeaderEx(hArcData, &rarHeaderData) == ERAR_SUCCESS)
|
||||
{
|
||||
sprintf(activity_message, "%s %s: %s", lang_strings[STR_EXTRACTING], file.name, rarHeaderData.FileName);
|
||||
if (RARProcessFile(hArcData, RAR_EXTRACT, destPath, NULL) != ERAR_SUCCESS)
|
||||
if (len < 0)
|
||||
{
|
||||
RARCloseArchive(hArcData);
|
||||
sprintf(status_message, "error archive_read_data('%s')", pathname.c_str());
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (write(fd, buffer, len) != len)
|
||||
{
|
||||
sprintf(status_message, "error write('%s')", pathname.c_str());
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
RARCloseArchive(hArcData);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int Extract(const DirEntry &file, const std::string &dir)
|
||||
/*
|
||||
* Extract a regular file.
|
||||
*/
|
||||
static void extract_file(struct archive *a, struct archive_entry *e, const std::string &path)
|
||||
{
|
||||
CompressFileType fileType = getCompressFileType(file.path);
|
||||
struct stat sb;
|
||||
int fd;
|
||||
const char *linkname;
|
||||
|
||||
if (fileType == COMPRESS_FILE_TYPE_ZIP)
|
||||
return ExtractZip(file, dir);
|
||||
else if (fileType == COMPRESS_FILE_TYPE_7Z)
|
||||
return Extract7Zip(file, dir);
|
||||
else if (fileType == COMPRESS_FILE_TYPE_RAR)
|
||||
return ExtractRar(file, dir);
|
||||
/* look for existing file of same name */
|
||||
recheck:
|
||||
if (lstat(path.c_str(), &sb) == 0) {
|
||||
(void)unlink(path.c_str());
|
||||
}
|
||||
|
||||
/* process symlinks */
|
||||
linkname = archive_entry_symlink(e);
|
||||
if (linkname != NULL) {
|
||||
if (symlink(linkname, path.c_str()) != 0)
|
||||
{
|
||||
sprintf(status_message, "error symlink('%s')", path.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
/* set access and modification time */
|
||||
return;
|
||||
}
|
||||
|
||||
if ((fd = open(path.c_str(), O_RDWR|O_CREAT|O_TRUNC, 0777)) < 0)
|
||||
{
|
||||
sprintf(status_message, "error open('%s')", path.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
extract2fd(a, path, fd);
|
||||
|
||||
/* set access and modification time */
|
||||
if (close(fd) != 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
static void extract(struct archive *a, struct archive_entry *e, const std::string &base_dir)
|
||||
{
|
||||
char *pathname, *realpathname;
|
||||
mode_t filetype;
|
||||
char *p, *q;
|
||||
|
||||
if ((pathname = pathdup(archive_entry_pathname(e))) == NULL) {
|
||||
archive_read_data_skip(a);
|
||||
return;
|
||||
}
|
||||
filetype = archive_entry_filetype(e);
|
||||
|
||||
/* sanity checks */
|
||||
if (pathname[0] == '/' ||
|
||||
strncmp(pathname, "../", 3) == 0 ||
|
||||
strstr(pathname, "/../") != NULL) {
|
||||
archive_read_data_skip(a);
|
||||
free(pathname);
|
||||
return;
|
||||
}
|
||||
|
||||
/* I don't think this can happen in a zipfile.. */
|
||||
if (!S_ISDIR(filetype) && !S_ISREG(filetype) && !S_ISLNK(filetype)) {
|
||||
archive_read_data_skip(a);
|
||||
free(pathname);
|
||||
return;
|
||||
}
|
||||
|
||||
realpathname = pathcat(base_dir.c_str(), pathname);
|
||||
|
||||
/* ensure that parent directory exists */
|
||||
FS::MkDirs(realpathname, true);
|
||||
|
||||
if (S_ISDIR(filetype))
|
||||
extract_dir(a, e, realpathname);
|
||||
else
|
||||
{
|
||||
sprintf(status_message, "%s - %s", file.name, lang_strings[STR_UNSUPPORTED_FILE_FORMAT]);
|
||||
return -1;
|
||||
snprintf(activity_message, 255, "%s: %s", lang_strings[STR_EXTRACTING], pathname);
|
||||
extract_file(a, e, realpathname);
|
||||
}
|
||||
|
||||
free(realpathname);
|
||||
free(pathname);
|
||||
}
|
||||
|
||||
/*
|
||||
* Callback function for reading passphrase.
|
||||
* Originally from cpio.c and passphrase.c, libarchive.
|
||||
*/
|
||||
static const char *passphrase_callback(struct archive *a, void *_client_data)
|
||||
{
|
||||
Dialog::initImeDialog(lang_strings[STR_PASSWORD], password, 127, ORBIS_TYPE_DEFAULT, 560, 200);
|
||||
int ime_result = Dialog::updateImeDialog();
|
||||
if (ime_result == IME_DIALOG_RESULT_FINISHED || ime_result == IME_DIALOG_RESULT_CANCELED)
|
||||
{
|
||||
if (ime_result == IME_DIALOG_RESULT_FINISHED)
|
||||
{
|
||||
snprintf(password, 127, "%s", (char *)Dialog::getImeDialogInputText());
|
||||
return password;
|
||||
}
|
||||
else
|
||||
{
|
||||
memset(password, 0, sizeof(password));
|
||||
}
|
||||
}
|
||||
|
||||
memset(password, 0, sizeof(password));
|
||||
return password;
|
||||
}
|
||||
|
||||
/*
|
||||
* Main loop: open the zipfile, iterate over its contents and decide what
|
||||
* to do with each entry.
|
||||
*/
|
||||
int Extract(const DirEntry &file, const std::string &basepath)
|
||||
{
|
||||
struct archive *a;
|
||||
struct archive_entry *e;
|
||||
int ret;
|
||||
uintmax_t total_size, file_count, error_count;
|
||||
|
||||
if ((a = archive_read_new()) == NULL)
|
||||
sprintf(status_message, "%s", "archive_read_new failed");
|
||||
|
||||
archive_read_support_format_all(a);
|
||||
archive_read_support_filter_all(a);
|
||||
archive_read_set_passphrase_callback(a, NULL, &passphrase_callback);
|
||||
|
||||
ret = archive_read_open_filename(a, file.path, TRANSFER_SIZE);
|
||||
if (ret < ARCHIVE_OK)
|
||||
{
|
||||
sprintf(status_message, "%s", "archive_read_open_filename failed");
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (;;) {
|
||||
if (stop_activity)
|
||||
break;
|
||||
|
||||
ret = archive_read_next_header(a, &e);
|
||||
|
||||
if (ret < ARCHIVE_OK)
|
||||
{
|
||||
sprintf(status_message, "%s", "archive_read_next_header failed");
|
||||
archive_read_free(a);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ret == ARCHIVE_EOF)
|
||||
break;
|
||||
|
||||
extract(a, e, basepath);
|
||||
}
|
||||
|
||||
archive_read_free(a);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user