rust-search-extension/manifest.jsonnet

48 lines
2.2 KiB
Text
Raw Normal View History

2020-05-13 15:39:15 +00:00
local manifest = import 'core/manifest.libsonnet';
2020-01-17 04:09:20 +00:00
local icons() = {
2020-05-12 13:45:04 +00:00
[size]: 'rust.png'
for size in ['16', '48', '128']
2020-01-17 04:09:20 +00:00
};
2020-05-12 13:45:04 +00:00
local js_files(name, files) = ['%s/%s.js' % [name, file] for file in files];
2020-05-13 15:39:15 +00:00
local json = manifest.new(
name='Rust Search Extension',
2020-08-21 03:27:48 +00:00
version='0.11.0',
2020-05-13 15:39:15 +00:00
keyword='rs',
description='The ultimate search extension for Rust',
)
.addIcons(icons())
2020-08-21 03:27:48 +00:00
.addWebAccessibleResources(['script/add-search-index.js', 'script/add-nightly-search-index.js'])
2020-05-14 04:09:01 +00:00
.addBackgroundScripts(
['settings.js', 'deminifier.js']
2020-05-13 15:39:15 +00:00
)
2020-05-14 04:09:01 +00:00
.addBackgroundScripts(js_files('search', ['book', 'crate', 'attribute', 'lint']))
2020-08-21 03:27:48 +00:00
.addBackgroundScripts(js_files('search/docs', ['base', 'std', 'nightly', 'crate-doc']))
2020-08-06 04:39:10 +00:00
.addBackgroundScripts(js_files('index', ['attributes', 'books', 'crates', 'std-docs', 'lints', 'labels', 'commands']))
.addBackgroundScripts(js_files('command', ['label', 'help', 'stable']))
2020-05-14 04:09:01 +00:00
.addBackgroundScripts('main.js')
2020-05-13 15:39:15 +00:00
.addContentScript(
2020-05-13 15:53:22 +00:00
matches=['*://docs.rs/*'],
2020-05-13 15:39:15 +00:00
js=js_files('script', ['lib', 'docs-rs']) + js_files('libs', ['semver']),
2020-05-13 15:53:22 +00:00
css=['script/docs-rs.css'],
2020-07-24 09:10:48 +00:00
)
.addContentScript(
matches=['*://doc.rust-lang.org/nightly/std/*'],
js=js_files('script', ['lib', 'nightly-std']),
css=[],
2020-05-13 15:39:15 +00:00
);
2020-06-05 03:19:56 +00:00
local browser = std.extVar('browser');
if browser == 'firefox' then
2020-05-13 15:39:15 +00:00
json
2020-01-17 04:09:20 +00:00
else
json.appendContentSecurityPolicy(" script-src-elem 'self' https://rust.extension.sh/crates/index.js;")
2020-06-05 03:19:56 +00:00
+
if browser == 'chrome' then
{
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',
}
else {}