fix instance list generator, add working dockerfile

This commit is contained in:
Felix 2020-02-09 14:31:09 +01:00
parent b750cf3cd1
commit 9bfc237335
6 changed files with 252 additions and 84 deletions

1
.dockerignore Normal file
View file

@ -0,0 +1 @@
node_modules

17
Dockerfile Normal file
View file

@ -0,0 +1,17 @@
FROM node:10-buster-slim as build-stage
WORKDIR /app
COPY package.json .
RUN yarn install --pure-lockfile \
&& yarn cache clean
COPY . .
RUN yarn run build
FROM nginx as production-stage
RUN mkdir /app
COPY --from=build-stage /app/dist /app
COPY nginx.conf /etc/nginx/nginx.conf

View file

@ -10,8 +10,8 @@ $ npm run serve
## Build for production ## Build for production
``` ```
$ yarn install --pure-lockfile # sudo docker build . -t joinpeertube
$ npm run build # docker run -it --rm -p 8080:80 --name joinpeertube joinpeertube
``` ```
## Update translations ## Update translations

View file

@ -8,27 +8,30 @@ instance_list = ['peertube.social', 'tube.tchncs.de', 'vidcommons.org', 'video.d
json_list = [] json_list = []
id = 0 id = 0
for i in instance_list: for i in instance_list:
r = requests.get('https://' + i + '/api/v1/config') config_json = requests.get('https://' + i + '/api/v1/config').json()
jsonres = r.json() about = requests.get('https://' + i + '/api/v1/config/about')
stats = requests.get('https://' + i + '/api/v1/server/stats')
about_json = about.json()
stats_json = stats.json()
data = { data = {
"id": id, "id": id,
"host": i, "host": i,
"name": jsonres['instance']['name'], "name": config_json['instance']['name'],
"shortDescription": r.json()['instance']['shortDescription'], "shortDescription": config_json['instance']['shortDescription'],
"version": jsonres['serverVersion'], "version": config_json['serverVersion'],
"signupAllowed": jsonres['signup']['allowed'], "signupAllowed": config_json['signup']['allowed'],
"userVideoQuota": jsonres['user']['videoQuota'], "userVideoQuota": config_json['user']['videoQuota'],
"categories": [], "categories": about_json['instance']['categories'],
"languages": [], "languages": about_json['instance']['languages'],
"autoBlacklistUserVideosEnabled": False, "autoBlacklistUserVideosEnabled": config_json['autoBlacklist']['videos']['ofUsers']['enabled'],
"defaultNSFWPolicy": jsonres['instance']['defaultNSFWPolicy'], "defaultNSFWPolicy": config_json['instance']['defaultNSFWPolicy'],
"isNSFW": jsonres['instance']['isNSFW'], "isNSFW": config_json['instance']['isNSFW'],
"totalUsers": None, "totalUsers": stats_json['totalUsers'],
"totalVideos": None, "totalVideos": stats_json['totalVideos'],
"totalLocalVideos": None, "totalLocalVideos": stats_json['totalLocalVideos'],
"totalInstanceFollowers": None, "totalInstanceFollowers": stats_json['totalInstanceFollowers'],
"totalInstanceFollowing": None, "totalInstanceFollowing": stats_json['totalInstanceFollowing'],
"health": None, "health": None,
"createdAt": None "createdAt": None
} }

31
nginx.conf Normal file
View file

@ -0,0 +1,31 @@
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name localhost;
location / {
root /app;
index index.html;
try_files $uri $uri/ /index.html;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
}

View file

@ -1,7 +1,8 @@
{ {
"total": 3, "total": 6,
"data": [{ "data": [
"id": -1, {
"id": 0,
"host": "peertube.social", "host": "peertube.social",
"name": "Peertube.social", "name": "Peertube.social",
"shortDescription": "Peertube instance for leftist and non-commercial content. Unlimited uploads (up to 500 MB per day)", "shortDescription": "Peertube instance for leftist and non-commercial content. Unlimited uploads (up to 500 MB per day)",
@ -9,57 +10,172 @@
"signupAllowed": false, "signupAllowed": false,
"userVideoQuota": -1, "userVideoQuota": -1,
"categories": [], "categories": [],
"languages": [], "languages": [
"autoBlacklistUserVideosEnabled": false, "es",
"de",
"en",
"sv",
"da",
"no",
"eo"
],
"autoBlacklistUserVideosEnabled": true,
"defaultNSFWPolicy": "do_not_list", "defaultNSFWPolicy": "do_not_list",
"isNSFW": false, "isNSFW": false,
"totalUsers": null, "totalUsers": 1977,
"totalVideos": null, "totalVideos": 96066,
"totalLocalVideos": null, "totalLocalVideos": 4686,
"totalInstanceFollowers": null, "totalInstanceFollowers": 75,
"totalInstanceFollowing": null, "totalInstanceFollowing": 307,
"health": null, "health": null,
"createdAt": null "createdAt": null
}, },
{ {
"id": -1, "id": 1,
"host": "tube.tchncs.de", "host": "tube.tchncs.de",
"name": "tchncs", "name": "tchncs",
"shortDescription": "PeerTube instance for your unique Vlogs and what not. 😉", "shortDescription": "PeerTube instance for your unique Vlogs and what not. \ud83d\ude09",
"version": "2.0.0", "version": "2.0.0",
"signupAllowed": false, "signupAllowed": false,
"userVideoQuota": -1, "userVideoQuota": -1,
"categories": [], "categories": [
"languages": [], 10,
"autoBlacklistUserVideosEnabled": false, 15,
"defaultNSFWPolicy": "do_not_list", 8,
12,
14,
13,
4,
11
],
"languages": [
"en",
"de"
],
"autoBlacklistUserVideosEnabled": true,
"defaultNSFWPolicy": "blur",
"isNSFW": false, "isNSFW": false,
"totalUsers": null, "totalUsers": 230,
"totalVideos": null, "totalVideos": 4129,
"totalLocalVideos": null, "totalLocalVideos": 573,
"totalInstanceFollowers": null, "totalInstanceFollowers": 84,
"totalInstanceFollowing": null, "totalInstanceFollowing": 6,
"health": null, "health": null,
"createdAt": null "createdAt": null
}, },
{ {
"id": -1, "id": 2,
"host": "vidcommons.org", "host": "vidcommons.org",
"name": "The VidCommons Project", "name": "The VidCommons Project",
"shortDescription": "A PeerTube instance dedicated to media licensed under the Creative Commons and Public Domain.", "shortDescription": "A PeerTube instance dedicated to media licensed under the Creative Commons and Public Domain.",
"version": "2.0.0", "version": "2.0.0",
"signupAllowed": false, "signupAllowed": false,
"userVideoQuota": -1, "userVideoQuota": -1,
"categories": [], "categories": [
"languages": [], 13,
10,
2,
9,
15
],
"languages": [
"en"
],
"autoBlacklistUserVideosEnabled": false, "autoBlacklistUserVideosEnabled": false,
"defaultNSFWPolicy": "do_not_list", "defaultNSFWPolicy": "display",
"isNSFW": false, "isNSFW": false,
"totalUsers": null, "totalUsers": 7,
"totalVideos": null, "totalVideos": 260,
"totalLocalVideos": null, "totalLocalVideos": 140,
"totalInstanceFollowers": null, "totalInstanceFollowers": 88,
"totalInstanceFollowing": null, "totalInstanceFollowing": 0,
"health": null,
"createdAt": null
},
{
"id": 3,
"host": "video.deadsuperhero.com",
"name": "DeadSuperHero Video",
"shortDescription": "A federated PeerTube instance of all of Sean Tilley's video projects.",
"version": "2.0.0",
"signupAllowed": false,
"userVideoQuota": -1,
"categories": [
8,
10
],
"languages": [
"en"
],
"autoBlacklistUserVideosEnabled": false,
"defaultNSFWPolicy": "display",
"isNSFW": false,
"totalUsers": 4,
"totalVideos": 66880,
"totalLocalVideos": 39,
"totalInstanceFollowers": 134,
"totalInstanceFollowing": 61,
"health": null,
"createdAt": null
},
{
"id": 4,
"host": "diode.zone",
"name": "Diode Zone",
"shortDescription": "Diode Zone is a friendly place for original content with a focus on creativity and electronics!",
"version": "2.0.0",
"signupAllowed": true,
"userVideoQuota": -1,
"categories": [
15,
12,
8,
16
],
"languages": [
"en"
],
"autoBlacklistUserVideosEnabled": false,
"defaultNSFWPolicy": "blur",
"isNSFW": false,
"totalUsers": 342,
"totalVideos": 4435,
"totalLocalVideos": 1146,
"totalInstanceFollowers": 89,
"totalInstanceFollowing": 6,
"health": null,
"createdAt": null
},
{
"id": 5,
"host": "share.tube",
"name": "ShareTUBE [a PeerTube Fediverse Server]",
"shortDescription": "A peertube instance advocating for sharing Creative Commons videos utilizing open source platforms. Share \u2014 thru Creative Commons & the nature of federation that automatically shares to other servers for tube enjoyment & inspiration.",
"version": "2.0.0",
"signupAllowed": false,
"userVideoQuota": 0,
"categories": [
4,
7,
15,
10,
13,
12,
1,
11,
8
],
"languages": [
"en"
],
"autoBlacklistUserVideosEnabled": false,
"defaultNSFWPolicy": "blur",
"isNSFW": false,
"totalUsers": 60,
"totalVideos": 4062,
"totalLocalVideos": 615,
"totalInstanceFollowers": 111,
"totalInstanceFollowing": 6,
"health": null, "health": null,
"createdAt": null "createdAt": null
} }