mirror of
https://github.com/ventoy/Ventoy.git
synced 2025-04-22 03:34:11 -04:00
1. Add check for invalid characters in menu_class plugin.
2. Optimization for help language list process
This commit is contained in:
parent
4131d95cef
commit
e1c26567a1
2
.github/ISSUE_TEMPLATE/issue_template.yml
vendored
2
.github/ISSUE_TEMPLATE/issue_template.yml
vendored
@ -21,7 +21,7 @@ body:
|
|||||||
attributes:
|
attributes:
|
||||||
label: Ventoy Version
|
label: Ventoy Version
|
||||||
description: What version of ventoy are you running?
|
description: What version of ventoy are you running?
|
||||||
placeholder: 1.0.61
|
placeholder: 1.0.62
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
- type: dropdown
|
- type: dropdown
|
||||||
|
@ -76,4 +76,3 @@ build_func "gcc -m32" '32' 'i386'
|
|||||||
build_func "aarch64-linux-gnu-gcc" 'aa64' 'aarch64'
|
build_func "aarch64-linux-gnu-gcc" 'aa64' 'aarch64'
|
||||||
build_func "mips-linux-gnu-gcc -mips64r2 -mabi=64" 'm64e' 'mips64el'
|
build_func "mips-linux-gnu-gcc -mips64r2 -mabi=64" 'm64e' 'mips64el'
|
||||||
|
|
||||||
|
|
||||||
|
@ -17,6 +17,10 @@ if [ -f ./www.tar.xz ]; then
|
|||||||
rm -f ./www.tar.xz
|
rm -f ./www.tar.xz
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
[ -f ./www/helplist ] && rm -f ./www/helplist
|
||||||
|
ls -1 ../INSTALL/grub/help/ | while read line; do
|
||||||
|
echo -n ${line:0:5} >> ./www/helplist
|
||||||
|
done
|
||||||
echo -n "$plugson_verion" > ./www/buildtime
|
echo -n "$plugson_verion" > ./www/buildtime
|
||||||
|
|
||||||
tar cf www.tar www
|
tar cf www.tar www
|
||||||
|
@ -60,12 +60,7 @@ static const char *g_ventoy_kbd_layout[] =
|
|||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char *g_ventoy_help_lang[] =
|
static char g_ventoy_help_lang[MAX_LANGUAGE][8];
|
||||||
{
|
|
||||||
"de_DE", "en_US", "fr_FR", "hr_HR", "id_ID", "pt_PT", "sr_CY", "sr_SR", "tr_TR", "zh_CN",
|
|
||||||
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
static char g_pub_path[2 * MAX_PATH];
|
static char g_pub_path[2 * MAX_PATH];
|
||||||
static data_control g_data_control[bios_max + 1];
|
static data_control g_data_control[bios_max + 1];
|
||||||
@ -622,7 +617,7 @@ int ventoy_data_json_control(data_control *ctrl, char *buf, int buflen)
|
|||||||
VTOY_JSON_FMT_KEY("help_list");
|
VTOY_JSON_FMT_KEY("help_list");
|
||||||
VTOY_JSON_FMT_ARY_BEGIN();
|
VTOY_JSON_FMT_ARY_BEGIN();
|
||||||
|
|
||||||
for (i = 0; g_ventoy_help_lang[i]; i++)
|
for (i = 0; g_ventoy_help_lang[i][0]; i++)
|
||||||
{
|
{
|
||||||
VTOY_JSON_FMT_ITEM(g_ventoy_help_lang[i]);
|
VTOY_JSON_FMT_ITEM(g_ventoy_help_lang[i]);
|
||||||
}
|
}
|
||||||
@ -3839,7 +3834,7 @@ static int ventoy_parse_control(VTOY_JSON *json, void *p)
|
|||||||
}
|
}
|
||||||
else if (strcmp(child->pcName, "VTOY_HELP_TXT_LANGUAGE") == 0)
|
else if (strcmp(child->pcName, "VTOY_HELP_TXT_LANGUAGE") == 0)
|
||||||
{
|
{
|
||||||
for (i = 0; g_ventoy_help_lang[i]; i++)
|
for (i = 0; g_ventoy_help_lang[i][0]; i++)
|
||||||
{
|
{
|
||||||
if (strcmp(child->unData.pcStrVal, g_ventoy_help_lang[i]) == 0)
|
if (strcmp(child->unData.pcStrVal, g_ventoy_help_lang[i]) == 0)
|
||||||
{
|
{
|
||||||
@ -5051,12 +5046,42 @@ int ventoy_http_stop(void)
|
|||||||
|
|
||||||
int ventoy_http_init(void)
|
int ventoy_http_init(void)
|
||||||
{
|
{
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
|
#ifdef VENTOY_SIM
|
||||||
|
char *Buffer = NULL;
|
||||||
|
int BufLen = 0;
|
||||||
|
|
||||||
|
ventoy_read_file_to_buf("www/helplist", 4, (void **)&Buffer, &BufLen);
|
||||||
|
if (Buffer)
|
||||||
|
{
|
||||||
|
for (i = 0; i < BufLen / 5; i++)
|
||||||
|
{
|
||||||
|
memcpy(g_ventoy_help_lang[i], Buffer + i * 5, 5);
|
||||||
|
g_ventoy_help_lang[i][5] = 0;
|
||||||
|
}
|
||||||
|
free(Buffer);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
ventoy_file *file;
|
||||||
|
file = ventoy_tar_find_file("www/helplist");
|
||||||
|
if (file)
|
||||||
|
{
|
||||||
|
for (i = 0; i < file->size / 5; i++)
|
||||||
|
{
|
||||||
|
memcpy(g_ventoy_help_lang[i], (char *)(file->addr) + i * 5, 5);
|
||||||
|
g_ventoy_help_lang[i][5] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (!g_pub_json_buffer)
|
if (!g_pub_json_buffer)
|
||||||
{
|
{
|
||||||
g_pub_json_buffer = malloc(JSON_BUF_MAX * 2);
|
g_pub_json_buffer = malloc(JSON_BUF_MAX * 2);
|
||||||
g_pub_save_buffer = g_pub_json_buffer + JSON_BUF_MAX;
|
g_pub_save_buffer = g_pub_json_buffer + JSON_BUF_MAX;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
pthread_mutex_init(&g_api_mutex, NULL);
|
pthread_mutex_init(&g_api_mutex, NULL);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
|
|
||||||
#include <civetweb.h>
|
#include <civetweb.h>
|
||||||
|
|
||||||
|
#define MAX_LANGUAGE 128
|
||||||
|
|
||||||
#define L1 " "
|
#define L1 " "
|
||||||
#define L2 " "
|
#define L2 " "
|
||||||
|
Binary file not shown.
@ -1 +1 @@
|
|||||||
20211201 20:08:18
|
20211203 17:44:10
|
1
Plugson/www/helplist
Normal file
1
Plugson/www/helplist
Normal file
@ -0,0 +1 @@
|
|||||||
|
de_DEen_USfr_FRhr_HRid_IDja_JPpt_PTsr_CYsr_SRtr_TRzh_CN
|
@ -723,7 +723,7 @@
|
|||||||
|
|
||||||
<footer class="main-footer">
|
<footer class="main-footer">
|
||||||
<div class="pull-right hidden-xs">
|
<div class="pull-right hidden-xs">
|
||||||
<b id="plugson_build_date">20211201 20:08:18</b>
|
<b id="plugson_build_date">20211203 17:44:10</b>
|
||||||
</div>
|
</div>
|
||||||
<strong><a href="https://www.ventoy.net" target="_blank">https://www.ventoy.net</a></strong>
|
<strong><a href="https://www.ventoy.net" target="_blank">https://www.ventoy.net</a></strong>
|
||||||
</footer>
|
</footer>
|
||||||
|
@ -169,11 +169,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (extra.indexOf("\"") >= 0) {
|
|
||||||
Message.error(g_current_language === 'en' ? "Class can not contains double quotes." : "Class 不能包含双引号。");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
callVtoy({
|
callVtoy({
|
||||||
method : 'class_add',
|
method : 'class_add',
|
||||||
index: current_tab_index,
|
index: current_tab_index,
|
||||||
@ -188,6 +183,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function OnAddKeyClass(key, value) {
|
function OnAddKeyClass(key, value) {
|
||||||
|
if (!ventoy_check_file_name_char(key)) {
|
||||||
|
Message.error(g_current_language === 'en' ? "As part of file name, key can not include invalid characters!" : "作为文件名的一部分,key 中不能包含特殊的符号!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
AddClassEntry(key, 0, 1, value);
|
AddClassEntry(key, 0, 1, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,3 +1,16 @@
|
|||||||
|
function ventoy_check_file_name_char(path) {
|
||||||
|
for (var i = 0; i < path.length; i++) {
|
||||||
|
var cc = path[i];
|
||||||
|
if (cc === '/' || cc === '\\' || cc === '*' || cc === '?' || cc === '"' || cc === '<' || cc === '>' || cc === '|')
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
(function(factory) {
|
(function(factory) {
|
||||||
if (typeof define === "function" && define.amd) {
|
if (typeof define === "function" && define.amd) {
|
||||||
define(["jquery", "../jquery.validate"], factory);
|
define(["jquery", "../jquery.validate"], factory);
|
||||||
@ -63,6 +76,14 @@
|
|||||||
return true;
|
return true;
|
||||||
}, 'Can not contain double quotes');
|
}, 'Can not contain double quotes');
|
||||||
|
|
||||||
|
$.validator.addMethod('filenamepart', function(value, element, params) {
|
||||||
|
if (this.optional(element)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ventoy_check_file_name_char(value);
|
||||||
|
}, 'Invalid characters');
|
||||||
|
|
||||||
|
|
||||||
$.validator.addMethod('printascii', function(value, element, params) {
|
$.validator.addMethod('printascii', function(value, element, params) {
|
||||||
if (this.optional(element)) {
|
if (this.optional(element)) {
|
||||||
|
@ -896,6 +896,7 @@ function VtoyCommonChangeLanguage(newlang) {
|
|||||||
utfmaxlen: $.validator.format("The string exceeds the maximum supported length"),
|
utfmaxlen: $.validator.format("The string exceeds the maximum supported length"),
|
||||||
start_slash: $.validator.format("Must start with /"),
|
start_slash: $.validator.format("Must start with /"),
|
||||||
noquotes: $.validator.format("Can not include double quotes"),
|
noquotes: $.validator.format("Can not include double quotes"),
|
||||||
|
filenamepart:$.validator.format("As part of file name, can not include invalid characters"),
|
||||||
printascii: $.validator.format("Can not include non-ascii characters.")
|
printascii: $.validator.format("Can not include non-ascii characters.")
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -941,6 +942,7 @@ function VtoyCommonChangeLanguage(newlang) {
|
|||||||
utfmaxlen: $.validator.format("超过最大长度"),
|
utfmaxlen: $.validator.format("超过最大长度"),
|
||||||
start_slash: $.validator.format("必须以反斜杠 / 开头"),
|
start_slash: $.validator.format("必须以反斜杠 / 开头"),
|
||||||
noquotes: $.validator.format("不能包含双引号"),
|
noquotes: $.validator.format("不能包含双引号"),
|
||||||
|
filenamepart:$.validator.format("作为文件名的一部分,不能包含特殊的符号"),
|
||||||
printascii: $.validator.format("不能包含中文或其他非 ascii 字符。")
|
printascii: $.validator.format("不能包含中文或其他非 ascii 字符。")
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -1102,7 +1104,8 @@ var g_set_key_validator = $("#SetKeyForm").validate({
|
|||||||
},
|
},
|
||||||
SetKeyValue : {
|
SetKeyValue : {
|
||||||
required: true,
|
required: true,
|
||||||
utfmaxlen: true
|
utfmaxlen: true,
|
||||||
|
filenamepart: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user