mirror of
https://github.com/anticensority/runet-censorship-bypass.git
synced 2024-11-24 02:13:43 +03:00
Release firefox edition separately
This commit is contained in:
parent
e5b47999b6
commit
0b80a6bd18
|
@ -56,52 +56,31 @@ const contexts = require('./src/templates-data').contexts;
|
||||||
|
|
||||||
const excFolder = (name) => [`!./src/**/${name}`, `!./src/**/${name}/**/*`];
|
const excFolder = (name) => [`!./src/**/${name}`, `!./src/**/${name}/**/*`];
|
||||||
const excluded = [ ...excFolder('test') , ...excFolder('node_modules'), ...excFolder('src') ];
|
const excluded = [ ...excFolder('test') , ...excFolder('node_modules'), ...excFolder('src') ];
|
||||||
const commonWoTests = ['./src/extension-common/**/*', ...excluded];
|
|
||||||
|
|
||||||
const miniDst = './build/extension-mini';
|
const miniDst = './build/extension-mini';
|
||||||
const fullDst = './build/extension-full';
|
const fullDst = './build/extension-full';
|
||||||
const betaDst = './build/extension-beta';
|
const betaDst = './build/extension-beta';
|
||||||
|
const firefoxDst = './build/extension-firefox';
|
||||||
|
|
||||||
gulp.task('_cp-common', ['clean'], function(cb) {
|
const commonSrc = './src/extension-common/**/*';;
|
||||||
|
const miniSrc = './src/extension-mini/**/*';
|
||||||
|
const fullSrc = './src/extension-full/**/*';
|
||||||
|
const firefoxSrc = './src/extension-firefox/**/*';
|
||||||
|
|
||||||
let fins = 0;
|
const joinSrc = (...args) => [...args, ...excluded];
|
||||||
const intheend = () => {
|
|
||||||
if (++fins === 2) {
|
|
||||||
cb();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
gulp.src(commonWoTests)
|
gulp.task('_cp-mini', function(cb) {
|
||||||
//.pipe(changed(miniDst))
|
|
||||||
.pipe(templatePlugin(contexts.mini))
|
|
||||||
.pipe(gulp.dest(miniDst))
|
|
||||||
.on('end', intheend);
|
|
||||||
|
|
||||||
gulp.src(commonWoTests)
|
gulp.src(joinSrc(commonSrc, miniSrc))
|
||||||
//.pipe(changed(fullDst))
|
|
||||||
.pipe(templatePlugin(contexts.full))
|
|
||||||
.pipe(gulp.dest(fullDst))
|
|
||||||
.on('end', intheend);
|
|
||||||
|
|
||||||
gulp.src(commonWoTests)
|
|
||||||
//.pipe(changed(fullDst))
|
|
||||||
.pipe(templatePlugin(contexts.beta))
|
|
||||||
.pipe(gulp.dest(betaDst))
|
|
||||||
.on('end', intheend);
|
|
||||||
});
|
|
||||||
|
|
||||||
gulp.task('_cp-mini', ['_cp-common'], function(cb) {
|
|
||||||
|
|
||||||
gulp.src(['./src/extension-mini/**/*', ...excluded])
|
|
||||||
//.pipe(changed(miniDst))
|
//.pipe(changed(miniDst))
|
||||||
.pipe(templatePlugin(contexts.mini))
|
.pipe(templatePlugin(contexts.mini))
|
||||||
.pipe(gulp.dest(miniDst))
|
.pipe(gulp.dest(miniDst))
|
||||||
.on('end', cb);
|
.on('end', cb);
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('_cp-full', ['_cp-common'], function(cb) {
|
gulp.task('_cp-full', function(cb) {
|
||||||
|
|
||||||
gulp.src(['./src/extension-full/**/*', ...excluded])
|
gulp.src(joinSrc(commonSrc, fullSrc))
|
||||||
//.pipe(changed(fullDst))
|
//.pipe(changed(fullDst))
|
||||||
.pipe(templatePlugin(contexts.full))
|
.pipe(templatePlugin(contexts.full))
|
||||||
.pipe(gulp.dest(fullDst))
|
.pipe(gulp.dest(fullDst))
|
||||||
|
@ -109,9 +88,19 @@ gulp.task('_cp-full', ['_cp-common'], function(cb) {
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('_cp-beta', ['_cp-common'], function(cb) {
|
gulp.task('_cp-firefox', function(cb) {
|
||||||
|
|
||||||
gulp.src(['./src/extension-full/**/*', ...excluded])
|
gulp.src(joinSrc(commonSrc, fullSrc, firefoxSrc))
|
||||||
|
//.pipe(changed(fullDst))
|
||||||
|
.pipe(templatePlugin(contexts.firefox))
|
||||||
|
.pipe(gulp.dest(firefoxDst))
|
||||||
|
.on('end', cb);
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
gulp.task('_cp-beta', function(cb) {
|
||||||
|
|
||||||
|
gulp.src(joinSrc(commonSrc, fullSrc))
|
||||||
//.pipe(changed(fullDst))
|
//.pipe(changed(fullDst))
|
||||||
.pipe(templatePlugin(contexts.beta))
|
.pipe(templatePlugin(contexts.beta))
|
||||||
.pipe(gulp.dest(betaDst))
|
.pipe(gulp.dest(betaDst))
|
||||||
|
@ -119,5 +108,6 @@ gulp.task('_cp-beta', ['_cp-common'], function(cb) {
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('build:all', ['_cp-mini', '_cp-full', '_cp-beta']);
|
gulp.task('build:all', ['_cp-mini', '_cp-full', '_cp-beta', '_cp-firefox']);
|
||||||
gulp.task('build:beta', ['_cp-beta']);
|
gulp.task('build:beta', ['_cp-beta']);
|
||||||
|
gulp.task('build:firefox', ['_cp-firefox']);
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
${persistent}
|
${persistent}
|
||||||
"scripts": [
|
"scripts": [
|
||||||
"00-init-apis.js"
|
"00-init-apis.js"
|
||||||
|
${scripts_0x}
|
||||||
, "11-error-handlers-api.js"
|
, "11-error-handlers-api.js"
|
||||||
, "12-errors-lib.js"
|
, "12-errors-lib.js"
|
||||||
, "13-http-lib.js"
|
, "13-http-lib.js"
|
||||||
|
|
|
@ -0,0 +1,42 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
{
|
||||||
|
|
||||||
|
if (!chrome.proxy.settings) {
|
||||||
|
|
||||||
|
const ffxStore = window.utils.createStorage('firefox-only');
|
||||||
|
|
||||||
|
|
||||||
|
chrome.proxy.settings = {
|
||||||
|
get: (_, cb) => {
|
||||||
|
|
||||||
|
let currentSettings = ffxStore('proxySettings') || {};
|
||||||
|
currentSettings.levelOfControl = 'controlled_by_this_extension'; // May be lie, but this field is required.
|
||||||
|
cb && cb(currentSettings);
|
||||||
|
|
||||||
|
},
|
||||||
|
onChange: {
|
||||||
|
addListener: () => {},
|
||||||
|
},
|
||||||
|
set: (details, cb) => {
|
||||||
|
|
||||||
|
browser.proxy.unregister();
|
||||||
|
browser.proxy.register('./default.pac.js');
|
||||||
|
|
||||||
|
|
||||||
|
// browser.proxy.onProxyError.addListener((...err) => { console.log('ERROR IN PAC:', ...err) });
|
||||||
|
|
||||||
|
browser.runtime.sendMessage(details, {toProxyScript: true});
|
||||||
|
ffxStore('proxySettings', details);
|
||||||
|
cb && cb();
|
||||||
|
|
||||||
|
},
|
||||||
|
};
|
||||||
|
const proxySettings = ffxStore('proxySettings');
|
||||||
|
if (proxySettings) {
|
||||||
|
chrome.proxy.settings.set(proxySettings);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -28,6 +28,7 @@ exports.contexts.full = Object.assign({}, commonContext, {
|
||||||
nameSuffixRu: '',
|
nameSuffixRu: '',
|
||||||
extra_permissions,
|
extra_permissions,
|
||||||
persistent: '',
|
persistent: '',
|
||||||
|
scripts_0x: '',
|
||||||
scripts_2x: ', "20-ip-to-host-api.js"',
|
scripts_2x: ', "20-ip-to-host-api.js"',
|
||||||
scripts_8x: ', "80-error-menu.js", "83-last-errors.js", "85-block-informer.js"',
|
scripts_8x: ', "80-error-menu.js", "83-last-errors.js", "85-block-informer.js"',
|
||||||
});
|
});
|
||||||
|
@ -38,10 +39,22 @@ exports.contexts.mini = Object.assign({}, commonContext, {
|
||||||
nameSuffixRu: ' МИНИ',
|
nameSuffixRu: ' МИНИ',
|
||||||
extra_permissions: '',
|
extra_permissions: '',
|
||||||
persistent: '"persistent": false,',
|
persistent: '"persistent": false,',
|
||||||
|
scripts_0x: '',
|
||||||
scripts_2x: ', "20-for-mini-only.js"',
|
scripts_2x: ', "20-for-mini-only.js"',
|
||||||
scripts_8x: '',
|
scripts_8x: '',
|
||||||
});
|
});
|
||||||
|
|
||||||
|
exports.contexts.firefox = Object.assign({}, commonContext, {
|
||||||
|
versionSuffix: '',
|
||||||
|
nameSuffixEn: '',
|
||||||
|
nameSuffixRu: '',
|
||||||
|
extra_permissions,
|
||||||
|
persistent: '',
|
||||||
|
scripts_0x: ', "01-chrome-proxy-settings.js"',
|
||||||
|
scripts_2x: ', "20-ip-to-host-api.js"',
|
||||||
|
scripts_8x: ', "80-error-menu.js", "83-last-errors.js", "85-block-informer.js"',
|
||||||
|
});
|
||||||
|
|
||||||
exports.contexts.beta = Object.assign({}, commonContext, {
|
exports.contexts.beta = Object.assign({}, commonContext, {
|
||||||
anticensorityPacUrls: [
|
anticensorityPacUrls: [
|
||||||
// 'https://rebrand.ly/ac-beta-pac',
|
// 'https://rebrand.ly/ac-beta-pac',
|
||||||
|
@ -53,6 +66,7 @@ exports.contexts.beta = Object.assign({}, commonContext, {
|
||||||
nameSuffixRu: ' ДЛЯ ТЕСТОВ',
|
nameSuffixRu: ' ДЛЯ ТЕСТОВ',
|
||||||
extra_permissions,
|
extra_permissions,
|
||||||
persistent: '',
|
persistent: '',
|
||||||
|
scripts_0x: '',
|
||||||
scripts_2x: ', "20-ip-to-host-api.js"',
|
scripts_2x: ', "20-ip-to-host-api.js"',
|
||||||
scripts_8x: ', "80-error-menu.js", "83-last-errors.js", "85-block-informer.js"',
|
scripts_8x: ', "80-error-menu.js", "83-last-errors.js", "85-block-informer.js"',
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue
Block a user