generated from VLADIMIR/template
update
This commit is contained in:
@@ -13,15 +13,19 @@ type Team struct {
|
||||
}
|
||||
|
||||
func (t *Team) GetTeamUrl() (string, error) {
|
||||
ips, err := getLocalIPs()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
ip := ips[0]
|
||||
ip := selectIP()
|
||||
u := fmt.Sprintf("http://%s:8100?name=%s&password=%s", ip, url.PathEscape(t.Name), t.Password)
|
||||
return u, nil
|
||||
}
|
||||
|
||||
func selectIP() string {
|
||||
ips, err := getLocalIPs()
|
||||
if err != nil || len(ips) == 0 {
|
||||
return "127.0.0.1"
|
||||
}
|
||||
return ips[0]
|
||||
}
|
||||
|
||||
func getLocalIPs() ([]string, error) {
|
||||
var ips []string
|
||||
addrs, err := net.InterfaceAddrs()
|
||||
|
||||
@@ -59,6 +59,13 @@ func NewStoryService(filepath string) (*StoryService, error) {
|
||||
}
|
||||
|
||||
func (s *StoryService) GetPlace(code string) *Place {
|
||||
if strings.HasPrefix(code, "[") || strings.HasSuffix(code, "]") {
|
||||
return &Place{
|
||||
Code: code,
|
||||
Name: "Не найдено",
|
||||
Text: "Уважаемые детективы внимательно прочитайте правила.",
|
||||
}
|
||||
}
|
||||
code = clearCode(code)
|
||||
for _, place := range s.story.Places {
|
||||
if clearCode(place.Code) == code {
|
||||
|
||||
Reference in New Issue
Block a user