Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-2-2
Commits
39c41fec
Commit
39c41fec
authored
Jun 06, 2013
by
Rafaël Carré
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lua http: make string easier to translate
parent
6d533620
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
11 deletions
+28
-11
modules/lua/libs/httpd.c
modules/lua/libs/httpd.c
+28
-11
No files found.
modules/lua/libs/httpd.c
View file @
39c41fec
...
@@ -61,17 +61,23 @@ static const luaL_Reg vlclua_httpd_reg[] = {
...
@@ -61,17 +61,23 @@ static const luaL_Reg vlclua_httpd_reg[] = {
{
NULL
,
NULL
}
{
NULL
,
NULL
}
};
};
static
const
char
no_password
[]
=
N_
(
"<!DOCTYPE html PUBLIC
\"
-//W3C//DTD XHTML 1.0 Strict//EN
\"
\"
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd
\"
>
\n
"
static
const
char
no_password
_fmt
[]
=
"<!DOCTYPE html PUBLIC
\"
-//W3C//DTD XHTML 1.0 Strict//EN
\"
\"
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd
\"
>
\n
"
"<html xmlns=
\"
http://www.w3.org/1999/xhtml
\"
>"
"<html xmlns=
\"
http://www.w3.org/1999/xhtml
\"
>"
"<head>"
"<head>"
"<meta http-equiv=
\"
Content-Type
\"
content=
\"
text/html;charset=utf-8
\"
/>"
"<meta http-equiv=
\"
Content-Type
\"
content=
\"
text/html;charset=utf-8
\"
/>"
"<title>
VLC media player
</title>"
"<title>
%s
</title>"
"</head>"
"</head>"
"<body>"
"<body>"
"%s"
"<!-- VLC_PASSWORD_NOT_SET --></body></html>"
;
static
const
char
no_password_body
[]
=
N_
(
"<p>Password for Web interface has not been set.</p>"
"<p>Password for Web interface has not been set.</p>"
"<p>Please use --http-password, or set a password in </p>"
"<p>Please use --http-password, or set a password in </p>"
"<p>Preferences > All > Main interfaces > Lua > Lua HTTP > Password.</p>"
"<p>Preferences > All > Main interfaces > Lua > Lua HTTP > Password.</p>"
"<!-- VLC_PASSWORD_NOT_SET --></body></html>"
);
);
static
const
char
no_password_title
[]
=
N_
(
"VLC media player"
);
static
int
vlclua_httpd_tls_host_new
(
lua_State
*
L
)
static
int
vlclua_httpd_tls_host_new
(
lua_State
*
L
)
{
{
...
@@ -154,13 +160,20 @@ static int vlclua_httpd_handler_callback(
...
@@ -154,13 +160,20 @@ static int vlclua_httpd_handler_callback(
if
(
!
p_sys
->
password
)
if
(
!
p_sys
->
password
)
{
{
free
(
*
pp_data
);
free
(
*
pp_data
);
size_t
s
=
strlen
(
_
(
no_password
));
char
*
no_password
=
NULL
;
if
(
asprintf
((
char
**
)
pp_data
,
"Status: 403
\n
"
if
(
asprintf
(
&
no_password
,
no_password_fmt
,
"Content-Length: %zu
\n
"
_
(
no_password_title
),
_
(
no_password_body
))
<
0
)
{
"Content-Type: text/html
\n\n
%s"
,
s
,
_
(
no_password
))
<
0
)
*
pi_data
=
0
;
*
pi_data
=
0
;
else
}
else
{
*
pi_data
=
strlen
((
char
*
)
*
pp_data
);
size_t
s
=
strlen
(
no_password
);
if
(
asprintf
((
char
**
)
pp_data
,
"Status: 403
\n
"
"Content-Length: %zu
\n
"
"Content-Type: text/html
\n\n
%s"
,
s
,
no_password
)
<
0
)
*
pi_data
=
0
;
else
*
pi_data
=
strlen
((
char
*
)
*
pp_data
);
free
(
no_password
);
}
}
}
lua_pop
(
L
,
1
);
lua_pop
(
L
,
1
);
/* function data */
/* function data */
...
@@ -257,8 +270,12 @@ static int vlclua_httpd_file_callback(
...
@@ -257,8 +270,12 @@ static int vlclua_httpd_file_callback(
if
(
!
p_sys
->
password
)
if
(
!
p_sys
->
password
)
{
{
free
(
*
pp_data
);
free
(
*
pp_data
);
*
pp_data
=
(
uint8_t
*
)
strdup
(
_
(
no_password
));
if
(
asprintf
((
char
**
)
pp_data
,
no_password_fmt
,
*
pi_data
=
strlen
((
char
*
)
*
pp_data
);
_
(
no_password_title
),
_
(
no_password_body
))
<
0
)
{
*
pi_data
=
0
;
}
else
{
*
pi_data
=
strlen
((
char
*
)
*
pp_data
);
}
}
}
lua_pop
(
L
,
1
);
lua_pop
(
L
,
1
);
/* function data */
/* function data */
...
...
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