mirror of
https://github.com/documize/community.git
synced 2025-08-04 21:15:24 +02:00
moving endpoints to new API (WIP)
This commit is contained in:
parent
27640dffc4
commit
72b14def6d
36 changed files with 1371 additions and 472 deletions
|
@ -14,22 +14,19 @@ package organization
|
|||
import (
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"github.com/documize/community/domain"
|
||||
)
|
||||
|
||||
// GetRequestSubdomain extracts subdomain from referring URL.
|
||||
func GetRequestSubdomain(s domain.StoreContext, r *http.Request) string {
|
||||
return urlSubdomain(s, r.Referer())
|
||||
func GetRequestSubdomain(r *http.Request) string {
|
||||
return urlSubdomain(r.Referer())
|
||||
}
|
||||
|
||||
// GetSubdomainFromHost extracts the subdomain from the requesting URL.
|
||||
func GetSubdomainFromHost(s domain.StoreContext, r *http.Request) string {
|
||||
return urlSubdomain(s, r.Host)
|
||||
func GetSubdomainFromHost(r *http.Request) string {
|
||||
return urlSubdomain(r.Host)
|
||||
}
|
||||
|
||||
// Find the subdomain (which is actually the organisation).
|
||||
func urlSubdomain(s domain.StoreContext, url string) string {
|
||||
func urlSubdomain(url string) string {
|
||||
url = strings.ToLower(url)
|
||||
url = strings.Replace(url, "https://", "", 1)
|
||||
url = strings.Replace(url, "http://", "", 1)
|
||||
|
@ -42,5 +39,5 @@ func urlSubdomain(s domain.StoreContext, url string) string {
|
|||
url = ""
|
||||
}
|
||||
|
||||
return CheckDomain(s, url)
|
||||
return url
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue