feat: add initial Flask web app for Discord server listing

Introduces backend with server retrieval and API integration, front-end UI with templates and styles, and configuration files for deployment.
This commit is contained in:
2025-09-03 05:18:39 -04:00
parent 334782fe5c
commit ba286278cf
17 changed files with 2329 additions and 0 deletions

View File

@@ -0,0 +1,80 @@
{% extends "base.html" %}
{% block title %}Browse Servers | {{ site_name }}{% endblock %}
{% block links %}
<link rel="stylesheet" href="{{url_for('static', filename='styles/index.css')}}">
{% endblock %}
{% block content %}
<div class="container my-4">
<div class="d-flex justify-content-between align-items-center">
<a href="{{ url_for('index') }}" class="btn btn-outline-light">&larr; Back to Home</a>
<h1 class="text-light">Browse Servers</h1>
</div>
<hr class="text-light">
</div>
<div class="container">
<div class="row">
<div class="col-md-3">
<h4 class="text-light">Tags</h4>
<div class="list-group">
<a href="{{ url_for('browse') }}" class="list-group-item list-group-item-action {% if not current_tag %}active{% endif %}">
All Servers
</a>
{% for tag in all_tags %}
<a href="{{ url_for('browse', tag_name=tag) }}" class="list-group-item list-group-item-action {% if tag == current_tag %}active{% endif %}">
{{ tag }}
</a>
{% endfor %}
</div>
</div>
<div class="col-md-9">
<div class="servers">
{% if servers %}
{% for server in servers %}
<div class="card shadow-lg" style="width: 18rem; margin:5px;">
<img class="card-img-top" src="{{server['icon_url']}}">
<div class="card-body">
<div class="card-header bg-danger bg-gradient text-light" style="margin-bottom:5px;">
<strong>{{server['server_name']}}</strong>
</div>
<p class="card-text server-description">{{ server['description'] }}</p>
<p class="card-text">
<strong>Tags:</strong> {{ server['tags'] }}
</p>
<a class="btn btn-outline-success d-block mx-auto" href="/server/{{ server['server_name']|replace(' ', '-') }}">View Server</a>
</div>
</div>
{% endfor %}
{% else %}
<div class="text-light text-center mt-5">
<h4>No servers found with the tag "{{ current_tag }}".</h4>
</div>
{% endif %}
</div>
</div>
</div>
</div>
{% endblock %}
{% block scripts %}
<script>
$(document).ready(() => {
// This is the part that renders markdown
const md = window.markdownit();
const elements = document.getElementsByClassName("server-description");
for (var i = 0; i < elements.length; i++) {
elements[i].innerHTML = md.render(elements[i].innerHTML);
}
// --- ADD THIS ANIMATION ---
// This fades in the server list, making it visible
$(".servers").animate({
opacity: "100%"
}, 600)
})
</script>
{% endblock %}