Files
2026-02-05 16:36:54 +01:00

97 lines
2.2 KiB
JavaScript

// SPDX-FileCopyrightText: © 2024 Olivier Meunier <olivier@neokraft.net>
//
// SPDX-License-Identifier: GPL-3.0-only
"use strict"
function manifest(browser) {
browser = browser || "firefox"
let pkg = require("./package.json")
const result = {
manifest_version: 3,
name: "readeck",
version: pkg.version,
description: pkg.description,
author: `${pkg.author.name} <${pkg.author.email}>`,
permissions: [
"activeTab",
"contextMenus",
"scripting",
"storage",
"webRequest",
],
host_permissions: ["http://*/*", "https://*/*"],
background: {},
content_security_policy: {
extension_pages: "script-src 'self'",
},
action: {
default_title: "Readeck",
default_icon: {
48: "icon48.png",
},
default_area: "navbar",
default_popup: "action/index.html",
},
commands: {
_execute_action: {
description: "Toggle Readeck",
suggested_key: {
default: "Alt+Shift+R",
},
},
save: {
description: "Save the current page to Readeck",
suggested_key: {
default: "Alt+Shift+W",
},
},
},
icons: {
48: "icon48.png",
96: "icon96.png",
},
options_ui: {
page: "settings.html",
open_in_tab: true,
},
web_accessible_resources: [
{
resources: ["oauth-callback.html"],
matches: ["http://*/*", "https://*/*"],
},
],
}
switch (browser) {
case "firefox":
result.background.scripts = ["dist/background.js"]
result.browser_specific_settings = {
gecko: {
id: "readeck@readeck.com",
strict_min_version: "115.0",
data_collection_permissions: {
required: ["none"],
optional: [],
},
},
gecko_android: {
strict_min_version: "115.0",
},
}
break
case "chrome":
result.background.service_worker = "dist/background.js"
break
case "safari":
result.name = "Readeck"
result.background.service_worker = "dist/background.js"
break
}
return result
}
module.exports = manifest