GSoC 2021 - Cookie Manager | Week 5
By Rishabh Ranjan Jha on 2021-07-13 04:55 in GSoC 21 Feature Enhancement - 2
Date: 5 July 2021 - 11 July 2021
Hi, this is the progress report for the cookie manager project which is currently part of GSoC.
In the 5th week of the program, we discussed how to block cookies along with the database design for storing the cookie scripts. Moreover, part of the discussion was the Admin UI’s elements and functions to manage the different types of scripts.
Admin UI for storing cookie scripts in the database table cookiemanager_scripts
- Scripts: List view
- Type of the script
- Script: Edit view
- Title with alias
- Position: list type with options
- After begin head
- Before end head
- After begin body
- Before end body
- Type: list type with options
- External script
- Code: textarea for cookie script (script should be without comments)
Cookie block/unblock process
- First, in the plugin, we render the cookie scripts with some modifications to them according to their type.
- Replace src with data-src in iframe, embed and img tags.
- Replace href with data-href in the link tag.
- Add another attribute to the scripts, data-cookiecategory with the value of its category.
- When the user will give consent, then will execute the script for that particular category to set the cookies, according to the position.
- Finally, we set one extra cookie [category]_cookie = true for the category that the user gave consent to.
- When the user requests another page, we render the cookie scripts according to the [category]_cookie in the response.
- If the user revokes the consent, we change [category]_cookie to false, and in the next response, we don’t render the scripts.