{% extends "base.html" %}
{% comment %}
#
# This file is part of Plinth.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
{% endcomment %}

{% load bootstrap %}

{% block content %}

<h2>Tor</h2>

<h3>Status</h3>

<p>
{% if is_running %}
  <div class='running-status active'></div> Tor is running
{% else %}
  <div class='running-status inactive'></div> Tor is not running
{% endif %}
</p>

<h3>Hidden Service</h3>

<p>A hidden service will allow your {{ cfg.box_name }} to provide selected
services (such as OwnCloud or Chat) without revealing its location.
Here is the current configuration:</p>

<ul>
  <li>Hostname: {{ tor_hs_hostname }}</li>
  <li>Ports: {{ tor_hs_ports }}</li>
</ul>

<form class="form form-inline" method="post">
  {% csrf_token %}

  {{ form|bootstrap }}

  <input type="submit" class="btn btn-primary btn-sm" value="Update setup"/>
</form>

<h3>Bridge</h3>

<p>Your {{ cfg.box_name }} is configured as a Tor bridge with obfsproxy, so it
can help circumvent censorship. If your {{ cfg.box_name }} is behind a router
or firewall, you should make sure the following ports are open, and
port-forwarded, if necessary:</p>

<div class="row">
  <div class="col-sm-3">
    <table class="table table-bordered table-condensed">
      {% for name, port in tor_ports.items %}
        <tr>
          <td>{{ name }}</td>
          <td>{{ port }}</td>
        </tr>
      {% endfor %}
    </table>
  </div>
</div>

<h3>SOCKS</h3>

<p>A Tor SOCKS port is available on your {{ cfg.box_name }} on TCP port
9050.</p>

{% endblock %}

{% block sidebar %}

  <div class="sidebar">

    <h3>Tor</h3>

    <p>Tor is an anonymous communication system. You can learn more about
    it from the <a href="https://www.torproject.org/">Tor Project</a>
    website. For best protection when web surfing, the Tor Project
    recommends that you use the
    <a href="https://www.torproject.org/download/download-easy.html.en">
    Tor Browser</a>.</p>

  </div>

{% endblock %}
