2020-01-16 12:30:14 +00:00
|
|
|
// jsonnet manifest.jsonnet --ext-str browser=chrome|firefox -o extension/manifest.json
|
2020-01-17 04:09:20 +00:00
|
|
|
local icons() = {
|
2020-04-12 05:29:46 +00:00
|
|
|
[size]: "rust.png"
|
2020-01-17 04:09:20 +00:00
|
|
|
for size in ["16","48","128"]
|
|
|
|
};
|
2020-03-01 08:33:52 +00:00
|
|
|
local js_files(name, files) = ["%s/%s.js" % [name, file] for file in files];
|
2020-01-16 12:30:14 +00:00
|
|
|
local manifest = {
|
|
|
|
manifest_version: 2,
|
|
|
|
name: "Rust Search Extension",
|
2020-03-01 08:33:52 +00:00
|
|
|
description: "The ultimate search extension for Rust",
|
2020-05-11 14:40:35 +00:00
|
|
|
version: "0.10.0",
|
2020-01-17 04:09:20 +00:00
|
|
|
icons: icons(),
|
2020-01-16 12:30:14 +00:00
|
|
|
browser_action: {
|
2020-03-01 08:33:52 +00:00
|
|
|
default_icon: $.icons,
|
2020-03-01 07:56:57 +00:00
|
|
|
default_popup: "popup/index.html",
|
2020-03-01 08:33:52 +00:00
|
|
|
default_title: $.description,
|
2020-01-16 12:30:14 +00:00
|
|
|
},
|
|
|
|
content_security_policy: "script-src 'self'; object-src 'self';",
|
|
|
|
omnibox: {
|
2020-01-17 04:09:20 +00:00
|
|
|
keyword: "rs"
|
2020-01-16 12:30:14 +00:00
|
|
|
},
|
2020-04-17 10:50:18 +00:00
|
|
|
web_accessible_resources: js_files("script", ["add-search-index"]),
|
2020-02-14 03:31:53 +00:00
|
|
|
content_scripts: [{
|
|
|
|
matches: [
|
|
|
|
"*://docs.rs/*"
|
|
|
|
],
|
2020-04-20 14:41:37 +00:00
|
|
|
js: js_files("script", ["lib", "docs-rs"]) + js_files("libs", ["semver"]),
|
2020-03-06 16:33:48 +00:00
|
|
|
css: ["script/docs-rs.css"],
|
2020-02-14 03:31:53 +00:00
|
|
|
run_at: "document_start"
|
|
|
|
}],
|
2020-01-16 12:30:14 +00:00
|
|
|
background: {
|
2020-03-01 08:33:52 +00:00
|
|
|
scripts: ["compat.js", "settings.js", "deminifier.js",] +
|
2020-03-07 09:13:18 +00:00
|
|
|
js_files("search" ,["book", "crate", "attribute", "lint"]) +
|
2020-03-07 17:01:49 +00:00
|
|
|
js_files("search/docs" ,["base", "std", "crate-doc"]) +
|
2020-03-25 14:27:23 +00:00
|
|
|
js_files("index" ,["books", "crates", "std-docs", "lints", "labels"]) +
|
|
|
|
js_files("command" ,["base", "history", "label", "manager"]) +
|
2020-05-01 13:20:15 +00:00
|
|
|
["omnibox.js", "main.js"]
|
2020-01-16 12:30:14 +00:00
|
|
|
},
|
|
|
|
permissions: [
|
|
|
|
"tabs"
|
|
|
|
],
|
|
|
|
appendContentSecurityPolicy(policy)::self + {
|
|
|
|
content_security_policy +: policy,
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2020-01-17 04:09:20 +00:00
|
|
|
if std.extVar("browser") == "firefox" then
|
|
|
|
manifest
|
|
|
|
else
|
2020-03-10 07:49:52 +00:00
|
|
|
manifest.appendContentSecurityPolicy(" script-src-elem 'self' https://rust-search-extension.now.sh/crates/index.js;")
|
|
|
|
+ {
|
2020-03-16 13:00:55 +00:00
|
|
|
description: "A handy browser extension to search Rust docs and crates, etc in the address bar instantly!",
|
|
|
|
// The production extension public key to get the constant extension id during development.
|
|
|
|
key: "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxOX+QfzcFnxPwwmzXDhuU59XGCSMZq+FGo0vOx/ufg/Vw7HfKEPVb9TKzrGtqW38kafWkjxOxGhF7VyyX2ymi55W0xqf8BedePbvMtV6H1tY5bscJ0dLKGH/ZG4T4f645LgvOWOBgyv8s3NDWXzwOMS57ER1y+EtHjDsWD1M0nfe0VCCLW18QlAsNTHfLZk6lUeEeGXZrl6+jK+pZxwhQFmc8cJvOyw7uAq6IJ9lnGDvxFVjGUepA0lKbLuIZjN3p70mgVUIuBYzKE6R8HDk4oBbKAK0HyyKfnuAYbfwVYotHw4def+OW9uADSlZEDC10wwIpU9NoP3szh+vWSnk0QIDAQAB"
|
|
|
|
}
|