Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.idea/
__pycache__/
venv/
Binary file modified database.sqlite
Binary file not shown.
24 changes: 24 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
alembic==1.5.2
click==7.1.2
et-xmlfile==1.0.1
Flask==1.1.2
Flask-Migrate==2.6.0
Flask-Script==2.0.6
Flask-SQLAlchemy==2.4.4
itsdangerous==1.1.0
jdcal==1.4.1
Jinja2==2.11.2
Mako==1.1.4
MarkupSafe==1.1.1
numpy==1.19.5
openpyxl==3.0.6
pandas==1.1.5
PyMySQL==0.10.1
python-dateutil==2.8.1
python-editor==1.0.4
pytz==2021.1
six==1.15.0
SQLAlchemy==1.3.22
Werkzeug==1.0.1
xlrd==2.0.1
XlsxWriter==1.3.7
9 changes: 6 additions & 3 deletions service.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,8 +366,11 @@ def get_subject(subjectID):
# ============================================================================================
@app.before_request
def before_request():
ip = IP
session['ip'] = ip
if request.headers.getlist("X-Forwarded-For"):
ip = request.headers.getlist("X-Forwarded-For")[0]
else:
ip = request.remote_addr
session['ip']=ip
visitor = Visitor.query.filter_by(ip=ip).first()
if visitor is None:
visitor = Visitor(ip=ip)
Expand Down Expand Up @@ -762,4 +765,4 @@ def author(author_id):


if __name__ == '__main__':
app.run(debug=True)
app.run(debug=True,host="0.0.0.0")
6 changes: 3 additions & 3 deletions templates/article.html
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ <h2 class="card-title">{{ article.title }}</h2><!--title-->

<p class="text-primary pp" onclick="dislike()">dislike</p>
<p id="dislike">{{ article.downvote }}</p>&nbsp;<br>
<p class="text-primary pp" onclick="dislike()">dislike</p> <p id="dislike">{{ article.downvote }}</p>&nbsp;
<!-- <p class="text-primary pp" onclick="dislike()">dislike</p> <p id="dislike">{{ article.downvote }}</p>&nbsp;-->

<!--New downloads-->
<div style="float:right"><p class="text-primary">download number </p> <p id="download_number">{{ article.downloadcount }}</p></div><br>
Expand Down Expand Up @@ -193,8 +193,8 @@ <h2 class="card-title">{{ article.title }}</h2><!--title-->
</div>
{% endfor %}
</div>

{% if comments %}
<button class="btn btn-primary" type="submit" style="float:right" onclick="sort()">排序/取消排序</button>

{% endif %}

{% endblock %}
2 changes: 1 addition & 1 deletion templates/search.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<td><a href="/article/{{ article.id }}">{{ Tool.highlight_matched_parts(article.title, kwd) | safe }}</a></td>
<td>{{ Tool.highlight_matched_parts(article.abstract, kwd) | safe }}</td>
<td>{{ Tool.highlight_matched_parts(article.highlight, kwd) | safe }}</td>
<td>{{ Tool.email_display_filter(article.author.mail) | safe }}</td>
<td><a href="{{ url_for('author', author_id=article.author_id) }}">{{ Tool.email_display_filter(article.author.mail) | safe }}</a></td>
<td>{{ article.time.strftime('%Y-%m-%d %H:%M') | safe }}</td>
<td>{{ article.metric }}</td>
</tr>
Expand Down
2 changes: 1 addition & 1 deletion templates/subject.html
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
{% for article in articles.items %}
<tr>
<td><a href="/article/{{ article.id }}">{{ article.title }}</a></td>
<td>{{ Tool.email_display_filter(article.author.mail) }}</td>
<td><a href="{{ url_for('author', author_id=article.author_id) }}">{{ Tool.email_display_filter(article.author.mail) }}</a></td>
<td>{{ article.time.strftime("%Y-%m-%d %H:%M") }}</td>
<td>{{ article.metric }}</td>
</tr>
Expand Down