diff --git a/.idea/workspace.xml b/.idea/workspace.xml index bd4ed6b..285659a 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,13 +2,37 @@ + + + + + + + + + + + + + + + + + - - + + + + + + + + - + + - + + + + @@ -93,7 +120,8 @@ 1578234985306 - + + 1578313443241 @@ -102,13 +130,21 @@ - + @@ -121,10 +157,10 @@ - + - + @@ -133,40 +169,40 @@ - + - - + + - - + + - - + + - + - + - - + + - - + + - + - + \ No newline at end of file diff --git a/dashmachine/__init__.py b/dashmachine/__init__.py index b95f75c..137f21d 100755 --- a/dashmachine/__init__.py +++ b/dashmachine/__init__.py @@ -18,7 +18,7 @@ avatars = Avatars(app) app.config["AVATARS_IDENTICON_BG"] = (255, 255, 255) app.config["SECRET_KEY"] = "66532a62c4048f976e22a39638b6f10e" -app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite:///site.db" +app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite:///user_data/site.db" app.config["SEND_FILE_MAX_AGE_DEFAULT"] = 0 # scheduler config diff --git a/dashmachine/main/utils.py b/dashmachine/main/utils.py index a2de04a..ce8a197 100755 --- a/dashmachine/main/utils.py +++ b/dashmachine/main/utils.py @@ -15,7 +15,7 @@ def row2dict(row): def read_config(): config = ConfigParser() try: - config.read("config.ini") + config.read("dashmachine/user_data/config.ini") except Exception as e: return {"msg": f"Invalid Config: {e}."} @@ -35,20 +35,40 @@ def read_config(): for section in config.sections(): if section != "Settings": - try: - app = Apps( - name=section, - prefix=config[section]["prefix"], - url=config[section]["url"], - icon=config[section]["icon"], - sidebar_icon=config[section]["sidebar_icon"], - description=config[section]["description"], - open_in=config[section]["open_in"], - ) - db.session.add(app) - db.session.commit() - except KeyError as e: - return {"msg": f"Invalid Config: {section} does not contain {e}."} + app = Apps() + app.name = section + if "prefix" in config[section]: + app.prefix = config[section]["prefix"] + else: + return {"msg": f"Invalid Config: {section} does not contain prefix."} + + if "url" in config[section]: + app.url = config[section]["url"] + else: + return {"msg": f"Invalid Config: {section} does not contain url."} + + if "icon" in config[section]: + app.icon = config[section]["icon"] + else: + app.icon = None + + if "sidebar_icon" in config[section]: + app.sidebar_icon = config[section]["sidebar_icon"] + else: + app.sidebar_icon = app.icon + + if "description" in config[section]: + app.description = config[section]["description"] + else: + app.description = None + + if "open_in" in config[section]: + app.open_in = config[section]["open_in"] + else: + app.open_in = "this_tab" + + db.session.add(app) + db.session.commit() return {"msg": "success", "settings": row2dict(settings)} diff --git a/dashmachine/settings_system/routes.py b/dashmachine/settings_system/routes.py index da8a375..7d93dfa 100644 --- a/dashmachine/settings_system/routes.py +++ b/dashmachine/settings_system/routes.py @@ -12,7 +12,7 @@ settings_system = Blueprint("settings_system", __name__) @settings_system.route("/settings", methods=["GET"]) def settings(): config_form = ConfigForm() - with open("config.ini", "r") as config_file: + with open("dashmachine/user_data/config.ini", "r") as config_file: config_form.config.data = config_file.read() files_html = load_files_html() return render_template( @@ -22,7 +22,7 @@ def settings(): @settings_system.route("/settings/save_config", methods=["POST"]) def save_config(): - with open("config.ini", "w") as config_file: + with open("dashmachine/user_data/config.ini", "w") as config_file: config_file.write(request.form.get("config")) msg = read_config() return jsonify(data=msg) diff --git a/dashmachine/sources.py b/dashmachine/sources.py index 7a65bca..a470d8f 100644 --- a/dashmachine/sources.py +++ b/dashmachine/sources.py @@ -1,9 +1,10 @@ import os +import random from jsmin import jsmin from dashmachine import app from dashmachine.main.models import Apps from dashmachine.settings_system.models import Settings -from dashmachine.paths import static_folder +from dashmachine.paths import static_folder, backgrounds_images_folder from dashmachine.cssmin import cssmin """This file establishes bundles of js and css sources, minifies them using jsmin and @@ -73,6 +74,11 @@ def process_css_sources(process_bundle=None, src=None, app_global=False): def context_processor(): apps = Apps.query.all() settings = Settings.query.first() + if settings.background == "random": + settings.background = ( + f"static/images/backgrounds/" + f"{random.choice(os.listdir(backgrounds_images_folder))}" + ) return dict( test_key="test", process_js_sources=process_js_sources, diff --git a/dashmachine/static/css/global/dashmachine-theme.css b/dashmachine/static/css/global/dashmachine-theme.css index 48ed734..8a66f9a 100644 --- a/dashmachine/static/css/global/dashmachine-theme.css +++ b/dashmachine/static/css/global/dashmachine-theme.css @@ -2,6 +2,7 @@ :root { --theme-background: #EBEEF0; --theme-surface: #fff; + --theme-surface-rgb: 255, 255, 255; --theme-surface-1: #fcfcfc; --theme-surface-2: #e0e0e0; --theme-primary: #FF9966; @@ -15,6 +16,7 @@ [data-theme="dark"] { --theme-background: #1c1c1c; --theme-surface: #2f2f2f; + --theme-surface-rgb: 47, 47, 47; --theme-surface-1: #434343; --theme-surface-2: #575757; --theme-color-font: #fff; @@ -76,4 +78,10 @@ } .theme-muted2-text { color: var(--theme-color-font-muted2) !important; +} +.theme-surface-transparent { + background: rgba(var(--theme-surface-rgb), 0.8) !important; +} +.theme-surface-transparent1 { + background: rgba(var(--theme-surface-rgb), 0.9) !important; } \ No newline at end of file diff --git a/dashmachine/static/css/global/dashmachine.css b/dashmachine/static/css/global/dashmachine.css index cd35a44..b490bb2 100644 --- a/dashmachine/static/css/global/dashmachine.css +++ b/dashmachine/static/css/global/dashmachine.css @@ -36,7 +36,7 @@ /* ELEMENT STLYES */ body { - overflow: hidden !important; + overflow: scroll; overflow-x: hidden !important; min-height: 100%; color: var(--theme-color-font); @@ -614,6 +614,7 @@ input:disabled { .sidenav { background-color: var(--theme-surface); + top: unset; } .border-bottom-1 { diff --git a/dashmachine/static/css/global/style.css b/dashmachine/static/css/global/style.css index f592519..ea92c7e 100644 --- a/dashmachine/static/css/global/style.css +++ b/dashmachine/static/css/global/style.css @@ -27,9 +27,6 @@ body #main { - min-height: -webkit-calc(100% - 116px); - min-height: -moz-calc(100% - 116px); - min-height: calc(100% - 116px); padding-left: 0; -webkit-transition: .3s ease all; diff --git a/dashmachine/static/images/apps/bitwarden.png b/dashmachine/static/images/apps/bitwarden.png new file mode 100644 index 0000000..be45706 Binary files /dev/null and b/dashmachine/static/images/apps/bitwarden.png differ diff --git a/dashmachine/static/images/apps/jackett.png b/dashmachine/static/images/apps/jackett.png new file mode 100644 index 0000000..5ada92f Binary files /dev/null and b/dashmachine/static/images/apps/jackett.png differ diff --git a/dashmachine/static/images/apps/radarr.png b/dashmachine/static/images/apps/radarr.png new file mode 100644 index 0000000..808a9c1 Binary files /dev/null and b/dashmachine/static/images/apps/radarr.png differ diff --git a/dashmachine/static/images/apps/sonarr.png b/dashmachine/static/images/apps/sonarr.png new file mode 100644 index 0000000..b41422f Binary files /dev/null and b/dashmachine/static/images/apps/sonarr.png differ diff --git a/dashmachine/static/images/backgrounds/Boy4aow.png b/dashmachine/static/images/backgrounds/Boy4aow.png new file mode 100644 index 0000000..38f2d78 Binary files /dev/null and b/dashmachine/static/images/backgrounds/Boy4aow.png differ diff --git a/dashmachine/static/images/backgrounds/Hk1KgQS.png b/dashmachine/static/images/backgrounds/Hk1KgQS.png new file mode 100644 index 0000000..2586855 Binary files /dev/null and b/dashmachine/static/images/backgrounds/Hk1KgQS.png differ diff --git a/dashmachine/static/images/backgrounds/ZtkPKMg.jpg b/dashmachine/static/images/backgrounds/ZtkPKMg.jpg new file mode 100644 index 0000000..378270b Binary files /dev/null and b/dashmachine/static/images/backgrounds/ZtkPKMg.jpg differ diff --git a/dashmachine/static/images/backgrounds/aodvrziifxcjmgvqhbsg.png b/dashmachine/static/images/backgrounds/aodvrziifxcjmgvqhbsg.png new file mode 100644 index 0000000..02646ce Binary files /dev/null and b/dashmachine/static/images/backgrounds/aodvrziifxcjmgvqhbsg.png differ diff --git a/dashmachine/static/images/backgrounds/avbtqymfykwfcjylgqql.jpg b/dashmachine/static/images/backgrounds/avbtqymfykwfcjylgqql.jpg new file mode 100644 index 0000000..5950879 Binary files /dev/null and b/dashmachine/static/images/backgrounds/avbtqymfykwfcjylgqql.jpg differ diff --git a/dashmachine/static/images/backgrounds/fns7rzzwluh11.png b/dashmachine/static/images/backgrounds/fns7rzzwluh11.png new file mode 100644 index 0000000..bb96f33 Binary files /dev/null and b/dashmachine/static/images/backgrounds/fns7rzzwluh11.png differ diff --git a/dashmachine/static/images/backgrounds/glWla8v.png b/dashmachine/static/images/backgrounds/glWla8v.png new file mode 100644 index 0000000..38897d9 Binary files /dev/null and b/dashmachine/static/images/backgrounds/glWla8v.png differ diff --git a/dashmachine/static/images/backgrounds/mKkaVVc.gif b/dashmachine/static/images/backgrounds/mKkaVVc.gif new file mode 100644 index 0000000..11822d9 Binary files /dev/null and b/dashmachine/static/images/backgrounds/mKkaVVc.gif 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 new file mode 100644 index 0000000..a3111c0 Binary files /dev/null and b/dashmachine/static/images/backgrounds/wallpaper-hd-of-pixel-art-and-background-powerpoint-inspirations-picture-pics-desktop.jpg differ diff --git a/dashmachine/static/images/backgrounds/xdWDtvx.png b/dashmachine/static/images/backgrounds/xdWDtvx.png new file mode 100644 index 0000000..fd1b1bf Binary files /dev/null and b/dashmachine/static/images/backgrounds/xdWDtvx.png differ diff --git a/dashmachine/static/images/backgrounds/xsxgvgayvfvekklkvwvf.png b/dashmachine/static/images/backgrounds/xsxgvgayvfvekklkvwvf.png new file mode 100644 index 0000000..4886bde Binary files /dev/null and b/dashmachine/static/images/backgrounds/xsxgvgayvfvekklkvwvf.png differ diff --git a/dashmachine/static/js/global/dashmachine.js b/dashmachine/static/js/global/dashmachine.js index 6a09039..8f9a72f 100644 --- a/dashmachine/static/js/global/dashmachine.js +++ b/dashmachine/static/js/global/dashmachine.js @@ -336,6 +336,20 @@ function initTinyMCE(el){ } } +function hide_sidenav() { + $("#main-sidenav").addClass('hide'); + $("#main.main-full").css('padding-left', 0); + $("#show-sidenav").removeClass('hide'); + localStorage.setItem('sidenav_hidden', 'true'); +} + +function show_sidenav(){ + $("#main-sidenav").removeClass('hide'); + $("#main.main-full").css('padding-left', 64); + $("#show-sidenav").addClass('hide'); + localStorage.setItem('sidenav_hidden', null); +} + //-------------------------------------------------------------------------------------- // Document ready function //-------------------------------------------------------------------------------------- @@ -350,16 +364,16 @@ $(document).ready(function () { init_copy_btn(); init_select(); + if (localStorage.getItem('sidenav_hidden') === 'true'){ + hide_sidenav(); + } + $("#hide-sidenav").on('click', function(e) { - $("#main-sidenav").addClass('hide'); - $("#main.main-full").css('padding-left', 0); - $("#show-sidenav").removeClass('hide'); + hide_sidenav(); }); $("#show-sidenav .material-icons-outlined").on('click', function(e) { - $("#main-sidenav").removeClass('hide'); - $("#main.main-full").css('padding-left', 64); - $("#show-sidenav").addClass('hide'); + show_sidenav(); }); $( "#show-sidenav" ).draggable({ axis: "y" }); diff --git a/dashmachine/templates/main/home.html b/dashmachine/templates/main/home.html index f7b6366..04d00d1 100755 --- a/dashmachine/templates/main/home.html +++ b/dashmachine/templates/main/home.html @@ -8,7 +8,8 @@ #main { background-image: url("{{ settings.background }}"); background-size: cover; - height: 100vh; + background-attachment: fixed; + min-height: 100vh; } {% endif %} @@ -21,7 +22,7 @@
search - +
@@ -29,11 +30,13 @@ {% for app in apps %} {% if app.open_in == 'iframe' %} + {% elif app.open_in == 'this_tab' %} + {% elif app.open_in == "new_tab" %} {% endif %}
-
+
diff --git a/dashmachine/templates/main/layout.html b/dashmachine/templates/main/layout.html index a57ebbd..2b2427d 100644 --- a/dashmachine/templates/main/layout.html +++ b/dashmachine/templates/main/layout.html @@ -12,27 +12,13 @@
diff --git a/dashmachine/templates/settings_system/settings.html b/dashmachine/templates/settings_system/settings.html index eb8b767..61cd15c 100644 --- a/dashmachine/templates/settings_system/settings.html +++ b/dashmachine/templates/settings_system/settings.html @@ -5,6 +5,11 @@ {% endblock page_vendor_css %} {% block page_lvl_css %} + {% if settings.background %}