Skip to content

Commit

Permalink
Migrate to Manifest V3
Browse files Browse the repository at this point in the history
  • Loading branch information
ZipFile committed Aug 26, 2024
1 parent 53df1c3 commit bffc6cb
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 22 deletions.
8 changes: 2 additions & 6 deletions chromeifyManifest.impl.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
import { readFile, writeFile } from "fs/promises";

export function chromeifyManifest(manifest) {
manifest["manifest_version"] = 3;
manifest["minimum_chrome_version"] = "97";
manifest["action"] = manifest["page_action"];
manifest["commands"]["_execute_action"] = manifest["commands"]["_execute_page_action"];
manifest["background"] = {
"service_worker": "background.js",
"type": "module",
};
manifest["background"]["service_worker"] = manifest["background"]["scripts"][0];

delete manifest["page_action"];
delete manifest["commands"]["_execute_page_action"];
delete manifest["background"]["scripts"];
delete manifest["browser_specific_settings"];
delete manifest["options_ui"]["browser_style"];

return manifest;
}
Expand Down
7 changes: 0 additions & 7 deletions src/background.html

This file was deleted.

10 changes: 5 additions & 5 deletions src/manifest.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"manifest_version": 2,
"manifest_version": 3,
"name": "Upload to Danbooru",
"description": "Add a page action and a context menu option (for images) to upload to Danbooru.",
"version": "3.3.5",
Expand Down Expand Up @@ -154,11 +154,11 @@
]
},
"options_ui": {
"page": "options.html",
"browser_style": true
"page": "options.html"
},
"background": {
"page": "background.html"
"scripts": ["background.js"],
"type": "module"
},
"permissions": [
"activeTab",
Expand All @@ -175,7 +175,7 @@
"browser_specific_settings": {
"gecko": {
"id": "[email protected]",
"strict_min_version": "79.0"
"strict_min_version": "106.0"
}
}
}
8 changes: 4 additions & 4 deletions test/test_chromeifyManifest.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { chromeifyManifest, chromeifyManifestFile } from "../chromeifyManifest.i

function makeManifest() {
return {
"manifest_version": 2,
"manifest_version": 3,
"name": "Test",
"version": "0.0.1",
"icons": {
Expand All @@ -25,10 +25,10 @@ function makeManifest() {
},
"options_ui": {
"page": "options.html",
"browser_style": true,
},
"background": {
"page": "background.html",
"scripts": ["background.js"],
"type": "module",
},
"permissions": [
"activeTab",
Expand All @@ -45,7 +45,7 @@ function makeManifest() {
"browser_specific_settings": {
"gecko": {
"id": "admin@localhost",
"strict_min_version": "59.0",
"strict_min_version": "106.0",
},
},
};
Expand Down

0 comments on commit bffc6cb

Please sign in to comment.