]> git.ipfire.org Git - dbl.git/commitdiff
dnsbl: Add description to lists
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 10 Dec 2025 11:49:51 +0000 (11:49 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 10 Dec 2025 11:49:51 +0000 (11:49 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/database.sql
src/dnsbl/exporters.py
src/dnsbl/lists.py
src/scripts/dnsbl.in

index 9c39018fd6c7cd5beed4059fd0a28b290a6b79dd..f75331c7fa5fe5f59d4a5c982aa5af78d0897a44 100644 (file)
@@ -2,7 +2,7 @@
 -- PostgreSQL database dump
 --
 
-\restrict uoDsydSaI5FPlrxacSe4GcAWBxa12RWCgmwmzOXlefNHtJ99eaarw0pTVxjYoSs
+\restrict iyF1xJX6Rr5HXWxSVy3hc4tk2qFzInuecwfyZcCbdOKUcUhTZab2fHQNbRay16f
 
 -- Dumped from database version 17.6 (Debian 17.6-0+deb13u1)
 -- Dumped by pg_dump version 17.6 (Debian 17.6-0+deb13u1)
@@ -36,7 +36,8 @@ CREATE TABLE public.lists (
     deleted_at timestamp with time zone,
     deleted_by text,
     license text NOT NULL,
-    updated_at timestamp with time zone
+    updated_at timestamp with time zone,
+    description text
 );
 
 
@@ -273,5 +274,5 @@ ALTER TABLE ONLY public.sources
 -- PostgreSQL database dump complete
 --
 
-\unrestrict uoDsydSaI5FPlrxacSe4GcAWBxa12RWCgmwmzOXlefNHtJ99eaarw0pTVxjYoSs
+\unrestrict iyF1xJX6Rr5HXWxSVy3hc4tk2qFzInuecwfyZcCbdOKUcUhTZab2fHQNbRay16f
 
index 5cebc6ad92835ca4f70e498ee36dc132ee0a50ad..76f17c25fb9afe7a15eacfb6fad3fa5002011a38 100644 (file)
@@ -79,6 +79,17 @@ class TextExporter(Exporter):
                        " that support blocklisting of known malicious or unwanted domains.",
                        "",
                        " List    : %s" % self.list.name,
+               ]
+
+               # Add the description
+               if self.list.description:
+                       lines += [
+                               "",
+                               "  %s" % self.list.description,
+                               "",
+                       ]
+
+               lines += [
                        " License : %s" % self.list.license,
                        " Updated : %s" % self.list.updated_at.isoformat(),
                        "",
index 7d34c0b487065b09d258df8fe6c5faa5466987d1..efcd96e0db7dafed2902cb6ec9f4872e2d5b9f4a 100644 (file)
@@ -85,7 +85,7 @@ class Lists(object):
 
                        return slug
 
-       def create(self, name, created_by, license):
+       def create(self, name, created_by, license, description=None):
                """
                        Creates a new list
                """
@@ -94,10 +94,11 @@ class Lists(object):
                # Create a new list
                return self.backend.db.insert(
                        List,
-                       name       = name,
-                       slug       = slug,
-                       created_by = created_by,
-                       license    = license,
+                       name        = name,
+                       slug        = slug,
+                       created_by  = created_by,
+                       license     = license,
+                       description = description,
                )
 
 
@@ -140,6 +141,9 @@ class List(sqlmodel.SQLModel, database.BackendMixin, table=True):
        # License
        license : str
 
+       # Description
+       description : str
+
        # Sources
        sources : typing.List["Source"] = sqlmodel.Relationship(
                back_populates="list",
index 522ff72e1d7c9c5404a4603fdedd8746e2f01561..ec0196bfc31d4675511649ea8641f3b5b42d16df 100644 (file)
@@ -72,6 +72,8 @@ class CLI(object):
                                default=os.environ.get("USER"), help=_("The creator of the list"))
                create.add_argument("--license", required=True,
                                help=_("The license of the list"))
+               create.add_argument("--description",
+                               help=_("The description of the list"))
                create.set_defaults(func=self.__create)
 
                # delete
@@ -204,9 +206,10 @@ class CLI(object):
                        Creates a new list
                """
                backend.lists.create(
-                       name       = args.name,
-                       created_by = args.created_by,
-                       license    = args.license,
+                       name        = args.name,
+                       created_by  = args.created_by,
+                       license     = args.license,
+                       description = args.description,
                )
 
        def __delete(self, backend, args):