Prev Commit: Update to 8.2.3 | Read HISTORY.md | Now: Improve version checker's messages

Former-commit-id: 2d773e9ef04ce4595167eb57784fc9113aeccab0
This commit is contained in:
kataras 2017-08-10 21:34:05 +03:00
parent bf929aa557
commit 85cfaa2874
3 changed files with 10 additions and 6 deletions

View File

@ -648,7 +648,7 @@ func (app *Application) Run(serve Runner, withOrWithout ...Configurator) error {
app.Configure(withOrWithout...)
app.logger.Debugf("Application: running using %d host(s)", len(app.Hosts)+1)
if !app.config.DisableVersionChecker && app.logger.Printer.IsTerminal {
if !app.config.DisableVersionChecker && app.logger.Level != golog.DisableLevel {
go CheckVersion()
}

View File

@ -24,7 +24,11 @@ type Response struct {
Success bool `json:"success"`
}
var client = netutil.Client(time.Duration(10 * time.Second))
// Client is the default `net/http#Client` instance which
// is used to send requests to the Google API.
//
// Change Client only if you know what you're doing.
var Client = netutil.Client(time.Duration(20 * time.Second))
// New accepts the google's recaptcha secret key and returns
// a middleware that verifies the request by sending a response to the google's API(V2-latest).
@ -54,7 +58,7 @@ func SiteFerify(ctx context.Context, secret string) (response Response) {
return
}
r, err := client.PostForm(apiURL,
r, err := Client.PostForm(apiURL,
url.Values{
"secret": {secret},
"response": {generatedResponseID},

View File

@ -36,7 +36,7 @@ type versionInfo struct {
}
func checkVersion() {
client := netutil.Client(time.Duration(15 * time.Second))
client := netutil.Client(time.Duration(20 * time.Second))
r, err := client.PostForm(versionURL, url.Values{"current_version": {Version}})
if err != nil {
@ -66,7 +66,7 @@ func checkVersion() {
return
}
format := "A more recent version has been found[%s > %s].\n"
format := "A new version is available online[%s > %s].\n"
if v.ChangelogURL != "" {
format += "Release notes: %s\n"
@ -107,7 +107,7 @@ func checkVersion() {
cmd.Stderr = os.Stdout
if err := cmd.Run(); err != nil {
golog.Warnf("unexpected message while trying to go get: %v", err)
golog.Warnf("unexpected message while trying to go get,\nif you edited the original source code then you've to remove the whole $GOPATH/src/github.com/kataras folder and execute `go get github.com/kataras/iris` manually\n%v", err)
return
}