mirror of
https://github.com/TeamPiped/instances-api.git
synced 2024-08-14 23:57:19 +00:00
include image proxy url and whether registration is disabled
This commit is contained in:
parent
bb978ea3a3
commit
119fd1c7c7
1 changed files with 27 additions and 21 deletions
48
main.go
48
main.go
|
@ -28,20 +28,24 @@ var monitored_instances = []Instance{}
|
||||||
var number_re = regexp.MustCompile(`(?m)(\d+)`)
|
var number_re = regexp.MustCompile(`(?m)(\d+)`)
|
||||||
|
|
||||||
type Instance struct {
|
type Instance struct {
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
ApiUrl string `json:"api_url"`
|
ApiUrl string `json:"api_url"`
|
||||||
Locations string `json:"locations"`
|
Locations string `json:"locations"`
|
||||||
Version string `json:"version"`
|
Version string `json:"version"`
|
||||||
UpToDate bool `json:"up_to_date"`
|
UpToDate bool `json:"up_to_date"`
|
||||||
Cdn bool `json:"cdn"`
|
Cdn bool `json:"cdn"`
|
||||||
Registered int `json:"registered"`
|
Registered int `json:"registered"`
|
||||||
LastChecked int64 `json:"last_checked"`
|
LastChecked int64 `json:"last_checked"`
|
||||||
Cache bool `json:"cache"`
|
Cache bool `json:"cache"`
|
||||||
S3Enabled bool `json:"s3_enabled"`
|
S3Enabled bool `json:"s3_enabled"`
|
||||||
|
ImageProxyUrl string `json:"image_proxy_url"`
|
||||||
|
RegistrationDisabled bool `json:"registration_disabled"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type FrontendConfig struct {
|
type FrontendConfig struct {
|
||||||
S3Enabled bool `json:"s3Enabled"`
|
S3Enabled bool `json:"s3Enabled"`
|
||||||
|
ImageProxyUrl string `json:"imageProxy"`
|
||||||
|
RegistrationDisabled bool `json:"registrationDisabled"`
|
||||||
}
|
}
|
||||||
|
|
||||||
var client = http.Client{
|
var client = http.Client{
|
||||||
|
@ -182,16 +186,18 @@ func getInstanceDetails(split []string, latest string) (Instance, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
return Instance{
|
return Instance{
|
||||||
Name: strings.TrimSpace(split[0]),
|
Name: strings.TrimSpace(split[0]),
|
||||||
ApiUrl: ApiUrl,
|
ApiUrl: ApiUrl,
|
||||||
Locations: strings.TrimSpace(split[2]),
|
Locations: strings.TrimSpace(split[2]),
|
||||||
Cdn: strings.TrimSpace(split[3]) == "Yes",
|
Cdn: strings.TrimSpace(split[3]) == "Yes",
|
||||||
Registered: int(registered),
|
Registered: int(registered),
|
||||||
LastChecked: lastChecked,
|
LastChecked: lastChecked,
|
||||||
Version: version,
|
Version: version,
|
||||||
UpToDate: strings.Contains(latest, hash),
|
UpToDate: strings.Contains(latest, hash),
|
||||||
Cache: cacheWorking,
|
Cache: cacheWorking,
|
||||||
S3Enabled: config.S3Enabled,
|
S3Enabled: config.S3Enabled,
|
||||||
|
ImageProxyUrl: config.ImageProxyUrl,
|
||||||
|
RegistrationDisabled: config.RegistrationDisabled,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue