Merge pull request #258068 from Izorkin/update-peertube

peertube: 5.1.0 -> 5.2.1

authored by Robert Hensing and committed by GitHub 29697af6 0a040b6f

+65 -74
+61 -70
nixos/modules/services/web-apps/peertube.nix
··· 352 352 }; 353 353 storage = { 354 354 tmp = lib.mkDefault "/var/lib/peertube/storage/tmp/"; 355 + tmp_persistent = lib.mkDefault "/var/lib/peertube/storage/tmp_persistent/"; 355 356 bin = lib.mkDefault "/var/lib/peertube/storage/bin/"; 356 357 avatars = lib.mkDefault "/var/lib/peertube/storage/avatars/"; 357 358 videos = lib.mkDefault "/var/lib/peertube/storage/videos/"; ··· 521 522 ''; 522 523 }; 523 524 525 + locations."~ ^/api/v1/runners/jobs/[^/]+/(update|success)$" = { 526 + tryFiles = "/dev/null @api"; 527 + root = cfg.settings.storage.tmp; 528 + priority = 1135; 529 + 530 + extraConfig = '' 531 + client_max_body_size 12G; 532 + add_header X-File-Maximum-Size 8G always; 533 + '' + lib.optionalString cfg.enableWebHttps '' 534 + add_header Strict-Transport-Security 'max-age=63072000; includeSubDomains'; 535 + '' + lib.optionalString config.services.nginx.virtualHosts.${cfg.localDomain}.http3 '' 536 + add_header Alt-Svc 'h3=":443"; ma=86400'; 537 + ''; 538 + }; 539 + 524 540 locations."~ ^/api/v1/(videos|video-playlists|video-channels|users/me)" = { 525 541 tryFiles = "/dev/null @api"; 526 542 priority = 1140; ··· 607 623 ''; 608 624 }; 609 625 610 - locations."^~ /lazy-static/avatars/" = { 611 - tryFiles = "$uri @api"; 612 - root = cfg.settings.storage.avatars; 613 - priority = 1330; 626 + locations."^~ /download/" = { 627 + proxyPass = "http://127.0.0.1:${toString cfg.listenHttp}"; 628 + priority = 1410; 614 629 extraConfig = '' 615 - if ($request_method = 'OPTIONS') { 616 - ${nginxCommonHeaders} 617 - add_header Access-Control-Max-Age 1728000; 618 - add_header Cache-Control 'no-cache'; 619 - add_header Content-Type 'text/plain charset=UTF-8'; 620 - add_header Content-Length 0; 621 - return 204; 622 - } 630 + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 631 + proxy_set_header Host $host; 632 + proxy_set_header X-Real-IP $remote_addr; 623 633 624 - ${nginxCommonHeaders} 625 - add_header Cache-Control 'public, max-age=7200'; 626 - 627 - rewrite ^/lazy-static/avatars/(.*)$ /$1 break; 634 + proxy_limit_rate 5M; 628 635 ''; 629 636 }; 630 637 631 - locations."^~ /lazy-static/banners/" = { 632 - tryFiles = "$uri @api"; 633 - root = cfg.settings.storage.avatars; 634 - priority = 1340; 638 + locations."^~ /static/streaming-playlists/private/" = { 639 + proxyPass = "http://127.0.0.1:${toString cfg.listenHttp}"; 640 + priority = 1420; 635 641 extraConfig = '' 636 - if ($request_method = 'OPTIONS') { 637 - ${nginxCommonHeaders} 638 - add_header Access-Control-Max-Age 1728000; 639 - add_header Cache-Control 'no-cache'; 640 - add_header Content-Type 'text/plain charset=UTF-8'; 641 - add_header Content-Length 0; 642 - return 204; 643 - } 644 - 645 - ${nginxCommonHeaders} 646 - add_header Cache-Control 'public, max-age=7200'; 642 + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 643 + proxy_set_header Host $host; 644 + proxy_set_header X-Real-IP $remote_addr; 647 645 648 - rewrite ^/lazy-static/banners/(.*)$ /$1 break; 646 + proxy_limit_rate 5M; 649 647 ''; 650 648 }; 651 649 652 - locations."^~ /lazy-static/previews/" = { 653 - tryFiles = "$uri @api"; 654 - root = cfg.settings.storage.previews; 655 - priority = 1350; 656 - extraConfig = '' 657 - if ($request_method = 'OPTIONS') { 658 - ${nginxCommonHeaders} 659 - add_header Access-Control-Max-Age 1728000; 660 - add_header Cache-Control 'no-cache'; 661 - add_header Content-Type 'text/plain charset=UTF-8'; 662 - add_header Content-Length 0; 663 - return 204; 664 - } 665 - 666 - ${nginxCommonHeaders} 667 - add_header Cache-Control 'public, max-age=7200'; 668 - 669 - rewrite ^/lazy-static/previews/(.*)$ /$1 break; 670 - ''; 671 - }; 672 - 673 - locations."^~ /static/streaming-playlists/private/" = { 650 + locations."^~ /static/web-videos/private/" = { 674 651 proxyPass = "http://127.0.0.1:${toString cfg.listenHttp}"; 675 - priority = 1410; 652 + priority = 1430; 676 653 extraConfig = '' 677 654 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 678 655 proxy_set_header Host $host; ··· 684 661 685 662 locations."^~ /static/webseed/private/" = { 686 663 proxyPass = "http://127.0.0.1:${toString cfg.listenHttp}"; 687 - priority = 1420; 664 + priority = 1440; 688 665 extraConfig = '' 689 666 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 690 667 proxy_set_header Host $host; ··· 694 671 ''; 695 672 }; 696 673 697 - locations."^~ /static/thumbnails/" = { 674 + locations."^~ /static/redundancy/" = { 698 675 tryFiles = "$uri @api"; 699 - root = cfg.settings.storage.thumbnails; 700 - priority = 1430; 676 + root = cfg.settings.storage.redundancy; 677 + priority = 1450; 701 678 extraConfig = '' 679 + set $peertube_limit_rate 800k; 680 + 681 + if ($request_uri ~ -fragmented.mp4$) { 682 + set $peertube_limit_rate 5M; 683 + } 684 + 702 685 if ($request_method = 'OPTIONS') { 703 686 ${nginxCommonHeaders} 704 687 add_header Access-Control-Max-Age 1728000; 705 - add_header Cache-Control 'no-cache'; 706 688 add_header Content-Type 'text/plain charset=UTF-8'; 707 689 add_header Content-Length 0; 708 690 return 204; 709 691 } 692 + if ($request_method = 'GET') { 693 + ${nginxCommonHeaders} 710 694 711 - ${nginxCommonHeaders} 712 - add_header Cache-Control 'public, max-age=7200'; 695 + access_log off; 696 + } 713 697 714 - rewrite ^/static/thumbnails/(.*)$ /$1 break; 698 + aio threads; 699 + sendfile on; 700 + sendfile_max_chunk 1M; 701 + 702 + limit_rate $peertube_limit_rate; 703 + limit_rate_after 5M; 704 + 705 + rewrite ^/static/redundancy/(.*)$ /$1 break; 715 706 ''; 716 707 }; 717 708 718 - locations."^~ /static/redundancy/" = { 709 + locations."^~ /static/streaming-playlists/" = { 719 710 tryFiles = "$uri @api"; 720 - root = cfg.settings.storage.redundancy; 721 - priority = 1440; 711 + root = cfg.settings.storage.streaming_playlists; 712 + priority = 1460; 722 713 extraConfig = '' 723 714 set $peertube_limit_rate 800k; 724 715 ··· 746 737 limit_rate $peertube_limit_rate; 747 738 limit_rate_after 5M; 748 739 749 - rewrite ^/static/redundancy/(.*)$ /$1 break; 740 + rewrite ^/static/streaming-playlists/(.*)$ /$1 break; 750 741 ''; 751 742 }; 752 743 753 - locations."^~ /static/streaming-playlists/" = { 744 + locations."^~ /static/web-videos/" = { 754 745 tryFiles = "$uri @api"; 755 746 root = cfg.settings.storage.streaming_playlists; 756 - priority = 1450; 747 + priority = 1470; 757 748 extraConfig = '' 758 749 set $peertube_limit_rate 800k; 759 750 ··· 788 779 locations."^~ /static/webseed/" = { 789 780 tryFiles = "$uri @api"; 790 781 root = cfg.settings.storage.videos; 791 - priority = 1460; 782 + priority = 1480; 792 783 extraConfig = '' 793 784 set $peertube_limit_rate 800k; 794 785
+4 -4
pkgs/servers/peertube/default.nix
··· 45 45 in 46 46 stdenv.mkDerivation rec { 47 47 pname = "peertube"; 48 - version = "5.1.0"; 48 + version = "5.2.1"; 49 49 50 50 src = fetchFromGitHub { 51 51 owner = "Chocobozzz"; 52 52 repo = "PeerTube"; 53 53 rev = "v${version}"; 54 - hash = "sha256-C9mBF+QymGXyBB3IFX6MNgsZpHk739qv1/DLuvzrTaU="; 54 + hash = "sha256-8JzU0JVb+JQCNiro8hPHBwkofNTUy90YkSCzTOoB+/A="; 55 55 }; 56 56 57 57 yarnOfflineCacheServer = fetchYarnDeps { 58 58 yarnLock = "${src}/yarn.lock"; 59 - hash = "sha256-W+pX2XO27j6qAVxvo+Xf1h7g3V0LUMtwNf+meZmkgwE="; 59 + hash = "sha256-pzXH6hdDf8O6Kr12Xw0jRcnPRD2TrDGdiEfxVr3KmwY="; 60 60 }; 61 61 62 62 yarnOfflineCacheTools = fetchYarnDeps { ··· 66 66 67 67 yarnOfflineCacheClient = fetchYarnDeps { 68 68 yarnLock = "${src}/client/yarn.lock"; 69 - hash = "sha256-TAv8QAAfT3q28jUo26h0uCGsoqBzAn8lybIaqNAApU8="; 69 + hash = "sha256-Ejzk/VEx7YtJpsrkHcXAZnJ+yRx1VhBJGpqquHYULNU="; 70 70 }; 71 71 72 72 nativeBuildInputs = [ brotli fixup_yarn_lock jq nodejs which yarn ];