30 lines
771 B
Python
30 lines
771 B
Python
# This file is part of VM-Experiments.
|
|
# Licensed under the AGPL-3.0-or-later. See LICENSE for details.
|
|
|
|
from flask import Flask, render_template, request
|
|
|
|
app = Flask(__name__)
|
|
|
|
search_terms = [
|
|
{
|
|
"term": "JetSearch",
|
|
"link": "https://jetsearch.com/",
|
|
"description": "World's fastest search engine.",
|
|
},
|
|
]
|
|
|
|
|
|
@app.route("/")
|
|
def index():
|
|
return render_template("search.html")
|
|
|
|
|
|
@app.route("/search", methods=["GET"])
|
|
def search():
|
|
query = request.args.get("query")
|
|
matching_terms = [
|
|
{"term": item["term"], "link": item["link"], "description": item["description"]}
|
|
for item in search_terms
|
|
if query.lower() in item["term"].lower()
|
|
]
|
|
return render_template("search.html", results=matching_terms)
|