Restore Engrish function names to normal English.
This commit is contained in:
parent
701fd10c1c
commit
70c5afd6a5
4
app.go
4
app.go
|
@ -156,7 +156,7 @@ func main() {
|
|||
|
||||
// Update filters we've just loaded right away, don't wait for periodic update timer
|
||||
go func() {
|
||||
checkFiltersUpdates(false)
|
||||
refreshFiltersIfNeccessary(false)
|
||||
// Save the updated config
|
||||
err := writeConfig()
|
||||
if err != nil {
|
||||
|
@ -177,7 +177,7 @@ func main() {
|
|||
|
||||
address := net.JoinHostPort(config.BindHost, strconv.Itoa(config.BindPort))
|
||||
|
||||
runFiltersUpdatesTimer()
|
||||
go periodicallyRefreshFilters()
|
||||
|
||||
http.Handle("/", optionalAuthHandler(http.FileServer(box)))
|
||||
registerControlHandlers()
|
||||
|
|
16
control.go
16
control.go
|
@ -471,7 +471,7 @@ func handleFilteringEnableURL(w http.ResponseWriter, r *http.Request) {
|
|||
}
|
||||
|
||||
// kick off refresh of rules from new URLs
|
||||
checkFiltersUpdates(false)
|
||||
refreshFiltersIfNeccessary(false)
|
||||
httpUpdateConfigReloadDNSReturnOK(w, r)
|
||||
}
|
||||
|
||||
|
@ -527,22 +527,20 @@ func handleFilteringSetRules(w http.ResponseWriter, r *http.Request) {
|
|||
|
||||
func handleFilteringRefresh(w http.ResponseWriter, r *http.Request) {
|
||||
force := r.URL.Query().Get("force")
|
||||
updated := checkFiltersUpdates(force != "")
|
||||
updated := refreshFiltersIfNeccessary(force != "")
|
||||
fmt.Fprintf(w, "OK %d filters updated\n", updated)
|
||||
}
|
||||
|
||||
// Sets up a timer that will be checking for filters updates periodically
|
||||
func runFiltersUpdatesTimer() {
|
||||
go func() {
|
||||
for range time.Tick(time.Minute) {
|
||||
checkFiltersUpdates(false)
|
||||
}
|
||||
}()
|
||||
func periodicallyRefreshFilters() {
|
||||
for range time.Tick(time.Minute) {
|
||||
refreshFiltersIfNeccessary(false)
|
||||
}
|
||||
}
|
||||
|
||||
// Checks filters updates if necessary
|
||||
// If force is true, it ignores the filter.LastUpdated field value
|
||||
func checkFiltersUpdates(force bool) int {
|
||||
func refreshFiltersIfNeccessary(force bool) int {
|
||||
config.Lock()
|
||||
|
||||
// fetch URLs
|
||||
|
|
Loading…
Reference in New Issue