diff --git a/app/admin_service.py b/app/admin_service.py index 57f5e38..b0c18ff 100644 --- a/app/admin_service.py +++ b/app/admin_service.py @@ -53,7 +53,7 @@ def article(): ) # 最小的page是1 except ValueError: return "page parmas must be int!" - + _articles = get_page_articles(_cur_page, _page_size) for article in _articles: # 获取每篇文章的title text = escape(article.text) # Fix XSS vulnerability, contributed by Xu Xuan @@ -74,7 +74,10 @@ def article(): context["text_list"] = get_page_articles(_cur_page, _page_size) _articles = get_page_articles(_cur_page, _page_size) for article in _articles: # 获取每篇文章的title - article.title = article.text.split("\n")[0] + text = escape(article.text) # Fix XSS vulnerability, contributed by Xu Xuan + article.title = text.split("\n")[0] + article.content = '
'.join(text.split("\n")[1:]) + context["text_list"] = _articles if request.method == "GET": @@ -85,6 +88,7 @@ def article(): if delete_id: # delete article delete_article_by_id(delete_id) _update_context() + elif request.method == "POST": data = request.form content = data.get("content", "") diff --git a/app/static/wordfreqapp.db b/app/static/wordfreqapp.db new file mode 100644 index 0000000..c6f3101 Binary files /dev/null and b/app/static/wordfreqapp.db differ