Skip to content

Commit

Permalink
Adding in changes so that Google doesn't pull me from the store
Browse files Browse the repository at this point in the history
  • Loading branch information
Garethp committed Apr 11, 2022
1 parent 34b2d67 commit b367bd4
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 15 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,9 @@ Take a look at the Feature List below
* Edge and Opera Support
* Possible EPWING support
* Add Jisho Stroke Orders

## Building for different browsers

A small note: When building for Chrome you need to remove the clipboard read optional
permission from the manifest. They don't require it (Firefox does though) and because
they don't require it they consider it a violation to even include it in the manifest
3 changes: 1 addition & 2 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"manifest_version": 2,
"author": "Gareth Parker",
"name": "RikaiRebuilt",
"version": "1.3.8",
"version": "1.3.9",

"applications": {
"gecko": {
Expand All @@ -23,7 +23,6 @@

"permissions": [
"<all_urls>",
"tabs",
"storage",
"contextMenus",
"nativeMessaging",
Expand Down
29 changes: 16 additions & 13 deletions src/background.ts
Original file line number Diff line number Diff line change
Expand Up @@ -543,19 +543,22 @@ browser.contextMenus.create({
browser.contextMenus.create({
title: "Visual Novel Hook",
contexts: ["browser_action"],
onclick: () => {
browser.permissions
.request({
permissions: ["clipboardRead"],
})
.then((allowed: boolean) => {
if (!allowed) return;

browser.tabs.create({
url: browser.extension.getURL("vn-hook/index.html"),
});
});
},
onclick: async () => {
// Chrome doesn't require us to check, and in fact doesn't **allow** us to check for clipboardRead permission
// because it's technically not required so we're not allowed to include it, but we still have to have a way of
// checking it for Firefox. However we need to check if we're in firefox land or chrome land in a non-async way
// that's why we check if getBrowserInfo exists, rather than actually calling it

const allowed = browser.runtime.getBrowserInfo
? await browser.permissions.request({ permissions: ["clipboardRead"] })
: true;

if (!allowed) return;

browser.tabs.create({
url: browser.extension.getURL("vn-hook/index.html"),
});
}
});

// @ts-ignore
Expand Down

0 comments on commit b367bd4

Please sign in to comment.