Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
dadigang
Ventoy
Commits
c57717ae
Commit
c57717ae
authored
Feb 06, 2022
by
longpanda
Browse files
Add tip in Plugson web page when old ventoy.json contains invalid configuration.
parent
be0e19fc
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
31 additions
and
1 deletion
+31
-1
Plugson/src/Core/ventoy_util.h
Plugson/src/Core/ventoy_util.h
+1
-0
Plugson/src/Web/ventoy_http.c
Plugson/src/Web/ventoy_http.c
+17
-0
Plugson/vs/VentoyPlugson/Release/VentoyPlugson.exe
Plugson/vs/VentoyPlugson/Release/VentoyPlugson.exe
+0
-0
Plugson/www/index.html
Plugson/www/index.html
+11
-1
Plugson/www/static/js/vtoy.js
Plugson/www/static/js/vtoy.js
+2
-0
No files found.
Plugson/src/Core/ventoy_util.h
View file @
c57717ae
...
@@ -87,6 +87,7 @@ typedef struct SYSINFO
...
@@ -87,6 +87,7 @@ typedef struct SYSINFO
{
{
char
buildtime
[
128
];
char
buildtime
[
128
];
int
syntax_error
;
int
syntax_error
;
int
invalid_config
;
int
language
;
int
language
;
int
pathcase
;
int
pathcase
;
...
...
Plugson/src/Web/ventoy_http.c
View file @
c57717ae
...
@@ -322,6 +322,9 @@ static int ventoy_api_sysinfo(struct mg_connection *conn, VTOY_JSON *json)
...
@@ -322,6 +322,9 @@ static int ventoy_api_sysinfo(struct mg_connection *conn, VTOY_JSON *json)
//read clear
//read clear
VTOY_JSON_FMT_SINT
(
"syntax_error"
,
g_sysinfo
.
syntax_error
);
VTOY_JSON_FMT_SINT
(
"syntax_error"
,
g_sysinfo
.
syntax_error
);
g_sysinfo
.
syntax_error
=
0
;
g_sysinfo
.
syntax_error
=
0
;
VTOY_JSON_FMT_SINT
(
"invalid_config"
,
g_sysinfo
.
invalid_config
);
g_sysinfo
.
invalid_config
=
0
;
#if defined(_MSC_VER) || defined(WIN32)
#if defined(_MSC_VER) || defined(WIN32)
...
@@ -4917,6 +4920,7 @@ static int ventoy_load_old_json(const char *filename)
...
@@ -4917,6 +4920,7 @@ static int ventoy_load_old_json(const char *filename)
unsigned
char
*
start
=
NULL
;
unsigned
char
*
start
=
NULL
;
VTOY_JSON
*
json
=
NULL
;
VTOY_JSON
*
json
=
NULL
;
VTOY_JSON
*
node
=
NULL
;
VTOY_JSON
*
node
=
NULL
;
VTOY_JSON
*
next
=
NULL
;
ret
=
ventoy_read_file_to_buf
(
filename
,
4
,
(
void
**
)
&
buffer
,
&
buflen
);
ret
=
ventoy_read_file_to_buf
(
filename
,
4
,
(
void
**
)
&
buffer
,
&
buflen
);
if
(
ret
)
if
(
ret
)
...
@@ -4950,6 +4954,18 @@ static int ventoy_load_old_json(const char *filename)
...
@@ -4950,6 +4954,18 @@ static int ventoy_load_old_json(const char *filename)
{
{
vlog
(
"parse ventoy.json success
\n
"
);
vlog
(
"parse ventoy.json success
\n
"
);
for
(
node
=
json
->
pstChild
;
node
;
node
=
node
->
pstNext
)
for
(
next
=
node
->
pstNext
;
next
;
next
=
next
->
pstNext
)
{
if
(
node
->
pcName
&&
next
->
pcName
&&
strcmp
(
node
->
pcName
,
next
->
pcName
)
==
0
)
{
vlog
(
"ventoy.json contains duplicate key <%s>.
\n
"
,
node
->
pcName
);
g_sysinfo
.
invalid_config
=
1
;
ret
=
1
;
goto
end
;
}
}
for
(
node
=
json
->
pstChild
;
node
;
node
=
node
->
pstNext
)
for
(
node
=
json
->
pstChild
;
node
;
node
=
node
->
pstNext
)
{
{
ventoy_parse_json
(
control
);
ventoy_parse_json
(
control
);
...
@@ -4975,6 +4991,7 @@ static int ventoy_load_old_json(const char *filename)
...
@@ -4975,6 +4991,7 @@ static int ventoy_load_old_json(const char *filename)
ret
=
1
;
ret
=
1
;
}
}
end:
vtoy_json_destroy
(
json
);
vtoy_json_destroy
(
json
);
free
(
buffer
);
free
(
buffer
);
...
...
Plugson/vs/VentoyPlugson/Release/VentoyPlugson.exe
View file @
c57717ae
No preview for this file type
Plugson/www/index.html
View file @
c57717ae
...
@@ -723,7 +723,7 @@
...
@@ -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"
>
20220
108 22:41:02
</b>
<b
id=
"plugson_build_date"
>
20220
204 16:31:23
</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>
...
@@ -777,6 +777,7 @@
...
@@ -777,6 +777,7 @@
//Main process
//Main process
var
m_syntax_error
;
var
m_syntax_error
;
var
m_invalid_config
;
callVtoySync
({
callVtoySync
({
method
:
'
sysinfo
'
method
:
'
sysinfo
'
},
function
(
data
)
{
},
function
(
data
)
{
...
@@ -784,6 +785,7 @@
...
@@ -784,6 +785,7 @@
g_current_dir
=
data
.
curdir
;
g_current_dir
=
data
.
curdir
;
g_current_os
=
data
.
os
;
g_current_os
=
data
.
os
;
m_syntax_error
=
data
.
syntax_error
;
m_syntax_error
=
data
.
syntax_error
;
m_invalid_config
=
data
.
invalid_config
;
...
@@ -833,6 +835,14 @@
...
@@ -833,6 +835,14 @@
});
});
m_syntax_error
=
0
;
m_syntax_error
=
0
;
}
}
if
(
m_invalid_config
===
1
&&
typeof
(
Modal
)
===
'
object
'
)
{
var
title
=
g_current_language
==
'
en
'
?
g_vtoy_cur_language_en
.
STR_INFO
:
g_vtoy_cur_language_cn
.
STR_INFO
;
var
msg
=
g_current_language
==
'
en
'
?
g_vtoy_cur_language_en
.
STR_INVALID_CONFIG_TIP
:
g_vtoy_cur_language_cn
.
STR_INVALID_CONFIG_TIP
;
Modal
.
alert
({
title
:
title
,
msg
:
msg
}).
on
(
function
(
e
)
{
});
m_invalid_config
=
0
;
}
setTimeout
(
function
()
{
setTimeout
(
function
()
{
ventoy_handshake
();
ventoy_handshake
();
...
...
Plugson/www/static/js/vtoy.js
View file @
c57717ae
...
@@ -479,6 +479,7 @@ var g_vtoy_cur_language_en =
...
@@ -479,6 +479,7 @@ var g_vtoy_cur_language_en =
"
STR_SECURE_BOOT_ENABLE
"
:
"
Enable
"
,
"
STR_SECURE_BOOT_ENABLE
"
:
"
Enable
"
,
"
STR_SECURE_BOOT_DISABLE
"
:
"
Disable
"
,
"
STR_SECURE_BOOT_DISABLE
"
:
"
Disable
"
,
"
STR_SYNTAX_ERROR_TIP
"
:
"
Syntax error detected in ventoy.json, so the configuration is not loaded!
"
,
"
STR_SYNTAX_ERROR_TIP
"
:
"
Syntax error detected in ventoy.json, so the configuration is not loaded!
"
,
"
STR_INVALID_CONFIG_TIP
"
:
"
Invalid configuration detected in ventoy.json, so the configuration is not loaded!
"
,
"
STR_XXX
"
:
"
xxx
"
"
STR_XXX
"
:
"
xxx
"
};
};
...
@@ -613,6 +614,7 @@ var g_vtoy_cur_language_cn =
...
@@ -613,6 +614,7 @@ var g_vtoy_cur_language_cn =
"
STR_SECURE_BOOT_ENABLE
"
:
"
开启
"
,
"
STR_SECURE_BOOT_ENABLE
"
:
"
开启
"
,
"
STR_SECURE_BOOT_DISABLE
"
:
"
未开启
"
,
"
STR_SECURE_BOOT_DISABLE
"
:
"
未开启
"
,
"
STR_SYNTAX_ERROR_TIP
"
:
"
ventoy.json 文件中存在语法错误,配置未加载!
"
,
"
STR_SYNTAX_ERROR_TIP
"
:
"
ventoy.json 文件中存在语法错误,配置未加载!
"
,
"
STR_INVALID_CONFIG_TIP
"
:
"
ventoy.json 文件中存在错误配置,配置未加载!
"
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment