mv font-awesome, simplify launch & update, add type to error reports

This commit is contained in:
Ilya Ig. Petrov 2017-01-11 11:26:20 +00:00
parent fc1b0fcae2
commit c6d0de4798
11 changed files with 39 additions and 38 deletions

View File

@ -78,11 +78,14 @@
window.apis.errorHandlers = {
viewErrorVoid(err) {
viewErrorVoid(errId) {
const json = JSON.stringify(err, errorJsonReplacer, 0);
const errors = this.idToError;
const json = JSON.stringify(errors, errorJsonReplacer, 0);
openAndFocus(
'http://rebrand.ly/ac-error/?json=' + encodeURIComponent(json) + '&version=' + chrome.runtime.getManifest().version
'http://rebrand.ly/ac-error/?json=' + encodeURIComponent(json) +
'&type=' + encodeURIComponent(errId) +
'&version=' + chrome.runtime.getManifest().version
);
},
@ -194,7 +197,7 @@
const handlers = window.apis.errorHandlers;
// INITIALIZATION
// Initialization
// ==============
chrome.proxy.settings.get(
@ -210,8 +213,7 @@
window.utils.messages.searchSettingsForUrl('proxy')
);
}
const errors = handlers.idToError;
handlers.viewErrorVoid(errors);
handlers.viewErrorVoid(notId);
});

View File

@ -718,16 +718,24 @@
new Date(antiCensorRu.lastPacUpdateStamp).toLocaleString('ru-RU')
);
const ifUpdating = antiCensorRu.version !== oldStorage.version;
console.log('IF_UPD?', ifUpdating, antiCensorRu.version, 'vs', oldStorage.version);
const pushOnUpdate = () => ifUpdating ? antiCensorRu.pushToStorageAsync() : null;
/*
1. There is no way to check that chrome.runtime.onInstalled wasn't fired
except timeout.
Otherwise we could put storage migration code only there.
2. We have to check storage for migration before using it.
Better on each launch then on each pull.
*/
const ifUpdating = antiCensorRu.version !== oldStorage.version;
if (!ifUpdating) {
// LAUNCH, RELOAD, ENABLE
antiCensorRu.pacProviders = oldStorage.pacProviders;
console.log('Extension launched, reloaded or enabled.');
} else {
// UPDATE & MIGRATION
const key = antiCensorRu._currentPacProviderKey;
if (
@ -737,44 +745,35 @@
antiCensorRu._currentPacProviderKey = 'Антицензорити'
}
console.log('Extension updated.');
}
if (!antiCensorRu.getPacProvider()) {
/*
In case of UPDATE:
1. new providers will still be shown.
2. new version won't be pushed to storage
*/
console.log('No PAC provider set. Do nothing.');
return pushOnUpdate();
}
/*
1. There is no way to check that chrome.runtime.onInstalled wasn't fired
except timeout.
Otherwise we could put storage migration code only there.
2. We have to check storage for migration before using it.
Better on each launch then on each pull.
*/
if (antiCensorRu.getPacProvider()) {
const ifAlarmTriggered = antiCensorRu.setAlarms();
if (!ifAlarmTriggered) {
return pushOnUpdate();
if (ifAlarmTriggered) {
return; // Already pushed.
}
}
if( ifUpdating ) {
antiCensorRu.pushToStorageAsync();
}
/*
History of Changes to Storage (Migration Guide)
-----------------------------------------------
Version 0.0.0.17:
* "Антиценз" removed.
* "Оба_и_на_свитчах" renamed to "Антицензорити".
* Remove "Антиценз".
* Rename "Оба_и_на_свитчах" to "Антицензорити"
* Add provider.label and provider.desc.
Version 0.0.0.10:
* Added this.version.
* PacProvider.proxyIps changed from {ip -> Boolean} to {ip -> hostname}.
* Add this.version.
* Change PacProvider.proxyIps from {ip -> Boolean} to {ip -> hostname}.
Version 0.0.0.8-9:
* Changed storage.ifNotInstalled to storage.ifFirstInstall.
* Added storage.lastPacUpdateStamp.
* Change storage.ifNotInstalled to storage.ifFirstInstall.
* Add storage.lastPacUpdateStamp.
**/
});

View File

@ -1,7 +1,7 @@
{
"manifest_version": 2,
"name": "__MSG_extName__ 0.16",
"name": "__MSG_extName__ 0.17",
"default_locale": "ru",
"description": "__MSG_extDesc__",
"version": "0.0.0.17",

View File

@ -2,7 +2,7 @@
<html style="display: none">
<head>
<title>Выбор провайдера PAC</title>
<link rel="stylesheet" href="./font-awesome/css/font-awesome.min.css">
<link rel="stylesheet" href="./vendor/font-awesome/css/font-awesome.min.css">
<style>
:root {
--ribbon-color: #4169e1; /* #1a6cc8 */