Skip to content

Commit 728e011

Browse files
committed
Merge all changes for MV3 and make it buildable for both MV2 and MV3
1 parent f152a9a commit 728e011

32 files changed

+1530
-1136
lines changed

config/webpack.config.js

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,52 @@ function modifyManifest(browser, mode, buffer) {
1616
manifest.options_ui = {
1717
page: "pages/options.html"
1818
};
19-
manifest.permissions.push("cookies",
20-
"contextualIdentities");
19+
manifest.permissions.push("cookies");
20+
manifest.permissions.push("contextualIdentities");
21+
manifest.permissions.push("<all_urls>");
2122
} else if (browser === "safari") {
2223
manifest.incognito = "split";
2324
manifest.options_page = "pages/options.html";
25+
manifest.permissions.push("<all_urls>");
2426
manifest.background.persistent = false;
2527
} else {
28+
// chromium family
29+
manifest.manifest_version = 3;
2630
manifest.permissions.push("proxy");
2731
manifest.permissions.push("tts");
2832
manifest.permissions.push("downloads.shelf");
29-
manifest.background.persistent = false;
33+
manifest.permissions.push("favicon");
34+
manifest.permissions.push("userScripts");
35+
manifest.permissions.push("scripting");
3036
manifest.incognito = "split";
3137
manifest.options_page = "pages/options.html";
38+
manifest.background = {
39+
"service_worker": "background.js"
40+
};
41+
manifest.host_permissions = [
42+
"<all_urls>"
43+
];
44+
manifest.web_accessible_resources = [
45+
{
46+
"resources": [
47+
"api.js",
48+
"pages/neovim.html",
49+
"pages/default.js",
50+
"pages/emoji.tsv",
51+
"pages/l10n.json",
52+
"pages/frontend.html",
53+
"pages/pdf_viewer.html",
54+
"pages/shadow.css",
55+
"pages/default.css"
56+
],
57+
"matches": [
58+
"<all_urls>"
59+
]
60+
}
61+
];
62+
manifest.action = manifest.browser_action;
63+
delete manifest.browser_action;
64+
delete manifest.content_security_policy;
3265

3366
if (mode === "development") {
3467
manifest.key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAneIRqYRqG/0RoYzpWoyeeO8KxxvWZvIabABbeQyHQ2PFOf81j/O5J28HGAEQJ56AptKMTcTeG2qZga9B2u9k98OmRcGp8BDco6fh1vD6/x0fWfehPeub5IcEcQmCd1lBuVa8AtUqV3C+He5rS4g8dB8g8GRlSPPSiDSVNMv+iwKAk7TbM3TKz6DyFO8eCtWXr6wJCcYeJA+Mub7o8DKIHKgv8XH8+GbJGjeeIUBU7mlGlyS7ivdsG1V6D2/Ldx0O1e6sRn7f9jiC4Xy1N+zgZ7BshYbnlbwedomg1d5kuo5m4rS+8BgTchPPkhkvEs62MI4e+fmQd0oGgs7PtMSrTwIDAQAb";
@@ -54,6 +87,7 @@ module.exports = (env, argv) => {
5487
};
5588
const moduleEntries = {
5689
'pages/options': './src/content_scripts/options.js',
90+
'api': './src/user_scripts/index.js'
5791
};
5892
const pagesCopyOptions = {
5993
ignore: [

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "Surfingkeys",
3-
"version": "1.16.1",
3+
"version": "1.17.3",
44
"description": "Map your keys for web surfing, expand your browser with javascript and keyboard.",
55
"main": "background.js",
66
"directories": {

src/background/chrome.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {
22
LOG,
33
filterByTitleOrUrl,
4-
} from '../content_scripts/common/utils.js';
4+
} from '../common/utils.js';
55
import {
66
_save,
77
dictFromArray,
@@ -26,6 +26,8 @@ function loadRawSettings(keys, cb, defaultSet) {
2626
cb(subset);
2727
});
2828
} else if (localSavedAt < syncSavedAt) {
29+
// don't sync local path
30+
delete syncSet.localPath;
2931
extendObject(rawSet, syncSet);
3032
cb(getSubSettings(rawSet, keys));
3133
_save(chrome.storage.local, syncSet);
@@ -117,7 +119,7 @@ function getLatestHistoryItem(text, maxResults, cb) {
117119
text: "",
118120
maxResults: prefetch
119121
}, function(items) {
120-
const filtered = filterByTitleOrUrl(items, text);
122+
const filtered = filterByTitleOrUrl(items, text, false);
121123
results = [...results, ...filtered];
122124
if (items.length < maxResults || results.length >= maxResults) {
123125
// all items are scanned or we have got what we want
@@ -134,7 +136,7 @@ function getLatestHistoryItem(text, maxResults, cb) {
134136

135137
function generatePassword() {
136138
const random = new Uint32Array(8);
137-
window.crypto.getRandomValues(random);
139+
self.crypto.getRandomValues(random);
138140
return Array.from(random).join("");
139141
}
140142

0 commit comments

Comments
 (0)