Skip to content

Commit

Permalink
fix app url when using fqdn alias
Browse files Browse the repository at this point in the history
  • Loading branch information
yusing committed Feb 25, 2025
1 parent ac72f77 commit f8b732c
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions internal/homepage/homepage.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package homepage

import (
"encoding/json"
"strings"

config "github.com/yusing/go-proxy/internal/config/types"
"github.com/yusing/go-proxy/internal/utils"
Expand Down Expand Up @@ -42,13 +43,17 @@ func (cfg *ItemConfig) GetOverride(alias string) *ItemConfig {
}

func (item *Item) MarshalJSON() ([]byte, error) {
godoxyCfg := config.GetInstance().Value()
// use first domain as base domain
domains := godoxyCfg.MatchDomains
var url *string
if len(domains) > 0 {
url = new(string)
*url = item.Alias + domains[0]
if !strings.ContainsRune(item.Alias, '.') {
godoxyCfg := config.GetInstance().Value()
// 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{
"show": item.Show,
Expand Down

0 comments on commit f8b732c

Please sign in to comment.