diff --git a/.github/SECURITY.md b/.github/SECURITY.md index c8ee568..2e85d3a 100644 --- a/.github/SECURITY.md +++ b/.github/SECURITY.md @@ -2,13 +2,9 @@ ## Supported Versions -The movie-web maintainers only support the latest version of movie-web published at https://movie-web.app. -This published version is equivalent to the master branch. - -Support is not provided for any forks or mirrors of movie-web. +The latest version of movie-web is the only version that is supported, as it is the only version that is being actively developed. ## Reporting a Vulnerability -There are two ways you can contact the movie-web maintainers to report a vulnerability: - - Email [security@movie-web.app](mailto:security@movie-web.app) - - Report the vulnerability in the [movie-web Discord server](https://discord.movie-web.app) +You can contact the movie-web maintainers to report a vulnerability: + - Report the vulnerability in the [movie-web Discord server](https://movie-web.github.io/links/discord) diff --git a/assets/active.png b/assets/active.png new file mode 100644 index 0000000..3a50ad1 Binary files /dev/null and b/assets/active.png differ diff --git a/assets/inactive.png b/assets/inactive.png new file mode 100644 index 0000000..2a86647 Binary files /dev/null and b/assets/inactive.png differ diff --git a/package.json b/package.json index 68cbd9f..c60afd3 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@movie-web/extension", "displayName": "movie-web extension", - "version": "1.1.1", + "version": "1.1.2", "description": "Enhance your movie-web experience with just one click", "author": "movie-web", "scripts": { @@ -54,6 +54,17 @@ "gecko": { "id": "{3fd86354-c73f-4395-9e26-2c5c984579bf}" } - } + }, + "web_accessible_resources": [ + { + "resources": [ + "assets/active.png", + "assets/inactive.png" + ], + "matches": [ + "" + ] + } + ] } } diff --git a/src/background/messages/makeRequest.ts b/src/background/messages/makeRequest.ts index 3039d21..61d77ca 100644 --- a/src/background/messages/makeRequest.ts +++ b/src/background/messages/makeRequest.ts @@ -3,6 +3,7 @@ import type { PlasmoMessaging } from '@plasmohq/messaging'; import type { BaseRequest } from '~types/request'; import type { BaseResponse } from '~types/response'; import { removeDynamicRules, setDynamicRules } from '~utils/declarativeNetRequest'; +import { isFirefox } from '~utils/extension'; import { makeFullUrl } from '~utils/fetcher'; import { assertDomainWhitelist } from '~utils/storage'; @@ -69,6 +70,9 @@ const handler: PlasmoMessaging.MessageHandler> = async (r const cookies = await (chrome || browser).cookies.getAll({ url: response.url, + ...(isFirefox() && { + firstPartyDomain: new URL(response.url).hostname, + }), }); res.send({ diff --git a/src/components/ToggleButton.tsx b/src/components/ToggleButton.tsx index 3a9f771..1d9481b 100644 --- a/src/components/ToggleButton.tsx +++ b/src/components/ToggleButton.tsx @@ -36,7 +36,7 @@ export function ToggleButton(props: ToggleButtonProps) {

- Extension {props.active ? 'enabled' : 'disabled'}
on {props.domain} + Extension {props.active ? 'enabled' : 'disabled'}
on {props.domain}

); diff --git a/src/hooks/useDomainWhitelist.ts b/src/hooks/useDomainWhitelist.ts index 73b8e51..a7cc42c 100644 --- a/src/hooks/useDomainWhitelist.ts +++ b/src/hooks/useDomainWhitelist.ts @@ -27,6 +27,11 @@ export function useToggleWhitelistDomain(domain: string) { const { domainWhitelist, addDomain, removeDomain } = useDomainWhitelist(); const isWhitelisted = domainWhitelist.includes(domain); const { grantPermission } = usePermission(); + const iconPath = (chrome || browser).runtime.getURL(isWhitelisted ? 'assets/active.png' : 'assets/inactive.png'); + + (chrome || browser).action.setIcon({ + path: iconPath, + }); const toggle = useCallback(() => { if (!isWhitelisted) { diff --git a/src/tabs/PermissionGrant.tsx b/src/tabs/PermissionGrant.tsx index 66305dc..a8c238c 100644 --- a/src/tabs/PermissionGrant.tsx +++ b/src/tabs/PermissionGrant.tsx @@ -8,7 +8,7 @@ export default function PermissionGrant() { const { grantPermission } = usePermission(); const queryParams = new URLSearchParams(window.location.search); - const redirectUrl = queryParams.get('redirectUrl') ?? 'https://movie-web.app'; + const redirectUrl = queryParams.get('redirectUrl') ?? 'https://mw.lonelil.ru'; const domain = makeUrlIntoDomain(redirectUrl); const redirectBack = () => { diff --git a/src/utils/extension.ts b/src/utils/extension.ts index 3a338fc..9999b34 100644 --- a/src/utils/extension.ts +++ b/src/utils/extension.ts @@ -1,3 +1,11 @@ export const isChrome = () => { return chrome.runtime.getURL('').startsWith('chrome-extension://'); }; + +export const isFirefox = () => { + try { + return browser.runtime.getURL('').startsWith('moz-extension://'); + } catch { + return false; + } +}; diff --git a/src/utils/storage.ts b/src/utils/storage.ts index ae06680..27698b1 100644 --- a/src/utils/storage.ts +++ b/src/utils/storage.ts @@ -3,7 +3,14 @@ import { useStorage } from '@plasmohq/storage/hook'; import { makeUrlIntoDomain } from '~utils/domains'; -export const DEFAULT_DOMAIN_WHITELIST = ['movie-web.app', 'dev.movie-web.app']; +export const DEFAULT_DOMAIN_WHITELIST = [ + 'mw.lonelil.ru', + 'watch.qtchaos.de', + 'bmov.vercel.app', + 'stream.thehairy.me', + 'scootydooter.vercel.app', + 'movie-web-me.vercel.app', +]; export const storage = new Storage(); @@ -31,5 +38,9 @@ export const isDomainWhitelisted = async (url: string | undefined) => { export const assertDomainWhitelist = async (url: string) => { const isWhiteListed = await isDomainWhitelisted(url); - if (!isWhiteListed) throw new Error('Domain is not whitelisted'); + const currentDomain = makeUrlIntoDomain(url); + if (!isWhiteListed) + throw new Error( + `${currentDomain} is not whitelisted. Open the extension and click on the power button to whitelist the site.`, + ); };