log.Debugln("YP Ping error returned from service:",pingResponse.Error)
return
}
ifpingResponse.Key!=key{
yp.writeSavedKey(pingResponse.Key)
}
}
func(yp*YP)writeSavedKey(keystring){
f,err:=os.Create(".yp.key")
deferf.Close()
iferr!=nil{
log.Errorln(err)
return
}
_,err=f.WriteString(key)
iferr!=nil{
log.Errorln(err)
return
}
}
func(yp*YP)getSavedKey()string{
fileBytes,err:=ioutil.ReadFile(".yp.key")
iferr!=nil{
return""
}
returnstring(fileBytes)
}
// DisplayInstructions will let the user know they are not in the directory by default and
// how they can enable the feature.
funcDisplayInstructions(){
text:="Your instance can be listed on the Owncast directory at http://something.something by enabling YP in your config. Learn more at http://something.something."