hopes and dreams
This commit is contained in:
parent
e3b1ac8bd1
commit
8f021fabf3
9 changed files with 23 additions and 26 deletions
2
src/requirements.txt
Normal file
2
src/requirements.txt
Normal file
|
@ -0,0 +1,2 @@
|
|||
flask
|
||||
gunicorn
|
72
src/static/style.css
Normal file
72
src/static/style.css
Normal file
|
@ -0,0 +1,72 @@
|
|||
/*
|
||||
This file is part of VM-Experiments.
|
||||
Licensed under the AGPL-3.0-or-later. See LICENSE for details.
|
||||
*/
|
||||
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
font-family: Verdana, Geneva, Tahoma, sans-serif;
|
||||
}
|
||||
|
||||
body {
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
display: grid;
|
||||
grid-template-rows: 75px 1fr;
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
h1 {
|
||||
color: white;
|
||||
margin: 10px;
|
||||
}
|
||||
|
||||
label {
|
||||
color: white;
|
||||
}
|
||||
|
||||
form {
|
||||
margin-top: 24px;
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
|
||||
.link {
|
||||
color: rgb(127, 127, 127);
|
||||
display: inline;
|
||||
font-size: 16px
|
||||
}
|
||||
|
||||
.description {
|
||||
color: rgb(192, 192, 192);
|
||||
font-size: 12px
|
||||
}
|
||||
|
||||
a {
|
||||
color: white;
|
||||
margin-top: 240px;
|
||||
text-decoration: none;
|
||||
font-size: 20px
|
||||
}
|
||||
|
||||
input {
|
||||
border: 0;
|
||||
border-radius: 5px;
|
||||
padding: 3px;
|
||||
background-color: gray;
|
||||
color: white;
|
||||
}
|
||||
|
||||
#top {
|
||||
background-color: black;
|
||||
grid-area: 1 / 1 / 2 / 2;
|
||||
padding-left: 36px;
|
||||
}
|
||||
|
||||
#content {
|
||||
padding: 10px;
|
||||
background-color: rgb(63, 63, 63);
|
||||
grid-area: 2 / 1 / 3 / 2;
|
||||
padding-left: 48px;
|
||||
}
|
36
src/templates/search.html
Normal file
36
src/templates/search.html
Normal file
|
@ -0,0 +1,36 @@
|
|||
<!--
|
||||
This file is part of VM-Experiments.
|
||||
Licensed under the AGPL-3.0-or-later. See LICENSE for details.
|
||||
-->
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="stylesheet" href=/static/style.css>
|
||||
<title>Document</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="top">
|
||||
<h1 id="title">JetSearch</h1>
|
||||
</div>
|
||||
|
||||
<div id="content">
|
||||
<form id="form" action="/search" method="get">
|
||||
<label for="textInput">Search:</label>
|
||||
<input type="text" name="query" required>
|
||||
<input type="submit" value="Submit">
|
||||
</form>
|
||||
{% for result in results %}
|
||||
<a href="{{ result.link }}">{{ result.term }} <p class="link">{{ result.link }}</p>
|
||||
<p class="description">{{ result.description }}</p>
|
||||
</a>
|
||||
<br>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
30
src/wsgi.py
Normal file
30
src/wsgi.py
Normal file
|
@ -0,0 +1,30 @@
|
|||
# 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)
|
Loading…
Add table
Add a link
Reference in a new issue