mirror of
https://github.com/huhu/rust-search-extension
synced 2024-11-14 15:47:12 +00:00
Migrate Firefox version to Manifest V3. close #201
This commit is contained in:
parent
77454c042e
commit
49949736da
3 changed files with 21 additions and 28 deletions
2
core
2
core
|
@ -1 +1 @@
|
|||
Subproject commit 5ec44508727b008c4803b9e079ce22a13b96a622
|
||||
Subproject commit abb055c76fa312adda1c94f7d6b0ec3838ac5b68
|
1
extension/firefox-bg.html
Normal file
1
extension/firefox-bg.html
Normal file
|
@ -0,0 +1 @@
|
|||
<script src="service-worker.js" type="module"></script>
|
|
@ -1,5 +1,6 @@
|
|||
// Format: jsonnetfmt -i manifest.jsonnet
|
||||
|
||||
local manifest_v3 = import 'core/manifest_v3.libsonnet';
|
||||
local utils = import 'core/utils.libsonnet';
|
||||
|
||||
local icons() = {
|
||||
|
@ -17,36 +18,27 @@ local browser = std.extVar('browser');
|
|||
local host_permissions = ['*://crates.io/api/v1/crates/*', 'https://rust.extension.sh/*'];
|
||||
local optional_host_permissions = ['file:///*'];
|
||||
local json = if std.member(['chrome', 'edge'], browser) then
|
||||
local manifest_v3 = import 'core/manifest_v3.libsonnet';
|
||||
manifest_v3.new(name, keyword, description, version, service_worker='service-worker.js', module_type=true)
|
||||
.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)
|
||||
manifest_v3.new(name, keyword, description, version, service_worker='service-worker.js')
|
||||
else
|
||||
local manifest_v2 = import 'core/manifest.libsonnet';
|
||||
manifest_v2.new(name, keyword, description, version)
|
||||
.addWebAccessibleResources(utils.js_files('script', ['lib', 'add-search-index']))
|
||||
.addWebAccessibleResources(['wasm/*.wasm', 'assets/*.svg'])
|
||||
.addBackgroundScripts(['settings.js', 'deminifier.js'])
|
||||
.addBackgroundScripts(utils.js_files('search', ['algorithm', 'book', 'crate', 'attribute', 'caniuse', 'lint']))
|
||||
.addBackgroundScripts(utils.js_files('search/docs', ['base', 'crate-doc', 'rustc']))
|
||||
.addBackgroundScripts(utils.js_files('index', ['attributes', 'books', 'caniuse', 'crates', 'std-docs', 'lints', 'labels', 'rfcs', 'commands', 'rustc', 'targets']))
|
||||
.addBackgroundScripts(utils.js_files('command', ['label', 'help', 'stable', 'rfc', 'rustc', 'target']))
|
||||
.addBackgroundScripts(['statistics.js', 'rust-version.js', 'crate-manager.js', 'index-manager.js', 'main.js'])
|
||||
.addPermissions(host_permissions)
|
||||
# Firefox does not support service worker yet.
|
||||
manifest_v3.new(name, keyword, description, version, background_page='firefox-bg.html')
|
||||
;
|
||||
|
||||
json.addIcons(icons())
|
||||
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())
|
||||
.addPermissions(['storage', 'unlimitedStorage'])
|
||||
.setOptionsUi('manage/index.html')
|
||||
.addContentScript(
|
||||
|
|
Loading…
Reference in a new issue