eotk: generate configuration in portal
This commit is contained in:
parent
ce520b87a5
commit
12794ec190
3 changed files with 31 additions and 3 deletions
|
@ -1,6 +1,7 @@
|
||||||
from flask import render_template, Blueprint
|
from flask import render_template, Blueprint, Response
|
||||||
from sqlalchemy import desc
|
from sqlalchemy import desc
|
||||||
|
|
||||||
|
from app.models.base import Group
|
||||||
from app.models.onions import Eotk
|
from app.models.onions import Eotk
|
||||||
|
|
||||||
bp = Blueprint("eotk", __name__)
|
bp = Blueprint("eotk", __name__)
|
||||||
|
@ -14,3 +15,12 @@ def eotk_list():
|
||||||
title="EOTK Instances",
|
title="EOTK Instances",
|
||||||
item="eotk",
|
item="eotk",
|
||||||
items=instances)
|
items=instances)
|
||||||
|
|
||||||
|
|
||||||
|
@bp.route("/conf/<group_id>")
|
||||||
|
def eotk_conf(group_id: int):
|
||||||
|
from app import app
|
||||||
|
group = Group.query.filter(Group.id == group_id).first()
|
||||||
|
return Response(render_template("sites.conf.j2",
|
||||||
|
bypass_token=app.config["BYPASS_TOKEN"],
|
||||||
|
group=group), content_type="text/plain")
|
||||||
|
|
18
app/portal/templates/sites.conf.j2
Normal file
18
app/portal/templates/sites.conf.j2
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
set log_separate 1
|
||||||
|
|
||||||
|
set nginx_resolver 127.0.0.53 ipv6=off
|
||||||
|
|
||||||
|
set nginx_cache_seconds 60
|
||||||
|
set nginx_cache_size 64m
|
||||||
|
set nginx_tmpfile_size 8m
|
||||||
|
|
||||||
|
set x_from_onion_value 1
|
||||||
|
set inject_headers_upstream Bypass-Rate-Limit-Token,{{ bypass_token }}
|
||||||
|
|
||||||
|
foreignmap facebookwkhpilnemxj7asaniu7vnjjbiltxjqhye3mhbshg7kx5tfyd.onion facebook.com
|
||||||
|
foreignmap twitter3e4tixl4xyajtrzo62zg5vztmjuricljdp2c5kshju4avyoid.onion twitter.com
|
||||||
|
|
||||||
|
set project sites
|
||||||
|
{% for o in group.onions %}
|
||||||
|
hardmap {{ o.onion_name }} {{ o.domain_name }}
|
||||||
|
{%- endfor %}
|
|
@ -98,8 +98,8 @@
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="#"
|
<a href="{{ url_for("portal.eotk.eotk_conf", group_id=instance.group_id) }}"
|
||||||
class="btn btn-primary btn-sm">Generate Configuration</a>
|
class="btn btn-primary btn-sm">Preview Configuration</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue