*(global): refactoring - moved runtime properties to Context

This commit is contained in:
Andrey Meshkov
2020-02-12 15:53:36 +03:00
parent d8d48c5386
commit ae2990582d
16 changed files with 141 additions and 131 deletions

View File

@@ -424,7 +424,7 @@ func parseFilterContents(contents []byte) (int, string) {
func (filter *filter) update() (bool, error) {
log.Tracef("Downloading update for filter %d from %s", filter.ID, filter.URL)
resp, err := config.client.Get(filter.URL)
resp, err := Context.client.Get(filter.URL)
if resp != nil && resp.Body != nil {
defer resp.Body.Close()
}
@@ -538,7 +538,7 @@ func (filter *filter) unload() {
// Path to the filter contents
func (filter *filter) Path() string {
return filepath.Join(config.getDataDir(), filterDir, strconv.FormatInt(filter.ID, 10)+".txt")
return filepath.Join(Context.getDataDir(), filterDir, strconv.FormatInt(filter.ID, 10)+".txt")
}
// LastTimeUpdated returns the time when the filter was last time updated