Skip to content
This repository was archived by the owner on Aug 16, 2024. It is now read-only.

Commit ed6b473

Browse files
committed
chore: change permissions in manifest
1 parent f27f017 commit ed6b473

File tree

3 files changed

+26
-9
lines changed

3 files changed

+26
-9
lines changed

src/common/api.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class Client {
3838
private getAPI(): string {
3939
switch (this.region) {
4040
case 'global':
41-
return 'https://a-translator-api.nerdynerd.org'
41+
return 'https://a-translator-api-cf.nerdynerd.org'
4242
case 'dev':
4343
return 'http://localhost:1337'
4444
default:

src/manifest.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
{
22
"name": "A Translator",
3-
"permissions": ["<all_urls>", "storage", "tabs"],
3+
"permissions": [
4+
"https://a-translator-api.nerdynerd.org/*",
5+
"https://a-translator-api-cf.nerdynerd.org/*",
6+
"storage",
7+
"tabs"
8+
],
49
"options_ui": {
510
"page": "options.html",
611
"chrome_style": false,
@@ -20,7 +25,7 @@
2025
},
2126
"content_scripts": [
2227
{
23-
"matches": ["http://*/*", "https://*/*", "<all_urls>"],
28+
"matches": ["http://*/*", "https://*/*"],
2429
"js": ["contentScript.bundle.js"],
2530
"css": ["contentScript.bundle.css"],
2631
"run_at": "document_end"

webpack.config.js

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -115,14 +115,26 @@ const options = {
115115
from: 'src/manifest.json',
116116
to: path.join(__dirname, 'build'),
117117
force: true,
118-
transform: function (content, path) {
118+
transform: function (content) {
119+
const manifest = JSON.parse(content.toString())
120+
const { permissions } = manifest
121+
122+
if (env.NODE_ENV !== 'production') {
123+
permissions.push('http://localhost:1337/*')
124+
}
125+
119126
// generates the manifest file using the package.json informations
120127
return Buffer.from(
121-
JSON.stringify({
122-
description: process.env.npm_package_description,
123-
version: process.env.npm_package_version,
124-
...JSON.parse(content.toString()),
125-
}),
128+
JSON.stringify(
129+
{
130+
...manifest,
131+
permissions,
132+
description: process.env.npm_package_description,
133+
version: process.env.npm_package_version,
134+
},
135+
null,
136+
2,
137+
),
126138
)
127139
},
128140
},

0 commit comments

Comments
 (0)