Allow /user/<username> url on youtube

This commit is contained in:
pluja 2020-08-27 12:07:59 +02:00
parent 16bc0acfd0
commit b56e5a1fae
4 changed files with 12 additions and 13 deletions

View File

@ -162,9 +162,9 @@ def search():
else: else:
return render_template('search.html', form = form) return render_template('search.html', form = form)
@app.route('/user/<username>') @app.route('/u/<username>')
@login_required @login_required
def user(username): def u(username):
form = EmptyForm() form = EmptyForm()
avatarPath = "img/avatars/{}.png".format(str(random.randint(1,12))) avatarPath = "img/avatars/{}.png".format(str(random.randint(1,12)))
user = getTwitterUserInfo(username) user = getTwitterUserInfo(username)
@ -288,6 +288,7 @@ def unfollowYoutubeChannel(channelId):
return redirect(request.referrer) return redirect(request.referrer)
@app.route('/channel/<id>', methods=['GET']) @app.route('/channel/<id>', methods=['GET'])
@app.route('/user/<id>', methods=['GET'])
@login_required @login_required
def channel(id): def channel(id):
form = ChannelForm() form = ChannelForm()

View File

@ -14,7 +14,7 @@
<i class="share square outline icon"></i> <i class="share square outline icon"></i>
</span></a> </span></a>
</div> </div>
<div class="header" id="author"><a href="user/{{post.op.replace('@','')}}">{{ post.op }}</a></div> <div class="header" id="author"><a href="{{url_for('u', username=post.op.replace('@',''))}}">{{ post.op }}</a></div>
<div class="meta"> <div class="meta">
<span class="category" id="time"><i class="clock icon"></i> {{post.date}} </span> <span class="category" id="time"><i class="clock icon"></i> {{post.date}} </span>
{% if post.isPinned %} {% if post.isPinned %}

View File

@ -21,9 +21,9 @@
<img class="ui avatar image" src="{{ res.avatar }}"> <img class="ui avatar image" src="{{ res.avatar }}">
<div class="content"> <div class="content">
{% if res.fullName|length > 20%} {% if res.fullName|length > 20%}
<a class="header" href="/user/{{res.username}}">{{res.fullName[0:23]}}...</a> <a class="header" href="/u/{{res.username}}">{{res.fullName[0:23]}}...</a>
{% else %} {% else %}
<a class="header" href="/user/{{res.username}}">{{res.fullName}}</a> <a class="header" href="/u/{{res.username}}">{{res.fullName}}</a>
{% endif %} {% endif %}
<div class="description">{{res.username}}</div> <div class="description">{{res.username}}</div>
</div> </div>

View File

@ -1,7 +1,7 @@
{% extends "base.html" %} {% extends "base.html" %}
{% block content %} {% block content %}
<div class="ui one column centered grid"> <div class="ui text container">
<form class="ui form" action="" method="post" novalidate> <form class="ui form" action="" method="post" novalidate>
{{ form.hidden_tag() }} {{ form.hidden_tag() }}
<p> <p>
@ -14,10 +14,9 @@
<p>{{ form.submit() }}</p> <p>{{ form.submit() }}</p>
</form> </form>
<div class="ui one column centered grid"> <h3 class="ui dividing header">Users</h3>
{% if channels %} {% if channels %}
<div class="ui middle aligned list"> <div class="ui relaxed divided list">
<h3 class="ui dividing header">Users</h3>
{% for res in channels %} {% for res in channels %}
<div class="item"> <div class="item">
@ -40,10 +39,10 @@
</div> </div>
<img class="ui avatar image" src="{{ res.thumbnail }}"> <img class="ui avatar image" src="{{ res.thumbnail }}">
<div class="content"> <div class="content">
<a href="{{ url_for('channel', id=res.channelId)}}">{{res.username}}</a> <a class = "header" href="{{ url_for('channel', id=res.channelId)}}">{{res.username}}</a>
<div class="ui label"> <div class="description"><div class="ui label">
<i class="user icon"></i> {{res.subCount}} <i class="user icon"></i> {{res.subCount}}
</div> </div></div>
</div> </div>
</div> </div>
{% endfor %} {% endfor %}
@ -63,7 +62,6 @@
{% include '_empty_feed.html' %} {% include '_empty_feed.html' %}
{% endif %} {% endif %}
</div> </div>
</div>
</div> </div>
{% endblock %} {% endblock %}