Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Thomas Gambier
slapos
Commits
615219b1
Commit
615219b1
authored
Jan 31, 2023
by
Thomas Gambier
🚴🏼
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
software/theia: public folder is not public in Theia
This is a fixup of
665166e2
(see especially
nexedi/slapos@665166e2 (comment 177402)
)
parent
526cc23e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
7 deletions
+9
-7
software/theia/buildout.hash.cfg
software/theia/buildout.hash.cfg
+1
-1
software/theia/instance-theia.cfg.jinja.in
software/theia/instance-theia.cfg.jinja.in
+2
-3
software/theia/test/test.py
software/theia/test/test.py
+6
-3
No files found.
software/theia/buildout.hash.cfg
View file @
615219b1
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
[instance-theia]
[instance-theia]
_update_hash_filename_ = instance-theia.cfg.jinja.in
_update_hash_filename_ = instance-theia.cfg.jinja.in
md5sum =
4b69822605e3f20fcec8f44a0bdf80bb
md5sum =
8a6efc1054b60f3cbd114a9f6097bae5
[instance]
[instance]
_update_hash_filename_ = instance.cfg.in
_update_hash_filename_ = instance.cfg.in
...
...
software/theia/instance-theia.cfg.jinja.in
View file @
615219b1
...
@@ -261,14 +261,13 @@ content =
...
@@ -261,14 +261,13 @@ content =
log global
log global
bind $${:ip}:$${:port} ssl crt $${frontend-instance-certificate:cert-file} alpn h2,http/1.1
bind $${:ip}:$${:port} ssl crt $${frontend-instance-certificate:cert-file} alpn h2,http/1.1
# writing twice the same ACL is doing OR
# writing twice the same ACL is doing OR
acl is_public path_beg /public/
acl is_public path /$${frontend-instance-favicon.ico:filename}
acl is_public path /$${frontend-instance-favicon.ico:filename}
acl is_public path /$${frontend-instance-theia.webmanifest:filename}
acl is_public path /$${frontend-instance-theia.webmanifest:filename}
acl is_public path /$${frontend-instance-theia-serviceworker.js:filename}
acl is_public path /$${frontend-instance-theia-serviceworker.js:filename}
acl auth_ok http_auth(basic-auth-list)
acl auth_ok http_auth(basic-auth-list)
# No authentication for
public folder
# No authentication for
some files
http-request auth unless auth_ok || is_public
http-request auth unless auth_ok || is_public
use_backend static if { path_beg /$${frontend-instance-fonts:folder-name} } || { path_beg /$${frontend-instance-slapos.css:folder-name} } || { path /$${frontend-instance-logo:filename} } || is_public
use_backend static if { path_beg /$${frontend-instance-fonts:folder-name} } || { path_beg /$${frontend-instance-slapos.css:folder-name} } || { path /$${frontend-instance-logo:filename} } ||
{ path_beg /public/ } ||
is_public
default_backend nodejs
default_backend nodejs
backend nodejs
backend nodejs
...
...
software/theia/test/test.py
View file @
615219b1
...
@@ -146,14 +146,17 @@ class TestTheia(TheiaTestCase):
...
@@ -146,14 +146,17 @@ class TestTheia(TheiaTestCase):
)).
geturl
()
)).
geturl
()
self
.
get
(
authenticated_url
)
self
.
get
(
authenticated_url
)
# there's a public folder to serve file
(no need for authentication)
# there's a public folder to serve file
with
open
(
'{}/srv/frontend-static/public/test_file'
.
format
(
with
open
(
'{}/srv/frontend-static/public/test_file'
.
format
(
self
.
getPath
()),
'w'
)
as
f
:
self
.
getPath
()),
'w'
)
as
f
:
f
.
write
(
"hello"
)
f
.
write
(
"hello"
)
resp
=
self
.
get
(
urljoin
(
url
,
'/public/'
))
resp
=
self
.
get
(
urljoin
(
authenticated_
url
,
'/public/'
))
self
.
assertIn
(
'test_file'
,
resp
.
text
)
self
.
assertIn
(
'test_file'
,
resp
.
text
)
resp
=
self
.
get
(
urljoin
(
url
,
'/public/test_file'
))
resp
=
self
.
get
(
urljoin
(
authenticated_
url
,
'/public/test_file'
))
self
.
assertEqual
(
'hello'
,
resp
.
text
)
self
.
assertEqual
(
'hello'
,
resp
.
text
)
# make sure public folder is protected
resp
=
self
.
get
(
urljoin
(
url
,
'/public/test_file'
))
self
.
assertEqual
(
resp
.
status_code
,
requests
.
codes
.
unauthorized
)
# there's a (not empty) favicon (no need for authentication)
# there's a (not empty) favicon (no need for authentication)
resp
=
self
.
get
(
urljoin
(
url
,
'/favicon.ico'
))
resp
=
self
.
get
(
urljoin
(
url
,
'/favicon.ico'
))
...
...
Romain Courteaud
@romain
·
Feb 02, 2023
thx
@tomo
thx @tomo
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