Skip to content

Commit

Permalink
Updated several security/persmissions to publish extension.
Browse files Browse the repository at this point in the history
  • Loading branch information
louismeunier committed Dec 27, 2020
1 parent 45d7d06 commit 7488fe4
Show file tree
Hide file tree
Showing 6 changed files with 118 additions and 13 deletions.
9 changes: 0 additions & 9 deletions src/background/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,4 @@ chrome.runtime.onInstalled.addListener(function() {
})
})
open(chrome.extension.getURL("views/options/options.html"));
chrome.declarativeContent.onPageChanged.removeRules(undefined, function() {
chrome.declarativeContent.onPageChanged.addRules([{
conditions: [new chrome.declarativeContent.PageStateMatcher({
pageUrl: {hostEquals: 'www.worldcubeassociation.org'},
})
],
actions: [new chrome.declarativeContent.ShowPageAction()]
}]);
});
});
Binary file added src/images/logo2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/images/wcaaddons.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions src/manifest.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "wcaddons",
"version": "0.0.1",
"version": "0.0.2",
"description": "Features to enchance your worldcubeassociation.org experience",
"permissions":["declarativeContent","storage","tabs","https://www.worldcubeassociation.org/*"],
"permissions":["storage","tabs"],
"web_accessible_resources": [
"images/*.*"
],
Expand All @@ -15,7 +15,7 @@
"css":["content/content.css"],
"matches":["https://www.worldcubeassociation.org/persons/*"]
}],
"page_action": {
"browser_action": {
"default_popup": "views/popup/popup.html",
"default_icon": {
"16":"images/logo.png"
Expand All @@ -33,5 +33,5 @@
},
"options_page": "views/options/options.html",
"manifest_version": 2,
"content_security_policy": "script-src 'self' https://unpkg.com/react-dom@17/umd/react-dom.production.min.js https://unpkg.com/react@17/umd/react.production.min.js https://cdnjs.cloudflare.com/ajax/libs/react-bootstrap-table/4.3.1/react-bootstrap-table.min https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js https://unpkg.com/react@17/umd/react.development.js https://unpkg.com/react-dom@17/umd/react-dom.development.js; object-src 'self'"
"content_security_policy": "script-src 'self' https://unpkg.com/react-dom@17/umd/react-dom.production.min.js https://unpkg.com/react@17/umd/react.production.min.js https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js https://unpkg.com/react@17/umd/react.development.js https://unpkg.com/react-dom@17/umd/react-dom.development.js; object-src 'self'"
}
77 changes: 77 additions & 0 deletions src/views/react-test/components/options.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
'use strict';

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

var Options = function (_React$Component) {
_inherits(Options, _React$Component);

function Options(props) {
_classCallCheck(this, Options);

var _this = _possibleConstructorReturn(this, (Options.__proto__ || Object.getPrototypeOf(Options)).call(this, props));

_this.state = { value: 'time' };

_this.handleChange = _this.handleChange.bind(_this);
_this.handleSubmit = _this.handleSubmit.bind(_this);
return _this;
}

_createClass(Options, [{
key: 'handleChange',
value: function handleChange(event) {
this.setState({ value: event.target.value });
}
}, {
key: 'handleSubmit',
value: function handleSubmit(event) {
event.preventDefault();
this.props.mode(this.state.value);
}
}, {
key: 'render',
value: function render() {
return React.createElement(
'form',
{ onSubmit: this.handleSubmit },
React.createElement(
'label',
null,
React.createElement(
'select',
{ value: this.state.value, onChange: this.handleChange },
React.createElement(
'option',
{ value: 'time' },
'time'
),
React.createElement(
'option',
{ value: 'worldRank' },
'wr'
),
React.createElement(
'option',
{ value: 'continentRank' },
'cr'
),
React.createElement(
'option',
{ value: 'countryRank' },
'nr'
)
)
),
React.createElement('input', { type: 'submit', value: 'Submit' })
);
}
}]);

return Options;
}(React.Component);
37 changes: 37 additions & 0 deletions src/views/react-test/src/components/options.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
'use strict';

class Options extends React.Component {
constructor(props) {
super(props);
this.state = {value: 'time'};

this.handleChange = this.handleChange.bind(this);
this.handleSubmit = this.handleSubmit.bind(this);
}

handleChange(event) {
this.setState({value: event.target.value});

}

handleSubmit(event) {
event.preventDefault();
this.props.mode(this.state.value);
}

render() {
return (
<form onSubmit={this.handleSubmit}>
<label>
<select value={this.state.value} onChange={this.handleChange}>
<option value="time">time</option>
<option value="worldRank">wr</option>
<option value="continentRank">cr</option>
<option value="countryRank">nr</option>
</select>
</label>
<input type="submit" value="Submit" />
</form>
);
}
}

0 comments on commit 7488fe4

Please sign in to comment.