Skip to content

Commit

Permalink
File directory structure update
Browse files Browse the repository at this point in the history
  • Loading branch information
iamadamdev committed Apr 19, 2020
1 parent 65163db commit b84c534
Show file tree
Hide file tree
Showing 22 changed files with 83 additions and 78 deletions.
21 changes: 0 additions & 21 deletions LICENSE

This file was deleted.

11 changes: 6 additions & 5 deletions README.md
@@ -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**
Expand Down Expand Up @@ -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.
21 changes: 0 additions & 21 deletions build.sh

This file was deleted.

39 changes: 39 additions & 0 deletions build/build.sh
@@ -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
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
19 changes: 10 additions & 9 deletions manifest-ff.json
@@ -1,8 +1,9 @@
{
"background": {
"scripts": [
"common.js",
"background.js"
"src/js/common.js",
"src/js/sites.js",
"src/js/background.js"
]
},
"content_scripts": [
Expand Down Expand Up @@ -50,7 +51,7 @@
"*://*.washingtonpost.com/*",
"*://*.wsj.com/*"
],
"js": ["contentScript.js"]
"js": ["src/js/contentScript.js"]
}
],
"applications": {
Expand All @@ -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",
Expand Down
20 changes: 14 additions & 6 deletions manifest.json
@@ -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",
Expand All @@ -24,7 +32,7 @@
"short_name": "Bypass Paywall",
"options_ui": {
"chrome_style": true,
"page": "options.html"
"page": "src/html/options.html"
},
"permissions": [
"cookies",
Expand Down
5 changes: 3 additions & 2 deletions options.html → src/html/options.html
Expand Up @@ -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>
4 changes: 2 additions & 2 deletions popup.html → src/html/popup.html
Expand Up @@ -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>
File renamed without changes
File renamed without changes
4 changes: 1 addition & 3 deletions background.js → src/js/background.js
@@ -1,5 +1,3 @@
/* Please respect alphabetical order when adding a site in any list */

'use strict';

const restrictions = {
Expand Down Expand Up @@ -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']);
Expand Down
8 changes: 8 additions & 0 deletions src/js/common.js
@@ -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"');
File renamed without changes.
File renamed without changes.
9 changes: 0 additions & 9 deletions common.js → src/js/sites.js
@@ -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',
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit b84c534

Please sign in to comment.