From e0076f5c6e1b6520ada188018af89425150b7ea3 Mon Sep 17 00:00:00 2001 From: nsosnsos Date: Tue, 2 May 2023 11:10:38 +0800 Subject: [PATCH] FIX: MAKE DARK STYLE COMPATIBLE WITH MARKDOWN CONTENT make dark style compatible with markdown content. fix flasky shell command for init, addusr, delusr. --- flasky.sh | 26 +++++++++++++++++++++--- hallelujah/static/css/markdown_patch.css | 9 +++++++- hallelujah/templates/_highlight.html | 4 ++-- hallelujah/utility.py | 2 +- 4 files changed, 34 insertions(+), 7 deletions(-) diff --git a/flasky.sh b/flasky.sh index 2b2e0e1..574ed69 100755 --- a/flasky.sh +++ b/flasky.sh @@ -6,7 +6,7 @@ HOME_PATH=$(eval echo ~${SUDO_USER}) SCRIPT_FILE=$(basename $(readlink -f "${0}")) SCRIPT_PATH=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &> /dev/null && pwd) -if [ ${#} -eq 0 ]; then +if [[ ${#} -eq 0 ]]; then OPTION='run' else OPTION=${1} @@ -34,11 +34,31 @@ if [[ ${#} -eq 0 || ${OPTION} == 'debug' ]]; then elif [ ${OPTION} == 'clean' ]; then clean elif [ ${OPTION} == 'init' ]; then + if [[ ${#} -ne 5 ]]; then + echo "${SCRIPT_FILE} init --mail_address EMAIL_ADDRESS --mail_password EMAIL_PASSWORD" + exit -1 + fi sudo apt install libgl1 -y cd ${SCRIPT_PATH} source ${PYTHON_ENV} pip3 install -r ${SCRIPT_PATH}/requirements.txt - flask init + flask init --mail_address ${3} --mail_password ${5} +elif [ ${OPTION} == 'addusr' ]; then + if [[ ${#} -ne 5 ]]; then + echo "${SCRIPT_FILE} addusr --username USERNAME --password PASSWORD" + exit -1 + fi + cd ${SCRIPT_PATH} + source ${PYTHON_ENV} + flask addusr --username ${3} --password ${5} +elif [ ${OPTION} == 'delusr' ]; then + if [[ ${#} -ne 3 ]]; then + echo "${SCRIPT_FILE} delusr --username" + exit -1 + fi + cd ${SCRIPT_PATH} + source ${PYTHON_ENV} + flask delusr --username ${3} elif [ ${OPTION} == 'test' ]; then cd ${SCRIPT_PATH} source ${PYTHON_ENV} @@ -67,6 +87,6 @@ elif [ ${OPTION} == 'restore' ]; then source ${PYTHON_ENV} flask restore else - echo "Usage: ${SCRIPT_FILE} [run|clean|test|init|deploy]" + echo "Usage: ${SCRIPT_FILE} [init|debug|run|deploy|test|clean|addusr|delusr|backup|restore]" fi diff --git a/hallelujah/static/css/markdown_patch.css b/hallelujah/static/css/markdown_patch.css index 890d14c..86541cf 100644 --- a/hallelujah/static/css/markdown_patch.css +++ b/hallelujah/static/css/markdown_patch.css @@ -1,8 +1,16 @@ /* markdown code block */ .markdown-body { + background-color: transparent; box-sizing: border-box; padding: 15px; } +.markdown-body table tr { + background-color: transparent; +} +.markdown-body table tr:nth-child(2n) { + background-color: transparent; + opacity: 0.7; +} .markdown-body pre { margin-top, margin-bottom: 5px; padding: 0; @@ -24,7 +32,6 @@ display: table; } .markdown-body code.hljs table.hljs-ln tr { - background-color: #f6f8fa; border: 0; } .markdown-body code.hljs table.hljs-ln td.hljs-ln-line { diff --git a/hallelujah/templates/_highlight.html b/hallelujah/templates/_highlight.html index 4ec64e3..9cf71a0 100644 --- a/hallelujah/templates/_highlight.html +++ b/hallelujah/templates/_highlight.html @@ -1,10 +1,10 @@ {% extends '_base.html' %} {% block styles %} - - {{ super() }} + {{ super() }} + {% endblock styles %} {% block scripts %} diff --git a/hallelujah/utility.py b/hallelujah/utility.py index 59c9f4c..614bd3f 100644 --- a/hallelujah/utility.py +++ b/hallelujah/utility.py @@ -134,7 +134,7 @@ def send_async_email(app, message): try: mail.send(message) except Exception as e: - app.config.logger.error('send_async_email: {}'.format(str(e))) + app.logger.error('send_async_email: {}'.format(str(e))) def send_email(to, subject, msg):