2022-07-14 16:41:48 +00:00
|
|
|
// Format: jsonnetfmt -i manifest.jsonnet
|
|
|
|
|
2024-06-01 23:38:32 +00:00
|
|
|
local manifest_v3 = import 'core/manifest_v3.libsonnet';
|
2020-09-07 11:38:08 +00:00
|
|
|
local utils = import 'core/utils.libsonnet';
|
|
|
|
|
2020-01-17 04:09:20 +00:00
|
|
|
local icons() = {
|
2022-08-08 14:24:58 +00:00
|
|
|
[size]: 'assets/rust.png'
|
2020-05-12 13:45:04 +00:00
|
|
|
for size in ['16', '48', '128']
|
2020-01-17 04:09:20 +00:00
|
|
|
};
|
2020-05-13 15:39:15 +00:00
|
|
|
|
2022-07-14 16:41:48 +00:00
|
|
|
local name = 'Rust Search Extension';
|
2024-06-20 07:00:35 +00:00
|
|
|
local version = '2.0.0';
|
2022-07-14 16:41:48 +00:00
|
|
|
local keyword = 'rs';
|
|
|
|
local description = 'Rust Search Extension - the ultimate search extension for Rust';
|
|
|
|
|
|
|
|
local browser = std.extVar('browser');
|
|
|
|
|
2023-03-25 10:58:40 +00:00
|
|
|
local host_permissions = ['*://crates.io/api/v1/crates/*', 'https://rust.extension.sh/*'];
|
2024-03-24 12:38:48 +00:00
|
|
|
local optional_host_permissions = ['file:///*'];
|
2022-08-14 14:20:17 +00:00
|
|
|
local json = if std.member(['chrome', 'edge'], browser) then
|
2024-06-01 23:38:32 +00:00
|
|
|
manifest_v3.new(name, keyword, description, version, service_worker='service-worker.js')
|
2022-07-14 16:41:48 +00:00
|
|
|
else
|
2024-10-16 07:08:00 +00:00
|
|
|
// Firefox does not support service worker yet.
|
|
|
|
manifest_v3.new(name, keyword, description, version, background_page='firefox-bg.html') { browser_specific_settings: {
|
|
|
|
// Firefox need extension id to be set in the manifest.
|
|
|
|
// https://extensionworkshop.com/documentation/develop/extensions-and-the-add-on-id/
|
|
|
|
gecko: {
|
|
|
|
id: '{04188724-64d3-497b-a4fd-7caffe6eab29}',
|
|
|
|
strict_min_version: '109.0',
|
|
|
|
},
|
|
|
|
} }
|
2022-07-14 16:41:48 +00:00
|
|
|
;
|
|
|
|
|
2024-06-01 23:38:32 +00:00
|
|
|
json
|
|
|
|
.addWebAccessibleResources(
|
|
|
|
resources=['script/*.js', 'wasm/*.wasm', 'assets/*.svg'],
|
|
|
|
matches=[
|
|
|
|
'*://docs.rs/*',
|
|
|
|
'*://doc.rust-lang.org/*',
|
|
|
|
],
|
|
|
|
) {
|
|
|
|
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.
|
|
|
|
[if browser == 'chrome' then 'key' else null]: 'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxOX+QfzcFnxPwwmzXDhuU59XGCSMZq+FGo0vOx/ufg/Vw7HfKEPVb9TKzrGtqW38kafWkjxOxGhF7VyyX2ymi55W0xqf8BedePbvMtV6H1tY5bscJ0dLKGH/ZG4T4f645LgvOWOBgyv8s3NDWXzwOMS57ER1y+EtHjDsWD1M0nfe0VCCLW18QlAsNTHfLZk6lUeEeGXZrl6+jK+pZxwhQFmc8cJvOyw7uAq6IJ9lnGDvxFVjGUepA0lKbLuIZjN3p70mgVUIuBYzKE6R8HDk4oBbKAK0HyyKfnuAYbfwVYotHw4def+OW9uADSlZEDC10wwIpU9NoP3szh+vWSnk0QIDAQAB',
|
|
|
|
}
|
|
|
|
.addHostPermissions(host_permissions)
|
|
|
|
.addOptionalHostPermissions(optional_host_permissions)
|
|
|
|
.addIcons(icons())
|
2022-11-15 02:42:55 +00:00
|
|
|
.addPermissions(['storage', 'unlimitedStorage'])
|
2022-08-13 08:46:56 +00:00
|
|
|
.setOptionsUi('manage/index.html')
|
2022-07-14 16:41:48 +00:00
|
|
|
.addContentScript(
|
2020-05-13 15:53:22 +00:00
|
|
|
matches=['*://docs.rs/*'],
|
2024-10-16 03:35:08 +00:00
|
|
|
js=['content-script-bundle.js'] + utils.js_files('script', ['lib', 'docs-rs', 'rust-src-navigate', 'semver']),
|
2022-01-12 12:10:53 +00:00
|
|
|
css=['script/docs-rs.css', 'script/details-toggle.css'],
|
2020-07-24 09:10:48 +00:00
|
|
|
)
|
2022-07-14 16:41:48 +00:00
|
|
|
.addContentScript(
|
2020-12-19 16:27:14 +00:00
|
|
|
matches=['*://doc.rust-lang.org/*'],
|
2024-05-27 07:55:55 +00:00
|
|
|
js=['content-script-bundle.js'] + utils.js_files('script', ['lib', 'doc-rust-lang-org', 'rust-src-navigate']),
|
2022-01-12 12:10:53 +00:00
|
|
|
css=['script/doc-rust-lang-org.css', 'script/details-toggle.css'],
|
2021-01-16 16:29:08 +00:00
|
|
|
exclude_matches=['*://doc.rust-lang.org/nightly/nightly-rustc/*'],
|
|
|
|
)
|
2022-07-14 16:41:48 +00:00
|
|
|
.addContentScript(
|
2021-03-26 15:01:54 +00:00
|
|
|
matches=['*://rust.extension.sh/update'],
|
2024-05-27 07:55:55 +00:00
|
|
|
js=['content-script-bundle.js'] + utils.js_files('script', ['rust-extension-sh']),
|
2020-10-22 08:40:27 +00:00
|
|
|
css=[],
|
2022-08-07 13:39:39 +00:00
|
|
|
).addContentScript(
|
|
|
|
matches=[
|
|
|
|
'*://docs.rs/*',
|
|
|
|
'*://doc.rust-lang.org/*',
|
|
|
|
],
|
2024-05-27 07:55:55 +00:00
|
|
|
js=['content-script-bundle.js'] + utils.js_files('script', ['lib', 'macro-railroad', 'macro-railroad-wasm']),
|
2022-08-07 13:39:39 +00:00
|
|
|
css=['script/macro-railroad.css'],
|
2022-07-14 16:41:48 +00:00
|
|
|
)
|