diff --git a/src/core/config.py b/src/core/config.py index 6a7d29a..7f2472e 100644 --- a/src/core/config.py +++ b/src/core/config.py @@ -10,7 +10,7 @@ from datetime import timedelta # Configs -APP_NAME = 'WebFM' +APP_NAME = 'WebFM' ROOT_FILE_PTH = os.path.dirname(os.path.realpath(__file__)) @@ -19,7 +19,8 @@ class Config(object): DEBUG = False TESTING = False THREADED = True - SECRET_KEY = secrets.token_hex(32) + SECRET_KEY = "2A#GQafbREoblgMSQYomZSxbaPE6dt#" + # SECRET_KEY = secrets.token_hex(32) PERMANENT_SESSION_LIFETIME = timedelta(days = 7).total_seconds() SQLALCHEMY_DATABASE_URI = "sqlite:///static/db/webfm.db" @@ -38,12 +39,14 @@ class Config(object): ] STATIC_FPTH = ROOT_FILE_PTH + "/static" - REMUX_FOLDER = STATIC_FPTH + "/remuxs" # Remuxed files folder - FFMPG_THUMBNLR = STATIC_FPTH + "/ffmpegthumbnailer" # Thumbnail generator binary - - ABS_THUMBS_PTH = STATIC_FPTH + "/imgs/thumbnails" # Used for thumbnail generation REL_THUMBS_PTH = "static/imgs/thumbnails" # Used for flask thumbnail return + # We are overiding some of the the shellmen view settings with these to make it all work with flask. + # These are passed along to the shellmen view from the Routes file upon the window controller creation. + ABS_THUMBS_PTH = STATIC_FPTH + "/imgs/thumbnails" # Used for thumbnail generation + REMUX_FOLDER = STATIC_FPTH + "/remuxs" # Remuxed files folder + FFMPG_THUMBNLR = STATIC_FPTH + "/ffmpegthumbnailer" # Thumbnail generator binary + diff --git a/src/core/routes/pages/OIDC_Login.py b/src/core/routes/pages/OIDC_Login.py index 7337011..b9f4a9b 100644 --- a/src/core/routes/pages/OIDC_Login.py +++ b/src/core/routes/pages/OIDC_Login.py @@ -11,6 +11,7 @@ from ... import app, oidc @app.route('/oidc-login', methods=['GET', 'POST']) @oidc.require_login def oidc_login(): + print(request) return redirect("/") diff --git a/src/core/utils/shellfm/windows/Settings.py b/src/core/utils/shellfm/windows/Settings.py deleted file mode 100644 index 41a4663..0000000 --- a/src/core/utils/shellfm/windows/Settings.py +++ /dev/null @@ -1,39 +0,0 @@ -# System import -from os import path - - -# Lib imports - - -# Apoplication imports - - - -class Settings: - logger = None - ABS_THUMBS_PTH = None # Used for thumbnail generation and is set by passing in - REMUX_FOLDER = None # Used for Remuxed files and is set by passing in - FFMPG_THUMBNLR = None # Used for thumbnail generator binary and is set by passing in - HIDE_HIDDEN_FILES = True - lock_folder = True - go_past_home = False - - subpath = "/LazyShare" # modify 'home' folder path - locked_folders = "Synced Backup::::venv::::flasks".split("::::") - mplayer_options = "-quiet -really-quiet -xy 1600 -geometry 50%:50%".split() - music_app = "/opt/deadbeef/bin/deadbeef" - media_app = "mpv" - image_app = "mirage" - office_app = "libreoffice" - pdf_app = "evince" - text_app = "leafpad" - file_manager_app = "spacefm" - remux_folder_max_disk_usage = "8589934592" - - - fvideos = ('.mkv', '.avi', '.flv', '.mov', '.m4v', '.mpg', '.wmv', '.mpeg', '.mp4', '.webm') - foffice = ('.doc', '.docx', '.xls', '.xlsx', '.xlt', '.xltx', '.xlm', '.ppt', 'pptx', '.pps', '.ppsx', '.odt', '.rtf') - fimages = ('.png', '.jpg', '.jpeg', '.gif', '.ico', '.tga') - ftext = ('.txt', '.text', '.sh', '.cfg', '.conf') - fmusic = ('.psf', '.mp3', '.ogg', '.flac', '.m4a') - fpdf = ('.pdf') diff --git a/src/core/utils/shellfm/windows/Window.py b/src/core/utils/shellfm/windows/Window.py index 089dc66..5284e08 100644 --- a/src/core/utils/shellfm/windows/Window.py +++ b/src/core/utils/shellfm/windows/Window.py @@ -1,4 +1,4 @@ -from .import View +from .view import View class Window: diff --git a/src/core/utils/shellfm/windows/__init__.py b/src/core/utils/shellfm/windows/__init__.py index 4d45198..cd9f6ce 100644 --- a/src/core/utils/shellfm/windows/__init__.py +++ b/src/core/utils/shellfm/windows/__init__.py @@ -1,6 +1,2 @@ -from .Settings import Settings -from .Launcher import Launcher -from .Path import Path -from .View import View from .Window import Window from .WindowController import WindowController diff --git a/src/core/utils/shellfm/windows/Path.py b/src/core/utils/shellfm/windows/view/Path.py similarity index 100% rename from src/core/utils/shellfm/windows/Path.py rename to src/core/utils/shellfm/windows/view/Path.py diff --git a/src/core/utils/shellfm/windows/View.py b/src/core/utils/shellfm/windows/view/View.py similarity index 98% rename from src/core/utils/shellfm/windows/View.py rename to src/core/utils/shellfm/windows/view/View.py index db8fe9c..2a37a5f 100644 --- a/src/core/utils/shellfm/windows/View.py +++ b/src/core/utils/shellfm/windows/view/View.py @@ -9,8 +9,8 @@ from os.path import isdir, isfile, join # Application imports -from . import Path, Settings, Launcher - +from .utils import Settings, Launcher +from . import Path class View(Settings, Launcher, Path): def __init__(self): diff --git a/src/core/utils/shellfm/windows/view/__init__.py b/src/core/utils/shellfm/windows/view/__init__.py new file mode 100644 index 0000000..da63bd2 --- /dev/null +++ b/src/core/utils/shellfm/windows/view/__init__.py @@ -0,0 +1,4 @@ +from .utils import * + +from .Path import Path +from .View import View diff --git a/src/core/utils/shellfm/windows/Launcher.py b/src/core/utils/shellfm/windows/view/utils/Launcher.py similarity index 100% rename from src/core/utils/shellfm/windows/Launcher.py rename to src/core/utils/shellfm/windows/view/utils/Launcher.py diff --git a/src/core/utils/shellfm/windows/view/utils/Settings.py b/src/core/utils/shellfm/windows/view/utils/Settings.py new file mode 100644 index 0000000..a6e3ea8 --- /dev/null +++ b/src/core/utils/shellfm/windows/view/utils/Settings.py @@ -0,0 +1,93 @@ +# System import +import json +import os +from os import path + +# Lib imports + + +# Apoplication imports + + + +class Settings: + logger = None + + USER_HOME = path.expanduser('~') + CONFIG_PATH = USER_HOME + "/.config/webfm" + CONFIG_FILE = CONFIG_PATH + "/settings.json" + HIDE_HIDDEN_FILES = True + + GTK_ORIENTATION = 1 # HORIZONTAL (0) VERTICAL (1) + DEFAULT_ICONS = CONFIG_PATH + "/icons" + DEFAULT_ICON = DEFAULT_ICONS + "/text.png" + FFMPG_THUMBNLR = CONFIG_PATH + "/ffmpegthumbnailer" # Thumbnail generator binary + REMUX_FOLDER = USER_HOME + "/.remuxs" # Remuxed files folder + + STEAM_BASE_URL = "https://steamcdn-a.akamaihd.net/steam/apps/" + ICON_DIRS = ["/usr/share/pixmaps", "/usr/share/icons", USER_HOME + "/.icons" ,] + BASE_THUMBS_PTH = USER_HOME + "/.thumbnails" # Used for thumbnail generation + ABS_THUMBS_PTH = BASE_THUMBS_PTH + "/normal" # Used for thumbnail generation + STEAM_ICONS_PTH = BASE_THUMBS_PTH + "/steam_icons" + CONTAINER_ICON_WH = [128, 128] + VIDEO_ICON_WH = [128, 64] + SYS_ICON_WH = [56, 56] + + # CONTAINER_ICON_WH = [128, 128] + # VIDEO_ICON_WH = [96, 48] + # SYS_ICON_WH = [96, 96] + + subpath = "" + go_past_home = None + lock_folder = None + locked_folders = None + mplayer_options = None + music_app = None + media_app = None + image_app = None + office_app = None + pdf_app = None + text_app = None + file_manager_app = None + remux_folder_max_disk_usage = None + + if path.isfile(CONFIG_FILE): + with open(CONFIG_FILE) as infile: + settings = json.load(infile)["settings"] + + subpath = settings["base_of_home"] + HIDE_HIDDEN_FILES = True if settings["hide_hidden_files"] == "true" else False + go_past_home = True if settings["go_past_home"] == "true" else False + lock_folder = True if settings["lock_folder"] == "true" else False + locked_folders = settings["locked_folders"].split("::::") + mplayer_options = settings["mplayer_options"].split() + music_app = settings["music_app"] + media_app = settings["media_app"] + image_app = settings["image_app"] + office_app = settings["office_app"] + pdf_app = settings["pdf_app"] + text_app = settings["text_app"] + file_manager_app = settings["file_manager_app"] + remux_folder_max_disk_usage = settings["remux_folder_max_disk_usage"] + + # Filters + fvideos = ('.mkv', '.avi', '.flv', '.mov', '.m4v', '.mpg', '.wmv', '.mpeg', '.mp4', '.webm') + foffice = ('.doc', '.docx', '.xls', '.xlsx', '.xlt', '.xltx', '.xlm', '.ppt', 'pptx', '.pps', '.ppsx', '.odt', '.rtf') + fimages = ('.png', '.jpg', '.jpeg', '.gif', '.ico', '.tga') + ftext = ('.txt', '.text', '.sh', '.cfg', '.conf') + fmusic = ('.psf', '.mp3', '.ogg', '.flac', '.m4a') + fpdf = ('.pdf') + + + # Dire structure check + if path.isdir(REMUX_FOLDER) == False: + os.mkdir(REMUX_FOLDER) + + if path.isdir(BASE_THUMBS_PTH) == False: + os.mkdir(BASE_THUMBS_PTH) + + if path.isdir(ABS_THUMBS_PTH) == False: + os.mkdir(ABS_THUMBS_PTH) + + if path.isdir(STEAM_ICONS_PTH) == False: + os.mkdir(STEAM_ICONS_PTH) diff --git a/src/core/utils/shellfm/windows/view/utils/__init__.py b/src/core/utils/shellfm/windows/view/utils/__init__.py new file mode 100644 index 0000000..3c05646 --- /dev/null +++ b/src/core/utils/shellfm/windows/view/utils/__init__.py @@ -0,0 +1,2 @@ +from .Settings import Settings +from .Launcher import Launcher diff --git a/src/user_config/webfm/ffmpegthumbnailer b/src/user_config/webfm/ffmpegthumbnailer new file mode 100755 index 0000000..0b6e6e2 Binary files /dev/null and b/src/user_config/webfm/ffmpegthumbnailer differ diff --git a/src/user_config/webfm/icons/archive.png b/src/user_config/webfm/icons/archive.png new file mode 100644 index 0000000..7943e4e Binary files /dev/null and b/src/user_config/webfm/icons/archive.png differ diff --git a/src/user_config/webfm/icons/audio.png b/src/user_config/webfm/icons/audio.png new file mode 100644 index 0000000..c010134 Binary files /dev/null and b/src/user_config/webfm/icons/audio.png differ diff --git a/src/user_config/webfm/icons/bin.png b/src/user_config/webfm/icons/bin.png new file mode 100644 index 0000000..d6954e3 Binary files /dev/null and b/src/user_config/webfm/icons/bin.png differ diff --git a/src/user_config/webfm/icons/dir.png b/src/user_config/webfm/icons/dir.png new file mode 100644 index 0000000..a9b5e9f Binary files /dev/null and b/src/user_config/webfm/icons/dir.png differ diff --git a/src/user_config/webfm/icons/doc.png b/src/user_config/webfm/icons/doc.png new file mode 100644 index 0000000..f838826 Binary files /dev/null and b/src/user_config/webfm/icons/doc.png differ diff --git a/src/user_config/webfm/icons/pdf.png b/src/user_config/webfm/icons/pdf.png new file mode 100644 index 0000000..9f40122 Binary files /dev/null and b/src/user_config/webfm/icons/pdf.png differ diff --git a/src/user_config/webfm/icons/presentation.png b/src/user_config/webfm/icons/presentation.png new file mode 100644 index 0000000..3a339af Binary files /dev/null and b/src/user_config/webfm/icons/presentation.png differ diff --git a/src/user_config/webfm/icons/spreadsheet.png b/src/user_config/webfm/icons/spreadsheet.png new file mode 100644 index 0000000..710efa6 Binary files /dev/null and b/src/user_config/webfm/icons/spreadsheet.png differ diff --git a/src/user_config/webfm/icons/text.png b/src/user_config/webfm/icons/text.png new file mode 100644 index 0000000..2546fcd Binary files /dev/null and b/src/user_config/webfm/icons/text.png differ diff --git a/src/user_config/webfm/icons/trash.png b/src/user_config/webfm/icons/trash.png new file mode 100644 index 0000000..c6514b9 Binary files /dev/null and b/src/user_config/webfm/icons/trash.png differ diff --git a/src/user_config/webfm/icons/video.png b/src/user_config/webfm/icons/video.png new file mode 100644 index 0000000..55afa98 Binary files /dev/null and b/src/user_config/webfm/icons/video.png differ diff --git a/src/user_config/webfm/icons/web.png b/src/user_config/webfm/icons/web.png new file mode 100644 index 0000000..17017ce Binary files /dev/null and b/src/user_config/webfm/icons/web.png differ diff --git a/src/user_config/webfm/settings.json b/src/user_config/webfm/settings.json new file mode 100644 index 0000000..2ba7a28 --- /dev/null +++ b/src/user_config/webfm/settings.json @@ -0,0 +1,18 @@ +{ + "settings": { + "base_of_home": "/LazyShare", + "hide_hidden_files": "true", + "go_past_home": "true", + "lock_folder": "true", + "locked_folders": "Synced Backup::::venv::::flasks::::Cryptomator", + "mplayer_options": "-quiet -really-quiet -xy 1600 -geometry 50%:50%", + "music_app": "/opt/deadbeef/bin/deadbeef", + "media_app": "mpv", + "image_app": "mirage", + "office_app": "libreoffice", + "pdf_app": "evince", + "text_app": "leafpad", + "file_manager_app": "spacefm", + "remux_folder_max_disk_usage": "8589934592" + } +}