File directory structure update

This commit is contained in:
Adam 2020-04-19 16:08:53 -07:00
parent 65163db75c
commit b84c534180
22 changed files with 83 additions and 78 deletions

21
LICENSE
View File

@ -1,21 +0,0 @@
MIT License
Copyright (c) 2019 Adam
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -1,4 +1,8 @@
# Bypass Paywalls browser extension
<p align="center">
<img src="https://github.com/iamadamdev/bypass-paywalls-chrome/blob/master/src/icons/bypass.png" width="75" height="75"/>
</p>
<h1 align="center">Bypass Paywalls</h1>
### Installation Instructions
**Google Chrome**
@ -174,7 +178,4 @@ Usually premium articles cannot be bypassed as they are behind a hard paywall.
* PRs are welcome.
### Show your support
* I am not asking for donations or anything like that, all I ask is that you star this repo.
### License
Bypass Paywalls is [MIT-licensed](https://github.com/iamadamdev/bypass-paywalls-chrome/blob/master/LICENSE).
* I am not asking for donations or anything like that, all I ask is that you star this repo.

View File

@ -1,21 +0,0 @@
#!/bin/sh
JS_FILES="background.js common.js contentScript.js options.js version.js"
HTML_FILES="options.html popup.html"
DOC_FILES="LICENSE README.md"
IMG_FILES="bypass.png"
GEN_FILES="$JS_FILES $HTML_FILES $DOC_FILES $IMG_FILES"
CH_FILES="$GEN_FILES manifest.json updates.xml"
FF_FILES="$GEN_FILES manifest-ff.json updates.json bypass-dark.png"
NAME="bypass-paywalls"
rm -f $NAME.crx $NAME.xpi
# Chrome .crx extension package
7z a -tzip -mx9 $NAME.crx $CH_FILES
7z rn $NAME.crx manifest-ch.json manifest.json # doesn't exist yet; fails harmlessly
# Firefox .xpi extension package (different manifest & update metadata)
7z a -tzip -mx9 $NAME.xpi $FF_FILES
7z rn $NAME.xpi manifest-ff.json manifest.json

39
build/build.sh Normal file
View File

@ -0,0 +1,39 @@
#!/bin/sh
JS_FILES="../src/js/common.js ../src/js/background.js ../src/js/sites.js ../src/js/contentScript.js ../src/js/options.js ../src/js/version.js"
DOC_FILES="../README.md"
IMG_FILES="../src/icons/bypass.png"
# Strip subdirectories for Chrome manifest
sed 's/src\/.*\///g' ../manifest.json > temp-chrome-manifest.json
# Strip subdirectories for Firefox manifest
sed 's/src\/.*\///g' ../manifest-ff.json > temp-ff-manifest.json
# Strip subdirectories for options html file
sed 's/\.\.\/js\///g' ../src/html/options.html > temp-options.html
# Strip subdirectories for popup html file
sed 's/\.\.\/js\///g' ../src/html/popup.html > temp-popup.html
HTML_FILES="temp-options.html temp-popup.html"
GEN_FILES="$JS_FILES $HTML_FILES $DOC_FILES $IMG_FILES"
CH_FILES="$GEN_FILES temp-chrome-manifest.json ../src/updates/updates.xml"
FF_FILES="$GEN_FILES temp-ff-manifest.json ../src/updates/updates.json ../src/icons/bypass-dark.png"
NAME="output/bypass-paywalls"
# Remove existing files
rm -f $NAME.crx $NAME.xpi
# Generate Chrome .crx extension package
7z a -tzip -mx9 $NAME.crx $CH_FILES
7z rn $NAME.crx temp-chrome-manifest.json manifest.json temp-options.html options.html temp-popup.html popup.html
# Generate Firefox .xpi extension package (Firefox manifest)
7z a -tzip -mx9 $NAME.xpi $FF_FILES
7z rn $NAME.xpi temp-ff-manifest.json manifest.json temp-options.html options.html temp-popup.html popup.html
# Remove temp files
echo "\nDeleting temp files..."
rm -v temp-chrome-manifest.json temp-ff-manifest.json temp-options.html temp-popup.html

View File

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

Before

Width:  |  Height:  |  Size: 208 KiB

After

Width:  |  Height:  |  Size: 208 KiB

View File

Before

Width:  |  Height:  |  Size: 158 KiB

After

Width:  |  Height:  |  Size: 158 KiB

View File

@ -1,8 +1,9 @@
{
"background": {
"scripts": [
"common.js",
"background.js"
"src/js/common.js",
"src/js/sites.js",
"src/js/background.js"
]
},
"content_scripts": [
@ -50,7 +51,7 @@
"*://*.washingtonpost.com/*",
"*://*.wsj.com/*"
],
"js": ["contentScript.js"]
"js": ["src/js/contentScript.js"]
}
],
"applications": {
@ -62,26 +63,26 @@
"browser_action": {
"theme_icons": [
{
"light": "bypass-dark.png",
"dark": "bypass.png",
"light": "src/icons/bypass-dark.png",
"dark": "src/icons/bypass.png",
"size": 128
}
],
"default_popup": "popup.html",
"default_popup": "src/html/popup.html",
"default_icon": {
"128": "bypass.png"
"128": "src/icons/bypass.png"
}
},
"description": "Bypass News Sites' Paywalls",
"homepage_url": "https://github.com/iamadamdev/bypass-paywalls-chrome/blob/master/README.md",
"icons": {
"128": "bypass.png"
"128": "src/icon/bypass.png"
},
"manifest_version": 2,
"name": "Bypass Paywalls",
"short_name": "Bypass Paywall",
"options_ui": {
"page": "options.html"
"page": "src/html/options.html"
},
"permissions": [
"cookies",

View File

@ -1,21 +1,29 @@
{
"background": {
"scripts": [
"common.js",
"background.js"
"src/js/common.js",
"src/js/sites.js",
"src/js/background.js"
]
},
"content_security_policy": "script-src 'self' https://ssl.google-analytics.com; object-src 'self'",
"content_scripts": [
{
"matches": [
"<all_urls>"
],
"js": ["src/js/contentScript.js"]
}],
"browser_action": {
"default_popup": "popup.html",
"default_popup": "src/html/popup.html",
"default_icon": {
"128": "bypass.png"
"128": "src/icons/bypass.png"
}
},
"description": "Bypass News Sites' Paywalls",
"homepage_url": "https://github.com/iamadamdev/bypass-paywalls-chrome/blob/master/README.md",
"icons": {
"128": "bypass.png"
"128": "src/icons/bypass.png"
},
"manifest_version": 2,
"key": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA3PRmcRnHFZwHUlCgoTAdBjc9nUjmJo8l8kvkl/OZV6biZFAGUQGdxF1xoGhRccWA7qfQrZdPwcM1VQoVS/1F+87XiutKTe/HNsTAFvOcVS0tjCSH6DOHpewkMUBZujwTIeo7UXUVmCPQ1UbVd6m8KmHYtSHYlaX0uXRcguWhLmO5hASxw4onvAD0uql/t/ntxsIATwn4hVApg0VZhy0QAbMany8/5ByKPa19mCQwsIdRkcpG+PNHTLWPDgeGoDL7S0DxIduraRhTlrDX/zy5ETu6NWq6r+/jRzmXAjx+vSDCU5Ps2YG8QwdCL4Zl+CNVdQrnqz4X1zfPFJ1FFmUSpwIDAQAB",
@ -24,7 +32,7 @@
"short_name": "Bypass Paywall",
"options_ui": {
"chrome_style": true,
"page": "options.html"
"page": "src/html/options.html"
},
"permissions": [
"cookies",

View File

@ -33,7 +33,8 @@
<button id="select-none">Select none</button>
</span>
<br/><br/>
<script src="common.js"></script>
<script src="options.js"></script>
<script src="../js/common.js"></script>
<script src="../js/sites.js"></script>
<script src="../js/options.js"></script>
</body>
</html>

View File

@ -6,7 +6,7 @@
<body>
<div style="width:180px;">Bypass Paywalls by Adam
<br><a href="options.html">Options</a> | <a href="https://github.com/iamadamdev/bypass-paywalls-chrome" target="_blank">GitHub</a> | <span id="version"></span></div>
<script src="common.js"></script>
<script src="version.js"></script>
<script src="../js/common.js"></script>
<script src="../js/version.js"></script>
</body>
</html>

View File

Before

Width:  |  Height:  |  Size: 654 B

After

Width:  |  Height:  |  Size: 654 B

View File

Before

Width:  |  Height:  |  Size: 693 B

After

Width:  |  Height:  |  Size: 693 B

View File

@ -1,5 +1,3 @@
/* Please respect alphabetical order when adding a site in any list */
'use strict';
const restrictions = {
@ -459,7 +457,7 @@ extension_api.webRequest.onCompleted.addListener(function(details) {
urls: ["<all_urls>"]
});
// Google Analytics to track DAU
// Google Analytics to track DAU (Chrome only)
function init_GA() {
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-69824169-2']);

8
src/js/common.js Normal file
View File

@ -0,0 +1,8 @@
const extension_api =
(typeof browser === 'object' &&
typeof browser.runtime === 'object' &&
typeof browser.runtime.getManifest === 'function') ? browser :
(typeof chrome === 'object' &&
typeof chrome.runtime === 'object' &&
typeof chrome.runtime.getManifest === 'function') ? chrome :
console.log('Cannot find extension_api under namespace "browser" or "chrome"');

View File

@ -1,12 +1,3 @@
const extension_api =
(typeof browser === 'object' &&
typeof browser.runtime === 'object' &&
typeof browser.runtime.getManifest === 'function') ? browser :
(typeof chrome === 'object' &&
typeof chrome.runtime === 'object' &&
typeof chrome.runtime.getManifest === 'function') ? chrome :
console.log('Cannot find extension_api under namespace "browser" or "chrome"');
// Cookies from this list are blocked by default
const defaultSites = {
'Adweek': 'adweek.com',