Make it compatible with the previous version.
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
parent
1c2e6e3da9
commit
6bdbf3b83d
1
.gitignore
vendored
1
.gitignore
vendored
@ -1 +1,2 @@
|
|||||||
data/config.toml
|
data/config.toml
|
||||||
|
data/announcements.json
|
@ -19,10 +19,7 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func AnnCheck() {
|
func AnnCheck() {
|
||||||
if resAnn == "true" {
|
if resAnn == "false" {
|
||||||
AnnPage()
|
|
||||||
Announcements()
|
|
||||||
} else {
|
|
||||||
log.Println("[Segfautils] ℹ Announcements are disabled")
|
log.Println("[Segfautils] ℹ Announcements are disabled")
|
||||||
http.HandleFunc("/announcements", func(w http.ResponseWriter, r *http.Request) {
|
http.HandleFunc("/announcements", func(w http.ResponseWriter, r *http.Request) {
|
||||||
http.Error(w, "Announcements are disabled.", http.StatusServiceUnavailable)
|
http.Error(w, "Announcements are disabled.", http.StatusServiceUnavailable)
|
||||||
@ -30,6 +27,9 @@ func AnnCheck() {
|
|||||||
http.HandleFunc("/api/announcements", func(w http.ResponseWriter, r *http.Request) {
|
http.HandleFunc("/api/announcements", func(w http.ResponseWriter, r *http.Request) {
|
||||||
http.Error(w, "{\"enabled\": \"false\"}", http.StatusServiceUnavailable)
|
http.Error(w, "{\"enabled\": \"false\"}", http.StatusServiceUnavailable)
|
||||||
})
|
})
|
||||||
|
} else {
|
||||||
|
AnnPage()
|
||||||
|
Announcements()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,14 +22,14 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func FormCheck() {
|
func FormCheck() {
|
||||||
if resForm == "true" {
|
if resForm == "false" {
|
||||||
FormPage()
|
|
||||||
Form()
|
|
||||||
} else {
|
|
||||||
log.Println("[Segfautils] ℹ Contact form is disabled")
|
log.Println("[Segfautils] ℹ Contact form is disabled")
|
||||||
http.HandleFunc("/form", func(w http.ResponseWriter, r *http.Request) {
|
http.HandleFunc("/form", func(w http.ResponseWriter, r *http.Request) {
|
||||||
http.Error(w, "Form is disabled.", http.StatusServiceUnavailable)
|
http.Error(w, "Form is disabled.", http.StatusServiceUnavailable)
|
||||||
})
|
})
|
||||||
|
} else {
|
||||||
|
FormPage()
|
||||||
|
Form()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,13 +6,13 @@ import (
|
|||||||
"github.com/spf13/viper"
|
"github.com/spf13/viper"
|
||||||
)
|
)
|
||||||
|
|
||||||
func OptForm() string {
|
func OptAnn() string {
|
||||||
viper.SetConfigName("config")
|
viper.SetConfigName("config")
|
||||||
viper.AddConfigPath("./data")
|
viper.AddConfigPath("./data")
|
||||||
err := viper.ReadInConfig()
|
err := viper.ReadInConfig()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println("Error reading config. Error getting: options.form", err.Error())
|
log.Println("Error reading config. Error getting: options.announce", err.Error())
|
||||||
}
|
}
|
||||||
result := viper.GetString("options.form")
|
result := viper.GetString("options.announce")
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
@ -6,13 +6,13 @@ import (
|
|||||||
"github.com/spf13/viper"
|
"github.com/spf13/viper"
|
||||||
)
|
)
|
||||||
|
|
||||||
func OptAnn() string {
|
func OptForm() string {
|
||||||
viper.SetConfigName("config")
|
viper.SetConfigName("config")
|
||||||
viper.AddConfigPath("./data")
|
viper.AddConfigPath("./data")
|
||||||
err := viper.ReadInConfig()
|
err := viper.ReadInConfig()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println("Error reading config. Error getting: options.announce", err.Error())
|
log.Println("Error reading config. Error getting: options.form", err.Error())
|
||||||
}
|
}
|
||||||
result := viper.GetString("options.announce")
|
result := viper.GetString("options.form")
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user