diff --git a/assets/inter/OFL.txt b/assets/inter/OFL.txt new file mode 100644 index 0000000..63db4fa --- /dev/null +++ b/assets/inter/OFL.txt @@ -0,0 +1,93 @@ +Copyright 2020 The Inter Project Authors (https://github.com/rsms/inter) + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +https://openfontlicense.org + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/assets/inter/bold.ttf b/assets/inter/bold.ttf new file mode 100644 index 0000000..fe23eeb Binary files /dev/null and b/assets/inter/bold.ttf differ diff --git a/assets/inter/regular.ttf b/assets/inter/regular.ttf new file mode 100644 index 0000000..5e4851f Binary files /dev/null and b/assets/inter/regular.ttf differ diff --git a/package.json b/package.json index e17da76..014a0d4 100644 --- a/package.json +++ b/package.json @@ -44,13 +44,11 @@ "manifest": { "permissions": [ "declarativeNetRequest", - "tabs", + "activeTab", "cookies" ], - "host_permissions": [ - "", - "https://dev.movie-web.app/*", - "https://movie-web.app/*" + "optional_host_permissions": [ + "" ], "browser_specific_settings": { "gecko": { diff --git a/src/Popup.css b/src/Popup.css index ee5b928..6cd335c 100644 --- a/src/Popup.css +++ b/src/Popup.css @@ -1,5 +1,3 @@ -@import url('https://fonts.googleapis.com/css2?family=Inter:wght@500;800&display=swap'); - html { min-height: 300px; min-width: 300px; @@ -9,7 +7,6 @@ body { min-height: 300px; min-width: 300px; margin: 0; - font-family: 'Inter', sans-serif; } .popup { diff --git a/src/components/PermissionMissingScreen.tsx b/src/components/PermissionMissingScreen.tsx index 2d57e44..d37f83f 100644 --- a/src/components/PermissionMissingScreen.tsx +++ b/src/components/PermissionMissingScreen.tsx @@ -1,17 +1,20 @@ +import { useCallback } from 'react'; + import { Icon } from '~components/Icon'; import '~tabs/PermissionGrant.css'; -export interface PermissionMissingProps { - onGrant?: () => void; -} +export function PermissionMissingScreen() { + const open = useCallback(() => { + const url = (chrome || browser).runtime.getURL(`/tabs/PermissionRequest.html`); + (chrome || browser).tabs.create({ url }); + }, []); -export function PermissionMissingScreen(props: PermissionMissingProps) { return (

The extension is missing permissions it needs to function

-
diff --git a/src/contents/movie-web.ts b/src/contents/movie-web.ts index 263895d..aeddda5 100644 --- a/src/contents/movie-web.ts +++ b/src/contents/movie-web.ts @@ -2,8 +2,7 @@ import { relayMessage } from '@plasmohq/messaging'; import type { PlasmoCSConfig } from 'plasmo'; export const config: PlasmoCSConfig = { - // works for chrome, but not for firefox, so we add explicit domains for firefox - matches: ['', 'https://dev.movie-web.app/*', 'https://movie-web.app/*'], + matches: [''], }; relayMessage({ diff --git a/src/popup.tsx b/src/popup.tsx index 1980551..bef7366 100644 --- a/src/popup.tsx +++ b/src/popup.tsx @@ -5,13 +5,15 @@ import { PermissionMissingScreen } from '~components/PermissionMissingScreen'; import { ToggleButton } from '~components/ToggleButton'; import { useDomain } from '~hooks/useDomain'; import { useToggleWhitelistDomain } from '~hooks/useDomainWhitelist'; -import './Popup.css'; import { usePermission } from '~hooks/usePermission'; +import './Popup.css'; +import './tabs/font.css'; + function IndexPopup() { const domain = useDomain(); const { isWhitelisted, toggle } = useToggleWhitelistDomain(domain); - const { grantPermission, hasPermission } = usePermission(); + const { hasPermission } = usePermission(); let page = 'toggle'; if (!hasPermission) page = 'perm'; @@ -22,7 +24,7 @@ function IndexPopup() {
{page === 'toggle' ? : null} {page === 'disabled' ? : null} - {page === 'perm' ? : null} + {page === 'perm' ? : null}
diff --git a/src/tabs/PermissionGrant.css b/src/tabs/PermissionGrant.css index df25203..b5f2983 100644 --- a/src/tabs/PermissionGrant.css +++ b/src/tabs/PermissionGrant.css @@ -1,10 +1,3 @@ -@import url('https://fonts.googleapis.com/css2?family=Inter:wght@500;800&display=swap'); - -* { - margin: 0; - padding: 0; -} - html { height: 100%; } diff --git a/src/tabs/PermissionGrant.tsx b/src/tabs/PermissionGrant.tsx index 5cd54fc..bfde7d8 100644 --- a/src/tabs/PermissionGrant.tsx +++ b/src/tabs/PermissionGrant.tsx @@ -2,6 +2,7 @@ import { useDomainWhitelist } from '~hooks/useDomainWhitelist'; import { usePermission } from '~hooks/usePermission'; import { makeUrlIntoDomain } from '~utils/domains'; +import './font.css'; import './PermissionGrant.css'; export default function PermissionGrant() { diff --git a/src/tabs/PermissionRequest.css b/src/tabs/PermissionRequest.css new file mode 100644 index 0000000..e69de29 diff --git a/src/tabs/PermissionRequest.tsx b/src/tabs/PermissionRequest.tsx new file mode 100644 index 0000000..97f0726 --- /dev/null +++ b/src/tabs/PermissionRequest.tsx @@ -0,0 +1,36 @@ +import { useCallback } from 'react'; + +import { usePermission } from '~hooks/usePermission'; + +import './font.css'; +import './PermissionRequest.css'; + +export default function PermissionRequest() { + const { grantPermission } = usePermission(); + + const grant = useCallback(() => { + grantPermission().then(() => window.close()); + }, [grantPermission]); + + return ( +
+
+

Permission

+

+ Websites need to ask for permission
before they can use this extension +

+
+

+ The website hello world wants to
use the extension on their + page. +

+
+
+ +
+
+
+ ); +} diff --git a/src/tabs/font.css b/src/tabs/font.css new file mode 100644 index 0000000..fe58171 --- /dev/null +++ b/src/tabs/font.css @@ -0,0 +1,24 @@ +@font-face { + font-family: "Inter"; + font-style: normal; + font-weight: 400; + font-display: swap; + src: url(data-base64:~assets/inter/regular.ttf) format("ttf"); +} + +@font-face { + font-family: "Inter"; + font-style: bold; + font-weight: 700; + font-display: swap; + src: url(data-base64:~assets/inter/bold.ttf) format("ttf"); +} + +body { + font-family: "Inter", Arial, Helvetica, sans-serif; +} + +* { + margin: 0; + padding: 0; +}