Skip to content

Commit 921c690

Browse files
committed
remove web_accessible_resources
1 parent 278f7de commit 921c690

File tree

8 files changed

+33
-45
lines changed

8 files changed

+33
-45
lines changed

manifest-chrome.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,5 @@
5050
"https://accounts.google.com/o/oauth2/revoke"
5151
],
5252
"offline_enabled": true,
53-
"web_accessible_resources": [
54-
"view/qr.html",
55-
"images/scan.gif"
56-
],
5753
"content_security_policy": "script-src 'self'; font-src 'self'; img-src 'self' data:; style-src 'self' 'unsafe-inline'; connect-src https://www.google.com/ https://*.dropboxapi.com https://www.googleapis.com/ https://accounts.google.com/o/oauth2/revoke ; default-src 'none'"
5854
}

manifest-firefox.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,5 @@
5050
"https://www.googleapis.com/*",
5151
"https://accounts.google.com/o/oauth2/revoke"
5252
],
53-
"web_accessible_resources": [
54-
"view/qr.html",
55-
"images/scan.gif"
56-
],
5753
"content_security_policy": "script-src 'self'; font-src 'self'; img-src 'self' data:; style-src 'self' 'unsafe-inline'; connect-src https://www.google.com/ https://*.dropboxapi.com https://www.googleapis.com/ https://accounts.google.com/o/oauth2/revoke ; default-src 'none'"
5854
}

package-lock.json

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"sass": "^1.21.0",
3030
"ts-loader": "^6.0.2",
3131
"typescript": "^3.5.1",
32+
"url-loader": "^2.0.1",
3233
"vue-loader": "^15.7.0",
3334
"vue-svg-loader": "^0.12.0",
3435
"vue-template-compiler": "^2.6.10",

src/content.ts

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// @ts-ignore
2+
import scanGIF from "../images/scan.gif";
3+
14
if (!document.getElementById("__ga_grayLayout__")) {
25
chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
36
switch (message.action) {
@@ -15,7 +18,7 @@ if (!document.getElementById("__ga_grayLayout__")) {
1518
alert(message.account + chrome.i18n.getMessage("added"));
1619
break;
1720
case "text":
18-
showQrCode(message.text);
21+
alert(message.text);
1922
break;
2023
case "pastecode":
2124
pasteCode(message.code);
@@ -38,10 +41,7 @@ function showGrayLayout() {
3841
document.body.appendChild(grayLayout);
3942
const scan = document.createElement("div");
4043
scan.className = "scan";
41-
scan.style.background =
42-
"url(" +
43-
chrome.extension.getURL("images/scan.gif") +
44-
") no-repeat center";
44+
scan.style.background = `url('${scanGIF}') no-repeat center`;
4545
grayLayout.appendChild(scan);
4646
const captureBox = document.createElement("div");
4747
captureBox.id = "__ga_captureBox__";
@@ -172,21 +172,6 @@ function sendPosition(
172172
});
173173
}
174174

175-
function showQrCode(msg: string) {
176-
const left = screen.width / 2 - 200;
177-
const top = screen.height / 2 - 100;
178-
const url =
179-
chrome.extension.getURL("view/qr.html") + "?" + encodeURIComponent(msg);
180-
window.open(
181-
url,
182-
"_blank",
183-
"toolbar=no, location=no, status=no, menubar=no, scrollbars=yes, copyhistory=no, width=400, height=200, left=" +
184-
left +
185-
",top=" +
186-
top
187-
);
188-
}
189-
190175
function pasteCode(code: string) {
191176
const _inputBoxes = document.getElementsByTagName("input");
192177
const inputBoxes: HTMLInputElement[] = [];

src/qr.ts

Lines changed: 0 additions & 4 deletions
This file was deleted.

view/qr.html

Lines changed: 0 additions & 11 deletions
This file was deleted.

webpack.config.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ module.exports = {
1010
content: './src/content.ts',
1111
popup: './src/popup.ts',
1212
import: './src/import.ts',
13-
qr: './src/qr.ts',
1413
qrdebug: './src/qrdebug.ts',
1514
test: './src/test/test.ts'
1615
},
@@ -19,7 +18,7 @@ module.exports = {
1918
{
2019
test: /\.tsx?$/,
2120
loader: 'ts-loader',
22-
options: {
21+
options: {
2322
appendTsSuffixTo: [/\.vue$/],
2423
transpileOnly: true
2524
},
@@ -32,6 +31,15 @@ module.exports = {
3231
{
3332
test: /\.svg$/,
3433
loader: 'vue-svg-loader'
34+
},
35+
{
36+
test: /\.(png|jpe?g|gif)$/,
37+
use: [
38+
{
39+
loader: 'url-loader',
40+
options: {},
41+
}
42+
]
3543
}
3644
]
3745
},

0 commit comments

Comments
 (0)