-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update extension to use manifest version 3
- Loading branch information
1 parent
b1d3522
commit 97cc385
Showing
17 changed files
with
1,119 additions
and
195 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1 +1 @@ | ||
/build/ | ||
/build/*.zip |
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,41 @@ | ||
"""Creates a package.zip file that contains the extension's files.""" | ||
from pathlib import Path | ||
import zipfile | ||
|
||
ROOT_DIR = Path(__file__).parent.parent | ||
EXTENSION_DIR = ROOT_DIR / 'extension' | ||
MANIFEST_V2_DIR = ROOT_DIR / 'manifest-v2' | ||
OUTPUT_DIR = Path(__file__).parent | ||
EXCLUDED_FILENAMES = ['.DS_Store'] | ||
|
||
|
||
def create_package(filename, manifest_version=3): | ||
package_path = OUTPUT_DIR / filename | ||
|
||
print(f'\nGenerating package: {package_path}') | ||
print(f'Zipped files:') | ||
with zipfile.ZipFile(package_path, 'w') as z: | ||
for path in EXTENSION_DIR.rglob('*'): | ||
if path.name in EXCLUDED_FILENAMES: | ||
continue | ||
|
||
relative_path = path.relative_to(EXTENSION_DIR) | ||
|
||
if ( | ||
manifest_version == 2 | ||
and (MANIFEST_V2_DIR / relative_path).exists() | ||
): | ||
path = MANIFEST_V2_DIR / relative_path | ||
|
||
z.write(path, relative_path) | ||
print(f' {path.relative_to(ROOT_DIR)}') | ||
|
||
|
||
def main(): | ||
create_package('package-chrome.zip') | ||
create_package('package-firefox.zip', manifest_version=2) | ||
create_package('package-edge.zip', manifest_version=2) | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Large diffs are not rendered by default.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,61 @@ | ||
{ | ||
"manifest_version": 2, | ||
"manifest_version": 3, | ||
"name": "Thumbnail Rating Bar for YouTube™", | ||
"version": "1.8.6", | ||
"version": "1.8.7", | ||
"description": "Displays a rating bar (likes/dislikes) on the bottom of every YouTube™ video thumbnail.", | ||
"author": "Elliot Waite", | ||
"icons": { | ||
"96": "icons/icon96.png", | ||
"128": "icons/icon128.png" | ||
}, | ||
"browser_action": { | ||
"action": { | ||
"default_icon": "icons/icon96.png", | ||
"default_title": "Settings", | ||
"default_popup": "options.html" | ||
}, | ||
"options_ui": { | ||
"page": "options.html", | ||
"chrome_style": false | ||
"browser_style": false | ||
}, | ||
"background": { | ||
"scripts": [ | ||
"background.js" | ||
], | ||
"persistent": false | ||
"service_worker": "background.js" | ||
}, | ||
"content_scripts": [ | ||
{ | ||
"matches": [ | ||
"*://*.youtube.com/*" | ||
], | ||
"js": [ | ||
"lib/jquery-3.6.0.min.js", | ||
"lib/jquery-3.6.1.min.js", | ||
"content-script.js" | ||
], | ||
"run_at": "document_end" | ||
} | ||
], | ||
"permissions": [ | ||
"*://*.youtube.com/*", | ||
"*://*.returnyoutubedislikeapi.com/*", | ||
"scripting", | ||
"storage" | ||
], | ||
"web_accessible_resources": [ | ||
"css/bar-blue-gray.css", | ||
"css/bar-blue-gray-video-page.css", | ||
"css/bar-bottom-separator.css", | ||
"css/bar-bottom-tooltip.css", | ||
"css/bar-bottom.css", | ||
"css/bar-green-red.css", | ||
"css/bar-green-red-video-page.css", | ||
"css/bar-tooltip.css", | ||
"css/bar-top-separator.css", | ||
"css/bar-top-tooltip.css", | ||
"css/bar-top.css", | ||
"css/bar.css" | ||
] | ||
"host_permissions": [ | ||
"*://*.youtube.com/*", | ||
"*://*.returnyoutubedislikeapi.com/*" | ||
], | ||
"web_accessible_resources": [{ | ||
"resources": [ | ||
"css/bar-blue-gray.css", | ||
"css/bar-blue-gray-video-page.css", | ||
"css/bar-bottom-separator.css", | ||
"css/bar-bottom-tooltip.css", | ||
"css/bar-bottom.css", | ||
"css/bar-green-red.css", | ||
"css/bar-green-red-video-page.css", | ||
"css/bar-tooltip.css", | ||
"css/bar-top-separator.css", | ||
"css/bar-top-tooltip.css", | ||
"css/bar-top.css", | ||
"css/bar.css" | ||
], | ||
"matches": [], | ||
"extension_ids": [] | ||
}] | ||
} |
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
Oops, something went wrong.