diff --git a/TODO.md b/TODO.md index de3a960..1501a29 100644 --- a/TODO.md +++ b/TODO.md @@ -1,7 +1,4 @@ # TODO -- [x] Cache html version until changes in md file +- [ ] Adding user authentications for restricted access - [ ] Optional auth to protect files against changes by unauthorized users -- [x] Edit and remove icons at the top instead of the text at the bottom -- [ ] Drawio integration -- [x] Knowledge graph using [visjs](https://visjs.github.io/vis-network/examples/) -- [x] use better search mechanism, using [whoosh](https://whoosh.readthedocs.io/en/latest/intro.html) +- [ ] Drawio integration \ No newline at end of file diff --git a/config.py b/config.py deleted file mode 100644 index 83b4363..0000000 --- a/config.py +++ /dev/null @@ -1,107 +0,0 @@ -import os -import yaml - -WIKMD_CONFIG_FILE = "wikmd-config.yaml" - -# Default config parameters -WIKMD_HOST_DEFAULT = "0.0.0.0" -WIKMD_PORT_DEFAULT = 5000 -WIKMD_LOGGING_DEFAULT = 1 -WIKMD_LOGGING_FILE_DEFAULT = "wikmd.log" - -GIT_EMAIL_DEFAULT = "wikmd@no-mail.com" -GIT_USER_DEFAULT = "wikmd" - -MAIN_BRANCH_NAME_DEFAULT = "main" -SYNC_WITH_REMOTE_DEFAULT = 0 -REMOTE_URL_DEFAULT = "" - -WIKI_DIRECTORY_DEFAULT = "wiki" -HOMEPAGE_DEFAULT = "homepage.md" -HOMEPAGE_TITLE_DEFAULT = "homepage" -IMAGES_ROUTE_DEFAULT = "img" - -HIDE_FOLDER_IN_WIKI = [] - -PLUGINS = [] - -PROTECT_EDIT_BY_PASSWORD = 0 -PASSWORD_IN_SHA_256 = "0E9C700FAB2D5B03B0581D080E74A2D7428758FC82BD423824C6C11D6A7F155E" #pw: wikmd - -# if False: Uses external CDNs to serve some files -LOCAL_MODE = False - -IMAGE_ALLOWED_MIME_DEFAULT = ["image/gif", "image/jpeg", "image/png", "image/svg+xml", "image/webp"] -# you need to have cwebp installed for optimization to work -OPTIMIZE_IMAGES_DEFAULT = "no" - -CACHE_DIR = "/dev/shm/wikmd/cache" -SEARCH_DIR = "/dev/shm/wikmd/searchindex" - -SECRET_KEY = '\xfd{H\xe5<\x95\xf9\xe3\x96.5\xd1\x01O bool: """ Function that determines if the given path is a git repo. diff --git a/image_manager.py b/src/image_manager.py similarity index 100% rename from image_manager.py rename to src/image_manager.py diff --git a/knowledge_graph.py b/src/knowledge_graph.py similarity index 99% rename from knowledge_graph.py rename to src/knowledge_graph.py index af24e1d..5613884 100644 --- a/knowledge_graph.py +++ b/src/knowledge_graph.py @@ -6,7 +6,6 @@ cfg = WikmdConfig() - def extend_ids(links): for link in links: for l in link["links"]: diff --git a/plugins/__init__.py b/src/plugins/__init__.py similarity index 100% rename from plugins/__init__.py rename to src/plugins/__init__.py diff --git a/plugins/alerts/__init__.py b/src/plugins/alerts/__init__.py similarity index 100% rename from plugins/alerts/__init__.py rename to src/plugins/alerts/__init__.py diff --git a/plugins/alerts/alerts.py b/src/plugins/alerts/alerts.py similarity index 100% rename from plugins/alerts/alerts.py rename to src/plugins/alerts/alerts.py diff --git a/plugins/draw/__init__.py b/src/plugins/draw/__init__.py similarity index 100% rename from plugins/draw/__init__.py rename to src/plugins/draw/__init__.py diff --git a/plugins/draw/default_draw b/src/plugins/draw/default_draw similarity index 100% rename from plugins/draw/default_draw rename to src/plugins/draw/default_draw diff --git a/plugins/draw/draw.py b/src/plugins/draw/draw.py similarity index 100% rename from plugins/draw/draw.py rename to src/plugins/draw/draw.py diff --git a/plugins/draw/drawings/.gitignore b/src/plugins/draw/drawings/.gitignore similarity index 100% rename from plugins/draw/drawings/.gitignore rename to src/plugins/draw/drawings/.gitignore diff --git a/plugins/embed-pages/__init__.py b/src/plugins/embed-pages/__init__.py similarity index 100% rename from plugins/embed-pages/__init__.py rename to src/plugins/embed-pages/__init__.py diff --git a/plugins/embed-pages/embed-pages.py b/src/plugins/embed-pages/embed-pages.py similarity index 100% rename from plugins/embed-pages/embed-pages.py rename to src/plugins/embed-pages/embed-pages.py diff --git a/plugins/load_plugins.py b/src/plugins/load_plugins.py similarity index 100% rename from plugins/load_plugins.py rename to src/plugins/load_plugins.py diff --git a/plugins/mermaid/__init__.py b/src/plugins/mermaid/__init__.py similarity index 100% rename from plugins/mermaid/__init__.py rename to src/plugins/mermaid/__init__.py diff --git a/plugins/mermaid/mermaid.py b/src/plugins/mermaid/mermaid.py similarity index 100% rename from plugins/mermaid/mermaid.py rename to src/plugins/mermaid/mermaid.py diff --git a/search.py b/src/search.py similarity index 100% rename from search.py rename to src/search.py diff --git a/utils.py b/src/utils.py similarity index 100% rename from utils.py rename to src/utils.py diff --git a/web_dependencies.py b/src/web_dependencies.py similarity index 100% rename from web_dependencies.py rename to src/web_dependencies.py diff --git a/wiki.py b/src/wiki.py similarity index 99% rename from wiki.py rename to src/wiki.py index b5435c3..a5be1dc 100644 --- a/wiki.py +++ b/src/wiki.py @@ -8,12 +8,11 @@ import knowledge_graph import secrets -from flask import Flask, render_template, request, redirect, url_for, make_response, send_file, \ - send_from_directory, flash - +from flask import Flask, render_template, request, redirect, url_for, make_response, send_file, send_from_directory, flash from werkzeug.utils import safe_join, secure_filename from threading import Thread from hashlib import sha256 + from cache import Cache from image_manager import ImageManager from config import WikmdConfig @@ -21,9 +20,9 @@ from search import Search, Watchdog from web_dependencies import get_web_deps from plugins.load_plugins import PluginLoader - from utils import pathify + SESSIONS = [] cfg = WikmdConfig() @@ -34,7 +33,8 @@ HOMEPAGE_PATH = pathify(cfg.wiki_directory, cfg.homepage) HIDDEN_PATHS = tuple([UPLOAD_FOLDER_PATH, GIT_FOLDER_PATH, HOMEPAGE_PATH] + HIDDEN_FOLDER_PATH_LIST) -app = Flask(__name__) +app = Flask(__name__, template_folder="../templates", static_folder="../static") + app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER_PATH app.config['SECRET_KEY'] = cfg.secret_key