Total Pageviews

Sunday 27 September 2020

Yotter:一个Youtube/Twitter替代前端

 在Yotter上面你可以订阅自己喜欢的Youtube/Twitter账号,收到最新的内容推送而不用担心隐私泄漏问题。

如果部署在境外VPS上面的话,看Youtube视频就不需要梯子了,不过目前还不能选择视频分辨率,作者在解决中。

下面我使用docker部署,首先安装需要用到的软件:

apt -y update
apt -y install curl nginx python-certbot-nginx
curl -sSL https://get.docker.com/ | sh
systemctl start docker
systemctl enable docker nginx
curl -L https://github.com/docker/compose/releases/download/1.26.2/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose

新建一个docker-compose.yml:

mkdir -p /opt/yotter && cd /opt/yotter && nano docker-compose.yml

写入如下配置:

version: '3.8'

services:
  mariadb:
    image: mariadb:10.5
    container_name: mariadb-yotter
    restart: unless-stopped
    environment:
      MYSQL_ROOT_PASSWORD: setyourpassword
      MYSQL_DATABASE: yotter
      MYSQL_USER: yotter
      MYSQL_PASSWORD: setyourpassword
    volumes:
     - mariadb:/var/lib/mysql
    healthcheck:
     test: ["CMD", "mysqladmin", "ping", "--silent"]

  yotter:
    image: ytorg/yotter:latest
    container_name: yotter
    restart: unless-stopped
    ports:
      - "127.0.0.1:5000:5000"
    environment:
      DATABASE_URL: mysql+pymysql://yotter:setyourpassword@mariadb:3306/yotter
    depends_on:
      - mariadb
    volumes:
     - migrations:/usr/src/app/migrations
     - ./yotter-config.json:/usr/src/app/yotter-config.json

volumes:
  mariadb:
  migrations:

新建一个yotter的配置文件:

nano yotter-config.json

写入如下配置:

{
	"serverName": "yotter.imlala.best",
	"nitterInstance": "https://nitter.net/",
	"maxInstanceUsers": 1,
	"serverLocation": "China",
	"restrictPublicUsage":true,
	"nginxVideoStream":true,
	"maintenance_mode":false,
	"show_admin_message":false,
	"admin_message_title":"Message from the admin",
	"admin_message":"Message from the admin text"
}

如果需要开放注册就把maxInstanceUsers后面的值改大,这里我设置为1,相当于我注册一个账号后就关闭注册,仅供个人使用。

配置好了之后up起来即可:

docker-compose up -d

接下来新建一个nginx站点配置文件:

nano /etc/nginx/conf.d/yotter.conf

写入如下配置:

server {
    listen       80;
    server_name  yotter.imlala.best; #换成你的域名

    location / {
        proxy_pass http://127.0.0.1:5000;
    }
    
    location ~ (/videoplayback|/vi/) {
       proxy_buffering off;
       resolver 1.1.1.1;
       proxy_pass https://$arg_hostname;
       proxy_set_header Host $arg_hostname;
       add_header Access-Control-Allow-Origin *;
     }
}

签一个ssl证书:

certbot --nginx --agree-tos --no-eff-email --email example@qq.com

访问你的域名如果正常的话应该可以看到下面的界面:


点搜索按钮可以搜索Youtube/Twitter账号并订阅,这里我随便试了下,然后就可以收到订阅账号的内容推送了。


No comments:

Post a Comment