modify dns in config
This commit is contained in:
parent
21234fccc6
commit
8b9880ce44
12
app.py
12
app.py
@ -315,7 +315,17 @@ def config_dashboard():
|
||||
"""Renders the configuration dashboard."""
|
||||
if not session.get('config_logged_in'):
|
||||
return redirect(url_for('config'))
|
||||
return render_template('config_dashboard.html')
|
||||
|
||||
DNS_FILE = os.path.join(os.path.dirname(__file__), '..', 'KTVManager_python', 'ktvmanager', 'lib', 'DNS_list.txt')
|
||||
|
||||
def read_dns_list():
|
||||
if not os.path.exists(DNS_FILE):
|
||||
return []
|
||||
with open(DNS_FILE, 'r') as f:
|
||||
return [line.strip() for line in f.readlines()]
|
||||
|
||||
dns_list = read_dns_list()
|
||||
return render_template('config_dashboard.html', dns_list=dns_list)
|
||||
|
||||
@app.route('/check-expiring-accounts', methods=['POST'])
|
||||
def check_expiring_accounts():
|
||||
|
@ -8,6 +8,35 @@
|
||||
<p>Welcome to the configuration page.</p>
|
||||
<button id="send-test-notification-btn" class="btn btn-primary">Send Test Notification</button>
|
||||
<button id="check-expiring-accounts-btn" class="btn btn-info">Check Expiring Accounts</button>
|
||||
|
||||
<div class="card mt-4">
|
||||
<div class="card-header">
|
||||
DNS Manager
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form action="{{ url_for('dns.add_dns') }}" method="post">
|
||||
<div class="input-group mb-3">
|
||||
<input type="text" class="form-control" name="dns_entry" placeholder="Enter DNS entry">
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-primary" type="submit">Add</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<ul class="list-group list-group-flush">
|
||||
{% for entry in dns_list %}
|
||||
<li class="list-group-item d-flex justify-content-between align-items-center">
|
||||
{{ entry }}
|
||||
<form action="{{ url_for('dns.remove_dns') }}" method="post" style="display: inline;">
|
||||
<input type="hidden" name="dns_entry" value="{{ entry }}">
|
||||
<button type="submit" class="btn btn-danger btn-sm">Remove</button>
|
||||
</form>
|
||||
</li>
|
||||
{% else %}
|
||||
<li class="list-group-item">No DNS entries found.</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user