From 28d6161672835986e45dc5f8c9d3bc9f391f019c Mon Sep 17 00:00:00 2001 From: Tyler Perkins Date: Wed, 20 Sep 2023 21:15:52 -0400 Subject: [PATCH] Add base site and test reply --- src/app.py | 38 +++++++++++++++++++++- src/static/style.css | 72 +++++++++++++++++++++++++++++++++++++++++ src/templates/base.html | 34 +++++++++++++++++++ 3 files changed, 143 insertions(+), 1 deletion(-) create mode 100644 src/static/style.css create mode 100644 src/templates/base.html diff --git a/src/app.py b/src/app.py index 8fb93fd..5a1dd94 100644 --- a/src/app.py +++ b/src/app.py @@ -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("/") 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 = """ +

An infinite website!

+

Type a url above and it will return a site generated by an AI!

+

The AI guesses what should be at the provided path, and returns it to you.

+

The pages will contain links generated by the AI. They will also work.

+

Pages someone else generated will be cached and served to you.

+

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!

+ """ + + return render_template('base.html', path="/", content=content) diff --git a/src/static/style.css b/src/static/style.css new file mode 100644 index 0000000..8a951da --- /dev/null +++ b/src/static/style.css @@ -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; +} diff --git a/src/templates/base.html b/src/templates/base.html new file mode 100644 index 0000000..6aba70a --- /dev/null +++ b/src/templates/base.html @@ -0,0 +1,34 @@ + + + + + + + + + The Infinite Website + + +
+ Home + Main Site +

{{ path }}

+
+
+ {{ content|safe }} +
+ + +