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 = { 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( 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; const handlers = window.apis.errorHandlers;
// INITIALIZATION // Initialization
// ============== // ==============
chrome.proxy.settings.get( chrome.proxy.settings.get(
@ -210,8 +213,7 @@
window.utils.messages.searchSettingsForUrl('proxy') window.utils.messages.searchSettingsForUrl('proxy')
); );
} }
const errors = handlers.idToError; handlers.viewErrorVoid(notId);
handlers.viewErrorVoid(errors);
}); });

View File

@ -718,16 +718,24 @@
new Date(antiCensorRu.lastPacUpdateStamp).toLocaleString('ru-RU') 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) { if (!ifUpdating) {
// LAUNCH, RELOAD, ENABLE // LAUNCH, RELOAD, ENABLE
antiCensorRu.pacProviders = oldStorage.pacProviders; antiCensorRu.pacProviders = oldStorage.pacProviders;
console.log('Extension launched, reloaded or enabled.'); console.log('Extension launched, reloaded or enabled.');
} else { } else {
// UPDATE & MIGRATION // UPDATE & MIGRATION
const key = antiCensorRu._currentPacProviderKey; const key = antiCensorRu._currentPacProviderKey;
if ( if (
@ -737,44 +745,35 @@
antiCensorRu._currentPacProviderKey = 'Антицензорити' antiCensorRu._currentPacProviderKey = 'Антицензорити'
} }
console.log('Extension updated.'); console.log('Extension updated.');
} }
if (!antiCensorRu.getPacProvider()) { if (antiCensorRu.getPacProvider()) {
/*
In case of UPDATE: const ifAlarmTriggered = antiCensorRu.setAlarms();
1. new providers will still be shown.
2. new version won't be pushed to storage if (ifAlarmTriggered) {
*/ return; // Already pushed.
console.log('No PAC provider set. Do nothing.'); }
return pushOnUpdate();
} }
if( ifUpdating ) {
/* antiCensorRu.pushToStorageAsync();
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 ifAlarmTriggered = antiCensorRu.setAlarms();
if (!ifAlarmTriggered) {
return pushOnUpdate();
} }
/* /*
History of Changes to Storage (Migration Guide) History of Changes to Storage (Migration Guide)
----------------------------------------------- -----------------------------------------------
Version 0.0.0.17: Version 0.0.0.17:
* "Антиценз" removed. * Remove "Антиценз".
* "Оба_и_на_свитчах" renamed to "Антицензорити". * Rename "Оба_и_на_свитчах" to "Антицензорити"
* Add provider.label and provider.desc.
Version 0.0.0.10: Version 0.0.0.10:
* Added this.version. * Add this.version.
* PacProvider.proxyIps changed from {ip -> Boolean} to {ip -> hostname}. * Change PacProvider.proxyIps from {ip -> Boolean} to {ip -> hostname}.
Version 0.0.0.8-9: Version 0.0.0.8-9:
* Changed storage.ifNotInstalled to storage.ifFirstInstall. * Change storage.ifNotInstalled to storage.ifFirstInstall.
* Added storage.lastPacUpdateStamp. * Add storage.lastPacUpdateStamp.
**/ **/
}); });

View File

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

View File

@ -2,7 +2,7 @@
<html style="display: none"> <html style="display: none">
<head> <head>
<title>Выбор провайдера PAC</title> <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> <style>
:root { :root {
--ribbon-color: #4169e1; /* #1a6cc8 */ --ribbon-color: #4169e1; /* #1a6cc8 */