~harmless/security.txt

e67159d87fc69c1cbad9025f3db088dcbe876c44 — Travis Paul 1 year, 8 months ago ed388d3
Minor tweaks pre-RC release.
9 files changed, 40 insertions(+), 17 deletions(-)

M README.md
M src/install.html
M src/js/background.js
M src/js/global.js
R src/js/{i18n.js => install.js}
M src/js/options.js
A src/js/release.js
M src/popup.html
M src/release.html
M README.md => README.md +11 -0
@@ 10,9 10,20 @@ display the files.

``yarn && yarn run build``

Each supported browser has a subdirectory within the `build` directory.

## Developer Quick Reference

- [Firefox Browser Extensions MDN](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions)
- [Chrome Extension Developer Guide](https://developer.chrome.com/extensions/devguide)
- [Opera Extensions Documentation](https://dev.opera.com/extensions/)
- [Microsoft Edge (EdgeHTML) extensions](https://docs.microsoft.com/en-us/microsoft-edge/extensions/)

## [License](LICENSE)

This project is licensed under the [BSD-2-Clause](https://opensource.org/licenses/BSD-2-Clause) license except where otherwise noted in the source files.

- [awsm.css](https://github.com/igoradamenko/awsm.css) is under the [MIT](https://opensource.org/licenses/MIT) license
- [webextension-polyfill](https://github.com/mozilla/webextension-polyfill) is under the [MPL-2.0](https://opensource.org/licenses/MPL-2.0)

See the [package.json](package.json) file for node modules used for building the project.
\ No newline at end of file

M src/install.html => src/install.html +1 -1
@@ 44,6 44,6 @@
    </footer>
    <script src="js/browser-polyfill.js"></script>
    <script src="js/global.js"></script>
    <script src="js/i18n.js"></script>
    <script src="js/install.js"></script>
  </body>
</html>
\ No newline at end of file

M src/js/background.js => src/js/background.js +11 -9
@@ 49,14 49,15 @@ function fetchFiles(tabId, tab) {

    browser.storage.local.get('check_humanstxt').then((result) => {

      if (result && result.hasOwnProperty('check_humanstxt') && result.check_humanstxt === 'OFF') {
      if (result && result.hasOwnProperty('check_humanstxt') && 
          result.check_humanstxt === 'OFF') {
        humansTxtCheck = false;
        return console.log('humans.txt check disabled');
      }

      // XXX I've encountered at least one site (netflix.com) where a HEAD 
      // doesn't work on a humans.txt file (403 response). While odd, in all 
      // fairness, the "humans.txt" files is inteded for "humans" who wouldn't
      // fairness, the "humans.txt" files is intedned for "humans" who wouldn't
      // be making HEAD requests but rather navigating to the URL manually...
      return fetch(`${host}/humans.txt`/*, fetchOptions*/).then((result) => {



@@ 81,8 82,6 @@ function fetchFiles(tabId, tab) {
        title = i18n('found_security_and_humans_txt');
      }

      // Mote that we need to change icons for Chrome/Edge bug with pageAction.hide()
      // interesting enough, the bug doesn't impact Opera
      if (finalResults.security || finalResults.humans) {
        localStorage.setItem(finalResults.host, JSON.stringify(finalResults));
        browser.pageAction.show(tabId);


@@ 92,6 91,8 @@ function fetchFiles(tabId, tab) {
            `&humans=${finalResults.humans}`
        });

        // XXX Note that we need to change icons for Chrome/Edge bug with 
        // pageAction.hide() interesting enough, the bug doesn't impact Opera
        if (BROWSER_QUIRKS === 'chrome' || BROWSER_QUIRKS === 'edge') {
          browser.pageAction.setIcon({
            tabId: tabId,


@@ 161,11 162,12 @@ function runtimeOnInstalled(details) {
        url: browser.runtime.getURL('install.html')
      });
    break;
    case 'update':
      browser.tabs.create({
        url: browser.runtime.getURL('release.html')
      });
    break;
    // XXX No updates yet
    // case 'update':
    //   browser.tabs.create({
    //     url: browser.runtime.getURL('release.html')
    //   });
    // break;
    default:
      console.log('browser.runtime.onInstalled', details);
    break;

M src/js/global.js => src/js/global.js +2 -1
@@ 35,7 35,8 @@ const i18nTag = {
      return;
    }
    for (let i = 0; i < element.options.length; i++) {
      element.options[i].textContent = i18n(element.id + '_' + element.options[i].value);
      element.options[i].textContent = i18n(element.id + '_' +
        element.options[i].value);
    }
  }
};

R src/js/i18n.js => src/js/install.js +3 -1
@@ 1,3 1,5 @@
/* globals i18nHydrate */

i18nHydrate();
\ No newline at end of file
window.addEventListener('DOMContentLoaded', () => {
  i18nHydrate();
});
\ No newline at end of file

M src/js/options.js => src/js/options.js +6 -3
@@ 23,8 23,10 @@ window.addEventListener('DOMContentLoaded', () => {
      element.addEventListener('change', (event) => {
        const pref = {};
        pref[event.target.id] = event.target.value;
        console.log(`Setting '${event.target.id}' to new value of '${event.target.value}'`);
        browser.storage.local.set(pref).then(storageLocalSet, storageLocalSetError);
        console.log(`Setting '${event.target.id}' to new value of: ` + 
          event.target.value);
        browser.storage.local.set(pref).then(storageLocalSet,
          storageLocalSetError);
      });
    }, storageLocalGetError);
  });


@@ 36,7 38,8 @@ document.querySelector('button').addEventListener('click', () => {
    const pref = {};
    element.value = defaultOptions[element.id];
    pref[element.id] = element.value;
    console.log(`Setting '${element.id}' to default value of '${element.value}'`);
    console.log(`Setting '${element.id}' to default value of: ` + 
      element.value);
    browser.storage.local.set(pref).then(storageLocalSet, storageLocalSetError);
  });
});
\ No newline at end of file

A src/js/release.js => src/js/release.js +5 -0
@@ 0,0 1,5 @@
/* globals i18nHydrate */

window.addEventListener('DOMContentLoaded', () => {
  i18nHydrate();
});
\ No newline at end of file

M src/popup.html => src/popup.html +0 -1
@@ 21,7 21,6 @@
    </div>
    <script src="js/browser-polyfill.js"></script>
    <script src="js/global.js"></script>
    <script src="js/i18n.js"></script>
    <script src="js/popup.js"></script>
  </body>
</html>
\ No newline at end of file

M src/release.html => src/release.html +1 -1
@@ 21,6 21,6 @@
    </footer>
    <script src="js/browser-polyfill.js"></script>
    <script src="js/global.js"></script>
    <script src="js/i18n.js"></script>
    <script src="js/release.js"></script>
  </body>
</html>
\ No newline at end of file