diff --git a/src/html/consent.html b/src/html/consent.html new file mode 100644 index 000000000..c789066c6 --- /dev/null +++ b/src/html/consent.html @@ -0,0 +1,66 @@ + + + + FastForward + + + + + + + + +
+
+

Thank you for installing FastForward

+

+ This extension collects the tab url when you choose to add a website to the whitelist, and temporarily processes the url of bypassed sites while navigating them. +

+

+ Additionally, if the "Crowd Bypass" option is enabled, the extension may send some bypassed urls to our server to be processed and added to our database in accordance with our privacy policy. They are never shared. +

+

+ If you consent to this data collection hit "Agree" to continue. Otherwise hit "Refuse" and the extension will be uninstalled. +

+ + +
+ + + diff --git a/src/html/consent.js b/src/html/consent.js new file mode 100644 index 000000000..2d284ce8d --- /dev/null +++ b/src/html/consent.js @@ -0,0 +1,26 @@ +// Function to save consent status +async function saveConsentStatus(consentStatus) { + return browser.storage.local.set({ consentStatus: consentStatus }); +} + +// Function to get consent status +async function getConsentStatus() { + return new Promise((resolve) => { + browser.storage.local.get('consentStatus').then((result) => { + resolve(result.consentStatus); + }); + }); +} + +// Event listener for "Agree" button +document.querySelector('#agree').addEventListener('click', async function () { + console.log("Agree button clicked."); + await saveConsentStatus('consent-granted'); + window.location.href = 'options.html'; +}); + +// Event listener for "Refuse" button +document.querySelector('#refuse').addEventListener('click', async function () { + console.log("Uninstalling extension."); + browser.management.uninstallSelf(); +}); \ No newline at end of file diff --git a/src/js/background.js b/src/js/background.js index ef101b399..1152b711b 100644 --- a/src/js/background.js +++ b/src/js/background.js @@ -1,5 +1,25 @@ import * as constants from './constants.js'; +const isFirefox = /Firefox/i.test(navigator.userAgent); + +// Check if the browser is Firefox +if (isFirefox) { + browser.runtime.onInstalled.addListener((details) => { + if (details.reason === 'install') { + browser.storage.local.get('consentStatus').then(function (data) { + const consentStatus = data.consentStatus; + if (consentStatus !== 'granted') { + browser.tabs.create({ + url: 'html/consent.html', + }); + return; + } + }); + return; + } + }); +} + const brws = typeof browser !== 'undefined' ? browser : chrome; const fetchDomains = ['crowd.fastforward.team', 'redirect-api.work.ink']; //only allow requests to these domains