mirror of
https://github.com/ventoy/Ventoy.git
synced 2025-09-16 17:11:13 +00:00
Compare commits
15 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
c2336f555a | ||
|
87391e8b32 | ||
|
f9c56c6686 | ||
|
1ab1799b72 | ||
|
4a42bdfce7 | ||
|
3f09fb9a23 | ||
|
c87ad1d734 | ||
|
5590208885 | ||
|
09a6d33d62 | ||
|
9852252aba | ||
|
0585d83a8f | ||
|
ebe0b7d282 | ||
|
261ddcef45 | ||
|
ebc5e2e993 | ||
|
d58bd8c3f7 |
@@ -48,10 +48,11 @@ int g_ventoy_suppress_esc = 0;
|
||||
int g_ventoy_suppress_esc_default = 1;
|
||||
int g_ventoy_menu_esc = 0;
|
||||
int g_ventoy_fn_mutex = 0;
|
||||
int g_ventoy_secondary_menu_on = 0;
|
||||
int g_ventoy_terminal_output = 0;
|
||||
|
||||
#define VTOY_COMM_HOTKEY(cmdkey) \
|
||||
if (0 == g_ventoy_fn_mutex) { \
|
||||
if (0 == g_ventoy_fn_mutex && 0 == g_ventoy_secondary_menu_on) { \
|
||||
cmdstr = grub_env_get(cmdkey); \
|
||||
if (cmdstr) \
|
||||
{ \
|
||||
@@ -933,70 +934,91 @@ run_menu (grub_menu_t menu, int nested, int *auto_boot)
|
||||
goto refresh;
|
||||
case GRUB_TERM_KEY_F1:
|
||||
case '1':
|
||||
menu_fini ();
|
||||
g_ventoy_memdisk_mode = 1 - g_ventoy_memdisk_mode;
|
||||
g_ventoy_menu_refresh = 1;
|
||||
goto refresh;
|
||||
|
||||
if (0 == g_ventoy_secondary_menu_on)
|
||||
{
|
||||
menu_fini ();
|
||||
g_ventoy_memdisk_mode = 1 - g_ventoy_memdisk_mode;
|
||||
g_ventoy_menu_refresh = 1;
|
||||
goto refresh;
|
||||
}
|
||||
break;
|
||||
case (GRUB_TERM_CTRL | 'i'):
|
||||
case 'i':
|
||||
menu_fini ();
|
||||
g_ventoy_iso_raw = 1 - g_ventoy_iso_raw;
|
||||
g_ventoy_menu_refresh = 1;
|
||||
goto refresh;
|
||||
|
||||
if (0 == g_ventoy_secondary_menu_on)
|
||||
{
|
||||
menu_fini ();
|
||||
g_ventoy_iso_raw = 1 - g_ventoy_iso_raw;
|
||||
g_ventoy_menu_refresh = 1;
|
||||
goto refresh;
|
||||
}
|
||||
break;
|
||||
case (GRUB_TERM_CTRL | 'r'):
|
||||
case 'r':
|
||||
menu_fini ();
|
||||
g_ventoy_grub2_mode = 1 - g_ventoy_grub2_mode;
|
||||
g_ventoy_menu_refresh = 1;
|
||||
goto refresh;
|
||||
|
||||
if (0 == g_ventoy_secondary_menu_on)
|
||||
{
|
||||
menu_fini ();
|
||||
g_ventoy_grub2_mode = 1 - g_ventoy_grub2_mode;
|
||||
g_ventoy_menu_refresh = 1;
|
||||
goto refresh;
|
||||
}
|
||||
break;
|
||||
case (GRUB_TERM_CTRL | 'w'):
|
||||
case 'w':
|
||||
menu_fini ();
|
||||
g_ventoy_wimboot_mode = 1 - g_ventoy_wimboot_mode;
|
||||
g_ventoy_menu_refresh = 1;
|
||||
goto refresh;
|
||||
|
||||
if (0 == g_ventoy_secondary_menu_on)
|
||||
{
|
||||
menu_fini ();
|
||||
g_ventoy_wimboot_mode = 1 - g_ventoy_wimboot_mode;
|
||||
g_ventoy_menu_refresh = 1;
|
||||
goto refresh;
|
||||
}
|
||||
break;
|
||||
case (GRUB_TERM_CTRL | 'u'):
|
||||
case 'u':
|
||||
menu_fini ();
|
||||
g_ventoy_iso_uefi_drv = 1 - g_ventoy_iso_uefi_drv;
|
||||
g_ventoy_menu_refresh = 1;
|
||||
goto refresh;
|
||||
|
||||
if (0 == g_ventoy_secondary_menu_on)
|
||||
{
|
||||
menu_fini ();
|
||||
g_ventoy_iso_uefi_drv = 1 - g_ventoy_iso_uefi_drv;
|
||||
g_ventoy_menu_refresh = 1;
|
||||
goto refresh;
|
||||
}
|
||||
break;
|
||||
case (GRUB_TERM_CTRL | 'h'):
|
||||
case 'h':
|
||||
{
|
||||
cmdstr = grub_env_get("VTOY_HELP_CMD");
|
||||
if (cmdstr)
|
||||
if (0 == g_ventoy_secondary_menu_on)
|
||||
{
|
||||
grub_script_execute_sourcecode(cmdstr);
|
||||
while (grub_getkey() != GRUB_TERM_ESC)
|
||||
;
|
||||
menu_fini ();
|
||||
goto refresh;
|
||||
cmdstr = grub_env_get("VTOY_HELP_CMD");
|
||||
if (cmdstr)
|
||||
{
|
||||
grub_script_execute_sourcecode(cmdstr);
|
||||
while (grub_getkey() != GRUB_TERM_ESC)
|
||||
;
|
||||
menu_fini ();
|
||||
goto refresh;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case (GRUB_TERM_CTRL | 'm'):
|
||||
case 'm':
|
||||
{
|
||||
if (g_ventoy_cur_img_path)
|
||||
{
|
||||
grub_env_set("VTOY_CHKSUM_FILE_PATH", g_ventoy_cur_img_path);
|
||||
cmdstr = grub_env_get("VTOY_CHKSUM_CMD");
|
||||
if (cmdstr)
|
||||
if (0 == g_ventoy_secondary_menu_on)
|
||||
{
|
||||
if (g_ventoy_cur_img_path)
|
||||
{
|
||||
menu_fini();
|
||||
grub_script_execute_sourcecode(cmdstr);
|
||||
goto refresh;
|
||||
grub_env_set("VTOY_CHKSUM_FILE_PATH", g_ventoy_cur_img_path);
|
||||
cmdstr = grub_env_get("VTOY_CHKSUM_CMD");
|
||||
if (cmdstr)
|
||||
{
|
||||
menu_fini();
|
||||
grub_script_execute_sourcecode(cmdstr);
|
||||
goto refresh;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
grub_env_set("VTOY_CHKSUM_FILE_PATH", "X");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
grub_env_set("VTOY_CHKSUM_FILE_PATH", "X");
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@@ -188,6 +188,21 @@ void * ventoy_alloc_chain(grub_size_t size)
|
||||
return p;
|
||||
}
|
||||
|
||||
void ventoy_memfile_env_set(const char *prefix, const void *buf, unsigned long long len)
|
||||
{
|
||||
char name[128];
|
||||
char val[64];
|
||||
|
||||
grub_snprintf(name, sizeof(name), "%s_addr", prefix);
|
||||
grub_snprintf(val, sizeof(val), "0x%llx", (ulonglong)(ulong)buf);
|
||||
grub_env_set(name, val);
|
||||
|
||||
grub_snprintf(name, sizeof(name), "%s_size", prefix);
|
||||
grub_snprintf(val, sizeof(val), "%llu", len);
|
||||
grub_env_set(name, val);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static int ventoy_arch_mode_init(void)
|
||||
{
|
||||
|
@@ -158,6 +158,8 @@ const char *g_menu_prefix[img_type_max] =
|
||||
"iso", "wim", "efi", "img", "vhd", "vtoy"
|
||||
};
|
||||
|
||||
static int g_vtoy_secondary_need_recover = 0;
|
||||
|
||||
static int g_vtoy_load_prompt = 0;
|
||||
static char g_vtoy_prompt_msg[64];
|
||||
|
||||
@@ -1034,8 +1036,6 @@ static grub_err_t ventoy_cmd_concat_efi_iso(grub_extcmd_context_t ctxt, int argc
|
||||
int totlen = 0;
|
||||
int offset = 0;
|
||||
grub_file_t file;
|
||||
char name[32];
|
||||
char value[32];
|
||||
char *buf = NULL;
|
||||
char *data = NULL;
|
||||
ventoy_iso9660_override *dirent;
|
||||
@@ -1095,13 +1095,7 @@ static grub_err_t ventoy_cmd_concat_efi_iso(grub_extcmd_context_t ctxt, int argc
|
||||
grub_file_read(file, data + sizeof(ventoy_chain_head) + len, file->size);
|
||||
grub_file_close(file);
|
||||
|
||||
grub_snprintf(name, sizeof(name), "%s_addr", args[1]);
|
||||
grub_snprintf(value, sizeof(value), "0x%llx", (ulonglong)(ulong)data);
|
||||
grub_env_set(name, value);
|
||||
|
||||
grub_snprintf(name, sizeof(name), "%s_size", args[1]);
|
||||
grub_snprintf(value, sizeof(value), "%d", (int)(totlen));
|
||||
grub_env_set(name, value);
|
||||
ventoy_memfile_env_set(args[1], data, (ulonglong)totlen);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1168,8 +1162,6 @@ grub_ssize_t ventoy_load_file_with_prompt(grub_file_t file, void *buf, grub_ssiz
|
||||
static grub_err_t ventoy_cmd_load_file_to_mem(grub_extcmd_context_t ctxt, int argc, char **args)
|
||||
{
|
||||
int rc = 1;
|
||||
char name[32];
|
||||
char value[32];
|
||||
char *buf = NULL;
|
||||
grub_file_t file;
|
||||
enum grub_file_type type;
|
||||
@@ -1220,13 +1212,7 @@ static grub_err_t ventoy_cmd_load_file_to_mem(grub_extcmd_context_t ctxt, int ar
|
||||
grub_file_read(file, buf, file->size);
|
||||
}
|
||||
|
||||
grub_snprintf(name, sizeof(name), "%s_addr", args[2]);
|
||||
grub_snprintf(value, sizeof(value), "0x%llx", (unsigned long long)(unsigned long)buf);
|
||||
grub_env_set(name, value);
|
||||
|
||||
grub_snprintf(name, sizeof(name), "%s_size", args[2]);
|
||||
grub_snprintf(value, sizeof(value), "%llu", (unsigned long long)file->size);
|
||||
grub_env_set(name, value);
|
||||
ventoy_memfile_env_set(args[2], buf, (ulonglong)(file->size));
|
||||
|
||||
grub_file_close(file);
|
||||
rc = 0;
|
||||
@@ -1238,8 +1224,6 @@ static grub_err_t ventoy_cmd_load_img_memdisk(grub_extcmd_context_t ctxt, int ar
|
||||
{
|
||||
int rc = 1;
|
||||
int headlen;
|
||||
char name[32];
|
||||
char value[32];
|
||||
char *buf = NULL;
|
||||
grub_file_t file;
|
||||
|
||||
@@ -1271,13 +1255,7 @@ static grub_err_t ventoy_cmd_load_img_memdisk(grub_extcmd_context_t ctxt, int ar
|
||||
|
||||
grub_file_read(file, buf + headlen, file->size);
|
||||
|
||||
grub_snprintf(name, sizeof(name), "%s_addr", args[1]);
|
||||
grub_snprintf(value, sizeof(value), "0x%llx", (unsigned long long)(unsigned long)buf);
|
||||
grub_env_set(name, value);
|
||||
|
||||
grub_snprintf(name, sizeof(name), "%s_size", args[1]);
|
||||
grub_snprintf(value, sizeof(value), "%llu", (unsigned long long)file->size);
|
||||
grub_env_set(name, value);
|
||||
ventoy_memfile_env_set(args[1], buf, (ulonglong)(file->size));
|
||||
|
||||
grub_file_close(file);
|
||||
rc = 0;
|
||||
@@ -2181,6 +2159,59 @@ int ventoy_fill_data(grub_uint32_t buflen, char *buffer)
|
||||
return len;
|
||||
}
|
||||
|
||||
static int
|
||||
ventoy_password_get (char buf[], unsigned buf_size)
|
||||
{
|
||||
unsigned i, cur_len = 0;
|
||||
int key;
|
||||
struct grub_term_coordinate *pos = grub_term_save_pos ();
|
||||
|
||||
while (1)
|
||||
{
|
||||
key = grub_getkey ();
|
||||
if (key == '\n' || key == '\r')
|
||||
break;
|
||||
|
||||
if (key == GRUB_TERM_ESC)
|
||||
{
|
||||
cur_len = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
if (key == '\b')
|
||||
{
|
||||
if (cur_len)
|
||||
{
|
||||
grub_term_restore_pos (pos);
|
||||
for (i = 0; i < cur_len; i++)
|
||||
grub_xputs (" ");
|
||||
grub_term_restore_pos (pos);
|
||||
cur_len--;
|
||||
for (i = 0; i < cur_len; i++)
|
||||
grub_xputs ("*");
|
||||
grub_refresh ();
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!grub_isprint (key))
|
||||
continue;
|
||||
|
||||
if (cur_len + 2 < buf_size)
|
||||
buf[cur_len++] = key;
|
||||
grub_xputs ("*");
|
||||
grub_refresh ();
|
||||
}
|
||||
|
||||
grub_memset (buf + cur_len, 0, buf_size - cur_len);
|
||||
|
||||
grub_xputs ("\n");
|
||||
grub_refresh ();
|
||||
grub_free (pos);
|
||||
|
||||
return (key != GRUB_TERM_ESC);
|
||||
}
|
||||
|
||||
int ventoy_check_password(const vtoy_password *pwd, int retry)
|
||||
{
|
||||
int offset;
|
||||
@@ -2196,7 +2227,7 @@ int ventoy_check_password(const vtoy_password *pwd, int retry)
|
||||
|
||||
if (pwd->type == VTOY_PASSWORD_TXT)
|
||||
{
|
||||
grub_password_get(input, 128);
|
||||
ventoy_password_get(input, 128);
|
||||
if (grub_strcmp(pwd->text, input) == 0)
|
||||
{
|
||||
return 0;
|
||||
@@ -2204,7 +2235,7 @@ int ventoy_check_password(const vtoy_password *pwd, int retry)
|
||||
}
|
||||
else if (pwd->type == VTOY_PASSWORD_MD5)
|
||||
{
|
||||
grub_password_get(input, 128);
|
||||
ventoy_password_get(input, 128);
|
||||
grub_crypto_hash(GRUB_MD_MD5, md5, input, grub_strlen(input));
|
||||
if (grub_memcmp(pwd->md5, md5, 16) == 0)
|
||||
{
|
||||
@@ -2214,7 +2245,7 @@ int ventoy_check_password(const vtoy_password *pwd, int retry)
|
||||
else if (pwd->type == VTOY_PASSWORD_SALT_MD5)
|
||||
{
|
||||
offset = (int)grub_snprintf(input, 128, "%s", pwd->salt);
|
||||
grub_password_get(input + offset, 128);
|
||||
ventoy_password_get(input + offset, 128);
|
||||
|
||||
grub_crypto_hash(GRUB_MD_MD5, md5, input, grub_strlen(input));
|
||||
if (grub_memcmp(pwd->md5, md5, 16) == 0)
|
||||
@@ -5970,9 +6001,11 @@ static grub_err_t ventoy_cmd_need_secondary_menu(grub_extcmd_context_t ctxt, int
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (ventoy_check_mode_by_name(args[0], "vtmemdisk") ||
|
||||
ventoy_check_mode_by_name(args[0], "vtgrub2") ||
|
||||
ventoy_check_mode_by_name(args[0], "vtwimboot"))
|
||||
if (ventoy_check_mode_by_name(args[0], "vtgrub2") ||
|
||||
ventoy_check_mode_by_name(args[0], "vtwimboot") ||
|
||||
ventoy_check_mode_by_name(args[0], "vtmemdisk") ||
|
||||
ventoy_check_mode_by_name(args[0], "vtnormal")
|
||||
)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
@@ -6009,6 +6042,7 @@ static grub_err_t ventoy_cmd_show_secondary_menu(grub_extcmd_context_t ctxt, int
|
||||
return 1;
|
||||
}
|
||||
|
||||
g_vtoy_secondary_need_recover = 0;
|
||||
grub_env_unset("VTOY_CHKSUM_FILE_PATH");
|
||||
|
||||
env = grub_env_get("VTOY_SECONDARY_TIMEOUT");
|
||||
@@ -6049,25 +6083,30 @@ static grub_err_t ventoy_cmd_show_secondary_menu(grub_extcmd_context_t ctxt, int
|
||||
g_ventoy_menu_esc = 1;
|
||||
g_ventoy_suppress_esc = 1;
|
||||
g_ventoy_suppress_esc_default = 0;
|
||||
g_ventoy_secondary_menu_on = 1;
|
||||
grub_snprintf(cfgfile, sizeof(cfgfile), "configfile mem:0x%llx:size:%d", (ulonglong)(ulong)cmd, pos);
|
||||
grub_script_execute_sourcecode(cfgfile);
|
||||
g_ventoy_menu_esc = 0;
|
||||
g_ventoy_suppress_esc = 0;
|
||||
g_ventoy_suppress_esc_default = 1;
|
||||
g_ventoy_secondary_menu_on = 0;
|
||||
|
||||
select = seldata[g_ventoy_last_entry];
|
||||
|
||||
if (select == 2)
|
||||
{
|
||||
g_ventoy_wimboot_mode = 1;
|
||||
g_vtoy_secondary_need_recover = 1;
|
||||
}
|
||||
else if (select == 3)
|
||||
{
|
||||
g_ventoy_grub2_mode = 1;
|
||||
g_vtoy_secondary_need_recover = 2;
|
||||
}
|
||||
else if (select == 4)
|
||||
{
|
||||
g_ventoy_memdisk_mode = 1;
|
||||
g_vtoy_secondary_need_recover = 3;
|
||||
}
|
||||
else if (select == 5)
|
||||
{
|
||||
@@ -6080,6 +6119,30 @@ static grub_err_t ventoy_cmd_show_secondary_menu(grub_extcmd_context_t ctxt, int
|
||||
return 0;
|
||||
}
|
||||
|
||||
static grub_err_t ventoy_cmd_secondary_recover_mode(grub_extcmd_context_t ctxt, int argc, char **args)
|
||||
{
|
||||
(void)ctxt;
|
||||
(void)argc;
|
||||
(void)args;
|
||||
|
||||
if (g_vtoy_secondary_need_recover == 1)
|
||||
{
|
||||
g_ventoy_wimboot_mode = 0;
|
||||
}
|
||||
else if (g_vtoy_secondary_need_recover == 2)
|
||||
{
|
||||
g_ventoy_grub2_mode = 0;
|
||||
}
|
||||
else if (g_vtoy_secondary_need_recover == 3)
|
||||
{
|
||||
g_ventoy_memdisk_mode = 0;
|
||||
}
|
||||
|
||||
g_vtoy_secondary_need_recover = 0;
|
||||
|
||||
VENTOY_CMD_RETURN(GRUB_ERR_NONE);
|
||||
}
|
||||
|
||||
static grub_err_t ventoy_cmd_fs_ignore_case(grub_extcmd_context_t ctxt, int argc, char **args)
|
||||
{
|
||||
(void)ctxt;
|
||||
@@ -6303,6 +6366,8 @@ static cmd_para ventoy_cmds[] =
|
||||
{ "vt_show_secondary_menu", ventoy_cmd_show_secondary_menu, 0, NULL, "", "", NULL },
|
||||
{ "vt_fs_ignore_case", ventoy_cmd_fs_ignore_case, 0, NULL, "", "", NULL },
|
||||
{ "vt_systemd_menu", ventoy_cmd_linux_systemd_menu, 0, NULL, "", "", NULL },
|
||||
{ "vt_limine_menu", ventoy_cmd_linux_limine_menu, 0, NULL, "", "", NULL },
|
||||
{ "vt_secondary_recover_mode", ventoy_cmd_secondary_recover_mode, 0, NULL, "", "", NULL },
|
||||
};
|
||||
|
||||
int ventoy_register_all_cmd(void)
|
||||
|
@@ -623,6 +623,7 @@ grub_uint32_t ventoy_get_iso_boot_catlog(grub_file_t file);
|
||||
int ventoy_has_efi_eltorito(grub_file_t file, grub_uint32_t sector);
|
||||
grub_err_t ventoy_cmd_linux_chain_data(grub_extcmd_context_t ctxt, int argc, char **args);
|
||||
grub_err_t ventoy_cmd_linux_systemd_menu(grub_extcmd_context_t ctxt, int argc, char **args);
|
||||
grub_err_t ventoy_cmd_linux_limine_menu(grub_extcmd_context_t ctxt, int argc, char **args);
|
||||
grub_err_t ventoy_cmd_linux_locate_initrd(grub_extcmd_context_t ctxt, int argc, char **args);
|
||||
grub_err_t ventoy_cmd_initrd_count(grub_extcmd_context_t ctxt, int argc, char **args);
|
||||
grub_err_t ventoy_cmd_valid_initrd_count(grub_extcmd_context_t ctxt, int argc, char **args);
|
||||
@@ -1039,6 +1040,7 @@ typedef struct menu_password
|
||||
}menu_password;
|
||||
|
||||
extern int g_ventoy_menu_esc;
|
||||
extern int g_ventoy_secondary_menu_on;
|
||||
extern int g_ventoy_suppress_esc;
|
||||
extern int g_ventoy_suppress_esc_default;
|
||||
extern int g_ventoy_last_entry;
|
||||
|
@@ -1572,7 +1572,6 @@ grub_err_t ventoy_cmd_trailer_cpio(grub_extcmd_context_t ctxt, int argc, char **
|
||||
grub_uint8_t *bufend;
|
||||
cpio_newc_header *head;
|
||||
grub_file_t file;
|
||||
char value[64];
|
||||
const grub_uint8_t trailler[124] = {
|
||||
0x30, 0x37, 0x30, 0x37, 0x30, 0x31, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,
|
||||
0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,
|
||||
@@ -1643,11 +1642,8 @@ grub_err_t ventoy_cmd_trailer_cpio(grub_extcmd_context_t ctxt, int argc, char **
|
||||
name = (char *)(head + 1);
|
||||
}
|
||||
}
|
||||
|
||||
grub_snprintf(value, sizeof(value), "0x%llx", (ulonglong)(ulong)g_ventoy_cpio_buf);
|
||||
ventoy_set_env("ventoy_cpio_addr", value);
|
||||
grub_snprintf(value, sizeof(value), "%d", bufsize);
|
||||
ventoy_set_env("ventoy_cpio_size", value);
|
||||
|
||||
ventoy_memfile_env_set("ventoy_cpio", g_ventoy_cpio_buf, (ulonglong)bufsize);
|
||||
|
||||
VENTOY_CMD_RETURN(GRUB_ERR_NONE);
|
||||
}
|
||||
@@ -1669,7 +1665,6 @@ grub_err_t ventoy_cmd_linux_chain_data(grub_extcmd_context_t ctxt, int argc, cha
|
||||
const char *pLastChain = NULL;
|
||||
const char *compatible;
|
||||
ventoy_chain_head *chain;
|
||||
char envbuf[64];
|
||||
|
||||
(void)ctxt;
|
||||
(void)argc;
|
||||
@@ -1757,10 +1752,7 @@ grub_err_t ventoy_cmd_linux_chain_data(grub_extcmd_context_t ctxt, int argc, cha
|
||||
return 1;
|
||||
}
|
||||
|
||||
grub_snprintf(envbuf, sizeof(envbuf), "0x%lx", (unsigned long)chain);
|
||||
grub_env_set("vtoy_chain_mem_addr", envbuf);
|
||||
grub_snprintf(envbuf, sizeof(envbuf), "%u", size);
|
||||
grub_env_set("vtoy_chain_mem_size", envbuf);
|
||||
ventoy_memfile_env_set("vtoy_chain_mem", chain, (ulonglong)size);
|
||||
|
||||
grub_memset(chain, 0, sizeof(ventoy_chain_head));
|
||||
|
||||
@@ -1921,8 +1913,6 @@ out:
|
||||
grub_err_t ventoy_cmd_linux_systemd_menu(grub_extcmd_context_t ctxt, int argc, char **args)
|
||||
{
|
||||
static char *buf = NULL;
|
||||
char name[128];
|
||||
char value[64];
|
||||
grub_fs_t fs;
|
||||
char *device_name = NULL;
|
||||
grub_device_t dev = NULL;
|
||||
@@ -1967,13 +1957,7 @@ grub_err_t ventoy_cmd_linux_systemd_menu(grub_extcmd_context_t ctxt, int argc, c
|
||||
ctx.len = VTOY_LINUX_SYSTEMD_MENU_MAX_BUF;
|
||||
fs->fs_dir(dev, "/loader/entries", ventoy_systemd_conf_hook, &ctx);
|
||||
|
||||
grub_snprintf(name, sizeof(name), "%s_addr", args[1]);
|
||||
grub_snprintf(value, sizeof(value), "0x%llx", (ulonglong)(ulong)buf);
|
||||
grub_env_set(name, value);
|
||||
|
||||
grub_snprintf(name, sizeof(name), "%s_size", args[1]);
|
||||
grub_snprintf(value, sizeof(value), "%d", ctx.pos);
|
||||
grub_env_set(name, value);
|
||||
ventoy_memfile_env_set(args[1], buf, (ulonglong)(ctx.pos));
|
||||
|
||||
end:
|
||||
grub_check_free(device_name);
|
||||
@@ -1981,3 +1965,147 @@ end:
|
||||
VENTOY_CMD_RETURN(GRUB_ERR_NONE);
|
||||
}
|
||||
|
||||
static int ventoy_limine_path_convert(char *path)
|
||||
{
|
||||
char newpath[256] = {0};
|
||||
|
||||
if (grub_strncmp(path, "boot://2/", 9) == 0)
|
||||
{
|
||||
grub_snprintf(newpath, sizeof(newpath), "(vtimghd,2)/%s", path + 9);
|
||||
}
|
||||
else if (grub_strncmp(path, "boot://1/", 9) == 0)
|
||||
{
|
||||
grub_snprintf(newpath, sizeof(newpath), "(vtimghd,1)/%s", path + 9);
|
||||
}
|
||||
|
||||
if (newpath[0])
|
||||
{
|
||||
grub_snprintf(path, 1024, "%s", newpath);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
grub_err_t ventoy_cmd_linux_limine_menu(grub_extcmd_context_t ctxt, int argc, char **args)
|
||||
{
|
||||
int pos = 0;
|
||||
int sub = 0;
|
||||
int len = VTOY_LINUX_SYSTEMD_MENU_MAX_BUF;
|
||||
char *filebuf = NULL;
|
||||
char *start = NULL;
|
||||
char *nextline = NULL;
|
||||
grub_file_t file = NULL;
|
||||
char *title = NULL;
|
||||
char *kernel = NULL;
|
||||
char *initrd = NULL;
|
||||
char *param = NULL;
|
||||
static char *buf = NULL;
|
||||
|
||||
(void)ctxt;
|
||||
(void)argc;
|
||||
|
||||
if (!buf)
|
||||
{
|
||||
buf = grub_malloc(len + 4 * 1024);
|
||||
if (!buf)
|
||||
{
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
title = buf + len;
|
||||
kernel = title + 1024;
|
||||
initrd = kernel + 1024;
|
||||
param = initrd + 1024;
|
||||
|
||||
file = ventoy_grub_file_open(VENTOY_FILE_TYPE, args[0]);
|
||||
if (!file)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
filebuf = grub_zalloc(file->size + 8);
|
||||
if (!filebuf)
|
||||
{
|
||||
goto end;
|
||||
}
|
||||
|
||||
grub_file_read(file, filebuf, file->size);
|
||||
grub_file_close(file);
|
||||
|
||||
|
||||
title[0] = kernel[0] = initrd[0] = param[0] = 0;
|
||||
for (start = filebuf; start; start = nextline)
|
||||
{
|
||||
nextline = ventoy_get_line(start);
|
||||
while (ventoy_isspace(*start))
|
||||
{
|
||||
start++;
|
||||
}
|
||||
|
||||
if (start[0] == ':')
|
||||
{
|
||||
if (start[1] == ':')
|
||||
{
|
||||
grub_snprintf(title, 1024, "%s", start + 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (sub)
|
||||
{
|
||||
vtoy_len_ssprintf(buf, pos, len, "}\n");
|
||||
sub = 0;
|
||||
}
|
||||
|
||||
if (nextline && nextline[0] == ':' && nextline[1] == ':')
|
||||
{
|
||||
vtoy_len_ssprintf(buf, pos, len, "submenu \"[+] %s\" {\n", start + 2);
|
||||
sub = 1;
|
||||
title[0] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
grub_snprintf(title, 1024, "%s", start + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (grub_strncmp(start, "KERNEL_PATH=", 12) == 0)
|
||||
{
|
||||
grub_snprintf(kernel, 1024, "%s", start + 12);
|
||||
}
|
||||
else if (grub_strncmp(start, "MODULE_PATH=", 12) == 0)
|
||||
{
|
||||
grub_snprintf(initrd, 1024, "%s", start + 12);
|
||||
}
|
||||
else if (grub_strncmp(start, "KERNEL_CMDLINE=", 15) == 0)
|
||||
{
|
||||
grub_snprintf(param, 1024, "%s", start + 15);
|
||||
}
|
||||
|
||||
if (title[0] && kernel[0] && initrd[0] && param[0])
|
||||
{
|
||||
ventoy_limine_path_convert(kernel);
|
||||
ventoy_limine_path_convert(initrd);
|
||||
|
||||
vtoy_len_ssprintf(buf, pos, len, "menuentry \"%s\" {\n", title);
|
||||
vtoy_len_ssprintf(buf, pos, len, " echo \"Downloading kernel ...\"\n linux %s %s\n", kernel, param);
|
||||
vtoy_len_ssprintf(buf, pos, len, " echo \"Downloading initrd ...\"\n initrd %s\n", initrd);
|
||||
vtoy_len_ssprintf(buf, pos, len, "}\n");
|
||||
|
||||
title[0] = kernel[0] = initrd[0] = param[0] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (sub)
|
||||
{
|
||||
vtoy_len_ssprintf(buf, pos, len, "}\n");
|
||||
sub = 0;
|
||||
}
|
||||
|
||||
ventoy_memfile_env_set(args[1], buf, (ulonglong)pos);
|
||||
|
||||
end:
|
||||
grub_check_free(filebuf);
|
||||
VENTOY_CMD_RETURN(GRUB_ERR_NONE);
|
||||
}
|
||||
|
||||
|
@@ -1118,7 +1118,6 @@ grub_err_t ventoy_cmd_unix_chain_data(grub_extcmd_context_t ctxt, int argc, char
|
||||
const char *pLastChain = NULL;
|
||||
const char *compatible;
|
||||
ventoy_chain_head *chain;
|
||||
char envbuf[64];
|
||||
|
||||
(void)ctxt;
|
||||
(void)argc;
|
||||
@@ -1197,10 +1196,7 @@ grub_err_t ventoy_cmd_unix_chain_data(grub_extcmd_context_t ctxt, int argc, char
|
||||
return 1;
|
||||
}
|
||||
|
||||
grub_snprintf(envbuf, sizeof(envbuf), "0x%lx", (unsigned long)chain);
|
||||
grub_env_set("vtoy_chain_mem_addr", envbuf);
|
||||
grub_snprintf(envbuf, sizeof(envbuf), "%u", size);
|
||||
grub_env_set("vtoy_chain_mem_size", envbuf);
|
||||
ventoy_memfile_env_set("vtoy_chain_mem", chain, (ulonglong)size);
|
||||
|
||||
grub_memset(chain, 0, sizeof(ventoy_chain_head));
|
||||
|
||||
|
@@ -305,7 +305,6 @@ grub_err_t ventoy_cmd_patch_vhdboot(grub_extcmd_context_t ctxt, int argc, char *
|
||||
int patchoffset[2];
|
||||
ventoy_patch_vhd *patch1;
|
||||
ventoy_patch_vhd *patch2;
|
||||
char envbuf[64];
|
||||
|
||||
(void)ctxt;
|
||||
(void)argc;
|
||||
@@ -356,15 +355,9 @@ grub_err_t ventoy_cmd_patch_vhdboot(grub_extcmd_context_t ctxt, int argc, char *
|
||||
|
||||
/* set buffer and size */
|
||||
#ifdef GRUB_MACHINE_EFI
|
||||
grub_snprintf(envbuf, sizeof(envbuf), "0x%lx", (ulong)g_vhdboot_totbuf);
|
||||
grub_env_set("vtoy_vhd_buf_addr", envbuf);
|
||||
grub_snprintf(envbuf, sizeof(envbuf), "%d", (int)(g_vhdboot_isolen + sizeof(ventoy_chain_head)));
|
||||
grub_env_set("vtoy_vhd_buf_size", envbuf);
|
||||
ventoy_memfile_env_set("vtoy_vhd_buf", g_vhdboot_totbuf, (ulonglong)(g_vhdboot_isolen + sizeof(ventoy_chain_head)));
|
||||
#else
|
||||
grub_snprintf(envbuf, sizeof(envbuf), "0x%lx", (ulong)g_vhdboot_isobuf);
|
||||
grub_env_set("vtoy_vhd_buf_addr", envbuf);
|
||||
grub_snprintf(envbuf, sizeof(envbuf), "%d", g_vhdboot_isolen);
|
||||
grub_env_set("vtoy_vhd_buf_size", envbuf);
|
||||
ventoy_memfile_env_set("vtoy_vhd_buf", g_vhdboot_isobuf, (ulonglong)g_vhdboot_isolen);
|
||||
#endif
|
||||
|
||||
VENTOY_CMD_RETURN(GRUB_ERR_NONE);
|
||||
@@ -645,7 +638,6 @@ grub_err_t ventoy_cmd_raw_chain_data(grub_extcmd_context_t ctxt, int argc, char
|
||||
grub_disk_t disk;
|
||||
const char *pLastChain = NULL;
|
||||
ventoy_chain_head *chain;
|
||||
char envbuf[64];
|
||||
|
||||
(void)ctxt;
|
||||
(void)argc;
|
||||
@@ -695,10 +687,7 @@ grub_err_t ventoy_cmd_raw_chain_data(grub_extcmd_context_t ctxt, int argc, char
|
||||
return 1;
|
||||
}
|
||||
|
||||
grub_snprintf(envbuf, sizeof(envbuf), "0x%lx", (unsigned long)chain);
|
||||
grub_env_set("vtoy_chain_mem_addr", envbuf);
|
||||
grub_snprintf(envbuf, sizeof(envbuf), "%u", size);
|
||||
grub_env_set("vtoy_chain_mem_size", envbuf);
|
||||
ventoy_memfile_env_set("vtoy_chain_mem", chain, (ulonglong)size);
|
||||
|
||||
grub_env_export("vtoy_chain_mem_addr");
|
||||
grub_env_export("vtoy_chain_mem_size");
|
||||
|
@@ -2033,7 +2033,6 @@ grub_err_t ventoy_cmd_windows_wimboot_data(grub_extcmd_context_t ctxt, int argc,
|
||||
grub_uint8_t *param = NULL;
|
||||
grub_uint8_t *exe_data = NULL;
|
||||
ventoy_windows_data *rtdata = NULL;
|
||||
char envbuf[64] = {0};
|
||||
char exename[128] = {0};
|
||||
wim_tail wim_data;
|
||||
|
||||
@@ -2076,13 +2075,7 @@ grub_err_t ventoy_cmd_windows_wimboot_data(grub_extcmd_context_t ctxt, int argc,
|
||||
rtdata = (ventoy_windows_data *)(param + jump_align + sizeof(ventoy_os_param));
|
||||
ventoy_fill_windows_rtdata(rtdata, chain->os_param.vtoy_img_path, dataflag);
|
||||
|
||||
grub_snprintf(envbuf, sizeof(envbuf), "0x%lx", (ulong)param);
|
||||
grub_env_set("vtoy_wimboot_mem_addr", envbuf);
|
||||
debug("vtoy_wimboot_mem_addr: %s\n", envbuf);
|
||||
|
||||
grub_snprintf(envbuf, sizeof(envbuf), "%u", wim_data.bin_align_len);
|
||||
grub_env_set("vtoy_wimboot_mem_size", envbuf);
|
||||
debug("vtoy_wimboot_mem_size: %s\n", envbuf);
|
||||
ventoy_memfile_env_set("vtoy_wimboot_mem", param, (ulonglong)(wim_data.bin_align_len));
|
||||
|
||||
grub_env_set(args[1], exename);
|
||||
grub_env_set(args[2], wim64 ? "64" : "32");
|
||||
@@ -2105,7 +2098,6 @@ grub_err_t ventoy_cmd_windows_chain_data(grub_extcmd_context_t ctxt, int argc, c
|
||||
const char *pLastChain = NULL;
|
||||
const char *compatible;
|
||||
ventoy_chain_head *chain;
|
||||
char envbuf[64];
|
||||
|
||||
(void)ctxt;
|
||||
(void)argc;
|
||||
@@ -2200,10 +2192,7 @@ grub_err_t ventoy_cmd_windows_chain_data(grub_extcmd_context_t ctxt, int argc, c
|
||||
return 1;
|
||||
}
|
||||
|
||||
grub_snprintf(envbuf, sizeof(envbuf), "0x%lx", (unsigned long)chain);
|
||||
grub_env_set("vtoy_chain_mem_addr", envbuf);
|
||||
grub_snprintf(envbuf, sizeof(envbuf), "%u", size);
|
||||
grub_env_set("vtoy_chain_mem_size", envbuf);
|
||||
ventoy_memfile_env_set("vtoy_chain_mem", chain, (ulonglong)size);
|
||||
|
||||
grub_memset(chain, 0, sizeof(ventoy_chain_head));
|
||||
|
||||
@@ -2437,7 +2426,6 @@ static grub_err_t ventoy_vlnk_wim_chain_data(grub_file_t wimfile)
|
||||
ventoy_img_chunk *chunknode;
|
||||
ventoy_override_chunk *override;
|
||||
ventoy_img_chunk_list wimchunk;
|
||||
char envbuf[128];
|
||||
|
||||
debug("vlnk wim chain data begin <%s> ...\n", wimfile->name);
|
||||
|
||||
@@ -2494,10 +2482,7 @@ static grub_err_t ventoy_vlnk_wim_chain_data(grub_file_t wimfile)
|
||||
return 1;
|
||||
}
|
||||
|
||||
grub_snprintf(envbuf, sizeof(envbuf), "0x%lx", (unsigned long)chain);
|
||||
grub_env_set("vtoy_chain_mem_addr", envbuf);
|
||||
grub_snprintf(envbuf, sizeof(envbuf), "%u", size);
|
||||
grub_env_set("vtoy_chain_mem_size", envbuf);
|
||||
ventoy_memfile_env_set("vtoy_chain_mem", chain, (ulonglong)size);
|
||||
|
||||
grub_memset(chain, 0, sizeof(ventoy_chain_head));
|
||||
|
||||
@@ -2602,7 +2587,6 @@ static grub_err_t ventoy_normal_wim_chain_data(grub_file_t wimfile)
|
||||
ventoy_img_chunk *chunknode;
|
||||
ventoy_override_chunk *override;
|
||||
ventoy_img_chunk_list wimchunk;
|
||||
char envbuf[128];
|
||||
|
||||
debug("normal wim chain data begin <%s> ...\n", wimfile->name);
|
||||
|
||||
@@ -2659,10 +2643,7 @@ static grub_err_t ventoy_normal_wim_chain_data(grub_file_t wimfile)
|
||||
return 1;
|
||||
}
|
||||
|
||||
grub_snprintf(envbuf, sizeof(envbuf), "0x%lx", (unsigned long)chain);
|
||||
grub_env_set("vtoy_chain_mem_addr", envbuf);
|
||||
grub_snprintf(envbuf, sizeof(envbuf), "%u", size);
|
||||
grub_env_set("vtoy_chain_mem_size", envbuf);
|
||||
ventoy_memfile_env_set("vtoy_chain_mem", chain, (ulonglong)size);
|
||||
|
||||
grub_memset(chain, 0, sizeof(ventoy_chain_head));
|
||||
|
||||
|
@@ -304,6 +304,7 @@ grub_uint64_t grub_udf_get_last_file_attr_offset
|
||||
grub_uint64_t *fe_entry_size_offset
|
||||
);
|
||||
int ventoy_is_efi_os(void);
|
||||
void ventoy_memfile_env_set(const char *prefix, const void *buf, unsigned long long len);
|
||||
|
||||
#endif /* __VENTOY_H__ */
|
||||
|
||||
|
@@ -51,6 +51,9 @@ if is_inotify_ventoy_part $3; then
|
||||
|
||||
if [ -e /sbin/anaconda-diskroot ]; then
|
||||
vtlog "set anaconda-diskroot ..."
|
||||
|
||||
#busybox cp doesn't support -t option (issue 1900)
|
||||
/bin/cp -a /bin/cp $BUSYBOX_PATH/cp
|
||||
/sbin/anaconda-diskroot /dev/ventoy
|
||||
fi
|
||||
|
||||
|
@@ -39,6 +39,9 @@ fi
|
||||
|
||||
if [ -e /sbin/anaconda-diskroot ]; then
|
||||
vtlog "set anaconda-diskroot /dev/ventoy ..."
|
||||
|
||||
#busybox cp doesn't support -t option (issue 1900)
|
||||
/bin/cp -a /bin/cp $BUSYBOX_PATH/cp
|
||||
/sbin/anaconda-diskroot /dev/ventoy
|
||||
fi
|
||||
|
||||
|
@@ -70,6 +70,9 @@ if is_inotify_ventoy_part $3; then
|
||||
|
||||
if [ -e /sbin/anaconda-diskroot ]; then
|
||||
vtlog "set anaconda-diskroot ..."
|
||||
|
||||
#busybox cp doesn't support -t option (issue 1900)
|
||||
/bin/cp -a /bin/cp $BUSYBOX_PATH/cp
|
||||
/sbin/anaconda-diskroot /dev/ventoy
|
||||
fi
|
||||
|
||||
|
@@ -39,6 +39,9 @@ fi
|
||||
|
||||
if [ -e /sbin/anaconda-diskroot ]; then
|
||||
vtlog "set anaconda-diskroot /dev/ventoy ..."
|
||||
|
||||
#busybox cp doesn't support -t option (issue 1900)
|
||||
/bin/cp -a /bin/cp $BUSYBOX_PATH/cp
|
||||
/sbin/anaconda-diskroot /dev/ventoy
|
||||
fi
|
||||
|
||||
|
@@ -37,9 +37,38 @@ if [ "$vtdiskname" = "unknown" ]; then
|
||||
fi
|
||||
|
||||
ventoy_udev_disk_common_hook "${vtdiskname#/dev/}2" "noreplace"
|
||||
|
||||
ventoy_create_dev_ventoy_part
|
||||
|
||||
if ventoy_need_dm_patch; then
|
||||
vtlog "extract a ko file"
|
||||
|
||||
mkdir -p /ventoy/tmpmnt1 /ventoy/tmpmnt2
|
||||
mount /dev/ventoy1 /ventoy/tmpmnt1
|
||||
mount /ventoy/tmpmnt1/boot/batocera /ventoy/tmpmnt2
|
||||
vtKV=$(uname -r)
|
||||
|
||||
mkdir -p /lib/modules/$vtKV/kernel/
|
||||
vtKO=$(find "/ventoy/tmpmnt2/lib/modules/$vtKV/kernel/fs/" -name "*.ko*" | head -n1)
|
||||
cp -a $vtKO /lib/modules/$vtKV/kernel/
|
||||
|
||||
vtlog "vtKV=$vtKV vtKO=$vtKO"
|
||||
|
||||
umount /ventoy/tmpmnt2
|
||||
umount /ventoy/tmpmnt1
|
||||
|
||||
vtPartid=1
|
||||
cat /vtoy_dm_table | while read vtline; do
|
||||
dmsetup remove ventoy$vtPartid
|
||||
vtPartid=$(expr $vtPartid + 1)
|
||||
done
|
||||
dmsetup remove ventoy
|
||||
|
||||
vtlog "Recreate device-mapper"
|
||||
ventoy_udev_disk_common_hook "${vtdiskname#/dev/}2" "noreplace"
|
||||
ventoy_create_dev_ventoy_part
|
||||
fi
|
||||
|
||||
|
||||
PATH=$VTPATH_OLD
|
||||
|
||||
set_ventoy_hook_finish
|
||||
|
@@ -23,6 +23,9 @@ $SED "/find drives/i $BUSYBOX_PATH/sh $VTOY_PATH/loop/easyos/ventoy-disk.sh; vtD
|
||||
|
||||
$SED "1a boot_dev=ventoy1;wkg_dev=ventoy2" -i /init
|
||||
|
||||
$SED 's#\(dd *if=/dev/.*WKG_DRV.* *of=/dev/null.*skip\)=[0-9]*#\1=1048576#' -i /init
|
||||
$SED "s#WKG_DEV=\"\"#WKG_DEV=ventoy2#g" -i /init
|
||||
|
||||
#check for ssd will read /sys/block/ventoy, will no exist, need a workaround
|
||||
$SED "s#/sys/block/\${WKG_DRV}/#/sys/block/\$vtDM/#g" -i /init
|
||||
|
||||
|
@@ -75,6 +75,10 @@ ventoy_get_os_type() {
|
||||
echo 'openwrt'; return
|
||||
fi
|
||||
|
||||
if $GREP -q 'easyos' /proc/cmdline; then
|
||||
echo 'easyos'; return
|
||||
fi
|
||||
|
||||
if [ -e /BOOT_SPECS ]; then
|
||||
if $GREP -q 'easyos' /BOOT_SPECS; then
|
||||
echo 'easyos'; return
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -163,7 +163,7 @@ fi
|
||||
PART1=$(get_disk_part_name $DISK 1)
|
||||
|
||||
if grep -q "^$PART1 " /proc/mounts; then
|
||||
mtpnt=$(grep "^$PART1 " /proc/mounts | awk '{print $2}')
|
||||
mtpnt=$(grep "^$PART1 " /proc/mounts | awk '{print $2}' | sed 's/\\040/ /g')
|
||||
fstype=$(grep "^$PART1 " /proc/mounts | awk '{print $3}')
|
||||
|
||||
if echo $fstype | grep -q -i 'fuse'; then
|
||||
|
@@ -936,6 +936,7 @@ function uefi_iso_menu_func {
|
||||
vt_show_secondary_menu "$vt_chosen_path" "$vtoy_os" $vt_chosen_size
|
||||
if vt_check_mode 0 "$vt_chosen_name"; then
|
||||
uefi_iso_memdisk $vtoy_iso_part "$vt_chosen_path"
|
||||
vt_secondary_recover_mode
|
||||
return
|
||||
fi
|
||||
fi
|
||||
@@ -957,6 +958,7 @@ function uefi_iso_menu_func {
|
||||
fi
|
||||
|
||||
ventoy_gui_console
|
||||
vt_secondary_recover_mode
|
||||
}
|
||||
|
||||
function uefi_iso_memdisk {
|
||||
@@ -1368,6 +1370,7 @@ function legacy_iso_menu_func {
|
||||
vt_show_secondary_menu "$vt_chosen_path" "$vtoy_os" $vt_chosen_size
|
||||
if vt_check_mode 0 "$vt_chosen_name"; then
|
||||
legacy_iso_memdisk $vtoy_iso_part "$vt_chosen_path"
|
||||
vt_secondary_recover_mode
|
||||
return
|
||||
fi
|
||||
fi
|
||||
@@ -1387,6 +1390,7 @@ function legacy_iso_menu_func {
|
||||
vt_check_compatible_linux (loop)
|
||||
legacy_linux_menu_func "$1" "${chosen_path}"
|
||||
fi
|
||||
vt_secondary_recover_mode
|
||||
}
|
||||
|
||||
function legacy_iso_memdisk {
|
||||
@@ -1843,6 +1847,41 @@ function ventoy_img_easyos {
|
||||
loopback -d easysfs
|
||||
}
|
||||
|
||||
function ventoy_img_easyos2 {
|
||||
vt_load_cpio $vtoy_path "${vt_chosen_path}" ${vtoy_iso_part} "busybox=$ventoy_busybox_ver"
|
||||
vt_trailer_cpio ${vtoy_iso_part} "${vt_chosen_path}" noinit
|
||||
|
||||
if [ -e (vtimghd,2)/easyos/easy.sfs ]; then
|
||||
loopback easysfs (vtimghd,2)/easyos/easy.sfs
|
||||
elif [ -d (vtimghd,2)/easyos/releases ]; then
|
||||
vt_fs_enum_1st_dir (vtimghd,2) /easyos/releases/ vt_dir_name
|
||||
loopback easysfs (vtimghd,2)/easyos/releases/$vt_dir_name/easy.sfs
|
||||
fi
|
||||
|
||||
vt_get_lib_module_ver (easysfs) /lib/modules/ vt_module_ver
|
||||
|
||||
if [ -n "$vt_module_ver" ]; then
|
||||
for mod in "kernel/drivers/md/dm-mod.ko" "kernel/drivers/dax/dax.ko"; do
|
||||
if [ -e (easysfs)/lib/modules/$vt_module_ver/$mod ]; then
|
||||
vt_img_extra_initrd_append (easysfs)/lib/modules/$vt_module_ver/$mod
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
ventoy_debug_pause
|
||||
|
||||
#boot image file
|
||||
vt_set_boot_opt rdinit=/vtoy/vtoy
|
||||
vt_img_hook_root
|
||||
|
||||
vt_limine_menu (vtimghd,1)/limine.cfg vt_sys_menu_mem
|
||||
configfile "mem:${vt_sys_menu_mem_addr}:size:${vt_sys_menu_mem_size}"
|
||||
|
||||
vt_img_unhook_root
|
||||
vt_unset_boot_opt
|
||||
loopback -d easysfs
|
||||
}
|
||||
|
||||
function ventoy_img_volumio {
|
||||
vt_load_cpio $vtoy_path "${vt_chosen_path}" ${vtoy_iso_part} "busybox=$ventoy_busybox_ver"
|
||||
vt_trailer_cpio ${vtoy_iso_part} "${vt_chosen_path}" noinit
|
||||
@@ -2258,6 +2297,8 @@ function img_common_menuentry {
|
||||
ventoy_img_esysrescue
|
||||
elif [ -e (vtimghd,1)/easy.sfs ]; then
|
||||
ventoy_img_easyos
|
||||
elif [ -d (vtimghd,2)/easyos ]; then
|
||||
ventoy_img_easyos2
|
||||
elif [ -e (vtimghd,1)/volumio.initrd ]; then
|
||||
ventoy_img_volumio
|
||||
elif [ -f (vtimghd,2)/loader/entries/ubos.conf ]; then
|
||||
@@ -2303,7 +2344,7 @@ function img_unsupport_menuentry {
|
||||
#############################################################
|
||||
#############################################################
|
||||
|
||||
set VENTOY_VERSION="1.0.80"
|
||||
set VENTOY_VERSION="1.0.81"
|
||||
|
||||
#ACPI not compatible with Window7/8, so disable by default
|
||||
set VTOY_PARAM_NO_ACPI=1
|
||||
|
Binary file not shown.
Binary file not shown.
@@ -882,7 +882,66 @@
|
||||
"STRXXX":""
|
||||
},
|
||||
{
|
||||
"name":"Spanish (Español)",
|
||||
"name":"Spanish (Latinoamérica)",
|
||||
"FontFamily":"Courier New",
|
||||
"FontSize":16,
|
||||
"Author":"MELERIX",
|
||||
|
||||
"STR_ERROR":"Error",
|
||||
"STR_WARNING":"Advertencia",
|
||||
"STR_INFO":"Información",
|
||||
"STR_INCORRECT_DIR":"¡Por favor, ejecuta bajo el directorio correcto!",
|
||||
"STR_INCORRECT_TREE_DIR":"No me ejecutes aquí, por favor descarga el paquete de instalación lanzado, y ejecútalo allí.",
|
||||
"STR_DEVICE":"Dispositivo",
|
||||
"STR_LOCAL_VER":"Ventoy En Paquete",
|
||||
"STR_DISK_VER":"Ventoy En Dispositivo",
|
||||
"STR_STATUS":"Estado - LISTO",
|
||||
"STR_INSTALL":"Instalar",
|
||||
"STR_UPDATE":"Actualizar",
|
||||
"STR_UPDATE_TIP":"La operación de actualización es segura, Los archivo ISO no se modificarán.#@¿Continuar?",
|
||||
"STR_INSTALL_TIP":"El dispositivo será formateado y todos los datos se perderán.#@¿Continuar?",
|
||||
"STR_INSTALL_TIP2":"El dispositivo será formateado y todos los datos se perderán.#@¿Continuar? (Doble Comprobación)",
|
||||
"STR_INSTALL_SUCCESS":"¡Felicitaciones!#@Ventoy ha sido instalado exitosamente en el dispositivo.",
|
||||
"STR_INSTALL_FAILED":"Ocurrió un error durante la instalación. Puedes reinsertar el dispositivo USB e intentar de nuevo. Comprueba log.txt para detalles. Si siempre falla, consulta las PF en el sitio web oficial.",
|
||||
"STR_UPDATE_SUCCESS":"¡Felicitaciones!#@Ventoy ha sido actualizado exitosamente en el dispositivo.",
|
||||
"STR_UPDATE_FAILED":"Ocurrió un error durante la actualización. Puedes reinsertar el dispositivo USB e intentar de nuevo. Comprueba log.txt para detalles. Si siempre falla, consulta las PF en el sitio web oficial.",
|
||||
"STR_WAIT_PROCESS":"Un hilo está ejecutándose, por favor espera...",
|
||||
"STR_MENU_OPTION":"Opción",
|
||||
"STR_MENU_SECURE_BOOT":"Soporte De Arranque Seguro",
|
||||
"STR_MENU_PART_CFG":"Configuración De Partición",
|
||||
"STR_BTN_OK":"Aceptar",
|
||||
"STR_BTN_CANCEL":"Cancelar",
|
||||
"STR_PRESERVE_SPACE":"Preservar algo de espacio al final del dispositivo",
|
||||
"STR_SPACE_VAL_INVALID":"Valor inválido para espacio reservado",
|
||||
"STR_MENU_CLEAR":"Limpiar Ventoy",
|
||||
"STR_CLEAR_SUCCESS":"Ventoy ha sido removido exitosamente desde el dispositivo.",
|
||||
"STR_CLEAR_FAILED":"Ocurrió un error al remover Ventoy del dispositivo. Puedes reinsertar el dispositivo USB e intentar de nuevo. Comprueba log.txt para detalles.",
|
||||
"STR_MENU_PART_STYLE":"Estilo De Partición",
|
||||
"STR_DISK_2TB_MBR_ERROR":"Por favor selecciona GPT para dispositivos sobre 2TB",
|
||||
"STR_SHOW_ALL_DEV":"Mostrar Todos Los Dispositivos",
|
||||
"STR_PART_ALIGN_4KB":"Alinear particiones con 4KB",
|
||||
"STR_WEB_COMMUNICATION_ERR":"Error de comunicación:",
|
||||
"STR_WEB_REMOTE_ABNORMAL":"Error de comunicación: anormal remoto",
|
||||
"STR_WEB_REQUEST_TIMEOUT":"Error de comunicación: Tiempo de espera agotado",
|
||||
"STR_WEB_SERVICE_UNAVAILABLE":"Error de comunicación: Servicio No Disponible",
|
||||
"STR_WEB_TOKEN_MISMATCH":" Estado del daemon actualizado, por favor reintenta más tarde.",
|
||||
"STR_WEB_SERVICE_BUSY":" El servicio está ocupado, por favor reintenta más tarde.",
|
||||
"STR_MENU_VTSI_CREATE":"Generar Archivo VTSI",
|
||||
"STR_VTSI_CREATE_TIP":"Esta vez no se escribirá al dispositivo, pero solo generará un archivo VTSI#@¿Continuar?",
|
||||
"STR_VTSI_CREATE_SUCCESS":"¡Archivo VTSI creado exitosamente!#@Puedes usar Rufus(3.15+) para escribirlo al dispositivo a fin de completar la instalación de Ventoy.",
|
||||
"STR_VTSI_CREATE_FAILED":"Fallo en el archivo VTSI creado.",
|
||||
"STR_MENU_PART_RESIZE":"Instalación no destructiva",
|
||||
"STR_PART_RESIZE_TIP":"Ventoy intentará una instalación no destructiva si es posible. #@¿Continuar?",
|
||||
"STR_PART_RESIZE_SUCCESS":"¡Felicitaciones!#@La instalación no destructiva de Ventoy a finalizado exitosamente.",
|
||||
"STR_PART_RESIZE_FAILED":"Instalación no destructiva fallida, Comprueba log.txt para detalles.",
|
||||
"STR_PART_RESIZE_UNSUPPORTED":"Instalación no destructiva de Ventoy detenida porque algunas condiciones no se pueden cumplir. Comprueba log.txt para detalles.",
|
||||
"STR_INSTALL_YES_TIP1":"Advertencia: ¡Los datos se perderán!",
|
||||
"STR_INSTALL_YES_TIP2":"Por favor ingresa YES en el cuadro de texto a continuación para confirmar que realmente quieres realizar una instalación nueva en vez de actualizar.",
|
||||
|
||||
"STRXXX":""
|
||||
},
|
||||
{
|
||||
"name":"Spanish (España)",
|
||||
"FontFamily":"Courier New",
|
||||
"FontSize":16,
|
||||
"Author":"Carlos Sánchez, MELERIX, shulkalala",
|
||||
|
@@ -8,14 +8,14 @@ build_func() {
|
||||
libsuffix=$2
|
||||
toolDir=$3
|
||||
|
||||
XXFLAG='-std=gnu99 -D_FILE_OFFSET_BITS=64'
|
||||
XXFLAG='-std=gnu99 -D_FILE_OFFSET_BITS=64 -O2'
|
||||
XXLIB=""
|
||||
|
||||
echo "CC=$1 libsuffix=$libsuffix toolDir=$toolDir"
|
||||
|
||||
echo "CC civetweb.o"
|
||||
$1 $XXFLAG -c -Wall -Wextra -Wshadow -Wformat-security -Winit-self \
|
||||
-Wmissing-prototypes -O2 -DLINUX \
|
||||
-Wmissing-prototypes -DLINUX \
|
||||
-I./src/Lib/libhttp/include \
|
||||
-DNDEBUG -DNO_CGI -DNO_CACHING -DNO_SSL -DSQLITE_DISABLE_LFS -DSSL_ALREADY_INITIALIZED \
|
||||
-DUSE_STACK_SIZE=102400 -DNDEBUG -fPIC \
|
||||
@@ -23,7 +23,7 @@ build_func() {
|
||||
-o ./civetweb.o
|
||||
|
||||
echo "CC plugson.o"
|
||||
$1 $XXFLAG -O2 $exopt -Wall -Wno-unused-function -DSTATIC=static -DINIT= \
|
||||
$1 $XXFLAG $exopt -Wall -Wno-unused-function -DSTATIC=static -DINIT= \
|
||||
-I./src \
|
||||
-I./src/Core \
|
||||
-I./src/Web \
|
||||
@@ -71,7 +71,6 @@ build_func() {
|
||||
}
|
||||
|
||||
build_func "gcc" '64' 'x86_64'
|
||||
|
||||
build_func "gcc -m32" '32' 'i386'
|
||||
build_func "aarch64-linux-gnu-gcc" 'aa64' 'aarch64'
|
||||
build_func "mips-linux-gnu-gcc -mips64r2 -mabi=64" 'm64e' 'mips64el'
|
||||
|
@@ -311,12 +311,24 @@ uint64_t ventoy_get_disk_size_in_byte(const char *disk)
|
||||
|
||||
int ventoy_get_disk_vendor(const char *name, char *vendorbuf, int bufsize)
|
||||
{
|
||||
return ventoy_get_sys_file_line(vendorbuf, bufsize, "/sys/block/%s/device/vendor", name);
|
||||
if (strncmp(name, "loop", 4) == 0)
|
||||
{
|
||||
scnprintf(vendorbuf, bufsize, "Local");
|
||||
return 0;
|
||||
}
|
||||
|
||||
return ventoy_get_sys_file_line(vendorbuf, bufsize, "/sys/block/%s/device/vendor", name);
|
||||
}
|
||||
|
||||
int ventoy_get_disk_model(const char *name, char *modelbuf, int bufsize)
|
||||
{
|
||||
return ventoy_get_sys_file_line(modelbuf, bufsize, "/sys/block/%s/device/model", name);
|
||||
if (strncmp(name, "loop", 4) == 0)
|
||||
{
|
||||
scnprintf(modelbuf, bufsize, "Loop Device");
|
||||
return 0;
|
||||
}
|
||||
|
||||
return ventoy_get_sys_file_line(modelbuf, bufsize, "/sys/block/%s/device/model", name);
|
||||
}
|
||||
|
||||
static int fatlib_media_sector_read(uint32 sector, uint8 *buffer, uint32 sector_count)
|
||||
@@ -576,9 +588,9 @@ int ventoy_get_disk_info(char **argv)
|
||||
char model[128];
|
||||
char *disk = argv[4];
|
||||
|
||||
if (strncmp(argv[4], "/dev/", 4) == 0)
|
||||
if (strncmp(argv[4], "/dev/", 5) == 0)
|
||||
{
|
||||
disk += 4;
|
||||
disk += 5;
|
||||
}
|
||||
ventoy_get_disk_vendor(disk, vendor, sizeof(vendor));
|
||||
ventoy_get_disk_model(disk, model, sizeof(model));
|
||||
|
@@ -152,6 +152,9 @@ typedef struct tagVTOY_JSON
|
||||
#define VTOY_JSON_FMT_ITEM_LN(P, Item) ssprintf(__uiCurPos, __pcBuf, __uiBufLen, "%s\"%s\",\n", P, (Item))
|
||||
#define VTOY_JSON_FMT_ITEM_PATH_LN(P, Item) ssprintf(__uiCurPos, __pcBuf, __uiBufLen, "%s\"%s\",\n", P, ventoy_real_path(Item))
|
||||
|
||||
#define VTOY_JSON_FMT_ITEM_INT(Item) ssprintf(__uiCurPos, __pcBuf, __uiBufLen, "%d,", (Item))
|
||||
|
||||
|
||||
#define VTOY_JSON_FMT_COMA() ssprintf(__uiCurPos, __pcBuf, __uiBufLen, ",")
|
||||
#define VTOY_JSON_FMT_COMA_N(cnt) ssprintf(__uiCurPos, __pcBuf, __uiBufLen, ",\n")
|
||||
#define VTOY_JSON_FMT_COMA_N_CNT(cnt) if ((cnt) > 0) ssprintf(__uiCurPos, __pcBuf, __uiBufLen, ",\n")
|
||||
|
@@ -257,4 +257,48 @@ if (backup)
|
||||
#endif
|
||||
}
|
||||
|
||||
static const char g_encoding_table[] = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',
|
||||
'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P',
|
||||
'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X',
|
||||
'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f',
|
||||
'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',
|
||||
'o', 'p', 'q', 'r', 's', 't', 'u', 'v',
|
||||
'w', 'x', 'y', 'z', '0', '1', '2', '3',
|
||||
'4', '5', '6', '7', '8', '9', '+', '/'};
|
||||
|
||||
char * ventoy_base64_encode(const char *data, int input_length, int *output_length)
|
||||
{
|
||||
int i = 0;
|
||||
int j = 0;
|
||||
char *encoded_data = NULL;
|
||||
int mod_table[] = {0, 2, 1};
|
||||
|
||||
*output_length = 4 * ((input_length + 2) / 3);
|
||||
encoded_data = malloc(*output_length + 4);
|
||||
if (!encoded_data)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
while (i < input_length)
|
||||
{
|
||||
unsigned int octet_a = i < input_length ? (unsigned char)data[i++] : 0;
|
||||
unsigned int octet_b = i < input_length ? (unsigned char)data[i++] : 0;
|
||||
unsigned int octet_c = i < input_length ? (unsigned char)data[i++] : 0;
|
||||
|
||||
unsigned int triple = (octet_a << 0x10) + (octet_b << 0x08) + octet_c;
|
||||
|
||||
encoded_data[j++] = g_encoding_table[(triple >> 3 * 6) & 0x3F];
|
||||
encoded_data[j++] = g_encoding_table[(triple >> 2 * 6) & 0x3F];
|
||||
encoded_data[j++] = g_encoding_table[(triple >> 1 * 6) & 0x3F];
|
||||
encoded_data[j++] = g_encoding_table[(triple >> 0 * 6) & 0x3F];
|
||||
}
|
||||
|
||||
for (i = 0; i < mod_table[input_length % 3]; i++)
|
||||
{
|
||||
encoded_data[*output_length - 1 - i] = '=';
|
||||
}
|
||||
|
||||
return encoded_data;
|
||||
}
|
||||
|
||||
|
@@ -199,6 +199,7 @@ extern unsigned char *g_unxz_buffer;
|
||||
extern int g_unxz_len;
|
||||
void unxz_error(char *x);
|
||||
int unxz_flush(void *src, unsigned int size);
|
||||
char * ventoy_base64_encode(const char *data, int input_length, int *output_length);
|
||||
|
||||
#endif /* __VENTOY_UTIL_H__ */
|
||||
|
||||
|
@@ -33,6 +33,7 @@
|
||||
#include <linux/fs.h>
|
||||
#include <dirent.h>
|
||||
#include <time.h>
|
||||
#include <semaphore.h>
|
||||
#include <ventoy_define.h>
|
||||
#include <ventoy_util.h>
|
||||
|
||||
@@ -234,30 +235,18 @@ int ventoy_write_buf_to_file(const char *FileName, void *Bufer, int BufLen)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static sem_t g_writeback_sem;
|
||||
static volatile int g_thread_stop = 0;
|
||||
static pthread_t g_writeback_thread;
|
||||
static pthread_mutex_t g_writeback_mutex;
|
||||
static pthread_cond_t g_writeback_cond;
|
||||
|
||||
static void * ventoy_local_thread_run(void* data)
|
||||
{
|
||||
ventoy_http_writeback_pf callback = (ventoy_http_writeback_pf)data;
|
||||
|
||||
while (1)
|
||||
while (0 == g_thread_stop)
|
||||
{
|
||||
pthread_mutex_lock(&g_writeback_mutex);
|
||||
pthread_cond_wait(&g_writeback_cond, &g_writeback_mutex);
|
||||
|
||||
if (g_thread_stop)
|
||||
{
|
||||
pthread_mutex_unlock(&g_writeback_mutex);
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
callback();
|
||||
pthread_mutex_unlock(&g_writeback_mutex);
|
||||
}
|
||||
sem_wait(&g_writeback_sem);
|
||||
callback();
|
||||
}
|
||||
|
||||
return NULL;
|
||||
@@ -265,15 +254,14 @@ static void * ventoy_local_thread_run(void* data)
|
||||
|
||||
void ventoy_set_writeback_event(void)
|
||||
{
|
||||
pthread_cond_signal(&g_writeback_cond);
|
||||
sem_post(&g_writeback_sem);
|
||||
}
|
||||
|
||||
int ventoy_start_writeback_thread(ventoy_http_writeback_pf callback)
|
||||
{
|
||||
g_thread_stop = 0;
|
||||
pthread_mutex_init(&g_writeback_mutex, NULL);
|
||||
pthread_cond_init(&g_writeback_cond, NULL);
|
||||
|
||||
sem_init(&g_writeback_sem, 0, 0);
|
||||
pthread_create(&g_writeback_thread, NULL, ventoy_local_thread_run, callback);
|
||||
|
||||
return 0;
|
||||
@@ -282,13 +270,10 @@ int ventoy_start_writeback_thread(ventoy_http_writeback_pf callback)
|
||||
void ventoy_stop_writeback_thread(void)
|
||||
{
|
||||
g_thread_stop = 1;
|
||||
pthread_cond_signal(&g_writeback_cond);
|
||||
|
||||
|
||||
sem_post(&g_writeback_sem);
|
||||
pthread_join(g_writeback_thread, NULL);
|
||||
|
||||
|
||||
pthread_cond_destroy(&g_writeback_cond);
|
||||
pthread_mutex_destroy(&g_writeback_mutex);
|
||||
sem_destroy(&g_writeback_sem);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -60,6 +60,17 @@ static const char *g_ventoy_kbd_layout[] =
|
||||
NULL
|
||||
};
|
||||
|
||||
#define VTOY_DEL_ALL_PATH "4119ae33-98ea-448e-b9c0-569aafcf1fb4"
|
||||
|
||||
static int g_json_exist[plugin_type_max][bios_max];
|
||||
static const char *g_plugin_name[plugin_type_max] =
|
||||
{
|
||||
"control", "theme", "menu_alias", "menu_tip",
|
||||
"menu_class", "auto_install", "persistence", "injection",
|
||||
"conf_replace", "password", "image_list",
|
||||
"auto_memdisk", "dud"
|
||||
};
|
||||
|
||||
static char g_ventoy_help_lang[MAX_LANGUAGE][8];
|
||||
|
||||
static char g_pub_path[2 * MAX_PATH];
|
||||
@@ -341,7 +352,10 @@ static int ventoy_api_sysinfo(struct mg_connection *conn, VTOY_JSON *json)
|
||||
|
||||
static int ventoy_api_handshake(struct mg_connection *conn, VTOY_JSON *json)
|
||||
{
|
||||
int i = 0;
|
||||
int j = 0;
|
||||
int pos = 0;
|
||||
char key[128];
|
||||
|
||||
(void)json;
|
||||
|
||||
@@ -350,6 +364,19 @@ static int ventoy_api_handshake(struct mg_connection *conn, VTOY_JSON *json)
|
||||
VTOY_JSON_FMT_SINT("status", 0);
|
||||
VTOY_JSON_FMT_SINT("save_error", g_sysinfo.config_save_error);
|
||||
g_sysinfo.config_save_error = 0;
|
||||
|
||||
for (i = 0; i < plugin_type_max; i++)
|
||||
{
|
||||
scnprintf(key, sizeof(key), "exist_%s", g_plugin_name[i]);
|
||||
VTOY_JSON_FMT_KEY(key);
|
||||
VTOY_JSON_FMT_ARY_BEGIN();
|
||||
for (j = 0; j < bios_max; j++)
|
||||
{
|
||||
VTOY_JSON_FMT_ITEM_INT(g_json_exist[i][j]);
|
||||
}
|
||||
VTOY_JSON_FMT_ARY_ENDEX();
|
||||
}
|
||||
|
||||
VTOY_JSON_FMT_OBJ_END();
|
||||
VTOY_JSON_FMT_END(pos);
|
||||
|
||||
@@ -718,7 +745,7 @@ int ventoy_data_cmp_theme(data_theme *data1, data_theme *data2)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
if (ventoy_path_list_cmp(data1->fontslist, data2->fontslist))
|
||||
{
|
||||
return 1;
|
||||
@@ -927,7 +954,14 @@ static int ventoy_api_theme_del_file(struct mg_connection *conn, VTOY_JSON *json
|
||||
path = VTOY_JSON_STR_EX("path");
|
||||
if (path)
|
||||
{
|
||||
vtoy_list_del(last, node, data->filelist, path);
|
||||
if (strcmp(path, VTOY_DEL_ALL_PATH) == 0)
|
||||
{
|
||||
vtoy_list_free(path_node, data->filelist);
|
||||
}
|
||||
else
|
||||
{
|
||||
vtoy_list_del(last, node, data->filelist, path);
|
||||
}
|
||||
}
|
||||
|
||||
ret = ventoy_data_save_all();
|
||||
@@ -982,7 +1016,14 @@ static int ventoy_api_theme_del_font(struct mg_connection *conn, VTOY_JSON *json
|
||||
path = VTOY_JSON_STR_EX("path");
|
||||
if (path)
|
||||
{
|
||||
vtoy_list_del(last, node, data->fontslist, path);
|
||||
if (strcmp(path, VTOY_DEL_ALL_PATH) == 0)
|
||||
{
|
||||
vtoy_list_free(path_node, data->fontslist);
|
||||
}
|
||||
else
|
||||
{
|
||||
vtoy_list_del(last, node, data->fontslist, path);
|
||||
}
|
||||
}
|
||||
|
||||
ret = ventoy_data_save_all();
|
||||
@@ -1179,7 +1220,14 @@ static int ventoy_api_alias_del(struct mg_connection *conn, VTOY_JSON *json)
|
||||
path = VTOY_JSON_STR_EX("path");
|
||||
if (path)
|
||||
{
|
||||
vtoy_list_del(last, node, data->list, path);
|
||||
if (strcmp(path, VTOY_DEL_ALL_PATH) == 0)
|
||||
{
|
||||
vtoy_list_free(data_alias_node, data->list);
|
||||
}
|
||||
else
|
||||
{
|
||||
vtoy_list_del(last, node, data->list, path);
|
||||
}
|
||||
}
|
||||
|
||||
ret = ventoy_data_save_all();
|
||||
@@ -1417,7 +1465,14 @@ static int ventoy_api_tip_del(struct mg_connection *conn, VTOY_JSON *json)
|
||||
path = VTOY_JSON_STR_EX("path");
|
||||
if (path)
|
||||
{
|
||||
vtoy_list_del(last, node, data->list, path);
|
||||
if (strcmp(path, VTOY_DEL_ALL_PATH) == 0)
|
||||
{
|
||||
vtoy_list_free(data_tip_node, data->list);
|
||||
}
|
||||
else
|
||||
{
|
||||
vtoy_list_del(last, node, data->list, path);
|
||||
}
|
||||
}
|
||||
|
||||
ret = ventoy_data_save_all();
|
||||
@@ -1620,7 +1675,14 @@ static int ventoy_api_class_del(struct mg_connection *conn, VTOY_JSON *json)
|
||||
path = VTOY_JSON_STR_EX("path");
|
||||
if (path)
|
||||
{
|
||||
vtoy_list_del(last, node, data->list, path);
|
||||
if (strcmp(path, VTOY_DEL_ALL_PATH) == 0)
|
||||
{
|
||||
vtoy_list_free(data_class_node, data->list);
|
||||
}
|
||||
else
|
||||
{
|
||||
vtoy_list_del(last, node, data->list, path);
|
||||
}
|
||||
}
|
||||
|
||||
ret = ventoy_data_save_all();
|
||||
@@ -1749,7 +1811,14 @@ static int ventoy_api_auto_memdisk_del(struct mg_connection *conn, VTOY_JSON *js
|
||||
path = VTOY_JSON_STR_EX("path");
|
||||
if (path)
|
||||
{
|
||||
vtoy_list_del(last, node, data->list, path);
|
||||
if (strcmp(path, VTOY_DEL_ALL_PATH) == 0)
|
||||
{
|
||||
vtoy_list_free(path_node, data->list);
|
||||
}
|
||||
else
|
||||
{
|
||||
vtoy_list_del(last, node, data->list, path);
|
||||
}
|
||||
}
|
||||
|
||||
ret = ventoy_data_save_all();
|
||||
@@ -1924,7 +1993,14 @@ static int ventoy_api_image_list_del(struct mg_connection *conn, VTOY_JSON *json
|
||||
path = VTOY_JSON_STR_EX("path");
|
||||
if (path)
|
||||
{
|
||||
vtoy_list_del(last, node, data->list, path);
|
||||
if (strcmp(path, VTOY_DEL_ALL_PATH) == 0)
|
||||
{
|
||||
vtoy_list_free(path_node, data->list);
|
||||
}
|
||||
else
|
||||
{
|
||||
vtoy_list_del(last, node, data->list, path);
|
||||
}
|
||||
}
|
||||
|
||||
ret = ventoy_data_save_all();
|
||||
@@ -2175,7 +2251,14 @@ static int ventoy_api_password_del(struct mg_connection *conn, VTOY_JSON *json)
|
||||
path = VTOY_JSON_STR_EX("path");
|
||||
if (path)
|
||||
{
|
||||
vtoy_list_del(last, node, data->list, path);
|
||||
if (strcmp(path, VTOY_DEL_ALL_PATH) == 0)
|
||||
{
|
||||
vtoy_list_free(menu_password, data->list);
|
||||
}
|
||||
else
|
||||
{
|
||||
vtoy_list_del(last, node, data->list, path);
|
||||
}
|
||||
}
|
||||
|
||||
ret = ventoy_data_save_all();
|
||||
@@ -2366,7 +2449,14 @@ static int ventoy_api_conf_replace_del(struct mg_connection *conn, VTOY_JSON *js
|
||||
path = VTOY_JSON_STR_EX("path");
|
||||
if (path)
|
||||
{
|
||||
vtoy_list_del(last, node, data->list, path);
|
||||
if (strcmp(path, VTOY_DEL_ALL_PATH) == 0)
|
||||
{
|
||||
vtoy_list_free(conf_replace_node, data->list);
|
||||
}
|
||||
else
|
||||
{
|
||||
vtoy_list_del(last, node, data->list, path);
|
||||
}
|
||||
}
|
||||
|
||||
ret = ventoy_data_save_all();
|
||||
@@ -2555,6 +2645,7 @@ static int ventoy_api_dud_del(struct mg_connection *conn, VTOY_JSON *json)
|
||||
int ret;
|
||||
int index = 0;
|
||||
const char *path = NULL;
|
||||
dud_node *next = NULL;
|
||||
dud_node *last = NULL;
|
||||
dud_node *node = NULL;
|
||||
data_dud *data = NULL;
|
||||
@@ -2565,7 +2656,20 @@ static int ventoy_api_dud_del(struct mg_connection *conn, VTOY_JSON *json)
|
||||
path = VTOY_JSON_STR_EX("path");
|
||||
if (path)
|
||||
{
|
||||
vtoy_list_del_ex(last, node, data->list, path, ventoy_free_path_node_list);
|
||||
if (strcmp(path, VTOY_DEL_ALL_PATH) == 0)
|
||||
{
|
||||
for (node = data->list; node; node = next)
|
||||
{
|
||||
next = node->next;
|
||||
ventoy_free_path_node_list(node->list);
|
||||
free(node);
|
||||
}
|
||||
data->list = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
vtoy_list_del_ex(last, node, data->list, path, ventoy_free_path_node_list);
|
||||
}
|
||||
}
|
||||
|
||||
ret = ventoy_data_save_all();
|
||||
@@ -2902,6 +3006,7 @@ static int ventoy_api_auto_install_del(struct mg_connection *conn, VTOY_JSON *js
|
||||
int index = 0;
|
||||
const char *path = NULL;
|
||||
auto_install_node *last = NULL;
|
||||
auto_install_node *next = NULL;
|
||||
auto_install_node *node = NULL;
|
||||
data_auto_install *data = NULL;
|
||||
|
||||
@@ -2911,7 +3016,20 @@ static int ventoy_api_auto_install_del(struct mg_connection *conn, VTOY_JSON *js
|
||||
path = VTOY_JSON_STR_EX("path");
|
||||
if (path)
|
||||
{
|
||||
vtoy_list_del_ex(last, node, data->list, path, ventoy_free_path_node_list);
|
||||
if (strcmp(path, VTOY_DEL_ALL_PATH) == 0)
|
||||
{
|
||||
for (node = data->list; node; node = next)
|
||||
{
|
||||
next = node->next;
|
||||
ventoy_free_path_node_list(node->list);
|
||||
free(node);
|
||||
}
|
||||
data->list = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
vtoy_list_del_ex(last, node, data->list, path, ventoy_free_path_node_list);
|
||||
}
|
||||
}
|
||||
|
||||
ret = ventoy_data_save_all();
|
||||
@@ -3229,6 +3347,7 @@ static int ventoy_api_persistence_del(struct mg_connection *conn, VTOY_JSON *jso
|
||||
int index = 0;
|
||||
const char *path = NULL;
|
||||
persistence_node *last = NULL;
|
||||
persistence_node *next = NULL;
|
||||
persistence_node *node = NULL;
|
||||
data_persistence *data = NULL;
|
||||
|
||||
@@ -3238,7 +3357,20 @@ static int ventoy_api_persistence_del(struct mg_connection *conn, VTOY_JSON *jso
|
||||
path = VTOY_JSON_STR_EX("path");
|
||||
if (path)
|
||||
{
|
||||
vtoy_list_del_ex(last, node, data->list, path, ventoy_free_path_node_list);
|
||||
if (strcmp(path, VTOY_DEL_ALL_PATH) == 0)
|
||||
{
|
||||
for (node = data->list; node; node = next)
|
||||
{
|
||||
next = node->next;
|
||||
ventoy_free_path_node_list(node->list);
|
||||
free(node);
|
||||
}
|
||||
data->list = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
vtoy_list_del_ex(last, node, data->list, path, ventoy_free_path_node_list);
|
||||
}
|
||||
}
|
||||
|
||||
ret = ventoy_data_save_all();
|
||||
@@ -3515,7 +3647,14 @@ static int ventoy_api_injection_del(struct mg_connection *conn, VTOY_JSON *json)
|
||||
path = VTOY_JSON_STR_EX("path");
|
||||
if (path)
|
||||
{
|
||||
vtoy_list_del(last, node, data->list, path);
|
||||
if (strcmp(path, VTOY_DEL_ALL_PATH) == 0)
|
||||
{
|
||||
vtoy_list_free(injection_node, data->list);
|
||||
}
|
||||
else
|
||||
{
|
||||
vtoy_list_del(last, node, data->list, path);
|
||||
}
|
||||
}
|
||||
|
||||
ret = ventoy_data_save_all();
|
||||
@@ -3524,6 +3663,34 @@ static int ventoy_api_injection_del(struct mg_connection *conn, VTOY_JSON *json)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if 0
|
||||
#endif
|
||||
|
||||
static int ventoy_api_preview_json(struct mg_connection *conn, VTOY_JSON *json)
|
||||
{
|
||||
int pos = 0;
|
||||
int len = 0;
|
||||
int encodelen = 0;
|
||||
char *encodebuf = NULL;
|
||||
|
||||
(void)json;
|
||||
|
||||
len = ventoy_data_real_save_all(0);
|
||||
encodebuf = ventoy_base64_encode(JSON_SAVE_BUFFER, len, &encodelen);
|
||||
encodebuf[encodelen] = 0;
|
||||
|
||||
VTOY_JSON_FMT_BEGIN(pos, JSON_BUFFER, JSON_BUF_MAX);
|
||||
VTOY_JSON_FMT_OBJ_BEGIN();
|
||||
VTOY_JSON_FMT_STRN("json", encodebuf);
|
||||
VTOY_JSON_FMT_OBJ_END();
|
||||
VTOY_JSON_FMT_END(pos);
|
||||
|
||||
free(encodebuf);
|
||||
|
||||
ventoy_json_buffer(conn, JSON_BUFFER, pos);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
#endif
|
||||
@@ -3534,14 +3701,17 @@ int ventoy_data_save_all(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ventoy_data_real_save_all(void)
|
||||
int ventoy_data_real_save_all(int apilock)
|
||||
{
|
||||
int i = 0;
|
||||
int pos = 0;
|
||||
char title[64];
|
||||
|
||||
pthread_mutex_lock(&g_api_mutex);
|
||||
|
||||
if (apilock)
|
||||
{
|
||||
pthread_mutex_lock(&g_api_mutex);
|
||||
}
|
||||
|
||||
ssprintf(pos, JSON_SAVE_BUFFER, JSON_BUF_MAX, "{\n");
|
||||
|
||||
ventoy_save_plug(control);
|
||||
@@ -3565,7 +3735,10 @@ int ventoy_data_real_save_all(void)
|
||||
}
|
||||
ssprintf(pos, JSON_SAVE_BUFFER, JSON_BUF_MAX, "}\n");
|
||||
|
||||
pthread_mutex_unlock(&g_api_mutex);
|
||||
if (apilock)
|
||||
{
|
||||
pthread_mutex_unlock(&g_api_mutex);
|
||||
}
|
||||
|
||||
return pos;
|
||||
}
|
||||
@@ -3578,7 +3751,7 @@ int ventoy_http_writeback(void)
|
||||
|
||||
ventoy_get_json_path(filename, NULL);
|
||||
|
||||
pos = ventoy_data_real_save_all();
|
||||
pos = ventoy_data_real_save_all(1);
|
||||
|
||||
#ifdef VENTOY_SIM
|
||||
printf("%s", JSON_SAVE_BUFFER);
|
||||
@@ -3675,11 +3848,11 @@ static JSON_CB g_ventoy_json_cb[] =
|
||||
{ "save_injection", ventoy_api_save_injection },
|
||||
{ "injection_add", ventoy_api_injection_add },
|
||||
{ "injection_del", ventoy_api_injection_del },
|
||||
|
||||
{ "preview_json", ventoy_api_preview_json },
|
||||
|
||||
};
|
||||
|
||||
static int ventoy_json_handler(struct mg_connection *conn, VTOY_JSON *json)
|
||||
static int ventoy_json_handler(struct mg_connection *conn, VTOY_JSON *json, char *jsonstr)
|
||||
{
|
||||
int i;
|
||||
const char *method = NULL;
|
||||
@@ -3696,7 +3869,7 @@ static int ventoy_json_handler(struct mg_connection *conn, VTOY_JSON *json)
|
||||
ventoy_api_handshake(conn, json);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
for (i = 0; i < (int)(sizeof(g_ventoy_json_cb) / sizeof(g_ventoy_json_cb[0])); i++)
|
||||
{
|
||||
if (strcmp(method, g_ventoy_json_cb[i].method) == 0)
|
||||
@@ -3740,7 +3913,7 @@ static int ventoy_request_handler(struct mg_connection *conn)
|
||||
if (JSON_SUCCESS == vtoy_json_parse(json, post_data_buf))
|
||||
{
|
||||
pthread_mutex_lock(&g_api_mutex);
|
||||
ventoy_json_handler(conn, json->pstChild);
|
||||
ventoy_json_handler(conn, json->pstChild, post_data_buf);
|
||||
pthread_mutex_unlock(&g_api_mutex);
|
||||
}
|
||||
else
|
||||
@@ -5026,7 +5199,8 @@ end:
|
||||
|
||||
int ventoy_http_start(const char *ip, const char *port)
|
||||
{
|
||||
int i;
|
||||
int i = 0;
|
||||
int ret = 0;
|
||||
char addr[128];
|
||||
char filename[128];
|
||||
char backupname[128];
|
||||
@@ -5063,10 +5237,13 @@ int ventoy_http_start(const char *ip, const char *port)
|
||||
if (ventoy_is_file_exist("%s", filename))
|
||||
{
|
||||
ventoy_copy_file(filename, backupname);
|
||||
ventoy_load_old_json(filename);
|
||||
ret = ventoy_load_old_json(filename);
|
||||
if (ret == 0)
|
||||
{
|
||||
ventoy_data_real_save_all(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* option */
|
||||
scnprintf(addr, sizeof(addr), "%s:%s", ip, port);
|
||||
options[1] = addr;
|
||||
|
@@ -41,6 +41,24 @@ typedef enum bios_mode
|
||||
bios_max
|
||||
}bios_mode;
|
||||
|
||||
typedef enum plugin_type
|
||||
{
|
||||
plugin_type_control = 0,
|
||||
plugin_type_theme,
|
||||
plugin_type_menu_alias,
|
||||
plugin_type_menu_tip,
|
||||
plugin_type_menu_class,
|
||||
plugin_type_auto_install,
|
||||
plugin_type_persistence,
|
||||
plugin_type_injection,
|
||||
plugin_type_conf_replace,
|
||||
plugin_type_password,
|
||||
plugin_type_image_list,
|
||||
plugin_type_auto_memdisk,
|
||||
plugin_type_dud,
|
||||
|
||||
plugin_type_max
|
||||
}plugin_type;
|
||||
|
||||
typedef struct data_control
|
||||
{
|
||||
@@ -260,8 +278,10 @@ typedef struct data_persistence
|
||||
for (i = 0; i < bios_max; i++) \
|
||||
{\
|
||||
scnprintf(title, sizeof(title), "%s%s", #plug, g_json_title_postfix[i]);\
|
||||
g_json_exist[plugin_type_##plug][i] = 0;\
|
||||
if (ventoy_data_cmp_##plug(g_data_##plug + i, g_data_##plug + bios_max))\
|
||||
{\
|
||||
g_json_exist[plugin_type_##plug][i] = 1;\
|
||||
pos += ventoy_data_save_##plug(g_data_##plug + i, title, JSON_SAVE_BUFFER + pos, JSON_BUF_MAX - pos);\
|
||||
}\
|
||||
}\
|
||||
@@ -302,6 +322,7 @@ typedef struct data_persistence
|
||||
free(__node);\
|
||||
__node = __next;\
|
||||
}\
|
||||
(list) = NULL;\
|
||||
}
|
||||
|
||||
#define vtoy_list_del(last, node, LIST, field) \
|
||||
@@ -401,6 +422,7 @@ void ventoy_http_exit(void);
|
||||
int ventoy_http_start(const char *ip, const char *port);
|
||||
int ventoy_http_stop(void);
|
||||
int ventoy_data_save_all(void);
|
||||
int ventoy_data_real_save_all(int apilock);
|
||||
|
||||
#endif /* __VENTOY_HTTP_H__ */
|
||||
|
||||
|
Binary file not shown.
@@ -1 +1 @@
|
||||
20220921 18:42:35
|
||||
20221021 14:42:35
|
@@ -57,6 +57,14 @@
|
||||
|
||||
<div class="navbar-custom-menu">
|
||||
<ul class="nav navbar-nav">
|
||||
<li class="dropdown user user-menu">
|
||||
<a href="javascript:void(0)" id="id_a_preview">
|
||||
<span class="fa fa-file-code-o"></span>
|
||||
<span id="id_span_preview" class="hidden-xs">Preview</span>
|
||||
<span class="hidden-xs"> </span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="dropdown user user-menu">
|
||||
<a href="javascript:void(0)" id="id_a_language">
|
||||
<span class="fa fa-language"></span>
|
||||
@@ -710,6 +718,32 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="modal" id="JsonPreviewModal">
|
||||
<div class="modal-dialog" style="width: 80%;">
|
||||
<div class="modal-content">
|
||||
<form id="JsonPeviewForm" class="form-horizontal">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
<h4>
|
||||
<b id="JsonPreviewForm_lang_1">JSON</b>
|
||||
<button type="button" id="id_btn_json_copy" class="btn btn-primary"><span class="fa fa-copy"> </span><span id="id_span_copy">Copy</span></button>
|
||||
</h4>
|
||||
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<textarea id="pre_json_preview" class="form-control" rows="30" style="font-family:Menlo,Monaco,Consolas,'Courier New',monospace"></textarea>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button id="PrewForm_lang_2" type="button" class="btn btn-primary btn-flat" data-dismiss="modal">确定</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- Content Wrapper. Contains page content -->
|
||||
@@ -723,7 +757,7 @@
|
||||
|
||||
<footer class="main-footer">
|
||||
<div class="pull-right hidden-xs">
|
||||
<b id="plugson_build_date">20220921 18:42:35</b>
|
||||
<b id="plugson_build_date">20221021 14:42:35</b>
|
||||
</div>
|
||||
<strong><a href="https://www.ventoy.net" target="_blank">https://www.ventoy.net</a></strong>
|
||||
</footer>
|
||||
@@ -745,8 +779,8 @@
|
||||
<script src="/static/js/jquery.validate.min.js"></script>
|
||||
<script src="/static/js/jquery.validate.vtoymethods.js?v=100"></script>
|
||||
|
||||
<script src="/static/js/vtoy.js?v=100"></script>
|
||||
<script src="/static/js/jquery.vtoy.alert.js?v=100"></script>
|
||||
<script src="/static/js/vtoy.js?v=100"></script>
|
||||
<script src="/static/js/md5.min.js"></script>
|
||||
|
||||
<!-- Bootstrap 3.3.5 -->
|
||||
@@ -760,6 +794,36 @@
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
function VtoyJsonCopyClick() {
|
||||
var copyText = document.getElementById("pre_json_preview");
|
||||
copyText.select();
|
||||
copyText.setSelectionRange(0, 99999); // For mobile devices
|
||||
|
||||
try {
|
||||
var successful = document.execCommand('copy');
|
||||
copyText.setSelectionRange(0, 0);
|
||||
if (successful) {
|
||||
Message.success(g_vtoy_cur_language.STR_JSON_COPY_SUCCESS);
|
||||
} else {
|
||||
Message.error(g_vtoy_cur_language.STR_JSON_COPY_FAILED);
|
||||
}
|
||||
} catch (err) {
|
||||
Message.error(g_vtoy_cur_language.STR_JSON_COPY_FAILED);
|
||||
}
|
||||
}
|
||||
|
||||
function VtoyPreviewClick() {
|
||||
callVtoySync({
|
||||
method : 'preview_json'
|
||||
}, function(data) {
|
||||
$('#JsonPeviewForm #JsonPreviewForm_lang_1').text(g_vtoy_cur_language.STR_JSON_PREVIEW);
|
||||
$('#JsonPeviewForm #PrewForm_lang_2').text(g_vtoy_cur_language.STR_BTN_OK);
|
||||
|
||||
$('#pre_json_preview').text(atob(data.json));
|
||||
$("#JsonPreviewModal").modal();
|
||||
});
|
||||
}
|
||||
|
||||
function VtoyLanguageClick() {
|
||||
var defaultPage = window.location.hash;
|
||||
|
||||
@@ -791,6 +855,8 @@
|
||||
|
||||
});
|
||||
|
||||
$('#id_btn_json_copy').click(VtoyJsonCopyClick);
|
||||
$('#id_a_preview').click(VtoyPreviewClick);
|
||||
$('#id_a_language').click(VtoyLanguageClick);
|
||||
|
||||
$("#plugson-menu a").click(function() {
|
||||
@@ -846,9 +912,13 @@
|
||||
});
|
||||
}
|
||||
|
||||
if (typeof(UpdateTabTitleIcon)==='function') {
|
||||
UpdateTabTitleIcon(data);
|
||||
}
|
||||
|
||||
setTimeout(function() {
|
||||
ventoy_handshake();
|
||||
}, 1000);
|
||||
}, 200);
|
||||
},
|
||||
|
||||
function(xmlHttpRequest, textStatus, errorThrown) {
|
||||
|
@@ -1,10 +1,12 @@
|
||||
<div class="box box-primary" id="control">
|
||||
<div class="box-header">
|
||||
<div class="col-sm-10" style="padding-top:8px;">
|
||||
<div class="col-sm-9" style="padding-top:8px;">
|
||||
<i class="fa fa-desktop"> </i>
|
||||
<h1 class="box-title" style="font-weight:bold;" id="id_h1_page_title">x</h1>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-1" style="padding-top:2px;">
|
||||
<button id="id_btn_reset" class="btn btn-sm btn-danger btn-del"><i class="fa fa-trash"></i><span id="id_btn_span_reset">Reset</span></button>
|
||||
</div>
|
||||
<div class="col-sm-2" style="font-size:16px;padding-top:8px;">
|
||||
<a id="id_a_official_doc" target="_blank" href="https://www.ventoy.net/en/plugin_autoinstall.html"><span class="fa fa-link"></span><span id="id_span_official_doc">官网文档</span></a>
|
||||
</div>
|
||||
@@ -543,7 +545,27 @@
|
||||
$('#id_tab_autoins a[href="#tab_3"]').click(OnClickMultiModeTab);
|
||||
$('#id_tab_autoins a[href="#tab_4"]').click(OnClickMultiModeTab);
|
||||
$('#id_tab_autoins a[href="#tab_5"]').click(OnClickMultiModeTab);
|
||||
|
||||
function UpdateTabTitleIcon(data) {
|
||||
CommonUpdateTabTitleIcon(data.exist_auto_install, '#id_tab_autoins a[href="#tab_', 'auto_install');
|
||||
}
|
||||
$('#id_btn_reset').click(function() {
|
||||
Modal.confirm({msg:GetResetTabConfigTipMsg(current_tab_index, 'auto_install')}).on(function(e) {
|
||||
if (e) {
|
||||
callVtoySync({
|
||||
method : 'auto_install_del',
|
||||
index: current_tab_index,
|
||||
path: g_del_all_path
|
||||
}, function(data) {
|
||||
|
||||
});
|
||||
|
||||
m_data_autoins[current_tab_index].length = 0;
|
||||
VtoyFillCurrentPageItem(m_data_autoins[g_vtoy_data_default_index]);
|
||||
Message.success(g_vtoy_cur_language.STR_SAVE_SUCCESS);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#id_tab_autoins a[href="#tab_0"]').tab('show');
|
||||
VtoyFillCurrentPageItem(m_data_autoins[0]);
|
||||
VtoyPageLanguageChange(g_current_language);
|
||||
|
@@ -1,10 +1,12 @@
|
||||
<div class="box box-primary" id="control">
|
||||
<div class="box-header">
|
||||
<div class="col-sm-10" style="padding-top:8px;">
|
||||
<div class="col-sm-9" style="padding-top:8px;">
|
||||
<i class="fa fa-floppy-o"> </i>
|
||||
<h1 class="box-title" style="font-weight:bold;" id="id_h1_page_title"></h1>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-1" style="padding-top:2px;">
|
||||
<button id="id_btn_reset" class="btn btn-sm btn-danger btn-del"><i class="fa fa-trash"></i><span id="id_btn_span_reset">Reset</span></button>
|
||||
</div>
|
||||
<div class="col-sm-2" style="font-size:16px;padding-top:8px;">
|
||||
<a id="id_a_official_doc" target="_blank" href="https://www.ventoy.net/en/plugin_automemdisk.html"><span class="fa fa-link"></span><span id="id_span_official_doc">官网文档</span></a>
|
||||
</div>
|
||||
@@ -172,7 +174,27 @@
|
||||
$('#id_tab_auto_memdisk a[href="#tab_3"]').click(OnClickMultiModeTab);
|
||||
$('#id_tab_auto_memdisk a[href="#tab_4"]').click(OnClickMultiModeTab);
|
||||
$('#id_tab_auto_memdisk a[href="#tab_5"]').click(OnClickMultiModeTab);
|
||||
|
||||
function UpdateTabTitleIcon(data) {
|
||||
CommonUpdateTabTitleIcon(data.exist_auto_memdisk, '#id_tab_auto_memdisk a[href="#tab_', 'auto_memdisk');
|
||||
}
|
||||
$('#id_btn_reset').click(function() {
|
||||
Modal.confirm({msg:GetResetTabConfigTipMsg(current_tab_index, 'auto_memdisk')}).on(function(e) {
|
||||
if (e) {
|
||||
callVtoySync({
|
||||
method : 'auto_memdisk_del',
|
||||
index: current_tab_index,
|
||||
path: g_del_all_path
|
||||
}, function(data) {
|
||||
|
||||
});
|
||||
|
||||
m_data_memdisk[current_tab_index].length = 0;
|
||||
VtoyFillCurrentPageItem(m_data_memdisk[g_vtoy_data_default_index]);
|
||||
Message.success(g_vtoy_cur_language.STR_SAVE_SUCCESS);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#id_tab_auto_memdisk a[href="#tab_0"]').tab('show');
|
||||
VtoyFillCurrentPageItem(m_data_memdisk[0]);
|
||||
VtoyPageLanguageChange(g_current_language);
|
||||
|
@@ -1,10 +1,12 @@
|
||||
<div class="box box-primary" id="control">
|
||||
<div class="box-header">
|
||||
<div class="col-sm-10" style="padding-top:8px;">
|
||||
<div class="col-sm-9" style="padding-top:8px;">
|
||||
<i class="fa fa-retweet"> </i>
|
||||
<h1 class="box-title" style="font-weight:bold;" id="id_h1_page_title">菜单别名插件</h1>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-1" style="padding-top:2px;">
|
||||
<button id="id_btn_reset" class="btn btn-sm btn-danger btn-del"><i class="fa fa-trash"></i><span id="id_btn_span_reset">Reset</span></button>
|
||||
</div>
|
||||
<div class="col-sm-2" style="font-size:16px;padding-top:8px;">
|
||||
<a id="id_a_official_doc" target="_blank" href="https://www.ventoy.net/en/plugin_bootconf_replace.html"><span class="fa fa-link"></span><span id="id_span_official_doc">官网文档</span></a>
|
||||
</div>
|
||||
@@ -268,7 +270,27 @@
|
||||
$('#id_tab_conf_replace a[href="#tab_3"]').click(OnClickMultiModeTab);
|
||||
$('#id_tab_conf_replace a[href="#tab_4"]').click(OnClickMultiModeTab);
|
||||
$('#id_tab_conf_replace a[href="#tab_5"]').click(OnClickMultiModeTab);
|
||||
|
||||
function UpdateTabTitleIcon(data) {
|
||||
CommonUpdateTabTitleIcon(data.exist_conf_replace, '#id_tab_conf_replace a[href="#tab_', 'conf_replace');
|
||||
}
|
||||
$('#id_btn_reset').click(function() {
|
||||
Modal.confirm({msg:GetResetTabConfigTipMsg(current_tab_index, 'conf_replace')}).on(function(e) {
|
||||
if (e) {
|
||||
callVtoySync({
|
||||
method : 'conf_replace_del',
|
||||
index: current_tab_index,
|
||||
path: g_del_all_path
|
||||
}, function(data) {
|
||||
|
||||
});
|
||||
|
||||
m_data_conf_replace[current_tab_index].length = 0;
|
||||
VtoyFillCurrentPageItem(m_data_conf_replace[g_vtoy_data_default_index]);
|
||||
Message.success(g_vtoy_cur_language.STR_SAVE_SUCCESS);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#id_tab_conf_replace a[href="#tab_0"]').tab('show');
|
||||
VtoyFillCurrentPageItem(m_data_conf_replace[0]);
|
||||
VtoyPageLanguageChange(g_current_language);
|
||||
|
@@ -1,6 +1,6 @@
|
||||
<div class="box box-primary" id="control">
|
||||
<div class="box-header">
|
||||
<div class="col-sm-8" style="padding-top:8px;">
|
||||
<div class="col-sm-7" style="padding-top:8px;">
|
||||
<i class="fa fa-wrench"> </i>
|
||||
<h1 class="box-title" style="font-weight:bold;" id="id_h1_page_title">全局控制插件</h1>
|
||||
</div>
|
||||
@@ -10,6 +10,10 @@
|
||||
<button id="id_btn_expand" class="btn btn-sm btn-primary"><i style="font-size: 14px;" class="fa fa-plus"></i></button>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-1" style="padding-top:2px;">
|
||||
<button id="id_btn_reset" class="btn btn-sm btn-danger btn-del"><i class="fa fa-trash"></i><span id="id_btn_span_reset">Reset</span></button>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-2" style="font-size:16px;padding-top:8px;">
|
||||
<a id="id_a_official_doc" target="_blank" href="https://www.ventoy.net/cn/plugin_control.html"><span class="fa fa-link"></span><span id="id_span_official_doc">官网文档</span></a>
|
||||
</div>
|
||||
@@ -991,6 +995,7 @@
|
||||
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
|
||||
function VtoyPageLanguageChange(newlang) {
|
||||
VtoyCommonChangeLanguage(newlang);
|
||||
|
||||
@@ -1303,6 +1308,18 @@
|
||||
$('#id_tab_control a[href="#tab_3"]').click(OnClickMultiModeTab);
|
||||
$('#id_tab_control a[href="#tab_4"]').click(OnClickMultiModeTab);
|
||||
$('#id_tab_control a[href="#tab_5"]').click(OnClickMultiModeTab);
|
||||
|
||||
function UpdateTabTitleIcon(data) {
|
||||
CommonUpdateTabTitleIcon(data.exist_control, '#id_tab_control a[href="#tab_', 'control');
|
||||
}
|
||||
$('#id_btn_reset').click(function() {
|
||||
Modal.confirm({msg:GetResetTabConfigTipMsg(current_tab_index, 'control')}).on(function(e) {
|
||||
if (e) {
|
||||
VtoyFillCurrentPageItem(m_data_control[g_vtoy_data_default_index]);
|
||||
VtoySaveCurrentPage();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#id_tab_control a[href="#tab_0"]').tab('show');
|
||||
VtoyFillCurrentPageItem(m_data_control[0]);
|
||||
|
@@ -1,10 +1,12 @@
|
||||
<div class="box box-primary" id="control">
|
||||
<div class="box-header">
|
||||
<div class="col-sm-10" style="padding-top:8px;">
|
||||
<div class="col-sm-9" style="padding-top:8px;">
|
||||
<i class="glyphicon glyphicon-cd"> </i>
|
||||
<h1 class="box-title" style="font-weight:bold;" id="id_h1_page_title">x</h1>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-1" style="padding-top:2px;">
|
||||
<button id="id_btn_reset" class="btn btn-sm btn-danger btn-del"><i class="fa fa-trash"></i><span id="id_btn_span_reset">Reset</span></button>
|
||||
</div>
|
||||
<div class="col-sm-2" style="font-size:16px;padding-top:8px;">
|
||||
<a id="id_a_official_doc" target="_blank" href="https://www.ventoy.net/en/plugin_dud.html"><span class="fa fa-link"></span><span id="id_span_official_doc">官网文档</span></a>
|
||||
</div>
|
||||
@@ -355,7 +357,27 @@
|
||||
$('#id_tab_dud a[href="#tab_3"]').click(OnClickMultiModeTab);
|
||||
$('#id_tab_dud a[href="#tab_4"]').click(OnClickMultiModeTab);
|
||||
$('#id_tab_dud a[href="#tab_5"]').click(OnClickMultiModeTab);
|
||||
|
||||
function UpdateTabTitleIcon(data) {
|
||||
CommonUpdateTabTitleIcon(data.exist_dud, '#id_tab_dud a[href="#tab_', 'dud');
|
||||
}
|
||||
$('#id_btn_reset').click(function() {
|
||||
Modal.confirm({msg:GetResetTabConfigTipMsg(current_tab_index, 'dud')}).on(function(e) {
|
||||
if (e) {
|
||||
callVtoySync({
|
||||
method : 'dud_del',
|
||||
index: current_tab_index,
|
||||
path: g_del_all_path
|
||||
}, function(data) {
|
||||
|
||||
});
|
||||
|
||||
m_data_dud[current_tab_index].length = 0;
|
||||
VtoyFillCurrentPageItem(m_data_dud[g_vtoy_data_default_index]);
|
||||
Message.success(g_vtoy_cur_language.STR_SAVE_SUCCESS);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#id_tab_dud a[href="#tab_0"]').tab('show');
|
||||
VtoyFillCurrentPageItem(m_data_dud[0]);
|
||||
VtoyPageLanguageChange(g_current_language);
|
||||
|
@@ -1,10 +1,12 @@
|
||||
<div class="box box-primary" id="control">
|
||||
<div class="box-header">
|
||||
<div class="col-sm-10" style="padding-top:8px;">
|
||||
<div class="col-sm-9" style="padding-top:8px;">
|
||||
<i class="fa fa-list-alt"> </i>
|
||||
<h1 class="box-title" style="font-weight:bold;" id="id_h1_page_title"></h1>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-1" style="padding-top:2px;">
|
||||
<button id="id_btn_reset" class="btn btn-sm btn-danger btn-del"><i class="fa fa-trash"></i><span id="id_btn_span_reset">Reset</span></button>
|
||||
</div>
|
||||
<div class="col-sm-2" style="font-size:16px;padding-top:8px;">
|
||||
<a id="id_a_official_doc" target="_blank" href="https://www.ventoy.net/en/plugin_imagelist.html"><span class="fa fa-link"></span><span id="id_span_official_doc">官网文档</span></a>
|
||||
</div>
|
||||
@@ -262,7 +264,27 @@
|
||||
$('#id_tab_image_list a[href="#tab_3"]').click(OnClickMultiModeTab);
|
||||
$('#id_tab_image_list a[href="#tab_4"]').click(OnClickMultiModeTab);
|
||||
$('#id_tab_image_list a[href="#tab_5"]').click(OnClickMultiModeTab);
|
||||
|
||||
function UpdateTabTitleIcon(data) {
|
||||
CommonUpdateTabTitleIcon(data.exist_image_list, '#id_tab_image_list a[href="#tab_', 'image_list');
|
||||
}
|
||||
$('#id_btn_reset').click(function() {
|
||||
Modal.confirm({msg:GetResetTabConfigTipMsg(current_tab_index, 'image_list')}).on(function(e) {
|
||||
if (e) {
|
||||
callVtoySync({
|
||||
method : 'image_list_del',
|
||||
index: current_tab_index,
|
||||
path: g_del_all_path
|
||||
}, function(data) {
|
||||
|
||||
});
|
||||
|
||||
m_data_imagelist[current_tab_index].list.length = 0;
|
||||
VtoyFillCurrentPageItem(m_data_imagelist[g_vtoy_data_default_index]);
|
||||
VtoySaveCurrentPage();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#id_tab_image_list a[href="#tab_0"]').tab('show');
|
||||
VtoyFillCurrentPageItem(m_data_imagelist[0]);
|
||||
VtoyPageLanguageChange(g_current_language);
|
||||
|
@@ -1,10 +1,12 @@
|
||||
<div class="box box-primary" id="control">
|
||||
<div class="box-header">
|
||||
<div class="col-sm-10" style="padding-top:8px;">
|
||||
<div class="col-sm-9" style="padding-top:8px;">
|
||||
<i class="fa fa-plus-circle"> </i>
|
||||
<h1 class="box-title" style="font-weight:bold;" id="id_h1_page_title">x</h1>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-1" style="padding-top:2px;">
|
||||
<button id="id_btn_reset" class="btn btn-sm btn-danger btn-del"><i class="fa fa-trash"></i><span id="id_btn_span_reset">Reset</span></button>
|
||||
</div>
|
||||
<div class="col-sm-2" style="font-size:16px;padding-top:8px;">
|
||||
<a id="id_a_official_doc" target="_blank" href="https://www.ventoy.net/en/plugin_injection.html"><span class="fa fa-link"></span><span id="id_span_official_doc">官网文档</span></a>
|
||||
</div>
|
||||
@@ -237,7 +239,27 @@
|
||||
$('#id_tab_injection a[href="#tab_3"]').click(OnClickMultiModeTab);
|
||||
$('#id_tab_injection a[href="#tab_4"]').click(OnClickMultiModeTab);
|
||||
$('#id_tab_injection a[href="#tab_5"]').click(OnClickMultiModeTab);
|
||||
|
||||
function UpdateTabTitleIcon(data) {
|
||||
CommonUpdateTabTitleIcon(data.exist_injection, '#id_tab_injection a[href="#tab_', 'injection');
|
||||
}
|
||||
$('#id_btn_reset').click(function() {
|
||||
Modal.confirm({msg:GetResetTabConfigTipMsg(current_tab_index, 'injection')}).on(function(e) {
|
||||
if (e) {
|
||||
callVtoySync({
|
||||
method : 'injection_del',
|
||||
index: current_tab_index,
|
||||
path: g_del_all_path
|
||||
}, function(data) {
|
||||
|
||||
});
|
||||
|
||||
m_data_injection[current_tab_index].length = 0;
|
||||
VtoyFillCurrentPageItem(m_data_injection[g_vtoy_data_default_index]);
|
||||
Message.success(g_vtoy_cur_language.STR_SAVE_SUCCESS);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#id_tab_injection a[href="#tab_0"]').tab('show');
|
||||
VtoyFillCurrentPageItem(m_data_injection[0]);
|
||||
VtoyPageLanguageChange(g_current_language);
|
||||
|
@@ -1,10 +1,12 @@
|
||||
<div class="box box-primary" id="control">
|
||||
<div class="box-header">
|
||||
<div class="col-sm-10" style="padding-top:8px;">
|
||||
<div class="col-sm-9" style="padding-top:8px;">
|
||||
<i class="fa fa-clone"> </i>
|
||||
<h1 class="box-title" style="font-weight:bold;" id="id_h1_page_title">菜单别名插件</h1>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-1" style="padding-top:2px;">
|
||||
<button id="id_btn_reset" class="btn btn-sm btn-danger btn-del"><i class="fa fa-trash"></i><span id="id_btn_span_reset">Reset</span></button>
|
||||
</div>
|
||||
<div class="col-sm-2" style="font-size:16px;padding-top:8px;">
|
||||
<a id="id_a_official_doc" target="_blank" href="https://www.ventoy.net/en/plugin_menualias.html"><span class="fa fa-link"></span><span id="id_span_official_doc">官网文档</span></a>
|
||||
</div>
|
||||
@@ -232,6 +234,27 @@
|
||||
$('#id_tab_menu_alias a[href="#tab_4"]').click(OnClickMultiModeTab);
|
||||
$('#id_tab_menu_alias a[href="#tab_5"]').click(OnClickMultiModeTab);
|
||||
|
||||
function UpdateTabTitleIcon(data) {
|
||||
CommonUpdateTabTitleIcon(data.exist_menu_alias, '#id_tab_menu_alias a[href="#tab_', 'menu_alias');
|
||||
}
|
||||
$('#id_btn_reset').click(function() {
|
||||
Modal.confirm({msg:GetResetTabConfigTipMsg(current_tab_index, 'menu_alias')}).on(function(e) {
|
||||
if (e) {
|
||||
callVtoySync({
|
||||
method : 'alias_del',
|
||||
index: current_tab_index,
|
||||
path: g_del_all_path
|
||||
}, function(data) {
|
||||
|
||||
});
|
||||
|
||||
m_data_alias[current_tab_index].length = 0;
|
||||
VtoyFillCurrentPageItem(m_data_alias[g_vtoy_data_default_index]);
|
||||
Message.success(g_vtoy_cur_language.STR_SAVE_SUCCESS);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#id_tab_menu_alias a[href="#tab_0"]').tab('show');
|
||||
VtoyFillCurrentPageItem(m_data_alias[0]);
|
||||
VtoyPageLanguageChange(g_current_language);
|
||||
|
@@ -1,10 +1,12 @@
|
||||
<div class="box box-primary" id="control">
|
||||
<div class="box-header">
|
||||
<div class="col-sm-10" style="padding-top:8px;">
|
||||
<div class="col-sm-9" style="padding-top:8px;">
|
||||
<i class="fa fa-list-ul"> </i>
|
||||
<h1 class="box-title" style="font-weight:bold;" id="id_h1_page_title">xx</h1>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-1" style="padding-top:2px;">
|
||||
<button id="id_btn_reset" class="btn btn-sm btn-danger btn-del"><i class="fa fa-trash"></i><span id="id_btn_span_reset">Reset</span></button>
|
||||
</div>
|
||||
<div class="col-sm-2" style="font-size:16px;padding-top:8px;">
|
||||
<a id="id_a_official_doc" target="_blank" href="https://www.ventoy.net/en/plugin_menuclass.html"><span class="fa fa-link"></span><span id="id_span_official_doc">官网文档</span></a>
|
||||
</div>
|
||||
@@ -270,6 +272,26 @@
|
||||
$('#id_tab_menu_class a[href="#tab_3"]').click(OnClickMultiModeTab);
|
||||
$('#id_tab_menu_class a[href="#tab_4"]').click(OnClickMultiModeTab);
|
||||
$('#id_tab_menu_class a[href="#tab_5"]').click(OnClickMultiModeTab);
|
||||
function UpdateTabTitleIcon(data) {
|
||||
CommonUpdateTabTitleIcon(data.exist_menu_class, '#id_tab_menu_class a[href="#tab_', 'menu_class');
|
||||
}
|
||||
$('#id_btn_reset').click(function() {
|
||||
Modal.confirm({msg:GetResetTabConfigTipMsg(current_tab_index, 'menu_class')}).on(function(e) {
|
||||
if (e) {
|
||||
callVtoySync({
|
||||
method : 'class_del',
|
||||
index: current_tab_index,
|
||||
path: g_del_all_path
|
||||
}, function(data) {
|
||||
|
||||
});
|
||||
|
||||
m_data_class[current_tab_index].length = 0;
|
||||
VtoyFillCurrentPageItem(m_data_class[g_vtoy_data_default_index]);
|
||||
Message.success(g_vtoy_cur_language.STR_SAVE_SUCCESS);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#id_tab_menu_class a[href="#tab_0"]').tab('show');
|
||||
VtoyFillCurrentPageItem(m_data_class[0]);
|
||||
|
@@ -1,10 +1,12 @@
|
||||
<div class="box box-primary" id="control">
|
||||
<div class="box-header">
|
||||
<div class="col-sm-10" style="padding-top:8px;">
|
||||
<div class="col-sm-9" style="padding-top:8px;">
|
||||
<i class="fa fa-commenting"> </i>
|
||||
<h1 class="box-title" style="font-weight:bold;" id="id_h1_page_title"></h1>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-1" style="padding-top:2px;">
|
||||
<button id="id_btn_reset" class="btn btn-sm btn-danger btn-del"><i class="fa fa-trash"></i><span id="id_btn_span_reset">Reset</span></button>
|
||||
</div>
|
||||
<div class="col-sm-2" style="font-size:16px;padding-top:8px;">
|
||||
<a id="id_a_official_doc" target="_blank" href="https://www.ventoy.net/en/plugin_menutip.html"><span class="fa fa-link"></span><span id="id_span_official_doc">官网文档</span></a>
|
||||
</div>
|
||||
@@ -373,6 +375,30 @@
|
||||
$('#id_tab_menu_tip a[href="#tab_4"]').click(OnClickMultiModeTab);
|
||||
$('#id_tab_menu_tip a[href="#tab_5"]').click(OnClickMultiModeTab);
|
||||
|
||||
function UpdateTabTitleIcon(data) {
|
||||
CommonUpdateTabTitleIcon(data.exist_menu_tip, '#id_tab_menu_tip a[href="#tab_', 'menu_tip');
|
||||
}
|
||||
$('#id_btn_reset').click(function() {
|
||||
Modal.confirm({msg:GetResetTabConfigTipMsg(current_tab_index, 'menu_tip')}).on(function(e) {
|
||||
if (e) {
|
||||
callVtoySync({
|
||||
method : 'tip_del',
|
||||
index: current_tab_index,
|
||||
path: g_del_all_path
|
||||
}, function(data) {
|
||||
|
||||
});
|
||||
|
||||
m_data_tip[current_tab_index].left = m_data_tip[g_vtoy_data_default_index].left;
|
||||
m_data_tip[current_tab_index].top = m_data_tip[g_vtoy_data_default_index].top;
|
||||
m_data_tip[current_tab_index].color = m_data_tip[g_vtoy_data_default_index].color;
|
||||
m_data_tip[current_tab_index].tips.length = 0;
|
||||
VtoyFillCurrentPageItem(m_data_tip[g_vtoy_data_default_index]);
|
||||
VtoySaveCurrentPage();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#id_tab_menu_tip a[href="#tab_0"]').tab('show');
|
||||
VtoyFillCurrentPageItem(m_data_tip[0]);
|
||||
VtoyPageLanguageChange(g_current_language);
|
||||
|
@@ -1,10 +1,12 @@
|
||||
<div class="box box-primary" id="control">
|
||||
<div class="box-header">
|
||||
<div class="col-sm-10" style="padding-top:8px;">
|
||||
<div class="col-sm-9" style="padding-top:8px;">
|
||||
<i class="glyphicon glyphicon-lock"> </i>
|
||||
<h1 class="box-title" style="font-weight:bold;" id="id_h1_page_title"></h1>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-1" style="padding-top:2px;">
|
||||
<button id="id_btn_reset" class="btn btn-sm btn-danger btn-del"><i class="fa fa-trash"></i><span id="id_btn_span_reset">Reset</span></button>
|
||||
</div>
|
||||
<div class="col-sm-2" style="font-size:16px;padding-top:8px;">
|
||||
<a id="id_a_official_doc" target="_blank" href="https://www.ventoy.net/en/plugin_password.html"><span class="fa fa-link"></span><span id="id_span_official_doc">官网文档</span></a>
|
||||
</div>
|
||||
@@ -234,7 +236,7 @@
|
||||
}
|
||||
|
||||
current_tab_index = index;
|
||||
VtoyFillCurrentPageItem(m_data_pwd[index].tips);
|
||||
VtoyFillCurrentPageItem(m_data_pwd[index]);
|
||||
}
|
||||
|
||||
function VtoyGetCurrentPageItem(data) {
|
||||
@@ -557,6 +559,27 @@ function VtoySetPassword(common, type, cb, data) {
|
||||
$('#id_tab_password a[href="#tab_4"]').click(OnClickMultiModeTab);
|
||||
$('#id_tab_password a[href="#tab_5"]').click(OnClickMultiModeTab);
|
||||
|
||||
function UpdateTabTitleIcon(data) {
|
||||
CommonUpdateTabTitleIcon(data.exist_password, '#id_tab_password a[href="#tab_', 'password');
|
||||
}
|
||||
$('#id_btn_reset').click(function() {
|
||||
Modal.confirm({msg:GetResetTabConfigTipMsg(current_tab_index, 'password')}).on(function(e) {
|
||||
if (e) {
|
||||
callVtoySync({
|
||||
method : 'password_del',
|
||||
index: current_tab_index,
|
||||
path: g_del_all_path
|
||||
}, function(data) {
|
||||
|
||||
});
|
||||
|
||||
m_data_pwd[current_tab_index].list.length = 0;
|
||||
VtoyFillCurrentPageItem(m_data_pwd[g_vtoy_data_default_index]);
|
||||
VtoySaveCurrentPage();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#id_tab_password a[href="#tab_0"]').tab('show');
|
||||
VtoyFillCurrentPageItem(m_data_pwd[0]);
|
||||
VtoyPageLanguageChange(g_current_language);
|
||||
|
@@ -1,10 +1,12 @@
|
||||
<div class="box box-primary" id="control">
|
||||
<div class="box-header">
|
||||
<div class="col-sm-10" style="padding-top:8px;">
|
||||
<div class="col-sm-9" style="padding-top:8px;">
|
||||
<i class="fa fa-database"> </i>
|
||||
<h1 class="box-title" style="font-weight:bold;" id="id_h1_page_title">x</h1>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-1" style="padding-top:2px;">
|
||||
<button id="id_btn_reset" class="btn btn-sm btn-danger btn-del"><i class="fa fa-trash"></i><span id="id_btn_span_reset">Reset</span></button>
|
||||
</div>
|
||||
<div class="col-sm-2" style="font-size:16px;padding-top:8px;">
|
||||
<a id="id_a_official_doc" target="_blank" href="https://www.ventoy.net/en/plugin_persistence.html"><span class="fa fa-link"></span><span id="id_span_official_doc">官网文档</span></a>
|
||||
</div>
|
||||
@@ -510,7 +512,27 @@
|
||||
$('#id_tab_persistence a[href="#tab_3"]').click(OnClickMultiModeTab);
|
||||
$('#id_tab_persistence a[href="#tab_4"]').click(OnClickMultiModeTab);
|
||||
$('#id_tab_persistence a[href="#tab_5"]').click(OnClickMultiModeTab);
|
||||
|
||||
function UpdateTabTitleIcon(data) {
|
||||
CommonUpdateTabTitleIcon(data.exist_persistence, '#id_tab_persistence a[href="#tab_', 'persistence');
|
||||
}
|
||||
$('#id_btn_reset').click(function() {
|
||||
Modal.confirm({msg:GetResetTabConfigTipMsg(current_tab_index, 'persistence')}).on(function(e) {
|
||||
if (e) {
|
||||
callVtoySync({
|
||||
method : 'persistence_del',
|
||||
index: current_tab_index,
|
||||
path: g_del_all_path
|
||||
}, function(data) {
|
||||
|
||||
});
|
||||
|
||||
m_data_persistence[current_tab_index].length = 0;
|
||||
VtoyFillCurrentPageItem(m_data_persistence[g_vtoy_data_default_index]);
|
||||
Message.success(g_vtoy_cur_language.STR_SAVE_SUCCESS);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#id_tab_persistence a[href="#tab_0"]').tab('show');
|
||||
VtoyFillCurrentPageItem(m_data_persistence[0]);
|
||||
VtoyPageLanguageChange(g_current_language);
|
||||
|
@@ -1,10 +1,12 @@
|
||||
<div class="box box-primary" id="control">
|
||||
<div class="box-header">
|
||||
<div class="col-sm-10" style="padding-top:8px;">
|
||||
<div class="col-sm-9" style="padding-top:8px;">
|
||||
<i class="fa fa-file-image-o"> </i>
|
||||
<h1 class="box-title" style="font-weight:bold;" id="id_h1_page_title">主题插件</h1>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-1" style="padding-top:2px;">
|
||||
<button id="id_btn_reset" class="btn btn-sm btn-danger btn-del"><i class="fa fa-trash"></i><span id="id_btn_span_reset">Reset</span></button>
|
||||
</div>
|
||||
<div class="col-sm-2" style="font-size:16px;padding-top:8px;">
|
||||
<a id="id_a_official_doc" target="_blank" href="https://www.ventoy.net/cn/plugin_theme.html"><span class="fa fa-link"></span><span id="id_span_official_doc">官网文档</span></a>
|
||||
</div>
|
||||
@@ -513,6 +515,36 @@
|
||||
$('#id_tab_theme a[href="#tab_4"]').click(OnClickMultiModeTab);
|
||||
$('#id_tab_theme a[href="#tab_5"]').click(OnClickMultiModeTab);
|
||||
|
||||
function UpdateTabTitleIcon(data) {
|
||||
CommonUpdateTabTitleIcon(data.exist_theme, '#id_tab_theme a[href="#tab_', 'theme');
|
||||
}
|
||||
$('#id_btn_reset').click(function() {
|
||||
Modal.confirm({msg:GetResetTabConfigTipMsg(current_tab_index, 'theme')}).on(function(e) {
|
||||
if (e) {
|
||||
callVtoySync({
|
||||
method : 'theme_del_file',
|
||||
index: current_tab_index,
|
||||
path: g_del_all_path
|
||||
}, function(data) {
|
||||
|
||||
});
|
||||
|
||||
callVtoySync({
|
||||
method : 'theme_del_font',
|
||||
index: current_tab_index,
|
||||
path: g_del_all_path
|
||||
}, function(data) {
|
||||
|
||||
});
|
||||
|
||||
m_data_theme[current_tab_index].filelist.length = 0;
|
||||
m_data_theme[current_tab_index].fontslist.length = 0;
|
||||
VtoyFillCurrentPageItem(m_data_theme[g_vtoy_data_default_index]);
|
||||
VtoySaveCurrentPage();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#id_tab_theme a[href="#tab_0"]').tab('show');
|
||||
VtoyFillCurrentPageItem(m_data_theme[0]);
|
||||
VtoyPageLanguageChange(g_current_language);
|
||||
|
@@ -288,71 +288,6 @@ String.prototype.endsWith = function(str) {
|
||||
return false;
|
||||
}
|
||||
|
||||
window.Message = function() {
|
||||
var _showMsg = function(type, msg, time) {
|
||||
var o = {type : type, msg : msg };
|
||||
if(time) {
|
||||
o.time = time;
|
||||
}
|
||||
_show(o);
|
||||
}
|
||||
|
||||
var _show = function(options) {
|
||||
var ops = {
|
||||
msg : "提示内容",
|
||||
type: 'S',
|
||||
time: 3000
|
||||
};
|
||||
$.extend(ops, options);
|
||||
|
||||
var msg_class = 'alert-success';
|
||||
if('S' === ops.type || 's' === ops.type) {
|
||||
msg_class = 'alert-success';
|
||||
} else if ('E' === ops.type || 'e' === ops.type) {
|
||||
msg_class = 'alert-danger';
|
||||
} else if ('W' === ops.type || 'w' === ops.type) {
|
||||
msg_class = 'alert-warning';
|
||||
} else if ('I' === ops.type || 'i' === ops.type) {
|
||||
msg_class = 'alert-info';
|
||||
} else {
|
||||
alert("未知的类型,请使用: w-警告;s-成功;e-失败;i-提示");
|
||||
return;
|
||||
}
|
||||
var $messageContainer = $("#fcss_message");
|
||||
if($messageContainer.length === 0) {
|
||||
$messageContainer = $('<div id="fcss_message" style="position:fixed; left: 20%; right: 20%; top:0px; z-index:99999999"></div>');
|
||||
$messageContainer.appendTo($('body'));
|
||||
}
|
||||
var $div = $('<div class="alert ' + msg_class + ' alert-dismissible fade in" role="alert" style="margin-bottom: 0; padding-top:10px; padding-bottom: 10px;"></div>');
|
||||
var $btn = $('<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>');
|
||||
$div.append($btn).append(ops.msg).appendTo($messageContainer);
|
||||
setTimeout(function() {
|
||||
$div.remove();
|
||||
}, ops.time);
|
||||
}
|
||||
|
||||
var _success = function(msg, time) {
|
||||
_showMsg('s', msg, time);
|
||||
}
|
||||
var _error = function(msg, time) {
|
||||
_showMsg('e', msg, time || 5000);
|
||||
}
|
||||
var _warn = function(msg, time) {
|
||||
_showMsg('w', msg, time);
|
||||
}
|
||||
var _info = function(msg, time) {
|
||||
_showMsg('i', msg, time);
|
||||
}
|
||||
|
||||
return {
|
||||
success : _success,
|
||||
error : _error,
|
||||
warn : _warn,
|
||||
info : _info,
|
||||
show : _show
|
||||
}
|
||||
}();
|
||||
|
||||
|
||||
var g_vtoy_cur_language_en =
|
||||
{
|
||||
@@ -376,6 +311,7 @@ var g_vtoy_cur_language_en =
|
||||
"STR_OPT_SETTING": "Option Setting",
|
||||
"STR_OPT_DESC": "Option Description",
|
||||
"STR_EDIT": "Edit",
|
||||
"STR_RESET": "Reset",
|
||||
"STR_FILE": "File",
|
||||
"STR_DIR": "Dir",
|
||||
"STR_SAVE_TIP": "Data in current page has been modified. Do you want to save it?",
|
||||
@@ -489,6 +425,10 @@ var g_vtoy_cur_language_en =
|
||||
"STR_INVALID_CONFIG_TIP": "Invalid configuration detected in ventoy.json, so the configuration is not loaded!",
|
||||
"STR_CONFIG_SAVE_ERROR_TIP": "Failed to write ventoy.json file. Check VentoyPlugson.log for more details!",
|
||||
|
||||
"STR_JSON_PREVIEW": "JSON Preview",
|
||||
"STR_JSON_COPY_SUCCESS": "JSON Copy Success",
|
||||
"STR_JSON_COPY_FAILED": "JSON Copy Failed",
|
||||
|
||||
"STR_XXX": "xxx"
|
||||
};
|
||||
|
||||
@@ -514,6 +454,7 @@ var g_vtoy_cur_language_cn =
|
||||
"STR_OPT_SETTING": "选项设置",
|
||||
"STR_OPT_DESC": "选项说明",
|
||||
"STR_EDIT": "设置",
|
||||
"STR_RESET": "重置",
|
||||
"STR_FILE": "文件",
|
||||
"STR_DIR": "目录",
|
||||
"STR_SAVE_TIP": "当前页面数据已经修改,是否保存?",
|
||||
@@ -625,6 +566,9 @@ var g_vtoy_cur_language_cn =
|
||||
"STR_INVALID_CONFIG_TIP": "ventoy.json 文件中存在错误配置,配置未加载!",
|
||||
"STR_CONFIG_SAVE_ERROR_TIP": "ventoy.json 文件写入失败,详细信息请参考 VentoyPlugson.log 文件!",
|
||||
|
||||
"STR_JSON_PREVIEW": "JSON 预览",
|
||||
"STR_JSON_COPY_SUCCESS": "JSON 内容复制成功",
|
||||
"STR_JSON_COPY_FAILED": "JSON 内容复制失败",
|
||||
|
||||
"STR_XXX": "xxx"
|
||||
};
|
||||
@@ -635,12 +579,45 @@ var g_current_language = 'cn';
|
||||
var g_vtoy_cur_language = g_vtoy_cur_language_cn;
|
||||
var g_vtoy_data_default_index = 6;
|
||||
|
||||
var g_bios_postfix = [ "", "_legacy", "_uefi", "_ia32", "_aa64", "_mips" ];
|
||||
var g_del_all_path = '4119ae33-98ea-448e-b9c0-569aafcf1fb4';
|
||||
var g_file_with_extra = false;
|
||||
var g_dir_with_extra = false;
|
||||
var g_file_fuzzy_match = 0;
|
||||
var g_file_modal_callback;
|
||||
var g_dir_modal_callback;
|
||||
|
||||
function GetResetTabConfigTipMsg(index, name) {
|
||||
var msgstr;
|
||||
|
||||
if (g_current_language === 'en') {
|
||||
msgstr = 'Are you sure to reset all the configurations on the <code>' + name + g_bios_postfix[index] + '</code> tab ?';
|
||||
} else {
|
||||
msgstr = '确认要重置 <code>' + name + g_bios_postfix[index] + '</code> 标签页下的所有配置?';
|
||||
}
|
||||
|
||||
return msgstr;
|
||||
}
|
||||
|
||||
function CommonUpdateTabTitleIcon(exists, id, name) {
|
||||
var exspan = " <span id='tab_0_icon' class='fa fa-circle' style='color:red;'></span>";
|
||||
for (var i = 0; i < g_vtoy_data_default_index; i++) {
|
||||
var fid = id + i + '"]';
|
||||
var oldhtml = $(fid).html();
|
||||
var newhtml;
|
||||
|
||||
if (exists[i]) {
|
||||
newhtml = name + g_bios_postfix[i] + exspan;
|
||||
} else {
|
||||
newhtml = name + g_bios_postfix[i];
|
||||
}
|
||||
|
||||
if (newhtml != oldhtml) {
|
||||
$(fid).html(newhtml);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function ventoy_file_submit(form, extra) {
|
||||
var filepath = $("#FilePath").val();
|
||||
var fileextra = $("#FileExtra").val();
|
||||
@@ -920,6 +897,8 @@ function VtoyCommonChangeLanguage(newlang) {
|
||||
$(this).text(" Plugin Official Document");
|
||||
});
|
||||
|
||||
$('#id_span_copy').text("Copy");
|
||||
$('#id_span_preview').text("Preview");
|
||||
$('#id_span_language').text("中文");
|
||||
|
||||
$("tr[id=tr_title_desc_cn]").each(function(){
|
||||
@@ -966,6 +945,8 @@ function VtoyCommonChangeLanguage(newlang) {
|
||||
$(this).text(" 插件官网文档");
|
||||
});
|
||||
|
||||
$('#id_span_copy').text("复制");
|
||||
$('#id_span_preview').text("预览");
|
||||
$('#id_span_language').text("English");
|
||||
|
||||
$("tr[id=tr_title_desc_cn]").each(function(){
|
||||
@@ -1002,7 +983,10 @@ function VtoyCommonChangeLanguage(newlang) {
|
||||
$('#id_span_save').text(g_vtoy_cur_language.STR_SAVE);
|
||||
$('#id_span_reset').text(g_vtoy_cur_language.STR_RESET);
|
||||
$('#id_span_donation').text(g_vtoy_cur_language.STR_PLUG_DONATION);
|
||||
|
||||
|
||||
$('span[id=id_btn_span_reset]').each(function(){
|
||||
$(this).text(' ' + g_vtoy_cur_language.STR_RESET);
|
||||
});
|
||||
$("span[id=id_span_btn_add]").each(function(){
|
||||
$(this).text(g_vtoy_cur_language.STR_ADD);
|
||||
});
|
||||
|
@@ -64,11 +64,14 @@ A GUI Ventoy plugin configurator. [VentoyPlugson](https://www.ventoy.net/en/plug
|
||||
* MBR and GPT partition style supported (1.0.15+)
|
||||
* x86 Legacy BIOS, IA32 UEFI, x86_64 UEFI, ARM64 UEFI, MIPS64EL UEFI supported
|
||||
* IA32/x86_64 UEFI Secure Boot supported (1.0.07+)
|
||||
* Persistence supported (1.0.11+)
|
||||
* Linux Persistence supported (1.0.11+)
|
||||
* Windows auto installation supported (1.0.09+)
|
||||
* RHEL7/8/CentOS/7/8/SUSE/Ubuntu Server/Debian ... auto installation supported (1.0.09+)
|
||||
* Linux auto installation supported (1.0.09+)
|
||||
* Variables Expansion supported for Windows/Linux auto installation script
|
||||
* FAT32/exFAT/NTFS/UDF/XFS/Ext2(3)(4) supported for main partition
|
||||
* ISO files larger than 4GB supported
|
||||
* Menu alias, Menu tip message supported
|
||||
* Password protect supported
|
||||
* Native boot menu style for Legacy & UEFI
|
||||
* Most types of OS supported, 1000+ iso files tested
|
||||
* Linux vDisk boot supported
|
||||
@@ -97,6 +100,7 @@ Please refer to [BuildVentoyFromSource.txt](DOC/BuildVentoyFromSource.txt)
|
||||
Title | Link
|
||||
-|-
|
||||
**Install & Update** | [https://www.ventoy.net/en/doc_start.html](https://www.ventoy.net/en/doc_start.html)
|
||||
**Browse/Boot Files In Local Disk** | [https://www.ventoy.net/en/doc_browser.html](https://www.ventoy.net/en/doc_browser.html)
|
||||
**Secure Boot** | [https://www.ventoy.net/en/doc_secure.html](https://www.ventoy.net/en/doc_secure.html)
|
||||
**Customize Theme** | [https://www.ventoy.net/en/plugin_theme.html](https://www.ventoy.net/en/plugin_theme.html)
|
||||
**Global Control** | [https://www.ventoy.net/en/plugin_control.html](https://www.ventoy.net/en/plugin_control.html)
|
||||
|
@@ -2482,6 +2482,22 @@ End:
|
||||
}
|
||||
|
||||
|
||||
static int vtoy_cmd_delete_file(char *File)
|
||||
{
|
||||
CHAR szCmd[MAX_PATH];
|
||||
STARTUPINFOA Si;
|
||||
PROCESS_INFORMATION Pi;
|
||||
|
||||
GetStartupInfoA(&Si);
|
||||
Si.dwFlags |= STARTF_USESHOWWINDOW;
|
||||
Si.wShowWindow = SW_HIDE;
|
||||
sprintf_s(szCmd, sizeof(szCmd), "cmd.exe /c del /F /Q %s", File);
|
||||
CreateProcessA(NULL, szCmd, NULL, NULL, FALSE, 0, NULL, NULL, &Si, &Pi);
|
||||
WaitForSingleObject(Pi.hProcess, INFINITE);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int real_main(int argc, char **argv)
|
||||
{
|
||||
int i = 0;
|
||||
@@ -2562,6 +2578,12 @@ int real_main(int argc, char **argv)
|
||||
sprintf_s(LunchFile, sizeof(LunchFile), "%s", "cmd.exe");
|
||||
}
|
||||
|
||||
if (IsFileExist(ORG_PECMD_BK_PATH))
|
||||
{
|
||||
Log("Delete backup file <%s>", ORG_PECMD_BK_PATH);
|
||||
vtoy_cmd_delete_file(ORG_PECMD_BK_PATH);
|
||||
}
|
||||
|
||||
Log("Backup log at this point");
|
||||
CopyFileA(LOG_FILE, "X:\\Windows\\ventoy.backup", TRUE);
|
||||
|
||||
|
Reference in New Issue
Block a user