mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-11-15 02:42:58 +00:00
Add (optional) date_modified field and use vw_whitelist view in vw_blacklist
Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
parent
b4ae142149
commit
126f7101ff
2 changed files with 11 additions and 12 deletions
|
@ -186,9 +186,9 @@ Displaylist() {
|
|||
num_pipes="$(grep -c "^" <<< "$(grep -o "|" <<< "${line}")")"
|
||||
|
||||
# Extract domain and enabled status based on the obtained number of pipe characters
|
||||
domain="$(cut -d'|' -f"-$((num_pipes-2))" <<< "${line}")"
|
||||
enabled="$(cut -d'|' -f"$((num_pipes-1))" <<< "${line}")"
|
||||
dateadded="$(cut -d'|' -f"$((num_pipes))" <<< "${line}")"
|
||||
domain="$(cut -d'|' -f"-$((num_pipes-3))" <<< "${line}")"
|
||||
enabled="$(cut -d'|' -f"$((num_pipes-2))" <<< "${line}")"
|
||||
dateadded="$(cut -d'|' -f"$((num_pipes-1))" <<< "${line}")"
|
||||
|
||||
# Translate boolean status into human readable string
|
||||
if [[ "${enabled}" -eq 1 ]]; then
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
CREATE TABLE whitelist (domain TEXT UNIQUE NOT NULL, enabled BOOLEAN NOT NULL DEFAULT 1, date_added INTEGER NOT NULL DEFAULT (cast(strftime('%s', 'now') as int)), comment TEXT);
|
||||
CREATE TABLE blacklist (domain TEXT UNIQUE NOT NULL, enabled BOOLEAN NOT NULL DEFAULT 1, date_added INTEGER NOT NULL DEFAULT (cast(strftime('%s', 'now') as int)), comment TEXT);
|
||||
CREATE TABLE regex (domain TEXT UNIQUE NOT NULL, enabled BOOLEAN NOT NULL DEFAULT 1, date_added INTEGER NOT NULL DEFAULT (cast(strftime('%s', 'now') as int)), comment TEXT);
|
||||
CREATE TABLE adlists (address TEXT UNIQUE NOT NULL, enabled BOOLEAN NOT NULL DEFAULT 1, date_added INTEGER NOT NULL DEFAULT (cast(strftime('%s', 'now') as int)), comment TEXT);
|
||||
CREATE TABLE whitelist (domain TEXT UNIQUE NOT NULL, enabled BOOLEAN NOT NULL DEFAULT 1, date_added INTEGER NOT NULL DEFAULT (cast(strftime('%s', 'now') as int)), date_modified INTEGER, comment TEXT);
|
||||
CREATE TABLE blacklist (domain TEXT UNIQUE NOT NULL, enabled BOOLEAN NOT NULL DEFAULT 1, date_added INTEGER NOT NULL DEFAULT (cast(strftime('%s', 'now') as int)), date_modified INTEGER, comment TEXT);
|
||||
CREATE TABLE regex (domain TEXT UNIQUE NOT NULL, enabled BOOLEAN NOT NULL DEFAULT 1, date_added INTEGER NOT NULL DEFAULT (cast(strftime('%s', 'now') as int)), date_modified INTEGER, comment TEXT);
|
||||
CREATE TABLE adlists (address TEXT UNIQUE NOT NULL, enabled BOOLEAN NOT NULL DEFAULT 1, date_added INTEGER NOT NULL DEFAULT (cast(strftime('%s', 'now') as int)), date_modified INTEGER, comment TEXT);
|
||||
CREATE TABLE gravity (domain TEXT UNIQUE NOT NULL);
|
||||
CREATE TABLE info (property TEXT NOT NULL, value TEXT NOT NULL);
|
||||
|
||||
|
@ -11,15 +11,14 @@ CREATE VIEW vw_gravity AS SELECT DISTINCT a.domain
|
|||
FROM gravity a
|
||||
WHERE a.domain NOT IN (SELECT domain from whitelist WHERE enabled == 1);
|
||||
|
||||
CREATE VIEW vw_blacklist AS SELECT DISTINCT a.domain
|
||||
FROM blacklist a
|
||||
WHERE a.enabled == 1 AND
|
||||
a.domain NOT IN (SELECT domain from whitelist WHERE enabled == 1);
|
||||
|
||||
CREATE VIEW vw_whitelist AS SELECT DISTINCT a.domain
|
||||
FROM whitelist a
|
||||
WHERE a.enabled == 1;
|
||||
|
||||
CREATE VIEW vw_blacklist AS SELECT DISTINCT a.domain
|
||||
FROM blacklist a
|
||||
WHERE a.enabled == 1 AND a.domain NOT IN vw_whitelist;
|
||||
|
||||
CREATE VIEW vw_regex AS SELECT DISTINCT a.domain
|
||||
FROM regex a
|
||||
WHERE a.enabled == 1;
|
||||
|
|
Loading…
Reference in a new issue