mirror of
https://github.com/mynodebtc/mynode.git
synced 2024-11-13 17:09:15 +00:00
Add toggle for disabling tor repo
This commit is contained in:
parent
97e9865f66
commit
26c27f7fd4
|
@ -72,6 +72,10 @@ if ! skip_base_upgrades ; then
|
||||||
grep -qxF "deb https://deb.torproject.org/torproject.org ${DEBIAN_VERSION} main" /etc/apt/sources.list || echo "deb https://deb.torproject.org/torproject.org ${DEBIAN_VERSION} main" >> /etc/apt/sources.list
|
grep -qxF "deb https://deb.torproject.org/torproject.org ${DEBIAN_VERSION} main" /etc/apt/sources.list || echo "deb https://deb.torproject.org/torproject.org ${DEBIAN_VERSION} main" >> /etc/apt/sources.list
|
||||||
grep -qxF "deb-src https://deb.torproject.org/torproject.org ${DEBIAN_VERSION} main" /etc/apt/sources.list || echo "deb-src https://deb.torproject.org/torproject.org ${DEBIAN_VERSION} main" >> /etc/apt/sources.list
|
grep -qxF "deb-src https://deb.torproject.org/torproject.org ${DEBIAN_VERSION} main" /etc/apt/sources.list || echo "deb-src https://deb.torproject.org/torproject.org ${DEBIAN_VERSION} main" >> /etc/apt/sources.list
|
||||||
fi
|
fi
|
||||||
|
if [ -f /mnt/hdd/mynode/settings/tor_repo_disabled ]; then
|
||||||
|
sed -i '/^deb https:\/\/deb.torproject.org/d' /etc/apt/sources.list
|
||||||
|
sed -i '/^deb-src https:\/\/deb.torproject.org/d' /etc/apt/sources.list
|
||||||
|
fi
|
||||||
# Raspbian mirrors
|
# Raspbian mirrors
|
||||||
#if [ $IS_RASPI = 1 ]; then
|
#if [ $IS_RASPI = 1 ]; then
|
||||||
# grep -qxF "deb http://plug-mirror.rcac.purdue.edu/raspbian/ ${DEBIAN_VERSION} main" /etc/apt/sources.list || echo "deb http://plug-mirror.rcac.purdue.edu/raspbian/ ${DEBIAN_VERSION} main" >> /etc/apt/sources.list
|
# grep -qxF "deb http://plug-mirror.rcac.purdue.edu/raspbian/ ${DEBIAN_VERSION} main" /etc/apt/sources.list || echo "deb http://plug-mirror.rcac.purdue.edu/raspbian/ ${DEBIAN_VERSION} main" >> /etc/apt/sources.list
|
||||||
|
|
|
@ -1144,6 +1144,13 @@ def enable_streamisolation_tor():
|
||||||
def disable_streamisolation_tor():
|
def disable_streamisolation_tor():
|
||||||
create_settings_file("streamisolation_tor_disabled")
|
create_settings_file("streamisolation_tor_disabled")
|
||||||
|
|
||||||
|
def is_tor_repo_enabled():
|
||||||
|
return not settings_file_exists("tor_repo_disabled")
|
||||||
|
def enable_tor_repo():
|
||||||
|
delete_settings_file("tor_repo_disabled")
|
||||||
|
def disable_tor_repo():
|
||||||
|
create_settings_file("tor_repo_disabled")
|
||||||
|
|
||||||
def is_aptget_tor_enabled():
|
def is_aptget_tor_enabled():
|
||||||
return os.path.isfile("/mnt/hdd/mynode/settings/torify_apt_get")
|
return os.path.isfile("/mnt/hdd/mynode/settings/torify_apt_get")
|
||||||
def enable_aptget_tor():
|
def enable_aptget_tor():
|
||||||
|
|
|
@ -94,6 +94,7 @@ def page_settings():
|
||||||
"upload_rate": upload_rate,
|
"upload_rate": upload_rate,
|
||||||
"btcrpcexplorer_token_enabled": is_btcrpcexplorer_token_enabled(),
|
"btcrpcexplorer_token_enabled": is_btcrpcexplorer_token_enabled(),
|
||||||
"is_btc_lnd_tor_enabled": is_btc_lnd_tor_enabled(),
|
"is_btc_lnd_tor_enabled": is_btc_lnd_tor_enabled(),
|
||||||
|
"is_tor_repo_enabled": is_tor_repo_enabled(),
|
||||||
"is_aptget_tor_enabled": is_aptget_tor_enabled(),
|
"is_aptget_tor_enabled": is_aptget_tor_enabled(),
|
||||||
"is_streamisolation_tor_enabled": is_streamisolation_tor_enabled(),
|
"is_streamisolation_tor_enabled": is_streamisolation_tor_enabled(),
|
||||||
"skip_fsck": skip_fsck(),
|
"skip_fsck": skip_fsck(),
|
||||||
|
@ -830,6 +831,18 @@ def page_btcrpcexplorer_token():
|
||||||
flash("BTC RPC Explorer Token Setting Saved", category="message")
|
flash("BTC RPC Explorer Token Setting Saved", category="message")
|
||||||
return redirect(url_for(".page_settings"))
|
return redirect(url_for(".page_settings"))
|
||||||
|
|
||||||
|
@mynode_settings.route("/settings/enable_tor_repo")
|
||||||
|
def page_enable_tor_repo():
|
||||||
|
check_logged_in()
|
||||||
|
|
||||||
|
enable = request.args.get('enable')
|
||||||
|
if enable == "1":
|
||||||
|
enable_tor_repo()
|
||||||
|
else:
|
||||||
|
disable_tor_repo()
|
||||||
|
|
||||||
|
flash("Tor Setting Saved", category="message")
|
||||||
|
return redirect(url_for(".page_settings"))
|
||||||
|
|
||||||
@mynode_settings.route("/settings/enable_aptget_tor")
|
@mynode_settings.route("/settings/enable_aptget_tor")
|
||||||
def page_enable_aptget_tor():
|
def page_enable_aptget_tor():
|
||||||
|
|
|
@ -524,6 +524,21 @@
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('#tor_repo_checkbox').change(function () {
|
||||||
|
$("#tor_repo").show();
|
||||||
|
});
|
||||||
|
$("#tor_repo").on("click", function() {
|
||||||
|
enabled=$('#tor_repo_checkbox').is(":checked")
|
||||||
|
if (enabled)
|
||||||
|
{
|
||||||
|
window.location.href='/settings/enable_tor_repo?enable=1'
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
window.location.href='/settings/enable_tor_repo?enable=0'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
$('#aptget_tor_checkbox').change(function () {
|
$('#aptget_tor_checkbox').change(function () {
|
||||||
$("#aptget_tor").show();
|
$("#aptget_tor").show();
|
||||||
});
|
});
|
||||||
|
@ -952,6 +967,20 @@
|
||||||
|
|
||||||
<div class="divider"></div>
|
<div class="divider"></div>
|
||||||
|
|
||||||
|
<div class="settings_block_subheader">Upgrade Tor</div>
|
||||||
|
During upgrades, the tor package is updated. In some locations, this can fail causing upgrade issues.
|
||||||
|
<br/><br/>
|
||||||
|
This should not be disabled unless you are having a specific upgrade issue accessing some package servers.
|
||||||
|
<br/><br/>
|
||||||
|
<label class="switch">
|
||||||
|
<input type="checkbox" id="tor_repo_checkbox" {% if is_tor_repo_enabled %}checked{% endif %}>
|
||||||
|
<span class="slider round"></span>
|
||||||
|
</label>
|
||||||
|
<br/><br/>
|
||||||
|
<button id="tor_repo" style="display: none;" class="ui-button ui-widget ui-corner-all settings_button_small">Save</button>
|
||||||
|
|
||||||
|
<div class="divider"></div>
|
||||||
|
|
||||||
<div class="settings_block_subheader">Use Tor for System Upgrades</div>
|
<div class="settings_block_subheader">Use Tor for System Upgrades</div>
|
||||||
During upgrades, new system packages are downloaded and installed. This setting will download and install those packages via tor.
|
During upgrades, new system packages are downloaded and installed. This setting will download and install those packages via tor.
|
||||||
<br/><br/>
|
<br/><br/>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user