diff --git a/CHANGELOG.md b/CHANGELOG.md index c0794c9..e1dd133 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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` diff --git a/SELF-HOSTING.md b/SELF-HOSTING.md index 2002784..4fa9d1b 100644 --- a/SELF-HOSTING.md +++ b/SELF-HOSTING.md @@ -233,11 +233,11 @@ server { } } ``` -Make sure to replace `` 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 `` 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 `` 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. diff --git a/app/routes.py b/app/routes.py index 6173108..005bd2f 100644 --- a/app/routes.py +++ b/app/routes.py @@ -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 diff --git a/app/templates/video.html b/app/templates/video.html index 310f987..adc2d1f 100644 --- a/app/templates/video.html +++ b/app/templates/video.html @@ -40,7 +40,7 @@ controls buffered preload="none"> - {% if config.nginxVideoStream %} + {% if config.isInstance %} {% for source in vsources %} {% endfor %} diff --git a/app/templates/ytsearch.html b/app/templates/ytsearch.html index ccb4966..04cfd25 100644 --- a/app/templates/ytsearch.html +++ b/app/templates/ytsearch.html @@ -23,7 +23,7 @@ {% for res in results.channels %}
- {% if config.nginxVideoStream %} + {% if config.isInstance %} Avatar {% else %} Avatar diff --git a/yotter-config.json b/yotter-config.json index e0ceeab..8b2342e 100644 --- a/yotter-config.json +++ b/yotter-config.json @@ -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",