Skip to content

Commit

Permalink
PromotionLinks.svelte:
Browse files Browse the repository at this point in the history
- Updated Chrome Web Store URL
- Fixed browser name detection
  • Loading branch information
avi12 committed May 6, 2024
1 parent cd6f2a7 commit 7f5141a
Showing 1 changed file with 30 additions and 2 deletions.
32 changes: 30 additions & 2 deletions src/popup/components/PromotionLinks.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,41 @@
};
const linkRatingMapper = {
chrome: "https://chrome.google.com/webstore/detail/fcphghnknhkimeagdglkljinmpbagone",
chrome: "https://chromewebstore.google.com/detail/fcphghnknhkimeagdglkljinmpbagone",
firefox: "https://addons.mozilla.org/firefox/addon/youtube-auto-hd-fps",
edge: "https://microsoftedge.microsoft.com/addons/detail/ggnepcoiimddpmjaoejhdfppjbcnfaom",
opera: "https://addons.opera.com/extensions/details/app_id/afgnmkmomgakegdfoldjonhgkohhodol",
safari: "https://apps.apple.com/app/id1546729687"
};
const browserName: "chrome" | "firefox" | "edge" | "opera" | "safari" = (() => {
const extensionBaseUrl = chrome.runtime.getURL("");
const isFirefox = extensionBaseUrl.startsWith("moz-extension://");
if (isFirefox) {
return "firefox";
}
const { userAgent } = navigator;
const isOpera = userAgent.includes("OPR");
if (isOpera) {
return "opera";
}
const isEdge = userAgent.includes("Edg");
if (isEdge) {
return "edge";
}
const isSafari = userAgent.match(/^((?!chrome|android).)*safari/i);
if (isSafari) {
return "safari";
}
return "chrome";
})();
type PromotionalLink = { label: string; url: string; icon: string };
const links: PromotionalLink[] = [
{
Expand All @@ -32,7 +60,7 @@
},
{
label: i18n.labelRate,
url: linkRatingMapper[process.env.PLASMO_BROWSER],
url: linkRatingMapper[browserName],
icon: mdiStarOutline
},
{
Expand Down

0 comments on commit 7f5141a

Please sign in to comment.