mirror of
https://github.com/safing/portmaster
synced 2025-09-02 10:39:22 +00:00
Api ednpoint to custom filter list added
This commit is contained in:
parent
fa1480d4c1
commit
a3c39b183e
1 changed files with 19 additions and 0 deletions
|
@ -9,6 +9,7 @@ import (
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/safing/portbase/api"
|
||||||
"github.com/safing/portbase/modules"
|
"github.com/safing/portbase/modules"
|
||||||
"golang.org/x/net/publicsuffix"
|
"golang.org/x/net/publicsuffix"
|
||||||
)
|
)
|
||||||
|
@ -70,6 +71,24 @@ func start() error {
|
||||||
return nil
|
return nil
|
||||||
}).Schedule(time.Now().Add(20 * time.Second))
|
}).Schedule(time.Now().Add(20 * time.Second))
|
||||||
|
|
||||||
|
// register api endpoint for updating the filter list
|
||||||
|
if err := api.RegisterEndpoint(api.Endpoint{
|
||||||
|
Path: "customlists/update",
|
||||||
|
Read: api.PermitUser,
|
||||||
|
BelongsTo: module,
|
||||||
|
ActionFunc: func(ar *api.Request) (msg string, err error) {
|
||||||
|
err = checkAndUpdateFilterList()
|
||||||
|
if err != nil {
|
||||||
|
return "failed to load custom filter list.", err
|
||||||
|
}
|
||||||
|
return "custom filter list loaded successfully.", nil
|
||||||
|
},
|
||||||
|
Name: "Update custom filter list",
|
||||||
|
Description: "Load a filter list form a file defined by the user.",
|
||||||
|
}); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue