Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,13 @@

app = Flask(__name__)

# Register all routes defined in the main Blueprint
# Load config settings into Flask's internal config manager properly
app.config.from_object(Config)

# Register all routes defined in the main Blueprint (This handles your '/' route!)
app.register_blueprint(main)


@app.after_request
def add_security_headers(response):
"""Add basic security headers to all responses."""
Expand All @@ -35,26 +39,28 @@ def add_security_headers(response):
@app.errorhandler(404)
def page_not_found(error):
"""Render a friendly 404 page instead of the raw Flask error."""
return render_template("404.html", config=Config), 404
return render_template("404.html", config=app.config), 404


@app.errorhandler(500)
def internal_server_error(error):
"""Render a friendly 500 page for unexpected server errors."""
return render_template("500.html", config=Config), 500
return render_template("500.html", config=app.config), 500

@app.errorhandler(405)
def method_not_allowed(error):
"""Render a friendly 405 page when the wrong HTTP method is used."""
return render_template("405.html", config=Config), 405
return render_template("405.html", config=app.config), 405

@app.errorhandler(403)
def forbidden(error):
"""Render a friendly 403 page when access is denied."""
return render_template("403.html", config=Config), 403
return render_template("403.html", config=app.config), 403


if __name__ == "__main__":

import os
debug_mode = os.environ.get("FLASK_DEBUG", "False").lower() in ("true", "1")
app.run(host="0.0.0.0", port=int(os.environ.get("PORT", 5000)), debug=debug_mode)

4 changes: 4 additions & 0 deletions static/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ function updateProfileWidgets() {
}
}


function recordSearch() {
progress.searches += 1;
computeProgressPoints();
Expand Down Expand Up @@ -453,6 +454,7 @@ updateProfileWidgets();
return valid;
}


function setLoadingState(isLoading) {
submitBtn.disabled = isLoading;
submitBtn.setAttribute("aria-busy", isLoading ? "true" : "false");
Expand Down Expand Up @@ -550,6 +552,7 @@ updateProfileWidgets();
resultsSection.scrollIntoView({ behavior: "smooth" });
}


skillsInput.setAttribute("role", "combobox");
skillsInput.setAttribute("aria-expanded", "false");
suggestions.setAttribute("role", "listbox");
Expand All @@ -574,6 +577,7 @@ updateProfileWidgets();
renderSuggestionState();
return;
}

if (event.key === "Escape") {
hideSuggestions();
return;
Expand Down
2 changes: 2 additions & 0 deletions templates/project.html
Original file line number Diff line number Diff line change
Expand Up @@ -395,8 +395,10 @@ <h3 class="sidebar-card-title">

<!-- Pass project metadata to the JavaScript without hardcoding -->
<script>

var PROJECT_ID = {{ project.id | tojson }};
var PROJECT_TITLE = {{ project.title | tojson }};

</script>
<script src="/static/script.js"></script>
</body>
Expand Down
1 change: 0 additions & 1 deletion utils/data_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ def get_project_stats():
"beginner_friendly": beginner_friendly,
}


def clear_cache():
"""Reset the in-memory project cache (used in tests)."""
global _projects_cache
Expand Down
Loading