Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
galene
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
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
nexedi
galene
Commits
90e2de0b
Commit
90e2de0b
authored
Jul 10, 2023
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add configuration option publicServer.
parent
bb0a0189
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
1 deletion
+23
-1
README
README
+3
-0
group/group.go
group/group.go
+1
-0
webserver/webserver.go
webserver/webserver.go
+19
-1
No files found.
README
View file @
90e2de0b
...
...
@@ -74,6 +74,9 @@ The fields are as follows:
- `admin` defines the users allowed to look at the `/stats.html` file; it
has the same syntax as user definitions in groups (see below).
- `publicServer`: if true, then cross-origin access to the server is
allowed. This is safe if the server is on the public Internet, but not
necessarily so if it is on a private network.
- `proxyURL`: if running behind a reverse proxy, this specifies the
address of the proxy.
- `canonicalHost`: the canonical name of the host running the server; this
...
...
group/group.go
View file @
90e2de0b
...
...
@@ -854,6 +854,7 @@ type Configuration struct {
modTime
time
.
Time
`json:"-"`
fileSize
int64
`json:"-"`
PublicServer
bool
`json:"publicServer"`
CanonicalHost
string
`json:"canonicalHost"`
ProxyURL
string
`json:"proxyURL"`
Admin
[]
ClientPattern
`json:"admin"`
...
...
webserver/webserver.go
View file @
90e2de0b
...
...
@@ -479,8 +479,26 @@ var wsUpgrader = websocket.Upgrader{
HandshakeTimeout
:
30
*
time
.
Second
,
}
var
wsPublicUpgrader
=
websocket
.
Upgrader
{
HandshakeTimeout
:
30
*
time
.
Second
,
CheckOrigin
:
func
(
r
*
http
.
Request
)
bool
{
return
true
},
}
func
wsHandler
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
conn
,
err
:=
wsUpgrader
.
Upgrade
(
w
,
r
,
nil
)
conf
,
err
:=
group
.
GetConfiguration
()
if
err
!=
nil
{
http
.
Error
(
w
,
"Internal server error"
,
http
.
StatusInternalServerError
)
return
}
upgrader
:=
wsUpgrader
if
conf
.
PublicServer
{
upgrader
=
wsPublicUpgrader
}
conn
,
err
:=
upgrader
.
Upgrade
(
w
,
r
,
nil
)
if
err
!=
nil
{
log
.
Printf
(
"Websocket upgrade: %v"
,
err
)
return
...
...
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