mirror of
https://github.com/yusing/godoxy.git
synced 2025-06-09 04:52:35 +02:00
fix app url when using fqdn alias
This commit is contained in:
parent
ac72f77a74
commit
f8b732c9b8
1 changed files with 11 additions and 6 deletions
|
@ -2,6 +2,7 @@ package homepage
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"strings"
|
||||||
|
|
||||||
config "github.com/yusing/go-proxy/internal/config/types"
|
config "github.com/yusing/go-proxy/internal/config/types"
|
||||||
"github.com/yusing/go-proxy/internal/utils"
|
"github.com/yusing/go-proxy/internal/utils"
|
||||||
|
@ -42,13 +43,17 @@ func (cfg *ItemConfig) GetOverride(alias string) *ItemConfig {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (item *Item) MarshalJSON() ([]byte, error) {
|
func (item *Item) MarshalJSON() ([]byte, error) {
|
||||||
godoxyCfg := config.GetInstance().Value()
|
|
||||||
// use first domain as base domain
|
|
||||||
domains := godoxyCfg.MatchDomains
|
|
||||||
var url *string
|
var url *string
|
||||||
if len(domains) > 0 {
|
if !strings.ContainsRune(item.Alias, '.') {
|
||||||
url = new(string)
|
godoxyCfg := config.GetInstance().Value()
|
||||||
*url = item.Alias + domains[0]
|
// use first domain as base domain
|
||||||
|
domains := godoxyCfg.MatchDomains
|
||||||
|
if len(domains) > 0 {
|
||||||
|
url = new(string)
|
||||||
|
*url = item.Alias + domains[0]
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
url = &item.Alias
|
||||||
}
|
}
|
||||||
return json.Marshal(map[string]any{
|
return json.Marshal(map[string]any{
|
||||||
"show": item.Show,
|
"show": item.Show,
|
||||||
|
|
Loading…
Add table
Reference in a new issue