Tangled mirror of Blue Blocker. Blocks all Twitter Blue verified users on twitter.com
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fix a bug where Firefox users were not getting the consent flow if they updated from non-listed versions (#384)

* [fix] check if the previous version is below the minimum version with a consent popup

I made the minimum this version just in case other users have the same issue as #383

* [fix] add text about the consent page coming up again

* [fix] skip consent script in non-FF FF-likes, add default value for canLoad flag

authored by

Rouge and committed by
GitHub
c7b133f1 05b844fe

+31 -7
+2 -2
package-lock.json
··· 1 1 { 2 2 "name": "blue-blocker", 3 - "version": "0.4.13", 3 + "version": "0.4.14", 4 4 "lockfileVersion": 3, 5 5 "requires": true, 6 6 "packages": { 7 7 "": { 8 8 "name": "blue-blocker", 9 - "version": "0.4.13", 9 + "version": "0.4.14", 10 10 "license": "MPL-2.0", 11 11 "devDependencies": { 12 12 "@crxjs/vite-plugin": "=2.0.0-beta.28",
+1 -1
package.json
··· 1 1 { 2 2 "name": "blue-blocker", 3 - "version": "0.4.13", 3 + "version": "0.4.14", 4 4 "author": "DanielleMiu", 5 5 "description": "Blocks all Twitter Blue verified users on twitter.com", 6 6 "type": "module",
+26 -3
src/background/index.ts
··· 109 109 // @ts-ignore 110 110 api.runtime?.getBrowserInfo().then(info => { 111 111 if(info.name == 'Firefox') { 112 - api.storage.local.get("canLoad").then( val => { 112 + api.storage.local.get({"canLoad": false}).then( val => { 113 113 if (!val) { 114 114 registerConsentScript(); 115 115 } ··· 118 118 } 119 119 }); 120 120 } 121 + else { 122 + // In a FF based browser, that isn't FF 123 + registerConsentScript(); 124 + } 121 125 }) 122 126 } 123 127 catch { ··· 125 129 } 126 130 }) 127 131 128 - const consentRequiredVersions = ['0.3.5'] 132 + const minConsentVersion = '0.4.14'; 133 + 134 + function isBelowMinVer(newVersion: string, minVersion: string) { 135 + const [newMajor, newMinor, newPatch] = String(newVersion).split('.').map(Number); 136 + const [minMajor, minMinor, minPatch] = String(minVersion).split('.').map(Number); 137 + 138 + if (newMajor !== minMajor) { 139 + return newMajor < minMajor; 140 + } 141 + 142 + if (newMinor !== minMinor) { 143 + return newMinor < minMinor; 144 + } 145 + 146 + return newPatch < minPatch; 147 + } 129 148 130 149 api.runtime.onInstalled.addListener( ({reason, previousVersion}) => { 131 150 try { 132 151 /** @ts-ignore I hate that I have to use FF specific APIs to detect FF :)))*/ 133 152 api.runtime?.getBrowserInfo().then(info => { 134 153 if (info.name == 'Firefox') { 135 - if(reason == 'install' || (reason == 'update' && consentRequiredVersions.includes(previousVersion as string))) { 154 + if(reason == 'install' || (reason == 'update' && isBelowMinVer(previousVersion as string, minConsentVersion))) { 136 155 registerConsentScript(); 137 156 const url = api.runtime.getURL('src/pages/consent/index.html'); 138 157 api.tabs.create({url}) 139 158 } 159 + } 160 + else { 161 + // In a FF based browser, that isn't FF 162 + registerConsentScript(); 140 163 } 141 164 }) 142 165 }
+1 -1
src/manifest.ts
··· 3 3 export default defineManifest({ 4 4 name: 'Blue Blocker', 5 5 description: 'Blocks all Twitter Blue verified users on twitter.com', 6 - version: '0.4.13', 6 + version: '0.4.14', 7 7 manifest_version: 3, 8 8 icons: { 9 9 '128': 'icon/icon-128.png',
+1
src/pages/consent/index.html
··· 33 33 <p>All data that Blue Blocker collects, stores, uses, and transmits is mandatory for the function of the extension Because the collection, storage, usage, and transmission of personal data is necessary for the function of this extension, refusing will cause the extension to be uninstalled</p> 34 34 <br> 35 35 <p>To read the full privacy policy visit the <a href="https://addons.mozilla.org/en-US/firefox/addon/blue-blocker/privacy/" target="_blank" rel="noopener noreferrer">Firefox addons page</a></p> 36 + <p>You might be shown this screen again in the future; for example if there is an update in Firefox's policies.</p> 36 37 <br> 37 38 <p>Having read the above disclosure, do you consent to Blue Blocker collecting, storing, using, and transmitting your personal data?</p> 38 39 <div class="inputs">