diff --git a/.gitignore b/.gitignore index 319e95d..6b18607 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,6 @@ # Remove all development files uploads/ -static/css/style.css +static/css/* # remove all PyCharm files .idea diff --git a/app.py b/app.py index f4092c5..71b9c54 100644 --- a/app.py +++ b/app.py @@ -3,10 +3,14 @@ import time import sys import os -print("""OnlyLegs - created by Fluffy Bean -Version: 060123 ---------------------------------- -Starting... +print(""" + ___ _ _ + / _ \ _ __ | |_ _| | ___ __ _ ___ +| | | | '_ \| | | | | | / _ \/ _` / __| +| |_| | | | | | |_| | |__| __/ (_| \__ \\ + \___/|_| |_|_|\__, |_____\___|\__, |___/ + |___/ |___/ +Created by Fluffy Bean - Version: 060123 """) time.sleep(1) diff --git a/packages/onlylegsDB.py b/packages/onlylegsDB.py index 1e62b08..30adc87 100644 --- a/packages/onlylegsDB.py +++ b/packages/onlylegsDB.py @@ -13,7 +13,14 @@ class DBmanager(): sys.exit(1) try: - load_dotenv(os.path.join('usr', '.env')) + env_path = os.path.join('usr', '.env') + + if not os.path.exists(env_path): + print("Error: could not find .env file") + print("Exiting...") + sys.exit(1) + + load_dotenv(env_path) print("### OnlyLegs Database Manager ###") print("Connecting to database...") @@ -34,10 +41,10 @@ class DBmanager(): record = cursor.fetchone() print("Connected to database:", record[0]) - print("Finished\n") + print("Done!\n") except Error as e: - print("Error while connecting to Database! Full error:\n", e) + print("Error while connecting to Database!\nFull error:", e) print("Exiting...") sys.exit(1) diff --git a/packages/onlylegsSass.py b/packages/onlylegsSass.py index 1f21d2e..ecc3465 100644 --- a/packages/onlylegsSass.py +++ b/packages/onlylegsSass.py @@ -1,5 +1,6 @@ import time import sys +import shutil import os class Sassy(): @@ -13,24 +14,82 @@ class Sassy(): print("Exiting...") sys.exit(1) - path_to_sass = os.path.join('usr', 'themes', theme, 'style.scss') + theme_path = os.path.join('usr', 'themes', theme, 'style.scss') - if os.path.exists(path_to_sass): - print(f"Theme '{theme}' found at:", path_to_sass) + if os.path.exists(theme_path): + print(f"Theme '{theme}' found at:", theme_path) self.sass = sass - self.loadTheme(path_to_sass) + self.loadTheme(theme_path) else: print("No theme found!") print("Exiting...") sys.exit(1) + + font_path = os.path.join('usr', 'themes', theme, 'fonts') + + if os.path.exists(font_path): + print("Fonts found at:", font_path) + self.loadFonts(font_path) + else: + print("No fonts found!") + + print("Done!\n") def loadTheme (self, theme): with open('static/css/style.css', 'w') as f: try: f.write(self.sass.compile(filename=theme, output_style='compressed')) - print("Compiled successfully to:", f.name)# - print("Finished\n") + print("Compiled successfully to:", f.name) except self.sass.CompileError as e: - print("Failed to compile! Full error:\n", e) + print("Failed to compile!\nFull error:", e) print("Exiting...") - sys.exit(1) \ No newline at end of file + sys.exit(1) + + def loadFonts (self, font_path): + dest = os.path.join('static', 'css', 'fonts') + + if os.path.exists(dest): + print("Removing old fonts...") + try: + shutil.rmtree(dest) + print("Removed old fonts!") + except Exception as e: + print("Failed to remove old fonts!\nFull error:", e) + print("Exiting...") + sys.exit(1) + + try: + shutil.copytree(font_path, dest) + print("Copied fonts to:", dest) + except Exception as e: + print("Failed to copy fonts!\nFull error:", e) + print("Exiting...") + sys.exit(1) + + #print ("Removing old fonts from:", dest) + #for old in os.listdir(dest): + # dir = os.path.join(dest , old) + # + # try: + # if os.path.isfile(dir) or os.path.islink(dir): + # os.unlink(dir) + # print("Removed:", old) + # elif os.path.isdir(dir): + # shutil.rmtree(dir) + # print("Removed:", old) + # except Exception as e: + # print("Failed to remove:", dir) + # print("Full error:", e) + + #print ("Loading new fonts") + #for font in os.listdir(font_path): + # dir = os.path.join(font_path, dest) + # new_dir = os.path.join(dest, font) + # + # try: + # if os.path.isfile(dir): + # shutil.copy(dir, new_dir) + # print("Copied font:", font) + # except Exception as e: + # print("Failed to copy font:", font) + # print("Full error:", e) \ No newline at end of file diff --git a/usr/example.env b/usr/example.env index 840dbd9..2df5fe7 100644 --- a/usr/example.env +++ b/usr/example.env @@ -1,8 +1,13 @@ -# Login -USERNAME = root -PASSWORD = -HOST = localhost -PORT = 3306 +# DATABASE CONFIGURATION +DB_NAME = onlylegs +DB_USER = root +DB_PASS = +DB_HOST = localhost +DB_PORT = -# Database name -DATABASE = onlylegs +# EMAIL CONFIGURATION +EMAIL_HOST = smtp.example.com +EMAIL_PORT = 465 +EMAIL_HOST_USER = noreply@example.com +EMAIL_HOST_PASSWORD = supersecurepassword +EMAIL_USE_TLS = True \ No newline at end of file diff --git a/static/fonts/Hubot-Sans.woff2 b/usr/themes/default/fonts/Hubot-Sans.woff2 similarity index 100% rename from static/fonts/Hubot-Sans.woff2 rename to usr/themes/default/fonts/Hubot-Sans.woff2 diff --git a/static/fonts/Mona-Sans.woff2 b/usr/themes/default/fonts/Mona-Sans.woff2 similarity index 100% rename from static/fonts/Mona-Sans.woff2 rename to usr/themes/default/fonts/Mona-Sans.woff2 diff --git a/usr/themes/default/fonts/worksans-black.woff2 b/usr/themes/default/fonts/worksans-black.woff2 new file mode 100644 index 0000000..ab8516a Binary files /dev/null and b/usr/themes/default/fonts/worksans-black.woff2 differ diff --git a/usr/themes/default/fonts/worksans-bold.woff2 b/usr/themes/default/fonts/worksans-bold.woff2 new file mode 100644 index 0000000..b3d3831 Binary files /dev/null and b/usr/themes/default/fonts/worksans-bold.woff2 differ diff --git a/usr/themes/default/fonts/worksans-regular.woff2 b/usr/themes/default/fonts/worksans-regular.woff2 new file mode 100644 index 0000000..e9fcd6e Binary files /dev/null and b/usr/themes/default/fonts/worksans-regular.woff2 differ diff --git a/usr/themes/default/style.scss b/usr/themes/default/style.scss index b3a3992..9f8c4b1 100644 --- a/usr/themes/default/style.scss +++ b/usr/themes/default/style.scss @@ -18,7 +18,7 @@ $font-body: "Mona-Sans", sans-serif; @font-face { font-family: "Mona-Sans"; - src: url("f../onts/Mona-Sans.woff2") format("woff2 supports variations"), + src: url("../fonts/Mona-Sans.woff2") format("woff2 supports variations"), url("../fonts/Mona-Sans.woff2") format("woff2-variations"); font-weight: 200 900; font-stretch: 75% 125%; @@ -33,6 +33,24 @@ $font-body: "Mona-Sans", sans-serif; font-display: swap; } +@font-face { + font-family: 'Work Sans'; + src: url('fonts/worksans-regular.woff2'); + font-weight: 400; +} + +@font-face { + font-family: 'Work Sans'; + src: url('fonts/worksans-bold.woff2'); + font-weight: 600; +} + +@font-face { + font-family: 'Work Sans'; + src: url('fonts/worksans-black.woff2'); + font-weight: 900; +} + @import 'buttons/btn'; html, body {