Replace insecure use of innerHTML, changed update URL

master
and94x 2 years ago
parent 423a4669e3
commit 7c5229d315

@ -1,8 +1,4 @@
let translatableSpans = document.querySelectorAll('.i18n-target'); let translatableSpans = document.querySelectorAll('.i18n-target');
for (let t of translatableSpans) { for (let t of translatableSpans) {
t.innerHTML = getMessage(t.attributes['data-id'].value); t.innerText = chrome.i18n.getMessage(t.attributes['data-id'].value);
}
function getMessage(id){
return chrome.i18n.getMessage(id);
} }

@ -32,7 +32,7 @@ function validateAndSave() {
console.log('Failed to save settings - form validation was not successful.') console.log('Failed to save settings - form validation was not successful.')
saveButton.classList.replace('btn-primary', 'btn-danger'); saveButton.classList.replace('btn-primary', 'btn-danger');
saveButton.classList.replace('btn-success', 'btn-danger'); saveButton.classList.replace('btn-success', 'btn-danger');
saveButton.textContent = getMessage('settingsSaveButtonCaptionFailure'); saveButton.textContent = chrome.i18n.getMessage('settingsSaveButtonCaptionFailure');
} }
} }
@ -46,7 +46,7 @@ function save() {
// Update form controls to let user know options were saved. // Update form controls to let user know options were saved.
saveButton.classList.replace('btn-primary', 'btn-success'); saveButton.classList.replace('btn-primary', 'btn-success');
saveButton.classList.replace('btn-danger', 'btn-success'); saveButton.classList.replace('btn-danger', 'btn-success');
saveButton.textContent = getMessage('settingsSaveButtonCaptionSuccess'); saveButton.textContent = chrome.i18n.getMessage('settingsSaveButtonCaptionSuccess');
}); });
} else { } else {
console.error('Unsupported browser or no access to localStorage') console.error('Unsupported browser or no access to localStorage')
@ -58,8 +58,8 @@ function save() {
function load(){ function load(){
if (chrome && chrome.storage && chrome.storage.local) { if (chrome && chrome.storage && chrome.storage.local) {
chrome.storage.local.get({ chrome.storage.local.get({
baseURL: getMessage("settingsFormInputRequired"), baseURL: chrome.i18n.getMessage("settingsFormInputRequired"),
wssURL: getMessage("settingsFormInputRequired") wssURL: chrome.i18n.getMessage("settingsFormInputRequired")
}, function (items) { }, function (items) {
stammTVBaseUrl.value = items.baseURL; stammTVBaseUrl.value = items.baseURL;
stammTVWSSUrl.value = items.wssURL; stammTVWSSUrl.value = items.wssURL;
@ -70,7 +70,6 @@ function load(){
} }
function autofillWSSURL() { function autofillWSSURL() {
console.log('here am i');
if (stammTVBaseUrl.value.startsWith('http')) { if (stammTVBaseUrl.value.startsWith('http')) {
let predictedWSSURL = stammTVBaseUrl.value.replace('https', 'wss').replace('http', 'wss'); let predictedWSSURL = stammTVBaseUrl.value.replace('https', 'wss').replace('http', 'wss');
if (predictedWSSURL.endsWith('/')) { if (predictedWSSURL.endsWith('/')) {

@ -1,11 +1,16 @@
{ {
"manifest_version": 2, "manifest_version": 2,
"name": "StammTV Helper", "name": "StammTV Helper",
"version": "1.5", "version": "2.0.1",
"browser_action": { "browser_action": {
"default_title": "StammTV Context-Menu", "default_title": "StammTV Context-Menu",
"default_popup": "popup/popup.html" "default_popup": "popup/popup.html"
}, },
"browser_specific_settings": {
"gecko": {
"update_url": "https://stammtv.m-it.biz/firefox/updates.json"
}
},
"default_locale": "en", "default_locale": "en",
"description": "Adds a context-menu option to send URLs to your instance of StammTV", "description": "Adds a context-menu option to send URLs to your instance of StammTV",
"icons": { "icons": {

Loading…
Cancel
Save