Add base site and test reply

This commit is contained in:
Tyler Perkins 2023-09-20 21:15:52 -04:00
parent 6262700ede
commit 28d6161672
3 changed files with 143 additions and 1 deletions

View File

@ -1,7 +1,43 @@
from flask import Flask, render_template
"""
This application is not written well I know. Its just a simple thing I threw together pretty quickly.
Environment to set:
OPENAI_API_KEY="sk-your-key-blahblahblah"
SQLITE_DB="/path/to/the/sqlite/database"
"""
app = Flask(__name__)
def getPageContent(route) -> str:
"""
Fetch the content of the provided page, either from the database or openai
"""
pass
@app.route("/<path:route>")
def default(route):
return "Route is " + route
content = ""
for i in range(0, 1000):
content += "Test test test\n";
return render_template('base.html',
path=route,
content=content)
@app.route("/")
def baseRoute():
content = """
<p>An infinite website!</p>
<p>Type a url above and it will return a site generated by an AI!</p>
<p>The AI guesses what should be at the provided path, and returns it to you.</p>
<p>The pages will contain links generated by the AI. They will also work.</p>
<p>Pages someone else generated will be cached and served to you.</p>
<p>The site has a limit of 10 dollars a month of openai usage, or 100 pages a day. Be courtious if others want to use the site!</p>
"""
return render_template('base.html', path="/", content=content)

72
src/static/style.css Normal file
View File

@ -0,0 +1,72 @@
html {
background: white;
}
body {
overflow-x: hidden;
margin: 0;
height: 100%;
padding-bottom: 0px;
}
header {
position: fixed;
top: 0;
left: 0;
width: 100%;
margin: 0;
height: 3em;
border-color: black;
border-bottom: solid 5px;
z-index: 1000;
overflow: hidden;
background: black;
}
header a {
padding: 10px 10px;
float: left;
color: white;
text-decoration: none;
transition-duration: 500ms;
transition-property: text-decoration;
}
header a:hover {
text-decoration: underline;
transition-duration: 500ms;
transition-property: text-decoration;
}
header p {
float: right;
padding: 10px 10px;
margin: 0;
color: white;
}
.content {
margin-top: 3em;
padding: 1em;
margin-bottom: 3.5em;
}
footer {
position: fixed;
bottom: 0;
left: 0;
width: 100%;
margin: 0;
height: 3em;
background: black;
border-color: black;
border-top: solid 5px;
color: white;
}
.white-link {
color: white;
}

34
src/templates/base.html Normal file
View File

@ -0,0 +1,34 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="author" content="Tyler Perkins">
<meta name="description" content="The Infinite Website, powered by GPT-4">
<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
<title>The Infinite Website</title>
</head>
<body>
<header>
<a href="/">Home</a>
<a href="https://tylerperkins.xyz">Main Site</a>
<p>{{ path }}</p>
</header>
<div class="content">
{{ content|safe }}
</div>
<footer>
<p style="margin: auto; text-align: center;">
<small>
Copyleft
<span style="display: inline-block; transform: rotate(180deg);">©</span>
2023.
<a href="https://git.clortox.com/tyler/InfiniteWebsite" class="white-link">Free open source software</a>
</small>
</p>
<p style="margin: auto; text-align: center;">
<small>Content made by an AI may be wrong. Just for fun.</small>
</p>
</footer>
</body>
</html>