2021-11-13 15:30:45 +00:00
|
|
|
//go:build checkupdate
|
2019-07-06 01:57:32 +00:00
|
|
|
// +build checkupdate
|
|
|
|
|
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"encoding/json"
|
|
|
|
"io"
|
|
|
|
"log"
|
|
|
|
"net/http"
|
|
|
|
)
|
|
|
|
|
2022-05-10 08:23:28 +00:00
|
|
|
const version = 12
|
2019-07-06 01:57:32 +00:00
|
|
|
|
|
|
|
func init() {
|
|
|
|
go checkUpdate()
|
|
|
|
}
|
|
|
|
|
|
|
|
func checkUpdate() {
|
2023-05-16 08:00:15 +00:00
|
|
|
res, err := http.Get("https://fic.srs.epita.fr/repochecker.version")
|
2019-07-06 01:57:32 +00:00
|
|
|
if err == nil {
|
|
|
|
defer res.Body.Close()
|
|
|
|
dec := json.NewDecoder(res.Body)
|
|
|
|
|
|
|
|
var v int
|
|
|
|
if err := dec.Decode(&v); err == io.EOF || err == nil {
|
|
|
|
if v > version {
|
2023-05-16 08:00:15 +00:00
|
|
|
log.Println("Your repochecker version is outdated, please update it:\n https://fic.srs.epita.fr/fic-binaries/")
|
2019-07-06 01:57:32 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|