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

View File

@ -14,7 +14,7 @@
<i class="share square outline icon"></i>
</span></a>
</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">
<span class="category" id="time"><i class="clock icon"></i> {{post.date}} </span>
{% if post.isPinned %}

View File

@ -21,9 +21,9 @@
<img class="ui avatar image" src="{{ res.avatar }}">
<div class="content">
{% 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 %}
<a class="header" href="/user/{{res.username}}">{{res.fullName}}</a>
<a class="header" href="/u/{{res.username}}">{{res.fullName}}</a>
{% endif %}
<div class="description">{{res.username}}</div>
</div>

View File

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