diff --git a/.gitignore b/.gitignore
index 92e87f5..6cd081a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -115,3 +115,9 @@ dmypy.json
.directory
scheduler.db
scheduler.db
+
+.idea/
+
+dashmachine/user_data/
+dashmachine/static/user_icons
+dashmachine/static/backgrounds
\ No newline at end of file
diff --git a/.idea/DashMachine.iml b/.idea/DashMachine.iml
deleted file mode 100644
index 832f34c..0000000
--- a/.idea/DashMachine.iml
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml
deleted file mode 100644
index 105ce2d..0000000
--- a/.idea/inspectionProfiles/profiles_settings.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
deleted file mode 100644
index 65dec42..0000000
--- a/.idea/misc.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
deleted file mode 100644
index 7f4baa9..0000000
--- a/.idea/modules.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
deleted file mode 100644
index 94a25f7..0000000
--- a/.idea/vcs.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/watcherTasks.xml b/.idea/watcherTasks.xml
deleted file mode 100644
index d7007b0..0000000
--- a/.idea/watcherTasks.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
deleted file mode 100644
index 285659a..0000000
--- a/.idea/workspace.xml
+++ /dev/null
@@ -1,208 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 1578234985306
-
-
- 1578234985306
-
-
-
-
-
-
- 1578313443241
-
-
-
- 1578313443242
-
-
- 1578364236996
-
-
-
- 1578364236996
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/dashmachine/__init__.py b/dashmachine/__init__.py
index 137f21d..5381949 100755
--- a/dashmachine/__init__.py
+++ b/dashmachine/__init__.py
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
-
+import os
from flask import Flask
from flask_caching import Cache
from flask_sqlalchemy import SQLAlchemy
@@ -10,6 +10,9 @@ from flask_avatars import Avatars
from apscheduler.jobstores.sqlalchemy import SQLAlchemyJobStore
from flask_apscheduler import APScheduler
+if not os.path.isdir("dashmachine/user_data"):
+ os.mkdir("dashmachine/user_data")
+
app = Flask(__name__)
cache = Cache(app, config={"CACHE_TYPE": "simple"})
diff --git a/dashmachine/dashmachine_init.py b/dashmachine/dashmachine_init.py
new file mode 100644
index 0000000..08c9c50
--- /dev/null
+++ b/dashmachine/dashmachine_init.py
@@ -0,0 +1,30 @@
+import os
+from shutil import copyfile
+from dashmachine.paths import dashmachine_folder, images_folder
+from dashmachine.main.utils import read_config
+from dashmachine.user_system.models import User
+from dashmachine.user_system.utils import add_edit_user
+
+
+def dashmachine_init():
+ user_data_folder = os.path.join(dashmachine_folder, "user_data")
+
+ # create the user_data subdirectories, link them to static
+ user_backgrounds_folder = os.path.join(user_data_folder, "backgrounds")
+ if not os.path.isdir(user_backgrounds_folder):
+ os.mkdir(user_backgrounds_folder)
+ os.symlink(user_backgrounds_folder, os.path.join(images_folder, "backgrounds"))
+
+ user_icons_folder = os.path.join(user_data_folder, "user_icons")
+ if not os.path.isdir(user_icons_folder):
+ os.mkdir(user_icons_folder)
+ os.symlink(user_icons_folder, os.path.join(images_folder, "user_icons"))
+
+ config_file = os.path.join(user_data_folder, "config.ini")
+ if not os.path.exists(config_file):
+ copyfile("default_config.ini", config_file)
+ read_config()
+
+ user = User.query.first()
+ if not user:
+ add_edit_user(username="admin", password="admin")
diff --git a/dashmachine/main/utils.py b/dashmachine/main/utils.py
index ce8a197..dec7bb3 100755
--- a/dashmachine/main/utils.py
+++ b/dashmachine/main/utils.py
@@ -1,4 +1,4 @@
-from configparser import ConfigParser, DuplicateSectionError
+from configparser import ConfigParser
from dashmachine.main.models import Apps
from dashmachine.settings_system.models import Settings
from dashmachine import db
diff --git a/dashmachine/paths.py b/dashmachine/paths.py
index 71fd305..a84f302 100755
--- a/dashmachine/paths.py
+++ b/dashmachine/paths.py
@@ -11,9 +11,9 @@ def get_root_folder():
root_folder = get_root_folder()
-elm_folder = os.path.join(root_folder, "dashmachine")
+dashmachine_folder = os.path.join(root_folder, "dashmachine")
-static_folder = os.path.join(elm_folder, "static")
+static_folder = os.path.join(dashmachine_folder, "static")
images_folder = os.path.join(static_folder, "images")
diff --git a/dashmachine/static/images/backgrounds/Boy4aow.png b/dashmachine/static/images/backgrounds/Boy4aow.png
deleted file mode 100644
index 38f2d78..0000000
Binary files a/dashmachine/static/images/backgrounds/Boy4aow.png and /dev/null differ
diff --git a/dashmachine/static/images/backgrounds/Hk1KgQS.png b/dashmachine/static/images/backgrounds/Hk1KgQS.png
deleted file mode 100644
index 2586855..0000000
Binary files a/dashmachine/static/images/backgrounds/Hk1KgQS.png and /dev/null differ
diff --git a/dashmachine/static/images/backgrounds/ZtkPKMg.jpg b/dashmachine/static/images/backgrounds/ZtkPKMg.jpg
deleted file mode 100644
index 378270b..0000000
Binary files a/dashmachine/static/images/backgrounds/ZtkPKMg.jpg and /dev/null differ
diff --git a/dashmachine/static/images/backgrounds/aodvrziifxcjmgvqhbsg.png b/dashmachine/static/images/backgrounds/aodvrziifxcjmgvqhbsg.png
deleted file mode 100644
index 02646ce..0000000
Binary files a/dashmachine/static/images/backgrounds/aodvrziifxcjmgvqhbsg.png and /dev/null differ
diff --git a/dashmachine/static/images/backgrounds/avbtqymfykwfcjylgqql.jpg b/dashmachine/static/images/backgrounds/avbtqymfykwfcjylgqql.jpg
deleted file mode 100644
index 5950879..0000000
Binary files a/dashmachine/static/images/backgrounds/avbtqymfykwfcjylgqql.jpg and /dev/null differ
diff --git a/dashmachine/static/images/backgrounds/background.png b/dashmachine/static/images/backgrounds/background.png
deleted file mode 100644
index 44c330e..0000000
Binary files a/dashmachine/static/images/backgrounds/background.png and /dev/null differ
diff --git a/dashmachine/static/images/backgrounds/fns7rzzwluh11.png b/dashmachine/static/images/backgrounds/fns7rzzwluh11.png
deleted file mode 100644
index bb96f33..0000000
Binary files a/dashmachine/static/images/backgrounds/fns7rzzwluh11.png and /dev/null differ
diff --git a/dashmachine/static/images/backgrounds/glWla8v.png b/dashmachine/static/images/backgrounds/glWla8v.png
deleted file mode 100644
index 38897d9..0000000
Binary files a/dashmachine/static/images/backgrounds/glWla8v.png and /dev/null differ
diff --git a/dashmachine/static/images/backgrounds/mKkaVVc.gif b/dashmachine/static/images/backgrounds/mKkaVVc.gif
deleted file mode 100644
index 11822d9..0000000
Binary files a/dashmachine/static/images/backgrounds/mKkaVVc.gif and /dev/null differ
diff --git a/dashmachine/static/images/backgrounds/wallpaper-hd-of-pixel-art-and-background-powerpoint-inspirations-picture-pics-desktop.jpg b/dashmachine/static/images/backgrounds/wallpaper-hd-of-pixel-art-and-background-powerpoint-inspirations-picture-pics-desktop.jpg
deleted file mode 100644
index a3111c0..0000000
Binary files a/dashmachine/static/images/backgrounds/wallpaper-hd-of-pixel-art-and-background-powerpoint-inspirations-picture-pics-desktop.jpg and /dev/null differ
diff --git a/dashmachine/static/images/backgrounds/xdWDtvx.png b/dashmachine/static/images/backgrounds/xdWDtvx.png
deleted file mode 100644
index fd1b1bf..0000000
Binary files a/dashmachine/static/images/backgrounds/xdWDtvx.png and /dev/null differ
diff --git a/dashmachine/static/images/backgrounds/xsxgvgayvfvekklkvwvf.png b/dashmachine/static/images/backgrounds/xsxgvgayvfvekklkvwvf.png
deleted file mode 100644
index 4886bde..0000000
Binary files a/dashmachine/static/images/backgrounds/xsxgvgayvfvekklkvwvf.png and /dev/null differ
diff --git a/dashmachine/user_data/config.ini b/dashmachine/user_data/config.ini
deleted file mode 100644
index 21665fa..0000000
--- a/dashmachine/user_data/config.ini
+++ /dev/null
@@ -1,88 +0,0 @@
-[Settings]
-theme = dark
-accent=orange
-background=random
-
-[Home Assistant]
-prefix = https://
-url = hass.wolf-house.net
-icon =static/images/apps/home-assistant.png
-description = Home automation software.
-open_in = iframe
-
-[Nextcloud]
-prefix = https://
-url = cloud.wolf-house.net
-icon = static/images/apps/nextcloud.png
-description = File server and sync software.
-open_in = new_tab
-
-[Wolflix]
-prefix = https://
-url = wolflix.wolf-house.net
-icon = static/images/apps/emby.png
-description = Movies and TV.
-open_in = iframe
-
-[Bitwarden]
-prefix = https://
-url = passwords.wolf-house.net
-icon = static/images/apps/bitwarden.png
-description = Password server.
-open_in = this_tab
-
-[Gitea]
-prefix = https://
-url = git.wolf-house.net
-icon = static/images/apps/gitea.png
-description = Self hosted git repo.
-open_in = this_tab
-
-[Black Pearl]
-prefix = https://
-url = blackpearl.wolf-house.net
-icon = static/images/apps/deluge.png
-description = Containerized torrent server with vpn.
-open_in = iframe
-
-[WolfPrime SSH]
-prefix = https://
-url = ssh.wolf-house.net
-icon = static/images/apps/terminal.png
-description = Terminal access for WolfPrime.
-open_in = iframe
-
-[Portainer]
-prefix = https://
-url = port.wolf-house.net
-icon = static/images/apps/portainer.png
-description = Manage docker containers.
-open_in = iframe
-
-[Nginx Proxy Manager]
-prefix = https://
-url = proxies.wolf-house.net
-icon = static/images/apps/nginxproxymanager.png
-description = Manage the nginx reverse proxy.
-open_in = new_tab
-
-[Sonarr]
-prefix = https://
-url = sonarr.wolf-house.net
-icon = static/images/apps/sonarr.png
-description = TV Shows.
-open_in = iframe
-
-[Radarr]
-prefix = https://
-url = radarr.wolf-house.net
-icon = static/images/apps/radarr.png
-description = Movies.
-open_in = iframe
-
-[Jackett]
-prefix = http://
-url = 192.168.39.175:9117
-icon = static/images/apps/jackett.png
-description = Torrent indexer.
-open_in = this_tab
\ No newline at end of file
diff --git a/dashmachine/user_data/site.db b/dashmachine/user_data/site.db
deleted file mode 100644
index 0ec97b8..0000000
Binary files a/dashmachine/user_data/site.db and /dev/null differ
diff --git a/dashmachine/user_system/models.py b/dashmachine/user_system/models.py
index 91695f2..32c75e9 100644
--- a/dashmachine/user_system/models.py
+++ b/dashmachine/user_system/models.py
@@ -9,13 +9,8 @@ def load_user(user_id):
class User(db.Model, UserMixin):
id = db.Column(db.Integer, primary_key=True)
- email = db.Column(db.String(20), unique=True, nullable=False)
+ username = db.Column(db.String(120), unique=True, nullable=False)
password = db.Column(db.String(60), nullable=False)
- fname = db.Column(db.String())
- lname = db.Column(db.String())
- phone = db.Column(db.String())
- avatar = db.Column(db.String())
- role = db.Column(db.String())
db.create_all()
diff --git a/dashmachine/user_system/routes.py b/dashmachine/user_system/routes.py
index feafdbb..32d46c3 100755
--- a/dashmachine/user_system/routes.py
+++ b/dashmachine/user_system/routes.py
@@ -7,9 +7,6 @@ from dashmachine.main.utils import public_route
user_system = Blueprint("user_system", __name__)
-# *****REMINDER*****
-# user accounts for this platform can only be created/edited with the
-# functions in user_system.utils
# ------------------------------------------------------------------------------
# User system routes
@@ -26,7 +23,7 @@ def login():
form = LoginForm()
if form.validate_on_submit():
- user = User.query.filter_by(email=form.email.data.lower()).first()
+ user = User.query.filter_by(username=form.email.data.lower()).first()
if user and bcrypt.check_password_hash(user.password, form.password.data):
login_user(user, remember=form.remember.data)
diff --git a/dashmachine/user_system/utils.py b/dashmachine/user_system/utils.py
index 2ac996f..f63bf13 100755
--- a/dashmachine/user_system/utils.py
+++ b/dashmachine/user_system/utils.py
@@ -2,16 +2,13 @@ from dashmachine import db, bcrypt
from dashmachine.user_system.models import User
-def add_user(email, password, fname, lname):
- hashed_password = bcrypt.generate_password_hash(password).decode("utf-8")
- user = User(email=email, fname=fname, lname=lname, password=hashed_password)
- db.session.add(user)
- db.session.commit()
-
-
-def change_password(user_id, new_password):
+def add_edit_user(username, password, user_id=None):
user = User.query.filter_by(id=user_id).first()
- hashed_password = bcrypt.generate_password_hash(new_password).decode("utf-8")
+ if not user:
+ user = User()
+
+ hashed_password = bcrypt.generate_password_hash(password).decode("utf-8")
+ user.username = username
user.password = hashed_password
db.session.merge(user)
db.session.commit()
diff --git a/default_config.ini b/default_config.ini
new file mode 100644
index 0000000..c768f39
--- /dev/null
+++ b/default_config.ini
@@ -0,0 +1,4 @@
+[Settings]
+theme = light
+accent = orange
+background = None
\ No newline at end of file
diff --git a/run.py b/run.py
index 648eab8..e8bfddd 100755
--- a/run.py
+++ b/run.py
@@ -1,6 +1,9 @@
#!/usr/bin/env python3
from dashmachine import app
+from dashmachine.dashmachine_init import dashmachine_init
+
+dashmachine_init()
if __name__ == "__main__":
app.run(debug=True, use_reloader=True, host="0.0.0.0", threaded=True)