49 lines
1.5 KiB
Python
49 lines
1.5 KiB
Python
# jet-search
|
|
# Copyright (C) 2024 VM-Experiments
|
|
#
|
|
# This program is free software: you can redistribute it and/or modify
|
|
# it under the terms of the GNU Affero General Public License as published by
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
# (at your option) any later version.
|
|
#
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU Affero General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU Affero General Public License
|
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
|
|
from flask import Flask, render_template, request
|
|
|
|
app = Flask(__name__)
|
|
|
|
search_terms = [
|
|
{
|
|
"term": "JetSearch",
|
|
"link": "https://jetsearch.com/",
|
|
"description": "World's fastest search engine.",
|
|
},
|
|
{
|
|
"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)
|