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,8 +18,13 @@ 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)
|
||||
manifest_v3.new(name, keyword, description, version, service_worker='service-worker.js')
|
||||
else
|
||||
# Firefox does not support service worker yet.
|
||||
manifest_v3.new(name, keyword, description, version, background_page='firefox-bg.html')
|
||||
;
|
||||
|
||||
json
|
||||
.addWebAccessibleResources(
|
||||
resources=['script/*.js', 'wasm/*.wasm', 'assets/*.svg'],
|
||||
matches=[
|
||||
|
@ -32,21 +38,7 @@ local json = if std.member(['chrome', 'edge'], browser) then
|
|||
}
|
||||
.addHostPermissions(host_permissions)
|
||||
.addOptionalHostPermissions(optional_host_permissions)
|
||||
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)
|
||||
;
|
||||
|
||||
json.addIcons(icons())
|
||||
.addIcons(icons())
|
||||
.addPermissions(['storage', 'unlimitedStorage'])
|
||||
.setOptionsUi('manage/index.html')
|
||||
.addContentScript(
|
||||
|
|
Loading…
Reference in a new issue