Skip to content

Commit

Permalink
Add HTTPS rewrite domain
Browse files Browse the repository at this point in the history
  • Loading branch information
Ralim committed Oct 28, 2024
1 parent fd8eaed commit e1efa1a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion server/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func (server *Server) GenerateVirtualFilePath(file index.FileOnDiskRecord, hostN
ext = strings.ToLower(ext)
fileFinalName := fmt.Sprintf("%s [%016X][v%d]%s", utilities.CleanName(file.Name), file.TitleID, file.Version, ext)
base := fmt.Sprintf("/vfile/%d/%d/data.bin#%s", file.TitleID, file.Version, fileFinalName)
if useHTTPS {
if useHTTPS || (server.settings.HTTPSRewriteDomain == hostNameToUse) {
base = "https://" + hostNameToUse + base
} else {
base = "http://" + hostNameToUse + base
Expand Down
21 changes: 11 additions & 10 deletions settings/settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,17 @@ type Settings struct {
PreferCompressed bool `json:"preferCompressed"` // Prefer compressed form of files on duplicate

//Serving files
PublicIP string `json:"publicIP"`
HTTPPort int `json:"httpPort"` // Port used for HTTP
FTPPort int `json:"ftpPort"` // Port used for FTP
FTPPassivePorts string `json:"FTPPassivePorts"` // Passive port range for FTP
FTPHost string `json:"FTPHost"`
AllowAnonFTP bool `json:"allowAnonFTP"` // Allow anon (open to public) FTP
AllowAnonHTTP bool `json:"allowAnonHTTP"` // Allow anon (open to public) HTTP
Users []AuthUser `json:"users"` // User accounts
JSONLocations []string `json:"jsonLocations"` // Extra locations to add to locations field in json for backup instances
ServerMOTD string `json:"serverMOTD"` // Server title used for public facing info
HTTPSRewriteDomain string `json:"httpsRewriteDomain"` // If this domain is used for HTTP, use HTTPS in response
PublicIP string `json:"publicIP"` // Public IP, required for FTP
HTTPPort int `json:"httpPort"` // Port used for HTTP
FTPPort int `json:"ftpPort"` // Port used for FTP
FTPPassivePorts string `json:"FTPPassivePorts"` // Passive port range for FTP
FTPHost string `json:"FTPHost"` //
AllowAnonFTP bool `json:"allowAnonFTP"` // Allow anon (open to public) FTP
AllowAnonHTTP bool `json:"allowAnonHTTP"` // Allow anon (open to public) HTTP
Users []AuthUser `json:"users"` // User accounts
JSONLocations []string `json:"jsonLocations"` // Extra locations to add to locations field in json for backup instances
ServerMOTD string `json:"serverMOTD"` // Server title used for public facing info

// Incoming
UploadingAllowed bool `json:"uploadingAllowed"` // Can FTP be used to push new files
Expand Down

0 comments on commit e1efa1a

Please sign in to comment.