#29: First login-less pages

This commit adds a config for . When enabled it allows users to navigate on the routes which don't have the @login_required
This commit is contained in:
pluja 2020-09-06 22:33:39 +02:00
parent c0d203afde
commit 6917b476fd
4 changed files with 8 additions and 3 deletions

View File

@ -242,7 +242,7 @@ def ytsearch():
'thumbnail':'https:{}'.format(c['thumbnails'][0]),
'subCount':c['suscriberCountText'].split(" ")[0]
})
return render_template('ytsearch.html', form=form, btform=button_form, channels=channels, videos=videos)
return render_template('ytsearch.html', form=form, btform=button_form, channels=channels, videos=videos, restricted=config['restrictPublicUsage'])
else:
return render_template('ytsearch.html', form=form)
@ -301,7 +301,7 @@ def channel(id):
data = feedparser.parse(data.content)
channelData = YoutubeSearch.channelInfo(id)
return render_template('channel.html', form=form, btform=button_form, channel=channelData[0], videos=channelData[1])
return render_template('channel.html', form=form, btform=button_form, channel=channelData[0], videos=channelData[1], restricted=config['restrictPublicUsage'])
@app.route('/watch', methods=['GET'])
@login_required

View File

@ -18,6 +18,7 @@
</div>
</div>
</div>
{% if restricted or current_user.is_authenticated %}
<div class="center aligned extra content">
{% if not current_user.is_following_yt(channel.id) %}
<p>
@ -35,6 +36,7 @@
</p>
{% endif %}
</div>
{% endif %}
</div>
</div>

View File

@ -20,6 +20,7 @@
{% for res in channels %}
<div class="item">
{% if restricted or current_user.is_authenticated %}
<div class="right floated content">
{% if not current_user.is_following_yt(res.channelId) %}
<p>
@ -37,6 +38,7 @@
</p>
{% endif %}
</div>
{% endif %}
<img alt="Avatar" class="ui avatar image" src="{{ res.thumbnail }}">
<div class="content">
<a class = "header" href="{{ url_for('channel', id=res.channelId)}}">{{res.username}}</a>

View File

@ -2,5 +2,6 @@
"serverName": "Yotter.xyz",
"nitterInstance": "https://nitter.net/",
"maxInstanceUsers": 10,
"serverLocation": "Germany"
"serverLocation": "Germany",
"restrictPublicUsage":false
}