VentoyPlugson Update:

1. Add preview json feature
2. Add reset button
3. Add configuration active identifier for each tab
4. Bug fix
This commit is contained in:
longpanda 2022-10-21 16:06:13 +08:00
parent c87ad1d734
commit 3f09fb9a23
25 changed files with 757 additions and 163 deletions

View File

@ -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'

View File

@ -311,11 +311,23 @@ uint64_t ventoy_get_disk_size_in_byte(const char *disk)
int ventoy_get_disk_vendor(const char *name, char *vendorbuf, int bufsize)
{
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)
{
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);
}
@ -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));

View File

@ -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")

View File

@ -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;
}

View File

@ -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__ */

View File

@ -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)
{
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
while (0 == g_thread_stop)
{
sem_wait(&g_writeback_sem);
callback();
pthread_mutex_unlock(&g_writeback_mutex);
}
}
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);
}

View File

@ -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);
@ -926,9 +953,16 @@ static int ventoy_api_theme_del_file(struct mg_connection *conn, VTOY_JSON *json
path = VTOY_JSON_STR_EX("path");
if (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();
@ -981,9 +1015,16 @@ static int ventoy_api_theme_del_font(struct mg_connection *conn, VTOY_JSON *json
path = VTOY_JSON_STR_EX("path");
if (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();
@ -1178,9 +1219,16 @@ static int ventoy_api_alias_del(struct mg_connection *conn, VTOY_JSON *json)
path = VTOY_JSON_STR_EX("path");
if (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();
@ -1416,9 +1464,16 @@ static int ventoy_api_tip_del(struct mg_connection *conn, VTOY_JSON *json)
path = VTOY_JSON_STR_EX("path");
if (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();
@ -1619,9 +1674,16 @@ static int ventoy_api_class_del(struct mg_connection *conn, VTOY_JSON *json)
path = VTOY_JSON_STR_EX("path");
if (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();
@ -1748,9 +1810,16 @@ static int ventoy_api_auto_memdisk_del(struct mg_connection *conn, VTOY_JSON *js
path = VTOY_JSON_STR_EX("path");
if (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();
@ -1923,9 +1992,16 @@ static int ventoy_api_image_list_del(struct mg_connection *conn, VTOY_JSON *json
path = VTOY_JSON_STR_EX("path");
if (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();
@ -2174,9 +2250,16 @@ static int ventoy_api_password_del(struct mg_connection *conn, VTOY_JSON *json)
path = VTOY_JSON_STR_EX("path");
if (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();
@ -2365,9 +2448,16 @@ static int ventoy_api_conf_replace_del(struct mg_connection *conn, VTOY_JSON *js
path = VTOY_JSON_STR_EX("path");
if (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;
@ -2564,9 +2655,22 @@ static int ventoy_api_dud_del(struct mg_connection *conn, VTOY_JSON *json)
path = VTOY_JSON_STR_EX("path");
if (path)
{
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;
@ -2910,9 +3015,22 @@ static int ventoy_api_auto_install_del(struct mg_connection *conn, VTOY_JSON *js
path = VTOY_JSON_STR_EX("path");
if (path)
{
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;
@ -3237,9 +3356,22 @@ static int ventoy_api_persistence_del(struct mg_connection *conn, VTOY_JSON *jso
path = VTOY_JSON_STR_EX("path");
if (path)
{
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();
@ -3514,9 +3646,16 @@ static int ventoy_api_injection_del(struct mg_connection *conn, VTOY_JSON *json)
path = VTOY_JSON_STR_EX("path");
if (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,13 +3701,16 @@ 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];
if (apilock)
{
pthread_mutex_lock(&g_api_mutex);
}
ssprintf(pos, JSON_SAVE_BUFFER, JSON_BUF_MAX, "{\n");
@ -3565,7 +3735,10 @@ int ventoy_data_real_save_all(void)
}
ssprintf(pos, JSON_SAVE_BUFFER, JSON_BUF_MAX, "}\n");
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;
@ -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,9 +5237,12 @@ 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);

View File

@ -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__ */

View File

@ -1 +1 @@
20220921 18:42:35
20221021 14:42:35

View File

@ -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>&nbsp;&nbsp;
<span id="id_span_preview" class="hidden-xs">Preview</span>
<span class="hidden-xs">&nbsp;&nbsp;&nbsp;</span>
</a>
</li>
<li class="dropdown user user-menu">
<a href="javascript:void(0)" id="id_a_language">
<span class="fa fa-language"></span>&nbsp;&nbsp;
@ -712,6 +720,32 @@
</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">&times;</span>
</button>
<h4>
<b id="JsonPreviewForm_lang_1">JSON</b> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<button type="button" id="id_btn_json_copy" class="btn btn-primary"><span class="fa fa-copy">&nbsp;&nbsp;</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 -->
<div class="content-wrapper clearfix" style="min-height: 385px; margin-top: 50px;">
<!-- Main 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) {

View File

@ -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">&nbsp;&nbsp;</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,6 +545,26 @@
$('#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]);

View File

@ -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">&nbsp;&nbsp;</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,6 +174,26 @@
$('#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]);

View File

@ -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">&nbsp;&nbsp;</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,6 +270,26 @@
$('#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]);

View File

@ -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">&nbsp;&nbsp;</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);
@ -1304,6 +1309,18 @@
$('#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]);
VtoyPageLanguageChange(g_current_language);

View File

@ -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">&nbsp;&nbsp;</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,6 +357,26 @@
$('#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]);

View File

@ -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">&nbsp;&nbsp;</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,6 +264,26 @@
$('#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]);

View File

@ -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">&nbsp;&nbsp;</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,6 +239,26 @@
$('#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]);

View File

@ -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">&nbsp;&nbsp;</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);

View File

@ -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">&nbsp;&nbsp;</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]);

View File

@ -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">&nbsp;&nbsp;</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);

View File

@ -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">&nbsp;</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);

View File

@ -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">&nbsp;&nbsp;</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,6 +512,26 @@
$('#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]);

View File

@ -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">&nbsp;&nbsp;</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);

View File

@ -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(){
@ -1003,6 +984,9 @@ function VtoyCommonChangeLanguage(newlang) {
$('#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);
});