diff --git a/CHANGES.md b/CHANGES.md index 9d9ea66..f4023a7 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,6 +1,11 @@ ## 版本更新记录 -### v0.6.6 2021-04 +### v0.6.7 2021-04 +- [修复]XSS过滤漏洞; +- [优化]文档类型标识; +- [优化]文档标签相关页面; + +### v0.6.6 2021-04-11 - [新增]站点语言配置项,英文和繁体中文语言包; - [新增]文集批量导出Markdown压缩包; diff --git a/MrDoc/settings.py b/MrDoc/settings.py index d2c39dc..c28a168 100644 --- a/MrDoc/settings.py +++ b/MrDoc/settings.py @@ -40,7 +40,7 @@ SECRET_KEY = '5&71mt9@^58zdg*_!t(x6g14q*@84d%ptr%%s6e0l50zs0we3d' # SECURITY WARNING: don't run with debug turned on in production! DEBUG = CONFIG.getboolean('site','debug') -VERSIONS = '0.6.6' +VERSIONS = '0.6.7' ALLOWED_HOSTS = ['*'] diff --git a/app_doc/views.py b/app_doc/views.py index 49b63e3..7ace00c 100644 --- a/app_doc/views.py +++ b/app_doc/views.py @@ -63,13 +63,14 @@ def get_pro_toc(pro_id): doc_list = [] n = 0 # 获取一级文档 - top_docs = Doc.objects.filter(top_doc=pro_id, parent_doc=0, status=1).values('id', 'name','open_children').order_by('sort') + top_docs = Doc.objects.filter(top_doc=pro_id, parent_doc=0, status=1).values('id', 'name','open_children','editor_mode').order_by('sort') # 遍历一级文档 for doc in top_docs: top_item = { 'id': doc['id'], 'name': doc['name'], - 'open_children':doc['open_children'] + 'open_children':doc['open_children'], + 'editor_mode':doc['editor_mode'] # 'spread': True, # 'level': 1 } @@ -80,13 +81,14 @@ def get_pro_toc(pro_id): top_doc=pro_id, parent_doc=doc['id'], status=1 - ).values('id', 'name','open_children').order_by('sort') + ).values('id', 'name','open_children','editor_mode').order_by('sort') top_item['children'] = [] for doc in sec_docs: sec_item = { 'id': doc['id'], 'name': doc['name'], - 'open_children': doc['open_children'] + 'open_children': doc['open_children'], + 'editor_mode': doc['editor_mode'] # 'level': 2 } # 如果二级文档存在下级文档,查询第三级文档 @@ -96,12 +98,13 @@ def get_pro_toc(pro_id): top_doc=pro_id, parent_doc=doc['id'], status=1 - ).values('id','name').order_by('sort') + ).values('id','name','editor_mode').order_by('sort') sec_item['children'] = [] for doc in thr_docs: item = { 'id': doc['id'], 'name': doc['name'], + 'editor_mode': doc['editor_mode'] # 'level': 3 } sec_item['children'].append(item) diff --git a/template/app_doc/docs_base.html b/template/app_doc/docs_base.html index 5982192..6ae111c 100644 --- a/template/app_doc/docs_base.html +++ b/template/app_doc/docs_base.html @@ -102,7 +102,7 @@
  • {% if docs.children %}
    - {{ docs.name }} + {% if docs.editor_mode == 4 %}{% else %}{% endif %} {{ docs.name }} {% if docs.open_children %} {% else %} @@ -120,7 +120,7 @@
  • {% if node.id|get_next_doc %}
    - {{ node.name }} + {{ node.name }} {% if node.open_children %} {% else %} @@ -135,17 +135,17 @@ {% for doc in node.children %} -
  • {{ doc.name }}
  • +
  • {{ doc.name }}
  • {% endfor %} {% else %} - {{ node.name }} + {{ node.name }} {% endif %} {% endfor %} {% else %} - {{ docs.name }} + {{ docs.name }} {% endif %} {% endfor %} @@ -153,7 +153,7 @@ {% endif %}
    - {% trans "本文档使用MrDoc发布" %} + {% trans "本文档使用 MrDoc 发布" %}
    @@ -319,6 +319,7 @@ + {% elif doc.editor_mode == 1 %} - {% elif doc.editor_mode == 4 %} diff --git a/template/app_doc/tag_doc_base.html b/template/app_doc/tag_doc_base.html index 3424a81..eabfb34 100644 --- a/template/app_doc/tag_doc_base.html +++ b/template/app_doc/tag_doc_base.html @@ -16,8 +16,19 @@ {% block title %}{% trans "标签:" %}{{tag.name}}{% endblock %} - {% if site_name != None and site_name != '' %}{{ site_name }}{% else %}{% trans "站点标题" %}{% endif %} - - + {% if doc.editor_mode != 4 %} + + {% endif %} + {% if doc.editor_mode == 2 %} + + {% endif %} + {% if doc.editor_mode == 4 %} + + + + + + {% endif %} @@ -29,6 +40,9 @@ max-width: 350px; } {% endif %} + /* html{ + filter: invert(1) hue-rotate(180deg); + } */ {% for doc in docs %}
  • - {{ doc.doc.name }} + {{ doc.doc.name }}
  • {% endfor %}
    - {% trans "本文档使用MrDoc发布" %} + {% trans "本文档使用 MrDoc 发布" %}
    @@ -165,13 +179,80 @@ -
    - {% block right_widget %} {% endblock %} +
    +
    + {% block right_widget %} {% endblock %} +
    + + + + + + + - - + + + + + + + - - - - - - - - - - - - - - - - - - +{% if doc.editor_mode == 2 %} + +{% elif doc.editor_mode == 1 %} + - +{% elif doc.editor_mode == 4 %} + + + +{% endif %} - - - - - - - - - - - - - - -