Skip to content

Commit 4797f76

Browse files
committed
reset wechat port
1 parent a172e56 commit 4797f76

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

app/OctBlog/config.py

+1
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ def get_env_value(key, default_value=''):
186186
},
187187
'only_abstract_in_feed': os.environ.get('only_abstract_in_feed', 'false').lower() == 'true',
188188
'allow_share_article': os.environ.get('allow_share_article', 'true').lower() == 'true',
189+
'allow_wechat_port': os.environ.get('allow_wechat_port', 'false').lower() == 'true',
189190
'gavatar_cdn_base': os.environ.get('gavatar_cdn_base', '//cdn.v2ex.com/gravatar/'),
190191
'gavatar_default_image': os.environ.get('gavatar_default_image', 'http://7tsygu.com1.z0.glb.clouddn.com/user-avatar.jpg'),
191192
'background_image': {

app/main/urls.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
from flask import Blueprint
1+
from flask import Blueprint, g
22

33
from . import views, admin_views, errors
4+
from OctBlog.config import OctBlogSettings
45

56
main = Blueprint('main', __name__)
67

@@ -60,3 +61,9 @@
6061
blog_admin.errorhandler(401)(errors.handle_unauthorized)
6162
blog_admin.errorhandler(403)(errors.handle_forbidden)
6263

64+
ALLOW_WECHAT_PORT = OctBlogSettings['allow_wechat_port']
65+
66+
@blog_admin.before_app_request
67+
def before_request():
68+
g.allow_wechat_port = ALLOW_WECHAT_PORT
69+

app/templates/admin_base.html

+4-1
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@
7878
<li><a href="#">Export</a></li>
7979
</ul>
8080
</li>
81+
82+
{% if g.allow_wechat_port %}
8183
<li class="dropdown">
8284
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">WeChat <span class="caret"></span></a>
8385
<ul class="dropdown-menu" role="menu">
@@ -87,9 +89,10 @@
8789
<li><a href="{{ url_for('blog_admin.wechat_drafts') }}">Drafts</a></li>
8890
</ul>
8991
</li>
92+
{% endif %} <!-- end allow_wechat_port -->
9093

9194

92-
{% endif %}
95+
{% endif %} <!-- g.identity.allow_write -->
9396

9497
{% if g.identity.allow_edit %}
9598
<li class="dropdown">

0 commit comments

Comments
 (0)