Skip to content

Commit

Permalink
move /user/ router to /contrib/
Browse files Browse the repository at this point in the history
  • Loading branch information
trim21 committed Aug 20, 2024
1 parent a221792 commit f1baeda
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 11 deletions.
2 changes: 1 addition & 1 deletion server/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ async def index(request: Request) -> Template:
)


@litestar.get("/user/{user_id:int}", guards=[require_user_login])
@litestar.get("/contrib/{user_id:int}", guards=[require_user_login])
async def show_user(user_id: int, request: Request) -> Template:
rows = await pg.fetch(
"select * from patch where from_user_id = $1 and deleted_at is NULL order by created_at desc",
Expand Down
4 changes: 4 additions & 0 deletions server/templates/component/header.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<div class="row">
<a href="/" class="link-underline link-underline-opacity-0"><h2>返回首页</h2></a>
<hr>
</div>
7 changes: 4 additions & 3 deletions server/templates/error.html.jinja2
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{% extends "layout/base.html.jinja2" %}

{% block content %}
{{ error }}
<hr>
<a href="/">返回首页</a>
{% include 'component/header.html' %}
<div class="row">
{{ error }}
</div>
{% endblock %}
9 changes: 6 additions & 3 deletions server/templates/list.html.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,16 @@
}
</style>
{% if user_id is defined %}
{% include 'component/header.html' %}
<div class="row m-1">
<a href="https://bgm.tv/user/{{ user_id }}"> <h2>用户 {{ user_id }} 的个人主页</h2> </a>
<a href="https://bgm.tv/user/{{ user_id }}">
<h3>用户 {{ user_id }} 的个人主页</h3>
</a>
</div>
{% else %}
{% if not auth.allow_edit %}
<div class="row m-1">
<a href="/suggest">添加Patch</a>
<div class="row m-0">
<a href="/suggest"><h3>添加Patch</h3></a>
</div>
{% endif %}
{% endif %}
Expand Down
6 changes: 2 additions & 4 deletions server/templates/patch.html.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@
{% endblock %}

{% block content %}
<div class="row"><a href="/"><h2>返回首页</h2></a></div>

<hr>
{% include 'component/header.html' %}

<div class="row">
<div class="col">
Expand All @@ -28,7 +26,7 @@
</a>
</div>
<div class="col">
<a href="/user/{{ patch.from_user_id }}" target="_blank"
<a href="/contrib/{{ patch.from_user_id }}" target="_blank"
rel="noopener">
<h3>提交者: {{ patch.from_user_id }}</h3>
</a>
Expand Down

0 comments on commit f1baeda

Please sign in to comment.