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
```
$ yarn install --pure-lockfile
$ npm run build
# sudo docker build . -t joinpeertube
# docker run -it --rm -p 8080:80 --name joinpeertube joinpeertube
```
## Update translations

View file

@ -8,27 +8,30 @@ instance_list = ['peertube.social', 'tube.tchncs.de', 'vidcommons.org', 'video.d
json_list = []
id = 0
for i in instance_list:
r = requests.get('https://' + i + '/api/v1/config')
jsonres = r.json()
config_json = requests.get('https://' + i + '/api/v1/config').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 = {
"id": id,
"host": i,
"name": jsonres['instance']['name'],
"shortDescription": r.json()['instance']['shortDescription'],
"version": jsonres['serverVersion'],
"signupAllowed": jsonres['signup']['allowed'],
"userVideoQuota": jsonres['user']['videoQuota'],
"categories": [],
"languages": [],
"autoBlacklistUserVideosEnabled": False,
"defaultNSFWPolicy": jsonres['instance']['defaultNSFWPolicy'],
"isNSFW": jsonres['instance']['isNSFW'],
"totalUsers": None,
"totalVideos": None,
"totalLocalVideos": None,
"totalInstanceFollowers": None,
"totalInstanceFollowing": None,
"name": config_json['instance']['name'],
"shortDescription": config_json['instance']['shortDescription'],
"version": config_json['serverVersion'],
"signupAllowed": config_json['signup']['allowed'],
"userVideoQuota": config_json['user']['videoQuota'],
"categories": about_json['instance']['categories'],
"languages": about_json['instance']['languages'],
"autoBlacklistUserVideosEnabled": config_json['autoBlacklist']['videos']['ofUsers']['enabled'],
"defaultNSFWPolicy": config_json['instance']['defaultNSFWPolicy'],
"isNSFW": config_json['instance']['isNSFW'],
"totalUsers": stats_json['totalUsers'],
"totalVideos": stats_json['totalVideos'],
"totalLocalVideos": stats_json['totalLocalVideos'],
"totalInstanceFollowers": stats_json['totalInstanceFollowers'],
"totalInstanceFollowing": stats_json['totalInstanceFollowing'],
"health": 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,
"data": [{
"id": -1,
"host": "peertube.social",
"name": "Peertube.social",
"shortDescription": "Peertube instance for leftist and non-commercial content. Unlimited uploads (up to 500 MB per day)",
"version": "2.0.0",
"signupAllowed": false,
"userVideoQuota": -1,
"categories": [],
"languages": [],
"autoBlacklistUserVideosEnabled": false,
"defaultNSFWPolicy": "do_not_list",
"isNSFW": false,
"totalUsers": null,
"totalVideos": null,
"totalLocalVideos": null,
"totalInstanceFollowers": null,
"totalInstanceFollowing": null,
"health": null,
"createdAt": null
},
{
"id": -1,
"host": "tube.tchncs.de",
"name": "tchncs",
"shortDescription": "PeerTube instance for your unique Vlogs and what not. 😉",
"version": "2.0.0",
"signupAllowed": false,
"userVideoQuota": -1,
"categories": [],
"languages": [],
"autoBlacklistUserVideosEnabled": false,
"defaultNSFWPolicy": "do_not_list",
"isNSFW": false,
"totalUsers": null,
"totalVideos": null,
"totalLocalVideos": null,
"totalInstanceFollowers": null,
"totalInstanceFollowing": null,
"health": null,
"createdAt": null
},
{
"id": -1,
"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": [],
"languages": [],
"autoBlacklistUserVideosEnabled": false,
"defaultNSFWPolicy": "do_not_list",
"isNSFW": false,
"totalUsers": null,
"totalVideos": null,
"totalLocalVideos": null,
"totalInstanceFollowers": null,
"totalInstanceFollowing": null,
"health": null,
"createdAt": null
}
]
"total": 6,
"data": [
{
"id": 0,
"host": "peertube.social",
"name": "Peertube.social",
"shortDescription": "Peertube instance for leftist and non-commercial content. Unlimited uploads (up to 500 MB per day)",
"version": "2.0.0",
"signupAllowed": false,
"userVideoQuota": -1,
"categories": [],
"languages": [
"es",
"de",
"en",
"sv",
"da",
"no",
"eo"
],
"autoBlacklistUserVideosEnabled": true,
"defaultNSFWPolicy": "do_not_list",
"isNSFW": false,
"totalUsers": 1977,
"totalVideos": 96066,
"totalLocalVideos": 4686,
"totalInstanceFollowers": 75,
"totalInstanceFollowing": 307,
"health": null,
"createdAt": null
},
{
"id": 1,
"host": "tube.tchncs.de",
"name": "tchncs",
"shortDescription": "PeerTube instance for your unique Vlogs and what not. \ud83d\ude09",
"version": "2.0.0",
"signupAllowed": false,
"userVideoQuota": -1,
"categories": [
10,
15,
8,
12,
14,
13,
4,
11
],
"languages": [
"en",
"de"
],
"autoBlacklistUserVideosEnabled": true,
"defaultNSFWPolicy": "blur",
"isNSFW": false,
"totalUsers": 230,
"totalVideos": 4129,
"totalLocalVideos": 573,
"totalInstanceFollowers": 84,
"totalInstanceFollowing": 6,
"health": 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
}
]
}