Change nginxVideoProxy to isInstance

This commit is contained in:
pluja 2020-10-17 13:09:08 +02:00
parent 4b153cf7e9
commit fa893f2d05
6 changed files with 11 additions and 11 deletions

View File

@ -57,7 +57,7 @@ location ~ (/videoplayback|/vi/|/a/) {
```
> Your `/etc/nginx/sites-enabled/yotter` file should look something [like this](https://bin.nixnet.services/?d319d06feb1f5756#HgsMgpN9kob7vB5GpUtdTtqZeCdb5SEggLzwr4YAaYo).
7. Edit your `yotter-config.json` file and enable the `nginxVideoStream` option.
7. Edit your `yotter-config.json` file and set the `isInstance` option to True.
8. `sudo service nginx reload`
9. `sudo supervisorctl start yotter`

View File

@ -233,11 +233,11 @@ server {
}
}
```
Make sure to replace `<yourdomain>` by the domain you are willing to use for your instance (i.e example.com). You can now edit `yotter-config.json` and set `nginxVideoStream` to `true`.
Make sure to replace `<yourdomain>` by the domain you are willing to use for your instance (i.e example.com). You can now edit `yotter-config.json` and set `isInstance` to `true`.
You will also need to change the `</path/to>` after `alias` to fit your system. You have to point to the Yotter folder, in this set up it would be `/home/ubuntu` as it is the location where we cloned the Yotter app. This alias is created to handle static files directly, without forwarding to the application.
Once done, you can run `sudo service nginx reload`. If everything so far went OK, you can now set the `nginxVideoStream` to `true` on the `yotter-config.json` file.
Once done, you can run `sudo service nginx reload`. If everything so far went OK, you can now set the `isInstance` to `true` on the `yotter-config.json` file.
Now you need to install an SSL certificate on your server so you can use HTTPS. If you are running Ubuntu 20LTS or already have `snap` installed, you can proceed as follows:
@ -274,7 +274,7 @@ Currently available config is:
* **maxInstanceUsers**: Max users on the instance. When set to `0` it closes registrations.
* **serverLocation**: Location of the server.
* **restrictPublicUsage**: When set to `false` the instance allows non-registered users to use some routes (i.e /watch?v=..., /ytsearch, /channel...). See [this section](https://github.com/pluja/Yotter/blob/dev-indep/SELF-HOSTING.md#removing-log-in-restrictions)
* **nginxVideoStream**: Wether or not to use Nginx as streaming engine. It is recommended for public instances. [See this link]()
* **isInstance**: If your installation is on a server using Nginx, it must be True. Only false if running on a local machine. [See this link]()
* **maintenance_mode**: Activates a message on the server warning users of maintenance mode.
* **show_admin_message**: Shows a message from the admin with title as `admin_message_title` and body as `admin_message`
* **admin_user**: Username of the admin user.

View File

@ -339,7 +339,7 @@ def ytsearch():
video['videoThumb'] = video['videoThumb'].replace("https://{}".format(hostname), "") + "&host=" + hostname
for channel in results['channels']:
if config['nginxVideoStream']:
if config['isInstance']:
channel['thumbnail'] = channel['thumbnail'].replace("~", "/")
hostName = urllib.parse.urlparse(channel['thumbnail']).netloc
channel['thumbnail'] = channel['thumbnail'].replace("https://{}".format(hostName),
@ -423,14 +423,14 @@ def channel(id):
data = ytch.get_channel_tab_info(id, page, sort)
for video in data['items']:
if config['nginxVideoStream']:
if config['isInstance']:
hostName = urllib.parse.urlparse(video['thumbnail'][1:]).netloc
video['thumbnail'] = video['thumbnail'].replace("https://{}".format(hostName), "")[1:].replace("hqdefault",
"mqdefault") + "&host=" + hostName
else:
video['thumbnail'] = video['thumbnail'].replace('/', '~')
if config['nginxVideoStream']:
if config['isInstance']:
hostName = urllib.parse.urlparse(data['avatar'][1:]).netloc
data['avatar'] = data['avatar'].replace("https://{}".format(hostName), "")[1:] + "?host=" + hostName
else:
@ -1027,7 +1027,7 @@ def getYoutubePosts(ids):
video.channelUrl = vid.author_detail.href
video.id = vid.yt_videoid
video.videoTitle = vid.title
if config['nginxVideoStream']:
if config['isInstance']:
hostName = urllib.parse.urlparse(vid.media_thumbnail[0]['url']).netloc
video.videoThumb = vid.media_thumbnail[0]['url'].replace("https://{}".format(hostName), "").replace(
"hqdefault", "mqdefault") + "?host=" + hostName

View File

@ -40,7 +40,7 @@
controls
buffered
preload="none">
{% if config.nginxVideoStream %}
{% if config.isInstance %}
{% for source in vsources %}
<source src="{{source.src}}" type="{{source.type}}">
{% endfor %}

View File

@ -23,7 +23,7 @@
{% for res in results.channels %}
<div class="item">
<div class="image">
{% if config.nginxVideoStream %}
{% if config.isInstance %}
<img src="{{res.thumbnail}}" alt="Avatar">
{% else %}
<img alt="Avatar" src="{{ url_for('img', url=res.thumbnail) }}">

View File

@ -4,7 +4,7 @@
"maxInstanceUsers": 100,
"serverLocation": "Germany",
"restrictPublicUsage":true,
"nginxVideoStream":true,
"isInstance":true,
"maintenance_mode":false,
"show_admin_message":false,
"admin_message_title":"Message from the admin",