django-cookie-consent 0.4.0.dev0__py3-none-any.whl → 0.6.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- cookie_consent/__init__.py +1 -1
- cookie_consent/cache.py +17 -11
- cookie_consent/migrations/0003_alter_cookiegroup_varname.py +32 -0
- cookie_consent/migrations/0004_cookie_natural_key.py +19 -0
- cookie_consent/models.py +89 -18
- cookie_consent/static/cookie_consent/cookiebar.js +2 -1
- cookie_consent/static/cookie_consent/cookiebar.module.js +163 -0
- cookie_consent/static/cookie_consent/cookiebar.module.js.map +7 -0
- cookie_consent/templatetags/cookie_consent_tags.py +39 -9
- cookie_consent/urls.py +15 -9
- cookie_consent/util.py +28 -11
- cookie_consent/views.py +55 -5
- {django_cookie_consent-0.4.0.dev0.dist-info → django_cookie_consent-0.6.0.dist-info}/AUTHORS +1 -0
- {django_cookie_consent-0.4.0.dev0.dist-info → django_cookie_consent-0.6.0.dist-info}/METADATA +32 -12
- django_cookie_consent-0.6.0.dist-info/RECORD +30 -0
- {django_cookie_consent-0.4.0.dev0.dist-info → django_cookie_consent-0.6.0.dist-info}/WHEEL +1 -1
- cookie_consent/compat.py +0 -11
- django_cookie_consent-0.4.0.dev0.dist-info/RECORD +0 -27
- {django_cookie_consent-0.4.0.dev0.dist-info → django_cookie_consent-0.6.0.dist-info}/LICENSE +0 -0
- {django_cookie_consent-0.4.0.dev0.dist-info → django_cookie_consent-0.6.0.dist-info}/top_level.txt +0 -0
cookie_consent/__init__.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "0.
|
|
1
|
+
__version__ = "0.6.0"
|
cookie_consent/cache.py
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
# -*- coding: utf-8 -*-
|
|
2
2
|
from django.core.cache import caches
|
|
3
3
|
|
|
4
|
-
from
|
|
4
|
+
from .conf import settings
|
|
5
|
+
from .models import CookieGroup
|
|
5
6
|
|
|
6
7
|
CACHE_KEY = "cookie_consent_cache"
|
|
7
|
-
CACHE_TIMEOUT = 60 * 60
|
|
8
|
+
CACHE_TIMEOUT = 60 * 60 # 60 minutes
|
|
8
9
|
|
|
9
10
|
|
|
10
11
|
def _get_cache():
|
|
@@ -23,17 +24,22 @@ def delete_cache():
|
|
|
23
24
|
cache.delete(CACHE_KEY)
|
|
24
25
|
|
|
25
26
|
|
|
27
|
+
def _get_cookie_groups_from_db():
|
|
28
|
+
qs = CookieGroup.objects.filter(is_required=False).prefetch_related("cookie_set")
|
|
29
|
+
return qs.in_bulk(field_name="varname")
|
|
30
|
+
|
|
31
|
+
|
|
26
32
|
def all_cookie_groups():
|
|
33
|
+
"""
|
|
34
|
+
Get all cookie groups that are optional.
|
|
35
|
+
|
|
36
|
+
Reads from the cache where possible, sets the value in the cache if there's a
|
|
37
|
+
cache miss.
|
|
38
|
+
"""
|
|
27
39
|
cache = _get_cache()
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
qs = CookieGroup.objects.filter(is_required=False)
|
|
33
|
-
qs = qs.prefetch_related("cookie_set")
|
|
34
|
-
items = dict([(g.varname, g) for g in qs])
|
|
35
|
-
cache.set(CACHE_KEY, items, CACHE_TIMEOUT)
|
|
36
|
-
return items
|
|
40
|
+
return cache.get_or_set(
|
|
41
|
+
CACHE_KEY, _get_cookie_groups_from_db, timeout=CACHE_TIMEOUT
|
|
42
|
+
)
|
|
37
43
|
|
|
38
44
|
|
|
39
45
|
def get_cookie_group(varname):
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Generated by Django 4.2.13 on 2024-05-09 19:01
|
|
2
|
+
|
|
3
|
+
import re
|
|
4
|
+
|
|
5
|
+
import django.core.validators
|
|
6
|
+
from django.db import migrations, models
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class Migration(migrations.Migration):
|
|
10
|
+
|
|
11
|
+
dependencies = [
|
|
12
|
+
("cookie_consent", "0002_auto__add_logitem"),
|
|
13
|
+
]
|
|
14
|
+
|
|
15
|
+
operations = [
|
|
16
|
+
migrations.AlterField(
|
|
17
|
+
model_name="cookiegroup",
|
|
18
|
+
name="varname",
|
|
19
|
+
field=models.CharField(
|
|
20
|
+
max_length=32,
|
|
21
|
+
unique=True,
|
|
22
|
+
validators=[
|
|
23
|
+
django.core.validators.RegexValidator(
|
|
24
|
+
re.compile("^[-_a-zA-Z0-9]+$"),
|
|
25
|
+
"Enter a valid 'varname' consisting of letters, numbers, underscores or hyphens.",
|
|
26
|
+
"invalid",
|
|
27
|
+
)
|
|
28
|
+
],
|
|
29
|
+
verbose_name="Variable name",
|
|
30
|
+
),
|
|
31
|
+
),
|
|
32
|
+
]
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Generated by Django 4.2.13 on 2024-05-09 20:22
|
|
2
|
+
|
|
3
|
+
from django.db import migrations, models
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class Migration(migrations.Migration):
|
|
7
|
+
|
|
8
|
+
dependencies = [
|
|
9
|
+
("cookie_consent", "0003_alter_cookiegroup_varname"),
|
|
10
|
+
]
|
|
11
|
+
|
|
12
|
+
operations = [
|
|
13
|
+
migrations.AddConstraint(
|
|
14
|
+
model_name="cookie",
|
|
15
|
+
constraint=models.UniqueConstraint(
|
|
16
|
+
fields=("cookiegroup", "name", "domain"), name="natural_key"
|
|
17
|
+
),
|
|
18
|
+
),
|
|
19
|
+
]
|
cookie_consent/models.py
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
# -*- coding: utf-8 -*-
|
|
2
2
|
import re
|
|
3
|
+
from typing import TypedDict
|
|
3
4
|
|
|
4
5
|
from django.core.validators import RegexValidator
|
|
5
6
|
from django.db import models
|
|
6
7
|
from django.utils.translation import gettext_lazy as _
|
|
7
8
|
|
|
8
|
-
from cookie_consent.cache import delete_cache
|
|
9
|
-
|
|
10
9
|
COOKIE_NAME_RE = re.compile(r"^[-_a-zA-Z0-9]+$")
|
|
11
10
|
validate_cookie_name = RegexValidator(
|
|
12
11
|
COOKIE_NAME_RE,
|
|
@@ -18,9 +17,48 @@ validate_cookie_name = RegexValidator(
|
|
|
18
17
|
)
|
|
19
18
|
|
|
20
19
|
|
|
20
|
+
def clear_cache_after(func):
|
|
21
|
+
def wrapper(*args, **kwargs):
|
|
22
|
+
from .cache import delete_cache
|
|
23
|
+
|
|
24
|
+
return_value = func(*args, **kwargs)
|
|
25
|
+
delete_cache()
|
|
26
|
+
return return_value
|
|
27
|
+
|
|
28
|
+
return wrapper
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class CookieGroupDict(TypedDict):
|
|
32
|
+
varname: str
|
|
33
|
+
name: str
|
|
34
|
+
description: str
|
|
35
|
+
is_required: bool
|
|
36
|
+
# TODO: should we output this? page cache busting would be
|
|
37
|
+
# required if we do this. Alternatively, set up a JSONView to output these?
|
|
38
|
+
# version: str
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
class BaseQueryset(models.query.QuerySet):
|
|
42
|
+
@clear_cache_after
|
|
43
|
+
def delete(self):
|
|
44
|
+
return super().delete()
|
|
45
|
+
|
|
46
|
+
@clear_cache_after
|
|
47
|
+
def update(self, **kwargs):
|
|
48
|
+
return super().update(**kwargs)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
class CookieGroupManager(models.Manager.from_queryset(BaseQueryset)):
|
|
52
|
+
def get_by_natural_key(self, varname):
|
|
53
|
+
return self.get(varname=varname)
|
|
54
|
+
|
|
55
|
+
|
|
21
56
|
class CookieGroup(models.Model):
|
|
22
57
|
varname = models.CharField(
|
|
23
|
-
_("Variable name"),
|
|
58
|
+
_("Variable name"),
|
|
59
|
+
max_length=32,
|
|
60
|
+
unique=True,
|
|
61
|
+
validators=[validate_cookie_name],
|
|
24
62
|
)
|
|
25
63
|
name = models.CharField(_("Name"), max_length=100, blank=True)
|
|
26
64
|
description = models.TextField(_("Description"), blank=True)
|
|
@@ -37,6 +75,8 @@ class CookieGroup(models.Model):
|
|
|
37
75
|
ordering = models.IntegerField(_("Ordering"), default=0)
|
|
38
76
|
created = models.DateTimeField(_("Created"), auto_now_add=True, blank=True)
|
|
39
77
|
|
|
78
|
+
objects = CookieGroupManager()
|
|
79
|
+
|
|
40
80
|
class Meta:
|
|
41
81
|
verbose_name = _("Cookie Group")
|
|
42
82
|
verbose_name_plural = _("Cookie Groups")
|
|
@@ -45,19 +85,37 @@ class CookieGroup(models.Model):
|
|
|
45
85
|
def __str__(self):
|
|
46
86
|
return self.name
|
|
47
87
|
|
|
48
|
-
|
|
88
|
+
@clear_cache_after
|
|
89
|
+
def save(self, *args, **kwargs):
|
|
90
|
+
super().save(*args, **kwargs)
|
|
91
|
+
|
|
92
|
+
@clear_cache_after
|
|
93
|
+
def delete(self, *args, **kwargs):
|
|
94
|
+
return super().delete(*args, **kwargs)
|
|
95
|
+
|
|
96
|
+
def natural_key(self):
|
|
97
|
+
return (self.varname,)
|
|
98
|
+
|
|
99
|
+
def get_version(self) -> str:
|
|
49
100
|
try:
|
|
50
101
|
return str(self.cookie_set.all()[0].get_version())
|
|
51
102
|
except IndexError:
|
|
52
103
|
return ""
|
|
53
104
|
|
|
54
|
-
def
|
|
55
|
-
|
|
56
|
-
|
|
105
|
+
def for_json(self) -> CookieGroupDict:
|
|
106
|
+
return {
|
|
107
|
+
"varname": self.varname,
|
|
108
|
+
"name": self.name,
|
|
109
|
+
"description": self.description,
|
|
110
|
+
"is_required": self.is_required,
|
|
111
|
+
# "version": self.get_version(),
|
|
112
|
+
}
|
|
57
113
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
114
|
+
|
|
115
|
+
class CookieManager(models.Manager.from_queryset(BaseQueryset)):
|
|
116
|
+
def get_by_natural_key(self, name, domain, cookiegroup):
|
|
117
|
+
group = CookieGroup.objects.get_by_natural_key(cookiegroup)
|
|
118
|
+
return self.get(cookiegroup=group, name=name, domain=domain)
|
|
61
119
|
|
|
62
120
|
|
|
63
121
|
class Cookie(models.Model):
|
|
@@ -72,14 +130,35 @@ class Cookie(models.Model):
|
|
|
72
130
|
domain = models.CharField(_("Domain"), max_length=250, blank=True)
|
|
73
131
|
created = models.DateTimeField(_("Created"), auto_now_add=True, blank=True)
|
|
74
132
|
|
|
133
|
+
objects = CookieManager()
|
|
134
|
+
|
|
75
135
|
class Meta:
|
|
76
136
|
verbose_name = _("Cookie")
|
|
77
137
|
verbose_name_plural = _("Cookies")
|
|
138
|
+
constraints = [
|
|
139
|
+
models.UniqueConstraint(
|
|
140
|
+
fields=("cookiegroup", "name", "domain"),
|
|
141
|
+
name="natural_key",
|
|
142
|
+
),
|
|
143
|
+
]
|
|
78
144
|
ordering = ["-created"]
|
|
79
145
|
|
|
80
146
|
def __str__(self):
|
|
81
147
|
return "%s %s%s" % (self.name, self.domain, self.path)
|
|
82
148
|
|
|
149
|
+
@clear_cache_after
|
|
150
|
+
def save(self, *args, **kwargs):
|
|
151
|
+
super().save(*args, **kwargs)
|
|
152
|
+
|
|
153
|
+
@clear_cache_after
|
|
154
|
+
def delete(self, *args, **kwargs):
|
|
155
|
+
return super().delete(*args, **kwargs)
|
|
156
|
+
|
|
157
|
+
def natural_key(self):
|
|
158
|
+
return (self.name, self.domain) + self.cookiegroup.natural_key()
|
|
159
|
+
|
|
160
|
+
natural_key.dependencies = ["cookie_consent.cookiegroup"]
|
|
161
|
+
|
|
83
162
|
@property
|
|
84
163
|
def varname(self):
|
|
85
164
|
return "%s=%s:%s" % (self.cookiegroup.varname, self.name, self.domain)
|
|
@@ -87,14 +166,6 @@ class Cookie(models.Model):
|
|
|
87
166
|
def get_version(self):
|
|
88
167
|
return self.created.isoformat()
|
|
89
168
|
|
|
90
|
-
def delete(self, *args, **kwargs):
|
|
91
|
-
super(Cookie, self).delete(*args, **kwargs)
|
|
92
|
-
delete_cache()
|
|
93
|
-
|
|
94
|
-
def save(self, *args, **kwargs):
|
|
95
|
-
super(Cookie, self).save(*args, **kwargs)
|
|
96
|
-
delete_cache()
|
|
97
|
-
|
|
98
169
|
|
|
99
170
|
ACTION_ACCEPTED = 1
|
|
100
171
|
ACTION_DECLINED = -1
|
|
@@ -10,7 +10,7 @@ function evalXCookieConsent(script) {
|
|
|
10
10
|
script.remove();
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
function
|
|
13
|
+
function lecacyShowCookieBar (options) {
|
|
14
14
|
const defaults = {
|
|
15
15
|
content: '',
|
|
16
16
|
cookie_groups: [],
|
|
@@ -64,3 +64,4 @@ function showCookieBar (options) {
|
|
|
64
64
|
});
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
+
window.legacyShowCookieBar = window.showCookieBar = lecacyShowCookieBar;
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
// src/cookiebar.ts
|
|
2
|
+
var DEFAULT_FETCH_HEADERS = {
|
|
3
|
+
"X-Cookie-Consent-Fetch": "1"
|
|
4
|
+
};
|
|
5
|
+
var FetchClient = class {
|
|
6
|
+
constructor(statusUrl, csrfHeaderName) {
|
|
7
|
+
this.statusUrl = statusUrl;
|
|
8
|
+
this.csrfHeaderName = csrfHeaderName;
|
|
9
|
+
this.cookieStatus = null;
|
|
10
|
+
}
|
|
11
|
+
async getCookieStatus() {
|
|
12
|
+
if (this.cookieStatus === null) {
|
|
13
|
+
const response = await window.fetch(
|
|
14
|
+
this.statusUrl,
|
|
15
|
+
{
|
|
16
|
+
method: "GET",
|
|
17
|
+
credentials: "same-origin",
|
|
18
|
+
headers: DEFAULT_FETCH_HEADERS
|
|
19
|
+
}
|
|
20
|
+
);
|
|
21
|
+
this.cookieStatus = await response.json();
|
|
22
|
+
}
|
|
23
|
+
if (this.cookieStatus === null) {
|
|
24
|
+
throw new Error("Unexpectedly received null cookie status");
|
|
25
|
+
}
|
|
26
|
+
return this.cookieStatus;
|
|
27
|
+
}
|
|
28
|
+
async saveCookiesStatusBackend(urlProperty) {
|
|
29
|
+
const cookieStatus = await this.getCookieStatus();
|
|
30
|
+
const url = cookieStatus[urlProperty];
|
|
31
|
+
if (!url) {
|
|
32
|
+
throw new Error(`Missing url for ${urlProperty} - was the cookie status not loaded properly?`);
|
|
33
|
+
}
|
|
34
|
+
await window.fetch(url, {
|
|
35
|
+
method: "POST",
|
|
36
|
+
credentials: "same-origin",
|
|
37
|
+
headers: {
|
|
38
|
+
...DEFAULT_FETCH_HEADERS,
|
|
39
|
+
[this.csrfHeaderName]: cookieStatus.csrftoken
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
var loadCookieGroups = (selector) => {
|
|
45
|
+
const node = document.querySelector(selector);
|
|
46
|
+
if (!node) {
|
|
47
|
+
throw new Error(`No cookie groups (script) tag found, using selector: '${selector}'`);
|
|
48
|
+
}
|
|
49
|
+
return JSON.parse(node.innerText);
|
|
50
|
+
};
|
|
51
|
+
var doInsertBefore = (beforeNode, newNode) => {
|
|
52
|
+
const parent = beforeNode.parentNode;
|
|
53
|
+
if (parent === null)
|
|
54
|
+
throw new Error("Reference node doesn't have a parent.");
|
|
55
|
+
parent.insertBefore(newNode, beforeNode);
|
|
56
|
+
};
|
|
57
|
+
var registerEvents = ({
|
|
58
|
+
client,
|
|
59
|
+
cookieBarNode,
|
|
60
|
+
cookieGroups,
|
|
61
|
+
acceptSelector,
|
|
62
|
+
onAccept,
|
|
63
|
+
declineSelector,
|
|
64
|
+
onDecline,
|
|
65
|
+
acceptedCookieGroups: accepted,
|
|
66
|
+
declinedCookieGroups: declined,
|
|
67
|
+
notAcceptedOrDeclinedCookieGroups: undecided
|
|
68
|
+
}) => {
|
|
69
|
+
const acceptNode = cookieBarNode.querySelector(acceptSelector);
|
|
70
|
+
if (acceptNode) {
|
|
71
|
+
acceptNode.addEventListener("click", (event) => {
|
|
72
|
+
event.preventDefault();
|
|
73
|
+
const acceptedGroups = filterCookieGroups(cookieGroups, accepted.concat(undecided));
|
|
74
|
+
onAccept == null ? void 0 : onAccept(acceptedGroups, event);
|
|
75
|
+
client.saveCookiesStatusBackend("acceptUrl");
|
|
76
|
+
cookieBarNode.parentNode.removeChild(cookieBarNode);
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
const declineNode = cookieBarNode.querySelector(declineSelector);
|
|
80
|
+
if (declineNode) {
|
|
81
|
+
declineNode.addEventListener("click", (event) => {
|
|
82
|
+
event.preventDefault();
|
|
83
|
+
const declinedGroups = filterCookieGroups(cookieGroups, declined.concat(undecided));
|
|
84
|
+
onDecline == null ? void 0 : onDecline(declinedGroups, event);
|
|
85
|
+
client.saveCookiesStatusBackend("declineUrl");
|
|
86
|
+
cookieBarNode.parentNode.removeChild(cookieBarNode);
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
var filterCookieGroups = (cookieGroups, varNames) => {
|
|
91
|
+
return cookieGroups.filter((group) => varNames.includes(group.varname));
|
|
92
|
+
};
|
|
93
|
+
function cloneNode(node) {
|
|
94
|
+
return node.cloneNode(true);
|
|
95
|
+
}
|
|
96
|
+
var showCookieBar = async (options = {}) => {
|
|
97
|
+
const {
|
|
98
|
+
templateSelector = "#cookie-consent__cookie-bar",
|
|
99
|
+
cookieGroupsSelector = "#cookie-consent__cookie-groups",
|
|
100
|
+
acceptSelector = ".cookie-consent__accept",
|
|
101
|
+
declineSelector = ".cookie-consent__decline",
|
|
102
|
+
insertBefore = null,
|
|
103
|
+
onShow,
|
|
104
|
+
onAccept,
|
|
105
|
+
onDecline,
|
|
106
|
+
statusUrl = "",
|
|
107
|
+
csrfHeaderName = "X-CSRFToken"
|
|
108
|
+
// Django's default, can be overridden with settings.CSRF_HEADER_NAME
|
|
109
|
+
} = options;
|
|
110
|
+
const cookieGroups = loadCookieGroups(cookieGroupsSelector);
|
|
111
|
+
if (!cookieGroups.length)
|
|
112
|
+
return;
|
|
113
|
+
const templateNode = document.querySelector(templateSelector);
|
|
114
|
+
if (!templateNode) {
|
|
115
|
+
throw new Error(`No (template) element found for selector '${templateSelector}'.`);
|
|
116
|
+
}
|
|
117
|
+
const doInsert = insertBefore === null ? (cookieBarNode2) => document.querySelector("body").appendChild(cookieBarNode2) : typeof insertBefore === "string" ? (cookieBarNode2) => {
|
|
118
|
+
const referenceNode = document.querySelector(insertBefore);
|
|
119
|
+
if (referenceNode === null)
|
|
120
|
+
throw new Error(`No element found for selector '${insertBefore}'.`);
|
|
121
|
+
doInsertBefore(referenceNode, cookieBarNode2);
|
|
122
|
+
} : (cookieBarNode2) => doInsertBefore(insertBefore, cookieBarNode2);
|
|
123
|
+
if (!statusUrl)
|
|
124
|
+
throw new Error("Missing status URL option, did you forget to pass the `statusUrl` option?");
|
|
125
|
+
const client = new FetchClient(statusUrl, csrfHeaderName);
|
|
126
|
+
const cookieStatus = await client.getCookieStatus();
|
|
127
|
+
const {
|
|
128
|
+
acceptedCookieGroups,
|
|
129
|
+
declinedCookieGroups,
|
|
130
|
+
notAcceptedOrDeclinedCookieGroups
|
|
131
|
+
} = cookieStatus;
|
|
132
|
+
const acceptedGroups = filterCookieGroups(cookieGroups, acceptedCookieGroups);
|
|
133
|
+
if (acceptedGroups.length)
|
|
134
|
+
onAccept == null ? void 0 : onAccept(acceptedGroups);
|
|
135
|
+
const declinedGroups = filterCookieGroups(cookieGroups, declinedCookieGroups);
|
|
136
|
+
if (declinedGroups.length)
|
|
137
|
+
onDecline == null ? void 0 : onDecline(declinedGroups);
|
|
138
|
+
if (!notAcceptedOrDeclinedCookieGroups.length)
|
|
139
|
+
return;
|
|
140
|
+
const childToClone = templateNode.content.firstElementChild;
|
|
141
|
+
if (childToClone === null)
|
|
142
|
+
throw new Error("The cookie bar template element may not be empty.");
|
|
143
|
+
const cookieBarNode = cloneNode(childToClone);
|
|
144
|
+
registerEvents({
|
|
145
|
+
client,
|
|
146
|
+
cookieBarNode,
|
|
147
|
+
cookieGroups,
|
|
148
|
+
acceptSelector,
|
|
149
|
+
onAccept,
|
|
150
|
+
declineSelector,
|
|
151
|
+
onDecline,
|
|
152
|
+
acceptedCookieGroups,
|
|
153
|
+
declinedCookieGroups,
|
|
154
|
+
notAcceptedOrDeclinedCookieGroups
|
|
155
|
+
});
|
|
156
|
+
doInsert(cookieBarNode);
|
|
157
|
+
onShow == null ? void 0 : onShow();
|
|
158
|
+
};
|
|
159
|
+
export {
|
|
160
|
+
loadCookieGroups,
|
|
161
|
+
showCookieBar
|
|
162
|
+
};
|
|
163
|
+
//# sourceMappingURL=cookiebar.module.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../js/src/cookiebar.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Cookiebar functionality, as a TS/JS module.\n *\n * About modules: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules\n *\n * The code is organized here in a way to make the templates work with Django's page\n * cache. This means that anything user-specific (so different django session and even\n * cookie consent cookies) cannot be baked into the templates, as that breaks caches.\n *\n * The cookie bar operates on the following principles:\n *\n * - The developer using the library includes the desired template in their django\n * templates, using the HTML <template> element. This contains the content for the\n * cookie bar.\n * - The developer is responsible for loading some Javascript that loads this script.\n * - The main export of this script needs to be called (showCookieBar), with the\n * appropriate options.\n * - The options include the backend URLs where the retrieve data, which selectors/DOM\n * nodes to use for various functionality and the hooks to tap into the accept/decline\n * life-cycle.\n * - When a user accepts or declines (all) cookies, the call to the backend is made via\n * a fetch request, bypassing any page caches and preventing full-page reloads.\n */\n\n/**\n * A serialized cookie group.\n *\n * See the backend model method `CookieGroup.as_json()`.\n */\nexport interface CookieGroup {\n varname: string;\n name: string;\n description: string;\n is_required: boolean;\n}\n\nexport interface Options {\n statusUrl: string;\n // TODO: also accept element rather than selector?\n templateSelector: string;\n /**\n * DOM selector to the (script) tag holding the JSON-serialized cookie groups.\n *\n * This is typically rendered in a template with a template tag, e.g.\n *\n * ```django\n * {% all_cookie_groups 'cookie-consent__cookie-groups' %}\n * ```\n *\n * resulting in the selector: `'#cookie-consent__cookie-groups'`.\n */\n cookieGroupsSelector: string;\n acceptSelector: string;\n declineSelector: string;\n /**\n * Either a string (selector), DOMNode or null.\n *\n * If null, the bar is appended to the body. If provided, the node is used or looked\n * up.\n */\n insertBefore: string | HTMLElement | null;\n /**\n * Optional callback for when the cookie bar is being shown.\n *\n * You can use this to add a CSS class name to the body, for example.\n */\n onShow?: () => void;\n /**\n * Optional callback called when cookies are accepted.\n */\n onAccept?: (acceptedGroups: CookieGroup[], event?: MouseEvent) => void;\n /**\n * Optional callback called when cookies are accepted.\n */\n onDecline?: (declinedGroups: CookieGroup[], event?: MouseEvent) => void;\n /**\n * Name of the header to use for the CSRF token.\n *\n * If needed, this can be read/set via `settings.CSRF_HEADER_NAME` in the backend.\n */\n csrfHeaderName: string;\n};\n\nexport interface CookieStatus {\n csrftoken: string;\n /**\n * Backend endpoint to POST to to accept the cookie groups.\n */\n acceptUrl: string;\n /**\n * Backend endpoint to POST to to decline the cookie groups.\n */\n declineUrl: string;\n /**\n * Array of accepted cookie group varnames.\n */\n acceptedCookieGroups: string[];\n /**\n * Array of declined cookie group varnames.\n */\n declinedCookieGroups: string[];\n /**\n * Array of undecided cookie group varnames.\n */\n notAcceptedOrDeclinedCookieGroups: string[];\n}\n\nconst DEFAULT_FETCH_HEADERS: Record<string, string> = {\n 'X-Cookie-Consent-Fetch': '1'\n};\n\nclass FetchClient {\n protected statusUrl: string;\n protected csrfHeaderName: string;\n protected cookieStatus: CookieStatus | null;\n\n constructor(statusUrl: string, csrfHeaderName: string) {\n this.statusUrl = statusUrl;\n this.csrfHeaderName = csrfHeaderName;\n this.cookieStatus = null;\n }\n\n async getCookieStatus(): Promise<CookieStatus> {\n if (this.cookieStatus === null) {\n const response = await window.fetch(\n this.statusUrl,\n {\n method: 'GET',\n credentials: 'same-origin',\n headers: DEFAULT_FETCH_HEADERS,\n }\n );\n this.cookieStatus = await response.json();\n }\n\n // type checker sanity check\n if (this.cookieStatus === null) {\n throw new Error('Unexpectedly received null cookie status');\n }\n return this.cookieStatus;\n };\n\n async saveCookiesStatusBackend (urlProperty: 'acceptUrl' | 'declineUrl') {\n const cookieStatus = await this.getCookieStatus();\n const url = cookieStatus[urlProperty];\n if (!url) {\n throw new Error(`Missing url for ${urlProperty} - was the cookie status not loaded properly?`);\n }\n\n await window.fetch(url, {\n method: 'POST',\n credentials: 'same-origin',\n headers: {\n ...DEFAULT_FETCH_HEADERS,\n [this.csrfHeaderName]: cookieStatus.csrftoken\n }\n });\n }\n}\n\n/**\n * Read the JSON script node contents and parse the content as JSON.\n *\n * The result is the list of available/configured cookie groups.\n * Use the status URL to get the accepted/declined status for an individual user.\n */\nexport const loadCookieGroups = (selector: string): CookieGroup[] => {\n const node = document.querySelector<HTMLScriptElement>(selector);\n if (!node) {\n throw new Error(`No cookie groups (script) tag found, using selector: '${selector}'`);\n }\n return JSON.parse(node.innerText);\n};\n\nconst doInsertBefore = (beforeNode: HTMLElement, newNode: Node): void => {\n const parent = beforeNode.parentNode;\n if (parent === null) throw new Error('Reference node doesn\\'t have a parent.');\n parent.insertBefore(newNode, beforeNode);\n}\n\ntype RegisterEventsOptions = Pick<\n Options,\n 'acceptSelector' | 'onAccept' | 'declineSelector' | 'onDecline'\n> & Pick<\n CookieStatus,\n 'acceptedCookieGroups' | 'declinedCookieGroups' | 'notAcceptedOrDeclinedCookieGroups'\n> & {\n client: FetchClient,\n cookieBarNode: Element;\n cookieGroups: CookieGroup[];\n}\n\n/**\n * Register the accept/decline event handlers.\n *\n * Note that we can't just set the decline or accept cookie purely client-side, as the\n * cookie possibly has the httpOnly flag set.\n */\nconst registerEvents = ({\n client,\n cookieBarNode,\n cookieGroups,\n acceptSelector,\n onAccept,\n declineSelector,\n onDecline,\n acceptedCookieGroups: accepted,\n declinedCookieGroups: declined,\n notAcceptedOrDeclinedCookieGroups: undecided,\n}: RegisterEventsOptions): void => {\n\n const acceptNode = cookieBarNode.querySelector<HTMLElement>(acceptSelector);\n if (acceptNode) {\n acceptNode.addEventListener('click', event => {\n event.preventDefault();\n const acceptedGroups = filterCookieGroups(cookieGroups, accepted.concat(undecided));\n onAccept?.(acceptedGroups, event);\n // trigger async action, but don't wait for completion\n client.saveCookiesStatusBackend('acceptUrl');\n cookieBarNode.parentNode!.removeChild(cookieBarNode);\n });\n }\n\n const declineNode = cookieBarNode.querySelector<HTMLElement>(declineSelector);\n if (declineNode) {\n declineNode.addEventListener('click', event => {\n event.preventDefault();\n const declinedGroups = filterCookieGroups(cookieGroups, declined.concat(undecided));\n onDecline?.(declinedGroups, event);\n // trigger async action, but don't wait for completion\n client.saveCookiesStatusBackend('declineUrl');\n cookieBarNode.parentNode!.removeChild(cookieBarNode);\n });\n }\n};\n\n/**\n * Filter the cookie groups down to a subset of specified varnames.\n */\nconst filterCookieGroups = (cookieGroups: CookieGroup[], varNames: string[]) => {\n return cookieGroups.filter(group => varNames.includes(group.varname));\n};\n\n// See https://github.com/microsoft/TypeScript/issues/283\nfunction cloneNode<T extends Node>(node: T) {\n return <T>node.cloneNode(true);\n}\n\nexport const showCookieBar = async (options: Partial<Options> = {}): Promise<void> => {\n const {\n templateSelector = '#cookie-consent__cookie-bar',\n cookieGroupsSelector = '#cookie-consent__cookie-groups',\n acceptSelector = '.cookie-consent__accept',\n declineSelector = '.cookie-consent__decline',\n insertBefore = null,\n onShow,\n onAccept,\n onDecline,\n statusUrl = '',\n csrfHeaderName = 'X-CSRFToken', // Django's default, can be overridden with settings.CSRF_HEADER_NAME\n } = options;\n\n const cookieGroups = loadCookieGroups(cookieGroupsSelector);\n\n // no cookie groups -> abort, nothing to do\n if (!cookieGroups.length) return;\n\n const templateNode = document.querySelector<HTMLTemplateElement>(templateSelector);\n if (!templateNode) {\n throw new Error(`No (template) element found for selector '${templateSelector}'.`)\n }\n\n // insert before a given node, if specified, or append to the body as default behaviour\n const doInsert = insertBefore === null\n ? (cookieBarNode: Node) => document.querySelector('body')!.appendChild(cookieBarNode)\n : typeof insertBefore === 'string'\n ? (cookieBarNode: Node) => {\n const referenceNode = document.querySelector<HTMLElement>(insertBefore);\n if (referenceNode === null) throw new Error(`No element found for selector '${insertBefore}'.`)\n doInsertBefore(referenceNode, cookieBarNode);\n }\n : (cookieBarNode: Node) => doInsertBefore(insertBefore, cookieBarNode)\n ;\n\n if (!statusUrl) throw new Error('Missing status URL option, did you forget to pass the `statusUrl` option?');\n\n const client = new FetchClient(statusUrl, csrfHeaderName);\n const cookieStatus = await client.getCookieStatus();\n\n // calculate the cookie groups to invoke the callbacks. We deliberately fire those\n // without awaiting so that our cookie bar is shown/hidden as soon as possible.\n const {\n acceptedCookieGroups,\n declinedCookieGroups,\n notAcceptedOrDeclinedCookieGroups\n } = cookieStatus;\n\n const acceptedGroups = filterCookieGroups(cookieGroups, acceptedCookieGroups);\n if (acceptedGroups.length) onAccept?.(acceptedGroups);\n const declinedGroups = filterCookieGroups(cookieGroups, declinedCookieGroups);\n if (declinedGroups.length) onDecline?.(declinedGroups);\n\n // there are no (more) cookie groups to accept, don't show the bar\n if (!notAcceptedOrDeclinedCookieGroups.length) return;\n\n // grab the contents from the template node and add them to the DOM, optionally\n // calling the onShow callback\n const childToClone = templateNode.content.firstElementChild;\n if (childToClone === null) throw new Error('The cookie bar template element may not be empty.');\n const cookieBarNode = cloneNode(childToClone);\n registerEvents({\n client,\n cookieBarNode,\n cookieGroups,\n acceptSelector,\n onAccept,\n declineSelector,\n onDecline,\n acceptedCookieGroups,\n declinedCookieGroups,\n notAcceptedOrDeclinedCookieGroups,\n });\n doInsert(cookieBarNode);\n onShow?.();\n};\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": ["cookieBarNode"]
|
|
7
|
+
}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
from django import template
|
|
1
|
+
import warnings
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
from django.core.urlresolvers import reverse
|
|
3
|
+
from django import template
|
|
4
|
+
from django.urls import reverse
|
|
5
|
+
from django.utils.html import json_script
|
|
8
6
|
|
|
9
|
-
from
|
|
10
|
-
from
|
|
7
|
+
from ..cache import all_cookie_groups as get_all_cookie_groups
|
|
8
|
+
from ..conf import settings
|
|
9
|
+
from ..util import (
|
|
11
10
|
are_all_cookies_accepted,
|
|
12
11
|
get_accepted_cookies,
|
|
13
12
|
get_cookie_dict_from_request,
|
|
@@ -90,10 +89,15 @@ def cookie_consent_decline_url(cookie_groups):
|
|
|
90
89
|
|
|
91
90
|
|
|
92
91
|
@register.simple_tag
|
|
93
|
-
def get_accept_cookie_groups_cookie_string(request, cookie_groups):
|
|
92
|
+
def get_accept_cookie_groups_cookie_string(request, cookie_groups): # pragma: no cover
|
|
94
93
|
"""
|
|
95
94
|
Tag returns accept cookie string suitable to use in javascript.
|
|
96
95
|
"""
|
|
96
|
+
warnings.warn(
|
|
97
|
+
"Cookie string template tags for JS are deprecated and will be removed "
|
|
98
|
+
"in django-cookie-consent 1.0",
|
|
99
|
+
DeprecationWarning,
|
|
100
|
+
)
|
|
97
101
|
cookie_dic = get_cookie_dict_from_request(request)
|
|
98
102
|
for cookie_group in cookie_groups:
|
|
99
103
|
cookie_dic[cookie_group.varname] = cookie_group.get_version()
|
|
@@ -105,6 +109,11 @@ def get_decline_cookie_groups_cookie_string(request, cookie_groups):
|
|
|
105
109
|
"""
|
|
106
110
|
Tag returns decline cookie string suitable to use in javascript.
|
|
107
111
|
"""
|
|
112
|
+
warnings.warn(
|
|
113
|
+
"Cookie string template tags for JS are deprecated and will be removed "
|
|
114
|
+
"in django-cookie-consent 1.0",
|
|
115
|
+
DeprecationWarning,
|
|
116
|
+
)
|
|
108
117
|
cookie_dic = get_cookie_dict_from_request(request)
|
|
109
118
|
for cookie_group in cookie_groups:
|
|
110
119
|
cookie_dic[cookie_group.varname] = settings.COOKIE_CONSENT_DECLINE
|
|
@@ -124,6 +133,13 @@ def js_type_for_cookie_consent(request, varname, cookie=None):
|
|
|
124
133
|
alert("Social cookie accepted");
|
|
125
134
|
</script>
|
|
126
135
|
"""
|
|
136
|
+
# This approach doesn't work with page caches and/or strict Content-Security-Policies
|
|
137
|
+
# (unless you use nonces, which again doesn't work with aggressive page caching).
|
|
138
|
+
warnings.warn(
|
|
139
|
+
"Template tags for use in/with JS are deprecated and will be removed "
|
|
140
|
+
"in django-cookie-consent 1.0",
|
|
141
|
+
DeprecationWarning,
|
|
142
|
+
)
|
|
127
143
|
enabled = is_cookie_consent_enabled(request)
|
|
128
144
|
if not enabled:
|
|
129
145
|
res = True
|
|
@@ -147,3 +163,17 @@ def accepted_cookies(request):
|
|
|
147
163
|
|
|
148
164
|
"""
|
|
149
165
|
return [c.varname for c in get_accepted_cookies(request)]
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
@register.simple_tag
|
|
169
|
+
def all_cookie_groups(element_id: str):
|
|
170
|
+
"""
|
|
171
|
+
Serialize all cookie groups to JSON and output them in a script tag.
|
|
172
|
+
|
|
173
|
+
:param element_id: The ID for the script tag so you can look it up in JS later.
|
|
174
|
+
|
|
175
|
+
This uses Django's core json_script filter under the hood.
|
|
176
|
+
"""
|
|
177
|
+
groups = get_all_cookie_groups()
|
|
178
|
+
value = [group.for_json() for group in groups.values()]
|
|
179
|
+
return json_script(value, element_id)
|
cookie_consent/urls.py
CHANGED
|
@@ -1,31 +1,37 @@
|
|
|
1
1
|
# -*- coding: utf-8 -*-
|
|
2
|
-
from django.urls import re_path
|
|
2
|
+
from django.urls import path, re_path
|
|
3
3
|
from django.views.decorators.csrf import csrf_exempt
|
|
4
4
|
|
|
5
|
-
from .views import
|
|
5
|
+
from .views import (
|
|
6
|
+
CookieGroupAcceptView,
|
|
7
|
+
CookieGroupDeclineView,
|
|
8
|
+
CookieGroupListView,
|
|
9
|
+
CookieStatusView,
|
|
10
|
+
)
|
|
6
11
|
|
|
7
12
|
urlpatterns = [
|
|
8
|
-
|
|
9
|
-
|
|
13
|
+
path(
|
|
14
|
+
"accept/",
|
|
10
15
|
csrf_exempt(CookieGroupAcceptView.as_view()),
|
|
11
16
|
name="cookie_consent_accept_all",
|
|
12
17
|
),
|
|
18
|
+
# TODO: use form or query string params for this instead?
|
|
13
19
|
re_path(
|
|
14
20
|
r"^accept/(?P<varname>.*)/$",
|
|
15
21
|
csrf_exempt(CookieGroupAcceptView.as_view()),
|
|
16
22
|
name="cookie_consent_accept",
|
|
17
23
|
),
|
|
24
|
+
# TODO: use form or query string params for this instead?
|
|
18
25
|
re_path(
|
|
19
26
|
r"^decline/(?P<varname>.*)/$",
|
|
20
27
|
csrf_exempt(CookieGroupDeclineView.as_view()),
|
|
21
28
|
name="cookie_consent_decline",
|
|
22
29
|
),
|
|
23
|
-
|
|
24
|
-
|
|
30
|
+
path(
|
|
31
|
+
"decline/",
|
|
25
32
|
csrf_exempt(CookieGroupDeclineView.as_view()),
|
|
26
33
|
name="cookie_consent_decline_all",
|
|
27
34
|
),
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
),
|
|
35
|
+
path("status/", CookieStatusView.as_view(), name="cookie_consent_status"),
|
|
36
|
+
path("", CookieGroupListView.as_view(), name="cookie_consent_cookie_group_list"),
|
|
31
37
|
]
|
cookie_consent/util.py
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
# -*- coding: utf-8 -*-
|
|
2
2
|
import datetime
|
|
3
|
+
from typing import Union
|
|
3
4
|
|
|
4
|
-
from
|
|
5
|
-
|
|
6
|
-
from
|
|
7
|
-
from cookie_consent.conf import settings
|
|
8
|
-
from cookie_consent.models import ACTION_ACCEPTED, ACTION_DECLINED, LogItem
|
|
5
|
+
from .cache import all_cookie_groups, get_cookie, get_cookie_group
|
|
6
|
+
from .conf import settings
|
|
7
|
+
from .models import ACTION_ACCEPTED, ACTION_DECLINED, LogItem
|
|
9
8
|
|
|
10
9
|
|
|
11
10
|
def parse_cookie_str(cookie):
|
|
@@ -100,7 +99,7 @@ def accept_cookies(request, response, varname=None):
|
|
|
100
99
|
def delete_cookies(response, cookie_group):
|
|
101
100
|
if cookie_group.is_deletable:
|
|
102
101
|
for cookie in cookie_group.cookie_set.all():
|
|
103
|
-
response.delete_cookie(
|
|
102
|
+
response.delete_cookie(cookie.name, cookie.path, cookie.domain)
|
|
104
103
|
|
|
105
104
|
|
|
106
105
|
def decline_cookies(request, response, varname=None):
|
|
@@ -132,17 +131,35 @@ def are_all_cookies_accepted(request):
|
|
|
132
131
|
)
|
|
133
132
|
|
|
134
133
|
|
|
135
|
-
def
|
|
136
|
-
"""
|
|
137
|
-
Returns all cookie groups that are neither accepted or declined.
|
|
138
|
-
"""
|
|
134
|
+
def _get_cookie_groups_by_state(request, state: Union[bool, None]):
|
|
139
135
|
return [
|
|
140
136
|
cookie_group
|
|
141
137
|
for cookie_group in get_cookie_groups()
|
|
142
|
-
if get_cookie_value_from_request(request, cookie_group.varname) is
|
|
138
|
+
if get_cookie_value_from_request(request, cookie_group.varname) is state
|
|
143
139
|
]
|
|
144
140
|
|
|
145
141
|
|
|
142
|
+
def get_not_accepted_or_declined_cookie_groups(request):
|
|
143
|
+
"""
|
|
144
|
+
Returns all cookie groups that are neither accepted or declined.
|
|
145
|
+
"""
|
|
146
|
+
return _get_cookie_groups_by_state(request, state=None)
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
def get_accepted_cookie_groups(request):
|
|
150
|
+
"""
|
|
151
|
+
Returns all cookie groups that are accepted.
|
|
152
|
+
"""
|
|
153
|
+
return _get_cookie_groups_by_state(request, state=True)
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
def get_declined_cookie_groups(request):
|
|
157
|
+
"""
|
|
158
|
+
Returns all cookie groups that are declined.
|
|
159
|
+
"""
|
|
160
|
+
return _get_cookie_groups_by_state(request, state=False)
|
|
161
|
+
|
|
162
|
+
|
|
146
163
|
def is_cookie_consent_enabled(request):
|
|
147
164
|
"""
|
|
148
165
|
Returns if django-cookie-consent is enabled for given request.
|
cookie_consent/views.py
CHANGED
|
@@ -1,12 +1,30 @@
|
|
|
1
1
|
# -*- coding: utf-8 -*-
|
|
2
|
+
from django.contrib.auth.views import RedirectURLMixin
|
|
2
3
|
from django.core.exceptions import SuspiciousOperation
|
|
3
|
-
from django.http import HttpResponse, HttpResponseRedirect
|
|
4
|
+
from django.http import HttpRequest, HttpResponse, HttpResponseRedirect, JsonResponse
|
|
5
|
+
from django.middleware.csrf import get_token as get_csrf_token
|
|
4
6
|
from django.urls import reverse
|
|
7
|
+
from django.utils.http import url_has_allowed_host_and_scheme
|
|
5
8
|
from django.views.generic import ListView, View
|
|
6
9
|
|
|
7
|
-
from .compat import RedirectURLMixin, url_has_allowed_host_and_scheme
|
|
8
10
|
from .models import CookieGroup
|
|
9
|
-
from .util import
|
|
11
|
+
from .util import (
|
|
12
|
+
accept_cookies,
|
|
13
|
+
decline_cookies,
|
|
14
|
+
get_accepted_cookie_groups,
|
|
15
|
+
get_declined_cookie_groups,
|
|
16
|
+
get_not_accepted_or_declined_cookie_groups,
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def is_ajax_like(request: HttpRequest) -> bool:
|
|
21
|
+
# legacy ajax, removed in Django 4.0 (used to be request.is_ajax())
|
|
22
|
+
ajax_header = request.headers.get("X-Requested-With")
|
|
23
|
+
if ajax_header == "XMLHttpRequest":
|
|
24
|
+
return True
|
|
25
|
+
|
|
26
|
+
# module-js uses fetch and a custom header
|
|
27
|
+
return bool(request.headers.get("X-Cookie-Consent-Fetch"))
|
|
10
28
|
|
|
11
29
|
|
|
12
30
|
class CookieGroupListView(ListView):
|
|
@@ -33,12 +51,12 @@ class CookieGroupBaseProcessView(RedirectURLMixin, View):
|
|
|
33
51
|
raise SuspiciousOperation("Unsafe open redirect suspected.")
|
|
34
52
|
return redirect_to or reverse("cookie_consent_cookie_group_list")
|
|
35
53
|
|
|
36
|
-
def process(self, request, response, varname):
|
|
54
|
+
def process(self, request, response, varname): # pragma: no cover
|
|
37
55
|
raise NotImplementedError()
|
|
38
56
|
|
|
39
57
|
def post(self, request, *args, **kwargs):
|
|
40
58
|
varname = kwargs.get("varname", None)
|
|
41
|
-
if request
|
|
59
|
+
if is_ajax_like(request):
|
|
42
60
|
response = HttpResponse()
|
|
43
61
|
else:
|
|
44
62
|
response = HttpResponseRedirect(self.get_success_url())
|
|
@@ -65,3 +83,35 @@ class CookieGroupDeclineView(CookieGroupBaseProcessView):
|
|
|
65
83
|
|
|
66
84
|
def delete(self, request, *args, **kwargs):
|
|
67
85
|
return self.post(request, *args, **kwargs)
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
class CookieStatusView(View):
|
|
89
|
+
"""
|
|
90
|
+
Check the current accept/decline status for cookies.
|
|
91
|
+
|
|
92
|
+
The returned accept and decline URLs are specific to this user and include the
|
|
93
|
+
cookie groups that weren't accepted or declined yet.
|
|
94
|
+
|
|
95
|
+
Note that this endpoint also returns a CSRF Token to be used by the frontend,
|
|
96
|
+
as baking a CSRFToken into a cached page will not reliably work.
|
|
97
|
+
"""
|
|
98
|
+
|
|
99
|
+
def get(self, request: HttpRequest) -> JsonResponse:
|
|
100
|
+
accepted = get_accepted_cookie_groups(request)
|
|
101
|
+
declined = get_declined_cookie_groups(request)
|
|
102
|
+
not_accepted_or_declined = get_not_accepted_or_declined_cookie_groups(request)
|
|
103
|
+
# TODO: change this csv URL param into proper POST params
|
|
104
|
+
varnames = ",".join([group.varname for group in not_accepted_or_declined])
|
|
105
|
+
data = {
|
|
106
|
+
"csrftoken": get_csrf_token(request),
|
|
107
|
+
"acceptUrl": reverse("cookie_consent_accept", kwargs={"varname": varnames}),
|
|
108
|
+
"declineUrl": reverse(
|
|
109
|
+
"cookie_consent_decline", kwargs={"varname": varnames}
|
|
110
|
+
),
|
|
111
|
+
"acceptedCookieGroups": [group.varname for group in accepted],
|
|
112
|
+
"declinedCookieGroups": [group.varname for group in declined],
|
|
113
|
+
"notAcceptedOrDeclinedCookieGroups": [
|
|
114
|
+
group.varname for group in not_accepted_or_declined
|
|
115
|
+
],
|
|
116
|
+
}
|
|
117
|
+
return JsonResponse(data)
|
{django_cookie_consent-0.4.0.dev0.dist-info → django_cookie_consent-0.6.0.dist-info}/METADATA
RENAMED
|
@@ -1,21 +1,41 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: django-cookie-consent
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.6.0
|
|
4
4
|
Summary: Django cookie consent application
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
Author-email: Informatika Mihelac <bmihelac@mihelac.org>
|
|
6
|
+
License: Copyright (c) Bojan Mihelac and individual contributors.
|
|
7
|
+
All rights reserved.
|
|
8
|
+
|
|
9
|
+
Redistribution and use in source and binary forms, with or without modification,
|
|
10
|
+
are permitted provided that the following conditions are met:
|
|
11
|
+
|
|
12
|
+
1. Redistributions of source code must retain the above copyright notice,
|
|
13
|
+
this list of conditions and the following disclaimer.
|
|
14
|
+
|
|
15
|
+
2. Redistributions in binary form must reproduce the above copyright
|
|
16
|
+
notice, this list of conditions and the following disclaimer in the
|
|
17
|
+
documentation and/or other materials provided with the distribution.
|
|
18
|
+
|
|
19
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
20
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
21
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
22
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
|
23
|
+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
24
|
+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
25
|
+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
|
26
|
+
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
27
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
28
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
29
|
+
|
|
9
30
|
Project-URL: Documentation, https://django-cookie-consent.readthedocs.io/en/latest/
|
|
10
31
|
Project-URL: Changelog, https://github.com/jazzband/django-cookie-consent/blob/master/docs/changelog.rst
|
|
11
32
|
Project-URL: Bug Tracker, https://github.com/jazzband/django-cookie-consent/issues
|
|
12
33
|
Project-URL: Source Code, https://github.com/jazzband/django-cookie-consent
|
|
13
34
|
Keywords: cookies,cookie-consent,cookie bar
|
|
14
|
-
Classifier: Development Status ::
|
|
35
|
+
Classifier: Development Status :: 4 - Beta
|
|
15
36
|
Classifier: Framework :: Django
|
|
16
|
-
Classifier: Framework :: Django :: 3.2
|
|
17
|
-
Classifier: Framework :: Django :: 4.1
|
|
18
37
|
Classifier: Framework :: Django :: 4.2
|
|
38
|
+
Classifier: Framework :: Django :: 5.0
|
|
19
39
|
Classifier: Intended Audience :: Developers
|
|
20
40
|
Classifier: License :: OSI Approved :: BSD License
|
|
21
41
|
Classifier: Operating System :: Unix
|
|
@@ -26,25 +46,25 @@ Classifier: Programming Language :: Python :: 3.8
|
|
|
26
46
|
Classifier: Programming Language :: Python :: 3.9
|
|
27
47
|
Classifier: Programming Language :: Python :: 3.10
|
|
28
48
|
Classifier: Programming Language :: Python :: 3.11
|
|
49
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
29
50
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
51
|
+
Requires-Python: >=3.8
|
|
30
52
|
Description-Content-Type: text/markdown
|
|
31
53
|
License-File: LICENSE
|
|
32
54
|
License-File: AUTHORS
|
|
33
|
-
Requires-Dist: django
|
|
55
|
+
Requires-Dist: django >=4.2
|
|
34
56
|
Requires-Dist: django-appconf
|
|
35
57
|
Provides-Extra: coverage
|
|
36
58
|
Requires-Dist: pytest-cov ; extra == 'coverage'
|
|
37
59
|
Provides-Extra: docs
|
|
38
60
|
Requires-Dist: sphinx ; extra == 'docs'
|
|
39
61
|
Requires-Dist: sphinx-rtd-theme ; extra == 'docs'
|
|
40
|
-
Provides-Extra: pep8
|
|
41
|
-
Requires-Dist: flake8 ; extra == 'pep8'
|
|
42
62
|
Provides-Extra: release
|
|
43
63
|
Requires-Dist: tbump ; extra == 'release'
|
|
44
|
-
Requires-Dist: twine ; extra == 'release'
|
|
45
64
|
Provides-Extra: tests
|
|
46
65
|
Requires-Dist: pytest ; extra == 'tests'
|
|
47
66
|
Requires-Dist: pytest-django ; extra == 'tests'
|
|
67
|
+
Requires-Dist: pytest-playwright ; extra == 'tests'
|
|
48
68
|
Requires-Dist: tox ; extra == 'tests'
|
|
49
69
|
Requires-Dist: isort ; extra == 'tests'
|
|
50
70
|
Requires-Dist: black ; extra == 'tests'
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
cookie_consent/__init__.py,sha256=cID1jLnC_vj48GgMN6Yb1FA3JsQ95zNmCHmRYE8TFhY,22
|
|
2
|
+
cookie_consent/admin.py,sha256=9IoTczdhLqbn4QMuJSbIWNe6dahj6niiOz3IDKw4sk4,1112
|
|
3
|
+
cookie_consent/apps.py,sha256=nldd3hZnNChnrajmCD3crvxFfieWgLi625grNTEVYis,248
|
|
4
|
+
cookie_consent/cache.py,sha256=ZiWDxyYjGoOCV4JjCKPoBCkrM69Xbybjfzq_az4XcZc,1408
|
|
5
|
+
cookie_consent/conf.py,sha256=Q-xpL-HgxMf1PTrZL7TtGOdOUgaUYs8_d1ZwBipK7Nk,555
|
|
6
|
+
cookie_consent/middleware.py,sha256=DvpJC-YabhAt-8V2u6mTdpzGN1q833nnuAeO4E9cBaA,1981
|
|
7
|
+
cookie_consent/models.py,sha256=Zpt1w_xa8pmkhIAdc2yJ4GiV0-VllLHFpQsWnNEWylE,5520
|
|
8
|
+
cookie_consent/urls.py,sha256=U5ssRnjWoJM3GynERe0CUVsDdZ0-98BKX6vyimg312A,1119
|
|
9
|
+
cookie_consent/util.py,sha256=vS0bd9WJDnEpS8lBlBTJCbApJw8Flr98Rh-D0edjIQs,5948
|
|
10
|
+
cookie_consent/views.py,sha256=bkSMs8i9A-kSdgULNijGKDzphaRXzmZd0kcbX57aQjM,4173
|
|
11
|
+
cookie_consent/fixtures/common_cookies.json,sha256=iOEeMtZhERoeoxBz5Kj-Mo_XOUk5F1ljNon4w2odBJo,2449
|
|
12
|
+
cookie_consent/migrations/0001_initial.py,sha256=jIGX_k1nIm7GGpqgE-zvI1NIBizD8wkxYEb-BL6FR4c,4180
|
|
13
|
+
cookie_consent/migrations/0002_auto__add_logitem.py,sha256=rZ_kkXI3eij3k6PiGP5CsA41psENNZBbMD0qwUxBBTM,1633
|
|
14
|
+
cookie_consent/migrations/0003_alter_cookiegroup_varname.py,sha256=Cebn_m9mMo231NKegc9GU1LBLGLX5u3doO6Qvw-8PeA,873
|
|
15
|
+
cookie_consent/migrations/0004_cookie_natural_key.py,sha256=KAQy71oe2sJjz0xwB5dPDL9LBjFd4gqdZfNwiAVhs0Y,466
|
|
16
|
+
cookie_consent/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
17
|
+
cookie_consent/static/cookie_consent/cookiebar.js,sha256=vdouyXSBRkzKDiLdMAdOTWKzNO3vgXZNehUTIVUW5Gk,1919
|
|
18
|
+
cookie_consent/static/cookie_consent/cookiebar.module.js,sha256=0RSPojS9J47HzEkY0xpAK5yJjWPU2ZcxFNMc8kHUCp0,5625
|
|
19
|
+
cookie_consent/static/cookie_consent/cookiebar.module.js.map,sha256=D7H9fwNVaaKgdM0pdaFW2mva0sgwHOO7h8vovh2SCVs,14288
|
|
20
|
+
cookie_consent/templates/cookie_consent/_cookie_group.html,sha256=wozvbdRjuKu3gnegN8vex_lDkku22pne830NWuzHXVw,1496
|
|
21
|
+
cookie_consent/templates/cookie_consent/base.html,sha256=ghOQ9vqSzKG32LfSQmj5xTF1PBs-SDtQEcOC1wjAemQ,85
|
|
22
|
+
cookie_consent/templates/cookie_consent/cookiegroup_list.html,sha256=PMO9iLxQrgRpQGLC0stlDamMonc3tLS3o5PWPF378Zg,308
|
|
23
|
+
cookie_consent/templatetags/__init__.py,sha256=FZk9hm7vBsK8G16pNugputbrrEciYqJc_XRAhTCcojI,46
|
|
24
|
+
cookie_consent/templatetags/cookie_consent_tags.py,sha256=gBn1Z61KeFcCRd368zxYCN9FJFQ1x5RX2E12ricdRgU,5175
|
|
25
|
+
django_cookie_consent-0.6.0.dist-info/AUTHORS,sha256=9Eey8K2GsZr5vWe3ZD3_oqA9aFgciNIVMTmyO5eq5rw,340
|
|
26
|
+
django_cookie_consent-0.6.0.dist-info/LICENSE,sha256=ZZi-io1uazO5jpDoNJScUfjeVI2dEzvDPOcyFhU0KYw,1349
|
|
27
|
+
django_cookie_consent-0.6.0.dist-info/METADATA,sha256=DCxTzS3v_qAwYuzfC7AkhXZ_cpYdgJFNfzR-dzMNU54,6053
|
|
28
|
+
django_cookie_consent-0.6.0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
|
29
|
+
django_cookie_consent-0.6.0.dist-info/top_level.txt,sha256=wD8Ix58rJguYeYfils_Z40QfVybiRYb1vwRNm09HN4M,15
|
|
30
|
+
django_cookie_consent-0.6.0.dist-info/RECORD,,
|
cookie_consent/compat.py
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
try:
|
|
2
|
-
from django.utils.http import url_has_allowed_host_and_scheme
|
|
3
|
-
except ImportError: # django < 3.0
|
|
4
|
-
from django.utils.http import is_safe_url as url_has_allowed_host_and_scheme
|
|
5
|
-
|
|
6
|
-
try: # django >= 4.1
|
|
7
|
-
from django.contrib.auth.views import RedirectURLMixin
|
|
8
|
-
except ImportError:
|
|
9
|
-
from django.contrib.auth.views import (
|
|
10
|
-
SuccessURLAllowedHostsMixin as RedirectURLMixin,
|
|
11
|
-
)
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
cookie_consent/__init__.py,sha256=5B0Zd_u0SQA_ltxO2HzzO8rTslrZ8C_2tUU0wv4lhYg,28
|
|
2
|
-
cookie_consent/admin.py,sha256=9IoTczdhLqbn4QMuJSbIWNe6dahj6niiOz3IDKw4sk4,1112
|
|
3
|
-
cookie_consent/apps.py,sha256=nldd3hZnNChnrajmCD3crvxFfieWgLi625grNTEVYis,248
|
|
4
|
-
cookie_consent/cache.py,sha256=nxSba7Xr9Xn53jxUoMObRLpb9w3owlMxCDP2jpM9PuQ,1281
|
|
5
|
-
cookie_consent/compat.py,sha256=vMaI1CIAgcS2BODgnUg1lZwq5kNiHM6B4U2qtXASoaI,397
|
|
6
|
-
cookie_consent/conf.py,sha256=Q-xpL-HgxMf1PTrZL7TtGOdOUgaUYs8_d1ZwBipK7Nk,555
|
|
7
|
-
cookie_consent/middleware.py,sha256=DvpJC-YabhAt-8V2u6mTdpzGN1q833nnuAeO4E9cBaA,1981
|
|
8
|
-
cookie_consent/models.py,sha256=cmxDFAXLfbdmwyyuBn2NLbAW8AhQUWGxHbciV3FqVow,3660
|
|
9
|
-
cookie_consent/urls.py,sha256=VlUdWUyJ7G1-w5uVtxSsigvvHslOQXIbNcVNGs_8OLE,903
|
|
10
|
-
cookie_consent/util.py,sha256=792FMk8a7SAa67m6chhMvZLe-Iic2ETkJCAJXm4zA5w,5553
|
|
11
|
-
cookie_consent/views.py,sha256=RrM6z6i5n5RfC6uNv9ToaqZOy9ToHOrdFV5jUvupICk,2173
|
|
12
|
-
cookie_consent/fixtures/common_cookies.json,sha256=iOEeMtZhERoeoxBz5Kj-Mo_XOUk5F1ljNon4w2odBJo,2449
|
|
13
|
-
cookie_consent/migrations/0001_initial.py,sha256=jIGX_k1nIm7GGpqgE-zvI1NIBizD8wkxYEb-BL6FR4c,4180
|
|
14
|
-
cookie_consent/migrations/0002_auto__add_logitem.py,sha256=rZ_kkXI3eij3k6PiGP5CsA41psENNZBbMD0qwUxBBTM,1633
|
|
15
|
-
cookie_consent/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
16
|
-
cookie_consent/static/cookie_consent/cookiebar.js,sha256=H0AzuvEMcZNzb53VYcw-U5UE6aDgt9MChxOmCZJBMMA,1840
|
|
17
|
-
cookie_consent/templates/cookie_consent/_cookie_group.html,sha256=wozvbdRjuKu3gnegN8vex_lDkku22pne830NWuzHXVw,1496
|
|
18
|
-
cookie_consent/templates/cookie_consent/base.html,sha256=ghOQ9vqSzKG32LfSQmj5xTF1PBs-SDtQEcOC1wjAemQ,85
|
|
19
|
-
cookie_consent/templates/cookie_consent/cookiegroup_list.html,sha256=PMO9iLxQrgRpQGLC0stlDamMonc3tLS3o5PWPF378Zg,308
|
|
20
|
-
cookie_consent/templatetags/__init__.py,sha256=FZk9hm7vBsK8G16pNugputbrrEciYqJc_XRAhTCcojI,46
|
|
21
|
-
cookie_consent/templatetags/cookie_consent_tags.py,sha256=j6_8e-mu3dy2syXwAxXjOlx6C90CGSdEqM391y2jqx0,4026
|
|
22
|
-
django_cookie_consent-0.4.0.dev0.dist-info/AUTHORS,sha256=1IpYKADNdC03tx3VzMmPLRJo8MHHC_JlWcPEcdcTDA8,323
|
|
23
|
-
django_cookie_consent-0.4.0.dev0.dist-info/LICENSE,sha256=ZZi-io1uazO5jpDoNJScUfjeVI2dEzvDPOcyFhU0KYw,1349
|
|
24
|
-
django_cookie_consent-0.4.0.dev0.dist-info/METADATA,sha256=CsHdJQ4fKqM5a9yov4i82Iz2O997JhPcxW1gWefNqBQ,4614
|
|
25
|
-
django_cookie_consent-0.4.0.dev0.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
|
|
26
|
-
django_cookie_consent-0.4.0.dev0.dist-info/top_level.txt,sha256=wD8Ix58rJguYeYfils_Z40QfVybiRYb1vwRNm09HN4M,15
|
|
27
|
-
django_cookie_consent-0.4.0.dev0.dist-info/RECORD,,
|
{django_cookie_consent-0.4.0.dev0.dist-info → django_cookie_consent-0.6.0.dist-info}/LICENSE
RENAMED
|
File without changes
|
{django_cookie_consent-0.4.0.dev0.dist-info → django_cookie_consent-0.6.0.dist-info}/top_level.txt
RENAMED
|
File without changes
|