Skip to content

Commit

Permalink
1.3.3: fix firefox CSP problem
Browse files Browse the repository at this point in the history
  • Loading branch information
cnwangjie committed Sep 7, 2018
1 parent 9c3ab75 commit fb54f8c
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 7 deletions.
1 change: 1 addition & 0 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ rules:
globals:
DEBUG: true
PRODUCTION: true
MOZ: true
ga: true
2 changes: 2 additions & 0 deletions config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
module.exports = {
development: {
__CLIENT_ID__: '530831729511-eq8apt6dhjimbmdli90jp2ple0lfmn3l.apps.googleusercontent.com',
__DEV_CSP__: process.env.MOZ ? '' : ' http://localhost:8098 chrome-extension://nhdogjmejiglipccpnnnanhbledajbpd'
},
production: {
__CLIENT_ID__: '530831729511-dclgvblhv7var13mvpjochb5f295a6vc.apps.googleusercontent.com',
__DEV_CSP__: ''
}
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"license": "MIT",
"scripts": {
"dev": "NODE_ENV=development webpack --watch",
"dev:moz": "MOZ=1 yarn dev",
"build": "NODE_ENV=production webpack",
"postbuild": "yarn run package",
"package": "rm -f dist.zip && cd dist && zip -r ../dist.zip ./*",
Expand Down
2 changes: 1 addition & 1 deletion src/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import __ from './common/i18n'
import browser from 'webextension-polyfill'
import boss from './common/service/boss'

if (DEBUG) import(
if (DEBUG && !MOZ) import(
/* webpackChunkName: "autoreload", webpackMode: "lazy" */
'./common/autoreload'
).then(({autoreload}) => autoreload())
Expand Down
18 changes: 12 additions & 6 deletions src/manifest.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
{
"manifest_version": 2,
"name": "__MSG_ext_name__",
"version": "1.3.2",
"version": "1.3.3",
"default_locale": "en",
"description": "__MSG_ext_desc__",
"author": "WangJie <[email protected]>",
"icons" : {
"icons": {
"16": "assets/icons/icon_16.png",
"48": "assets/icons/icon_48.png",
"128": "assets/icons/icon_128.png"
},
"background": {
"scripts": ["background.js"],
"scripts": [
"background.js"
],
"persistent": false
},
"commands": {
Expand All @@ -37,6 +39,11 @@
}
},
"browser_action": {
"default_icon": {
"16": "assets/icons/icon_16.png",
"24": "assets/icons/icon_48.png",
"32": "assets/icons/icon_128.png"
}
},
"permissions": [
"contextMenus",
Expand All @@ -54,10 +61,9 @@
},
"offline_enabled": true,
"options_page": "index.html#/app/options",
"options_ui":
{
"options_ui": {
"page": "index.html#/app/options",
"open_in_tab": true
},
"content_security_policy": "script-src 'self' 'unsafe-eval' https://www.google-analytics.com https://apis.google.com http://localhost:8098 chrome-extension://nhdogjmejiglipccpnnnanhbledajbpd; object-src 'self'"
"content_security_policy": "script-src 'self' 'unsafe-eval' https://www.google-analytics.com https://apis.google.com __DEV_CSP__; object-src 'self'"
}
2 changes: 2 additions & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const config = require('./config')

const resolve = (...paths) => path.join(__dirname, ...paths)
const mode = process.env.NODE_ENV || 'development'
const moz = process.env.MOZ
module.exports = {
mode,
entry: {
Expand All @@ -25,6 +26,7 @@ module.exports = {
new webpack.DefinePlugin({
DEBUG: mode === 'development',
PRODUCTION: mode !== 'development',
MOZ: moz,
}),
new CleanWebpackPlugin(['dist']),
new CopyWebpackPlugin([
Expand Down

0 comments on commit fb54f8c

Please sign in to comment.