Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix offline mode not working in Chrome #275

Merged
merged 2 commits into from
Mar 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion core
2 changes: 1 addition & 1 deletion docs/content/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ path is your doc directory.

- For Chrome/Edge users:
Prepend `file://` before your doc directory, and input it to the input box on the
settings page.
settings page. Then [enable access to file URLs](https://developer.chrome.com/docs/extensions/develop/concepts/declare-permissions#allow_access_to_file_urls_and_incognito_pages) on the extension's details page.

![GIF](/offline-mode-chrome.gif)

Expand Down
2 changes: 2 additions & 0 deletions manifest.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ local description = 'Rust Search Extension - the ultimate search extension for R
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')
Expand All @@ -33,6 +34,7 @@ local json = if std.member(['chrome', 'edge'], browser) then
[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)
else
local manifest_v2 = import 'core/manifest.libsonnet';
manifest_v2.new(name, keyword, description, version)
Expand Down