Skip to content

Commit

Permalink
Merge pull request #4 from D0g3-Lab/dev
Browse files Browse the repository at this point in the history
Fix some bugs and add an issue template
  • Loading branch information
0akarma authored Dec 15, 2019
2 parents 8151781 + 594437b commit b047281
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 20 deletions.
14 changes: 9 additions & 5 deletions CTFd/plugins/ctfd-matrix-scoreboard/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,15 @@ def get_standings():
jstandings = []
# print(standings)
for team in standings:
print(team)
teamid = team[0]
# To do 区分模式
solves = db.session.query(Solves.challenge_id.label('chalid'), Solves.date.label('date')).filter(Solves.team_id==teamid)
mode = utils.get_config("user_mode")
if mode == "teams":
teamid = Users.query.filter_by(id=team[0]).first_or_404().team_id
solves = db.session.query(Solves.challenge_id.label('chalid'), Solves.date.label('date')).filter(
Solves.team_id == teamid)
else:
teamid = team[0]
solves = db.session.query(Solves.challenge_id.label('chalid'), Solves.date.label('date')).filter(
Solves.user_id == teamid)

freeze = utils.get_config('freeze')
if freeze:
Expand Down Expand Up @@ -67,7 +72,6 @@ def get_standings():
score = score + int(cvalue * 1)
jsolves.append(solve)

mode = utils.get_config("user_mode")
if mode == "teams":
jstandings.append({'userid':"", 'teamid':team[0], 'score':score, 'name':team[2],'solves':jsolves})
else:
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ <h1>Scoreboard has been frozen.</h1>
</th>
<th width="5%" rowspan="2"><b>Score</b>
</th>
<!-- TODO: 可适应布局调整 -->
{% for chal in challenges %}
<div><th class="chalname" title="{{ chal.category }}"><div><span>{{ chal.name }}</span></div></th></div>
{% endfor %}
Expand Down
9 changes: 6 additions & 3 deletions CTFd/plugins/ctfd-owl/frp_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ def update_frp_redirect():
frp_api_ip = "frpc"
frp_api_port = "7400"
# print(output)
requests.put("http://" + frp_api_ip + ":" + frp_api_port + "/api/config", output,
timeout=5)
requests.get("http://" + frp_api_ip + ":" + frp_api_port + "/api/reload", timeout=5)
if configs.get("frpc_config_template") is not None:
requests.put("http://" + frp_api_ip + ":" + frp_api_port + "/api/config", output,
timeout=5)
requests.get("http://" + frp_api_ip + ":" + frp_api_port + "/api/reload", timeout=5)
else:
pass
17 changes: 11 additions & 6 deletions CTFd/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ def setup():
set_config("mail_useauth", None)

set_config("setup", True)
# add h1ve-theme as default theme
set_config("ctf_theme", "H1ve-theme")

try:
db.session.add(admin)
Expand Down Expand Up @@ -179,14 +181,17 @@ def static_html(route):
:param route:
:return:
"""
page = get_page(route)
if page is None:
abort(404)
if route == "index":
return render_template("index.html")
else:
if page.auth_required and authed() is False:
return redirect(url_for("auth.login", next=request.full_path))
page = get_page(route)
if page is None:
abort(404)
else:
if page.auth_required and authed() is False:
return redirect(url_for("auth.login", next=request.full_path))

return render_template("page.html", content=markdown(page.content))
return render_template("page.html", content=markdown(page.content))


@views.route("/files", defaults={"path": ""})
Expand Down
19 changes: 19 additions & 0 deletions docs/issue_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!-
为了方便我们能更好的复现和修复BUG,请遵从下面的规范描述您的问题
In order to help us recurrence and fix bugs, please follow issue-rules as follow
-->

### New Issue Checklist (自检清单)

- [ ] Updated H1ve to the latest version (是否更新到最新版本)
- [ ] I have read the [README](https://github.com/D0g3-Lab/H1ve/blob/master/README.md)
- [ ] I searched for [existing GitHub issues](https://github.com/D0g3-Lab/H1ve/issues)

### Issue Description (问题描述)
<!-- Please include what's happening, expected behavior, and any relevant code samples -->

### Version & Environment (系统/环境版本)
+ Docker Version
+ Docker-compose Version
+ Os Version
+ Browser Version
10 changes: 6 additions & 4 deletions single.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,9 @@ services:
- internal

frps:
image: hive-frp
build: ./frp
image: 0akarma/hive-frp
# you can build image by yourself if you want.
# build: ./frp
restart: always
volumes:
- ./frp:/conf/
Expand All @@ -71,8 +72,9 @@ services:
frp:

frpc:
image: hive-frp
build: ./frp
image: 0akarma/hive-frp
# you can build image by yourself if you want.
# build: ./frp
restart: always
volumes:
- ./frp:/conf/
Expand Down

0 comments on commit b047281

Please sign in to comment.