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
9b7d6cbc
Commit
9b7d6cbc
authored
Dec 20, 2022
by
longpanda
Browse files
Add theme plugin duplicate file check. (#2078)
parent
bf797cea
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
50 additions
and
11 deletions
+50
-11
Plugson/src/Core/ventoy_json.h
Plugson/src/Core/ventoy_json.h
+1
-0
Plugson/src/Web/ventoy_http.c
Plugson/src/Web/ventoy_http.c
+31
-1
Plugson/vs/VentoyPlugson/Release/VentoyPlugson.exe
Plugson/vs/VentoyPlugson/Release/VentoyPlugson.exe
+0
-0
Plugson/vs/VentoyPlugson/x64/Release/VentoyPlugson_X64.exe
Plugson/vs/VentoyPlugson/x64/Release/VentoyPlugson_X64.exe
+0
-0
Plugson/www/index.html
Plugson/www/index.html
+4
-4
Plugson/www/plugson_theme.html
Plugson/www/plugson_theme.html
+14
-6
No files found.
Plugson/src/Core/ventoy_json.h
View file @
9b7d6cbc
...
...
@@ -70,6 +70,7 @@
#define VTOY_JSON_TOKEN_ERR_RET "{ \"result\" : \"tokenerror\" }"
#define VTOY_JSON_EXIST_RET "{ \"result\" : \"exist\" }"
#define VTOY_JSON_TIMEOUT_RET "{ \"result\" : \"timeout\" }"
#define VTOY_JSON_DUPLICATE "{ \"result\" : \"duplicate\" }"
#define VTOY_JSON_BUSY_RET "{ \"result\" : \"busy\" }"
#define VTOY_JSON_INUSE_RET "{ \"result\" : \"inuse\" }"
#define VTOY_JSON_NOTFOUND_RET "{ \"result\" : \"notfound\" }"
...
...
Plugson/src/Web/ventoy_http.c
View file @
9b7d6cbc
...
...
@@ -918,9 +918,11 @@ static int ventoy_api_theme_add_file(struct mg_connection *conn, VTOY_JSON *json
int
ret
;
int
index
=
0
;
const
char
*
path
=
NULL
;
const
char
*
realpath
=
NULL
;
path_node
*
node
=
NULL
;
path_node
*
cur
=
NULL
;
data_theme
*
data
=
NULL
;
char
pathbuf
[
MAX_PATH
];
vtoy_json_get_int
(
json
,
"index"
,
&
index
);
data
=
g_data_theme
+
index
;
...
...
@@ -928,6 +930,19 @@ static int ventoy_api_theme_add_file(struct mg_connection *conn, VTOY_JSON *json
path
=
VTOY_JSON_STR_EX
(
"path"
);
if
(
path
)
{
realpath
=
ventoy_real_path
(
path
);
scnprintf
(
pathbuf
,
sizeof
(
pathbuf
),
"%s"
,
realpath
);
for
(
node
=
data
->
filelist
;
node
;
node
=
node
->
next
)
{
realpath
=
ventoy_real_path
(
node
->
path
);
if
(
strcmp
(
pathbuf
,
realpath
)
==
0
)
{
ventoy_json_result
(
conn
,
VTOY_JSON_DUPLICATE
);
return
0
;
}
}
node
=
zalloc
(
sizeof
(
path_node
));
if
(
node
)
{
...
...
@@ -980,16 +995,31 @@ static int ventoy_api_theme_add_font(struct mg_connection *conn, VTOY_JSON *json
int
ret
;
int
index
=
0
;
const
char
*
path
=
NULL
;
const
char
*
realpath
=
NULL
;
path_node
*
node
=
NULL
;
path_node
*
cur
=
NULL
;
data_theme
*
data
=
NULL
;
char
pathbuf
[
MAX_PATH
];
vtoy_json_get_int
(
json
,
"index"
,
&
index
);
data
=
g_data_theme
+
index
;
path
=
VTOY_JSON_STR_EX
(
"path"
);
if
(
path
)
{
realpath
=
ventoy_real_path
(
path
);
scnprintf
(
pathbuf
,
sizeof
(
pathbuf
),
"%s"
,
realpath
);
for
(
node
=
data
->
fontslist
;
node
;
node
=
node
->
next
)
{
realpath
=
ventoy_real_path
(
node
->
path
);
if
(
strcmp
(
pathbuf
,
realpath
)
==
0
)
{
ventoy_json_result
(
conn
,
VTOY_JSON_DUPLICATE
);
return
0
;
}
}
node
=
zalloc
(
sizeof
(
path_node
));
if
(
node
)
{
...
...
Plugson/vs/VentoyPlugson/Release/VentoyPlugson.exe
View file @
9b7d6cbc
No preview for this file type
Plugson/vs/VentoyPlugson/x64/Release/VentoyPlugson_X64.exe
View file @
9b7d6cbc
No preview for this file type
Plugson/www/index.html
View file @
9b7d6cbc
...
...
@@ -757,7 +757,7 @@
<footer
class=
"main-footer"
>
<div
class=
"pull-right hidden-xs"
>
<b
id=
"plugson_build_date"
>
20221220 1
8:30:51
</b>
<b
id=
"plugson_build_date"
>
20221220 1
9:41:37
</b>
</div>
<strong><a
href=
"https://www.ventoy.net"
target=
"_blank"
>
https://www.ventoy.net
</a></strong>
</footer>
...
...
@@ -777,10 +777,10 @@
<script
src=
"/static/js/jQuery-2.1.4.min.js"
></script>
<!-- jquery validate -->
<script
src=
"/static/js/jquery.validate.min.js"
></script>
<script
src=
"/static/js/jquery.validate.vtoymethods.js?v=10
1
"
></script>
<script
src=
"/static/js/jquery.validate.vtoymethods.js?v=10
2
"
></script>
<script
src=
"/static/js/jquery.vtoy.alert.js?v=10
1
"
></script>
<script
src=
"/static/js/vtoy.js?v=10
1
"
></script>
<script
src=
"/static/js/jquery.vtoy.alert.js?v=10
2
"
></script>
<script
src=
"/static/js/vtoy.js?v=10
2
"
></script>
<script
src=
"/static/js/md5.min.js"
></script>
<!-- Bootstrap 3.3.5 -->
...
...
Plugson/www/plugson_theme.html
View file @
9b7d6cbc
...
...
@@ -403,9 +403,13 @@
index
:
current_tab_index
,
path
:
data
.
path
},
function
(
e
)
{
list
.
push
(
data
);
FillThemeFileTable
(
list
,
m_data_theme
[
current_tab_index
].
default_file
);
Message
.
success
(
g_vtoy_cur_language
.
STR_SAVE_SUCCESS
);
if
(
e
.
result
===
'
success
'
)
{
list
.
push
(
data
);
FillThemeFileTable
(
list
,
m_data_theme
[
current_tab_index
].
default_file
);
Message
.
success
(
g_vtoy_cur_language
.
STR_SAVE_SUCCESS
);
}
else
if
(
e
.
result
===
'
duplicate
'
)
{
Message
.
error
(
g_vtoy_cur_language
.
STR_DUPLICATE_PATH
);
}
});
}
...
...
@@ -428,9 +432,13 @@
index
:
current_tab_index
,
path
:
data
.
path
},
function
(
e
)
{
list
.
push
(
data
);
FillThemeFontTable
(
list
);
Message
.
success
(
g_vtoy_cur_language
.
STR_SAVE_SUCCESS
);
if
(
e
.
result
===
'
success
'
)
{
list
.
push
(
data
);
FillThemeFontTable
(
list
);
Message
.
success
(
g_vtoy_cur_language
.
STR_SAVE_SUCCESS
);
}
else
if
(
e
.
result
===
'
duplicate
'
)
{
Message
.
error
(
g_vtoy_cur_language
.
STR_DUPLICATE_PATH
);
}
});
}
...
...
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