-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: Compatibility issues for Firefox (#287)
* Fixes Support for Setting Net Rules on Firefox Firefox has random IDs, so we have to make a dynamic rule instead. * Add simple permission popup * Restyle popup * Make sure to reload extension * chore: run format * chore: update Chrome types * Update button style for disabled state * Update button text * Adjust offer tracking banner for Firefox * chore: run formatting * Update alert text Co-authored-by: Step7750 <[email protected]> * Require optional host permission on Firefox --------- Co-authored-by: Step7750 <[email protected]>
- Loading branch information
Showing
10 changed files
with
187 additions
and
15 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<link rel="preconnect" href="https://fonts.googleapis.com" /> | ||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin /> | ||
<link | ||
href="https://fonts.googleapis.com/css2?family=Inter:[email protected]&family=Roboto:ital,wght@0,100..900;1,100..900&display=swap" | ||
rel="stylesheet" | ||
/> | ||
<style> | ||
body { | ||
width: 300px; | ||
padding: 16px; | ||
background-color: #15171c; | ||
} | ||
button { | ||
width: 100%; | ||
padding: 10px; | ||
background-color: rgba(35, 123, 255, 0.15); | ||
color: #237bff; | ||
border: none; | ||
border-radius: 8px; | ||
cursor: pointer; | ||
font-family: 'Roboto', serif; | ||
font-size: 14px; | ||
font-weight: 500; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
gap: 8px; | ||
} | ||
button:hover { | ||
background-color: #2a374d; | ||
} | ||
button:disabled { | ||
cursor: not-allowed; | ||
background-color: rgba(255, 255, 255, .12); | ||
color: rgba(255, 255, 255, .5); | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<button id="requestPermissions"> | ||
<svg | ||
xmlns="http://www.w3.org/2000/svg" | ||
width="24" | ||
height="24" | ||
viewBox="0 0 24 24" | ||
fill="none" | ||
stroke="currentColor" | ||
stroke-width="3" | ||
stroke-linecap="round" | ||
stroke-linejoin="round" | ||
> | ||
<path | ||
d="M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z" | ||
/> | ||
<path d="M12 8v4" /> | ||
<path d="M12 16h.01" /> | ||
</svg> | ||
<span>Enable Offer Tracking</span> | ||
</button> | ||
<script src="popup/popup.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
window.addEventListener('DOMContentLoaded', async () => { | ||
const requestButton = document.getElementById('requestPermissions'); | ||
if (!requestButton) { | ||
return; | ||
} | ||
|
||
const hasPermissions = await chrome.permissions.contains({ | ||
origins: ['*://*.steampowered.com/*'], | ||
}); | ||
|
||
if (hasPermissions) { | ||
// If permissions are already granted, disable the button | ||
requestButton.children[1].textContent = 'Offer Tracking Enabled'; | ||
requestButton.setAttribute('disabled', 'true'); | ||
} else { | ||
requestButton.addEventListener('click', async () => { | ||
try { | ||
const success = await chrome.permissions.request({ | ||
origins: ['*://*.steampowered.com/*'], | ||
}); | ||
if (success) { | ||
// extension requires reload to apply permissions | ||
browser.runtime.reload(); | ||
} | ||
} catch (error) { | ||
console.error('Error requesting permissions:', error); | ||
} | ||
}); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters