mirror of
https://github.com/Derpy-Leggies/OnlyLegs.git
synced 2025-06-29 11:36:16 +00:00
Start on Upload page
Remove reduntant Exiting text Rename css folder to theme
This commit is contained in:
parent
d85ac5f103
commit
f730ecd0c9
7 changed files with 63 additions and 61 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1,6 +1,6 @@
|
||||||
# Remove all development files
|
# Remove all development files
|
||||||
uploads/
|
uploads/
|
||||||
static/css/*
|
static/theme/*
|
||||||
|
|
||||||
# remove all PyCharm files
|
# remove all PyCharm files
|
||||||
.idea
|
.idea
|
||||||
|
|
8
app.py
8
app.py
|
@ -2,10 +2,10 @@ print("""
|
||||||
___ _ _
|
___ _ _
|
||||||
/ _ \ _ __ | |_ _| | ___ __ _ ___
|
/ _ \ _ __ | |_ _| | ___ __ _ ___
|
||||||
| | | | '_ \| | | | | | / _ \/ _` / __|
|
| | | | '_ \| | | | | | / _ \/ _` / __|
|
||||||
| |_| | | | | | |_| | |__| __/ (_| \__ \\
|
| |_| | | | | | |_| | |__| __/ (_| \__ \
|
||||||
\___/|_| |_|_|\__, |_____\___|\__, |___/
|
\___/|_| |_|_|\__, |_____\___|\__, |___/
|
||||||
|___/ |___/
|
|___/ |___/
|
||||||
Created by Fluffy Bean - Version: 080123
|
Created by Fluffy Bean - Version 080123
|
||||||
""")
|
""")
|
||||||
|
|
||||||
# Import base packages
|
# Import base packages
|
||||||
|
@ -74,6 +74,10 @@ def internal_server_error(e):
|
||||||
def home():
|
def home():
|
||||||
return render_template('home.html')
|
return render_template('home.html')
|
||||||
|
|
||||||
|
@app.route('/upload')
|
||||||
|
def upload():
|
||||||
|
return render_template('upload.html')
|
||||||
|
|
||||||
@app.route('/image/<request_id>')
|
@app.route('/image/<request_id>')
|
||||||
def image(request_id):
|
def image(request_id):
|
||||||
# Check if request_id is valid
|
# Check if request_id is valid
|
||||||
|
|
|
@ -13,18 +13,15 @@ class DBmanager():
|
||||||
print("Error: could not import required packages")
|
print("Error: could not import required packages")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
try:
|
|
||||||
env_path = os.path.join('usr', '.env')
|
env_path = os.path.join('usr', '.env')
|
||||||
|
|
||||||
if not os.path.exists(env_path):
|
if not os.path.exists(env_path):
|
||||||
print("Error: could not find .env file")
|
print("Error: could not find .env file")
|
||||||
print("Exiting...")
|
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
load_dotenv(env_path)
|
load_dotenv(env_path)
|
||||||
print("### OnlyLegs Database Manager ###")
|
|
||||||
print(f"{now.hour}:{now.minute}:{now.second} - Connecting to database...")
|
print(f"{now.hour}:{now.minute}:{now.second} - Connecting to database...")
|
||||||
|
|
||||||
|
try:
|
||||||
database = mysql.connector.connect(host=os.environ.get('DB_HOST'),
|
database = mysql.connector.connect(host=os.environ.get('DB_HOST'),
|
||||||
port=os.environ.get('DB_PORT'),
|
port=os.environ.get('DB_PORT'),
|
||||||
database=os.environ.get('DB_NAME'),
|
database=os.environ.get('DB_NAME'),
|
||||||
|
@ -46,52 +43,42 @@ class DBmanager():
|
||||||
|
|
||||||
except Error as e:
|
except Error as e:
|
||||||
print("Error while connecting to Database!\nFull error:", e)
|
print("Error while connecting to Database!\nFull error:", e)
|
||||||
print("Exiting...")
|
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
self.database = database
|
self.database = database
|
||||||
|
|
||||||
def initialize(self):
|
def initialize(self):
|
||||||
dir = os.path.join('packages', 'tables')
|
if not os.path.exists(os.path.join('packages', 'tables', 'generate.sql')):
|
||||||
|
|
||||||
if not os.path.exists(dir+'/generate.sql'):
|
|
||||||
print("Error: could not find tables directory")
|
print("Error: could not find tables directory")
|
||||||
print("Exiting...")
|
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
else:
|
else:
|
||||||
print(f"{now.hour}:{now.minute}:{now.second} - Initializing tables...")
|
print(f"{now.hour}:{now.minute}:{now.second} - Initializing tables...")
|
||||||
|
|
||||||
with open(dir+'/generate.sql', 'r') as f:
|
with open(os.path.join('packages', 'tables', 'generate.sql'), 'r') as sql:
|
||||||
sql = f.read()
|
|
||||||
|
|
||||||
cursor = self.database.cursor()
|
cursor = self.database.cursor()
|
||||||
query = cursor.execute(sql, multi=True)
|
query = cursor.execute(sql.read(), multi=True)
|
||||||
|
|
||||||
|
i = 0
|
||||||
for res in query:
|
for res in query:
|
||||||
#print("Running query...")
|
print(f"Query {i+1}: Affected {res.rowcount} rows")
|
||||||
print(f"Affected {res.rowcount} rows")
|
i += 1
|
||||||
|
|
||||||
self.database.commit()
|
if not os.path.exists(os.path.join('packages', 'tables', 'junctions.sql')):
|
||||||
|
|
||||||
if not os.path.exists(dir+'/junctions.sql'):
|
|
||||||
print("Error: could not find junctions directory")
|
print("Error: could not find junctions directory")
|
||||||
print("Exiting...")
|
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
else:
|
else:
|
||||||
print(f"{now.hour}:{now.minute}:{now.second} - Initializing junctions...")
|
print(f"{now.hour}:{now.minute}:{now.second} - Initializing junctions...")
|
||||||
|
|
||||||
with open(dir+'/junctions.sql', 'r') as f:
|
with open(os.path.join('packages', 'tables', 'junctions.sql'), 'r') as sql:
|
||||||
sql = f.read()
|
|
||||||
|
|
||||||
cursor = self.database.cursor()
|
cursor = self.database.cursor()
|
||||||
query = cursor.execute(sql, multi=True)
|
query = cursor.execute(sql.read(), multi=True)
|
||||||
|
|
||||||
|
i = 0
|
||||||
for res in query:
|
for res in query:
|
||||||
#print("Running query...")
|
print(f"Query {i+1}: Affected {res.rowcount} rows")
|
||||||
print(f"Affected {res.rowcount} rows")
|
i += 1
|
||||||
|
|
||||||
self.database.commit()
|
self.database.commit()
|
||||||
|
|
||||||
print(f"{now.hour}:{now.minute}:{now.second} - Done!\n")
|
print(f"{now.hour}:{now.minute}:{now.second} - Done!\n")
|
||||||
|
|
||||||
def getImage(self, id):
|
def getImage(self, id):
|
||||||
|
|
|
@ -13,7 +13,6 @@ class Sassy():
|
||||||
import sass
|
import sass
|
||||||
except ImportError:
|
except ImportError:
|
||||||
print("Could not find libsass!")
|
print("Could not find libsass!")
|
||||||
print("Exiting...")
|
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
theme_path = os.path.join('usr', 'themes', theme, 'style.scss')
|
theme_path = os.path.join('usr', 'themes', theme, 'style.scss')
|
||||||
|
@ -24,7 +23,6 @@ class Sassy():
|
||||||
self.loadTheme(theme_path)
|
self.loadTheme(theme_path)
|
||||||
else:
|
else:
|
||||||
print("No theme found!")
|
print("No theme found!")
|
||||||
print("Exiting...")
|
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
font_path = os.path.join('usr', 'themes', theme, 'fonts')
|
font_path = os.path.join('usr', 'themes', theme, 'fonts')
|
||||||
|
@ -38,17 +36,16 @@ class Sassy():
|
||||||
print(f"{now.hour}:{now.minute}:{now.second} - Done!\n")
|
print(f"{now.hour}:{now.minute}:{now.second} - Done!\n")
|
||||||
|
|
||||||
def loadTheme (self, theme):
|
def loadTheme (self, theme):
|
||||||
with open('static/css/style.css', 'w') as f:
|
with open('static/theme/style.css', 'w') as f:
|
||||||
try:
|
try:
|
||||||
f.write(self.sass.compile(filename=theme, output_style='compressed'))
|
f.write(self.sass.compile(filename=theme, output_style='compressed'))
|
||||||
print("Compiled successfully to:", f.name)
|
print("Compiled successfully to:", f.name)
|
||||||
except self.sass.CompileError as e:
|
except self.sass.CompileError as e:
|
||||||
print("Failed to compile!\nFull error:", e)
|
print("Failed to compile!\nFull error:", e)
|
||||||
print("Exiting...")
|
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
def loadFonts (self, font_path):
|
def loadFonts (self, font_path):
|
||||||
dest = os.path.join('static', 'css', 'fonts')
|
dest = os.path.join('static', 'theme', 'fonts')
|
||||||
|
|
||||||
if os.path.exists(dest):
|
if os.path.exists(dest):
|
||||||
print("Removing old fonts...")
|
print("Removing old fonts...")
|
||||||
|
@ -57,7 +54,6 @@ class Sassy():
|
||||||
print("Removed old fonts!")
|
print("Removed old fonts!")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("Failed to remove old fonts!\nFull error:", e)
|
print("Failed to remove old fonts!\nFull error:", e)
|
||||||
print("Exiting...")
|
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -65,7 +61,6 @@ class Sassy():
|
||||||
print("Copied fonts to:", dest)
|
print("Copied fonts to:", dest)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("Failed to copy fonts!\nFull error:", e)
|
print("Failed to copy fonts!\nFull error:", e)
|
||||||
print("Exiting...")
|
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
#print ("Removing old fonts from:", dest)
|
#print ("Removing old fonts from:", dest)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{% extends 'layout.html' %}
|
{% extends 'layout.html' %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<header>
|
<header>
|
||||||
<img src="{{ url_for('static', filename='images/leaves.jpg') }}" alt="leaves"/>
|
<img src="{{ url_for('static', filename='images/leaves.jpg') }}" alt="leaves" onload="imgFade(this)" style="display: none;"/>
|
||||||
<span></span>
|
<span></span>
|
||||||
</header>
|
</header>
|
||||||
<div class="app">
|
<div class="app">
|
||||||
|
|
|
@ -4,30 +4,31 @@
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>Gallery</title>
|
<title>Gallery</title>
|
||||||
<link rel="stylesheet" href="{{url_for('static', filename='css/style.css')}}" defer>
|
<link rel="stylesheet" href="{{url_for('static', filename='theme/style.css')}}" defer>
|
||||||
<script
|
<script
|
||||||
src="https://code.jquery.com/jquery-3.6.0.min.js"
|
src="https://code.jquery.com/jquery-3.6.0.min.js"
|
||||||
integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4="
|
integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4="
|
||||||
crossorigin="anonymous">
|
crossorigin="anonymous">
|
||||||
</script>
|
</script>
|
||||||
<!--<script src="https://unpkg.com/phosphor-icons" defer></script>-->
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<nav id="navRoot">
|
<nav id="navRoot">
|
||||||
<div>
|
<div>
|
||||||
<a href="{{url_for('home')}}">
|
<a href="{{url_for('home')}}">
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="-2 -2 24 24" width="24" fill="currentColor">
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="-2 -2 24 24" width="24" fill="currentColor">
|
||||||
<path d="M18 18V7.132l-8-4.8-8 4.8V18h4v-2.75a4 4 0 1 1 8 0V18h4zm-6 2v-4.75a2 2 0 1 0-4 0V20H2a2 2 0 0 1-2-2V7.132a2 2 0 0 1 .971-1.715l8-4.8a2 2 0 0 1 2.058 0l8 4.8A2 2 0 0 1 20 7.132V18a2 2 0 0 1-2 2h-6z"></path>
|
<path d="M2 8v10h12V8H2zm2-2V2a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2h-2v4a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h2zm2 0h8a2 2 0 0 1 2 2v4h2V2H6v4zm0 9a3 3 0 1 1 0-6 3 3 0 0 1 0 6zm0-2a1 1 0 1 0 0-2 1 1 0 0 0 0 2z"></path><path d="M7 6a3 3 0 1 1 6 0h-2a1 1 0 0 0-2 0H7zm1.864 13.518l2.725-4.672a1 1 0 0 1 1.6-.174l1.087 1.184 1.473-1.354-1.088-1.183a3 3 0 0 0-4.8.52L7.136 18.51l1.728 1.007zm6.512-12.969a2.994 2.994 0 0 1 3.285.77l1.088 1.183-1.473 1.354-1.087-1.184A1 1 0 0 0 16 8.457V8c0-.571-.24-1.087-.624-1.451z"></path>
|
||||||
</svg>
|
</svg>
|
||||||
<span>Home</span>
|
<span>Home</span>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<a href="{{url_for('home')}}">
|
<a href="{{url_for('home')}}">
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="-2 -2 24 24" width="24" fill="currentColor">
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="-2 -4 24 24" width="24" fill="currentColor">
|
||||||
<path d="M2 8v10h12V8H2zm2-2V2a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2h-2v4a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h2zm2 0h8a2 2 0 0 1 2 2v4h2V2H6v4zm0 9a3 3 0 1 1 0-6 3 3 0 0 1 0 6zm0-2a1 1 0 1 0 0-2 1 1 0 0 0 0 2z"></path><path d="M7 6a3 3 0 1 1 6 0h-2a1 1 0 0 0-2 0H7zm1.864 13.518l2.725-4.672a1 1 0 0 1 1.6-.174l1.087 1.184 1.473-1.354-1.088-1.183a3 3 0 0 0-4.8.52L7.136 18.51l1.728 1.007zm6.512-12.969a2.994 2.994 0 0 1 3.285.77l1.088 1.183-1.473 1.354-1.087-1.184A1 1 0 0 0 16 8.457V8c0-.571-.24-1.087-.624-1.451z"></path>
|
<path d="M17 4H9.415l-.471-1.334A1.001 1.001 0 0 0 8 2H3a1 1 0 0 0-1 1v10a1 1 0 0 0 1 1h14a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1zm-6.17-2H17a3 3 0 0 1 3 3v8a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V3a3 3 0 0 1 3-3h5c1.306 0 2.417.835 2.83 2z"></path>
|
||||||
</svg>
|
</svg>
|
||||||
<span>Groups</span>
|
<span>Groups</span>
|
||||||
</a>
|
</a>
|
||||||
<a href="{{ url_for('home') }}">
|
|
||||||
|
<a href="{{url_for('upload')}}">
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="-5 -5 24 24" width="24" fill="currentColor">
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="-5 -5 24 24" width="24" fill="currentColor">
|
||||||
<path d="M8 3.414v5.642a1 1 0 1 1-2 0V3.414L4.879 4.536A1 1 0 0 1 3.464 3.12L6.293.293a1 1 0 0 1 1.414 0l2.829 2.828A1 1 0 1 1 9.12 4.536L8 3.414zM1 12h12a1 1 0 0 1 0 2H1a1 1 0 0 1 0-2z"></path>
|
<path d="M8 3.414v5.642a1 1 0 1 1-2 0V3.414L4.879 4.536A1 1 0 0 1 3.464 3.12L6.293.293a1 1 0 0 1 1.414 0l2.829 2.828A1 1 0 1 1 9.12 4.536L8 3.414zM1 12h12a1 1 0 0 1 0 2H1a1 1 0 0 1 0-2z"></path>
|
||||||
</svg>
|
</svg>
|
||||||
|
@ -41,9 +42,10 @@
|
||||||
</svg>
|
</svg>
|
||||||
<span>Profile</span>
|
<span>Profile</span>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<a href="{{url_for('home')}}">
|
<a href="{{url_for('home')}}">
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="-5 -7 24 24" width="24" fill="currentColor">
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="-1 -2 24 24" width="24" fill="currentColor">
|
||||||
<path d="M1 0h5a1 1 0 1 1 0 2H1a1 1 0 1 1 0-2zm7 8h5a1 1 0 0 1 0 2H8a1 1 0 1 1 0-2zM1 4h12a1 1 0 0 1 0 2H1a1 1 0 1 1 0-2z"></path>
|
<path d="M9.815 3.094a3.467 3.467 0 0 1-2.78-1.09l-.084-.001a3.467 3.467 0 0 1-2.781 1.09 3.477 3.477 0 0 1-1.727 2.51 3.471 3.471 0 0 1 0 2.794 3.477 3.477 0 0 1 1.727 2.51 3.467 3.467 0 0 1 2.78 1.09h.084a3.467 3.467 0 0 1 2.78-1.09 3.477 3.477 0 0 1 1.727-2.51 3.471 3.471 0 0 1 0-2.794 3.477 3.477 0 0 1-1.726-2.51zM14 5.714a1.474 1.474 0 0 0 0 2.572l-.502 1.684a1.473 1.473 0 0 0-1.553 2.14l-1.443 1.122A1.473 1.473 0 0 0 8.143 14l-2.304-.006a1.473 1.473 0 0 0-2.352-.765l-1.442-1.131A1.473 1.473 0 0 0 .5 9.968L0 8.278a1.474 1.474 0 0 0 0-2.555l.5-1.69a1.473 1.473 0 0 0 1.545-2.13L3.487.77A1.473 1.473 0 0 0 5.84.005L8.143 0a1.473 1.473 0 0 0 2.358.768l1.444 1.122a1.473 1.473 0 0 0 1.553 2.14L14 5.714zm-5.812 9.198a7.943 7.943 0 0 0 2.342-.73 3.468 3.468 0 0 1-.087.215 3.477 3.477 0 0 1 1.727 2.51 3.467 3.467 0 0 1 2.78 1.09h.084a3.467 3.467 0 0 1 2.78-1.09 3.477 3.477 0 0 1 1.727-2.51 3.471 3.471 0 0 1 0-2.794 3.477 3.477 0 0 1-1.726-2.51 3.467 3.467 0 0 1-2.78-1.09h-.084l-.015.016a8.077 8.077 0 0 0 .002-2.016L16.144 6a1.473 1.473 0 0 0 2.358.768l1.444 1.122a1.473 1.473 0 0 0 1.553 2.14L22 11.714a1.474 1.474 0 0 0 0 2.572l-.502 1.684a1.473 1.473 0 0 0-1.553 2.14l-1.443 1.122a1.473 1.473 0 0 0-2.359.768l-2.304-.006a1.473 1.473 0 0 0-2.352-.765l-1.442-1.131a1.473 1.473 0 0 0-1.545-2.13l-.312-1.056zM7 10a3 3 0 1 1 0-6 3 3 0 0 1 0 6zm0-2a1 1 0 1 0 0-2 1 1 0 0 0 0 2zm8 8a3 3 0 1 1 0-6 3 3 0 0 1 0 6zm0-2a1 1 0 1 0 0-2 1 1 0 0 0 0 2z"></path>
|
||||||
</svg>
|
</svg>
|
||||||
<span>Settings</span>
|
<span>Settings</span>
|
||||||
</a>
|
</a>
|
||||||
|
|
14
templates/upload.html
Normal file
14
templates/upload.html
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
{% extends 'layout.html' %}
|
||||||
|
{% block content %}
|
||||||
|
<header>
|
||||||
|
<img src="{{ url_for('static', filename='images/leaves.jpg') }}" alt="leaves" onload="imgFade(this)" style="display: none;"/>
|
||||||
|
<span></span>
|
||||||
|
</header>
|
||||||
|
<div class="app">
|
||||||
|
<h1>Upload!!!!!</h1>
|
||||||
|
<div id="upload" class="upload"></div>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
|
||||||
|
</script>
|
||||||
|
{% endblock %}
|
Loading…
Add table
Add a link
Reference in a new issue