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,67 +1,183 @@
{ {
"total": 3, "total": 6,
"data": [{ "data": [
"id": -1, {
"host": "peertube.social", "id": 0,
"name": "Peertube.social", "host": "peertube.social",
"shortDescription": "Peertube instance for leftist and non-commercial content. Unlimited uploads (up to 500 MB per day)", "name": "Peertube.social",
"version": "2.0.0", "shortDescription": "Peertube instance for leftist and non-commercial content. Unlimited uploads (up to 500 MB per day)",
"signupAllowed": false, "version": "2.0.0",
"userVideoQuota": -1, "signupAllowed": false,
"categories": [], "userVideoQuota": -1,
"languages": [], "categories": [],
"autoBlacklistUserVideosEnabled": false, "languages": [
"defaultNSFWPolicy": "do_not_list", "es",
"isNSFW": false, "de",
"totalUsers": null, "en",
"totalVideos": null, "sv",
"totalLocalVideos": null, "da",
"totalInstanceFollowers": null, "no",
"totalInstanceFollowing": null, "eo"
"health": null, ],
"createdAt": null "autoBlacklistUserVideosEnabled": true,
}, "defaultNSFWPolicy": "do_not_list",
{ "isNSFW": false,
"id": -1, "totalUsers": 1977,
"host": "tube.tchncs.de", "totalVideos": 96066,
"name": "tchncs", "totalLocalVideos": 4686,
"shortDescription": "PeerTube instance for your unique Vlogs and what not. 😉", "totalInstanceFollowers": 75,
"version": "2.0.0", "totalInstanceFollowing": 307,
"signupAllowed": false, "health": null,
"userVideoQuota": -1, "createdAt": null
"categories": [], },
"languages": [], {
"autoBlacklistUserVideosEnabled": false, "id": 1,
"defaultNSFWPolicy": "do_not_list", "host": "tube.tchncs.de",
"isNSFW": false, "name": "tchncs",
"totalUsers": null, "shortDescription": "PeerTube instance for your unique Vlogs and what not. \ud83d\ude09",
"totalVideos": null, "version": "2.0.0",
"totalLocalVideos": null, "signupAllowed": false,
"totalInstanceFollowers": null, "userVideoQuota": -1,
"totalInstanceFollowing": null, "categories": [
"health": null, 10,
"createdAt": null 15,
}, 8,
{ 12,
"id": -1, 14,
"host": "vidcommons.org", 13,
"name": "The VidCommons Project", 4,
"shortDescription": "A PeerTube instance dedicated to media licensed under the Creative Commons and Public Domain.", 11
"version": "2.0.0", ],
"signupAllowed": false, "languages": [
"userVideoQuota": -1, "en",
"categories": [], "de"
"languages": [], ],
"autoBlacklistUserVideosEnabled": false, "autoBlacklistUserVideosEnabled": true,
"defaultNSFWPolicy": "do_not_list", "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": 2,
"host": "vidcommons.org",
"name": "The VidCommons Project",
"shortDescription": "A PeerTube instance dedicated to media licensed under the Creative Commons and Public Domain.",
"version": "2.0.0",
"signupAllowed": false,
"userVideoQuota": -1,
"categories": [
13,
10,
2,
9,
15
],
"languages": [
"en"
],
"autoBlacklistUserVideosEnabled": false,
"defaultNSFWPolicy": "display",
"isNSFW": false,
"totalUsers": 7,
"totalVideos": 260,
"totalLocalVideos": 140,
"totalInstanceFollowers": 88,
"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,
"createdAt": null
}
]
} }