From a18dfbf5e30b3a579d5cbe21d27438f5f728bed6 Mon Sep 17 00:00:00 2001 From: 3JlOy_PYCCKUI <3jl0y_pycckui@riseup.net> Date: Tue, 17 Oct 2023 02:27:26 +0300 Subject: [PATCH] torrentstream: init at 1.0.1.6 --- ...lay-the-message-of-caught-exceptions.patch | 37 +++++++++++++++ pkgs/by-name/to/torrentstream/deps.nix | 39 ++++++++++++++++ pkgs/by-name/to/torrentstream/package.nix | 46 +++++++++++++++++++ 3 files changed, 122 insertions(+) create mode 100644 pkgs/by-name/to/torrentstream/0001-display-the-message-of-caught-exceptions.patch create mode 100644 pkgs/by-name/to/torrentstream/deps.nix create mode 100644 pkgs/by-name/to/torrentstream/package.nix diff --git a/pkgs/by-name/to/torrentstream/0001-display-the-message-of-caught-exceptions.patch b/pkgs/by-name/to/torrentstream/0001-display-the-message-of-caught-exceptions.patch new file mode 100644 index 000000000000..3e21bb0530bd --- /dev/null +++ b/pkgs/by-name/to/torrentstream/0001-display-the-message-of-caught-exceptions.patch @@ -0,0 +1,37 @@ +diff --git a/Program.cs b/Program.cs +index 5697d79..7cfba20 100644 +--- a/Program.cs ++++ b/Program.cs +@@ -79,6 +79,8 @@ app.MapGet ( "/proxyvideolist", ProxyHandler.ProxyVideolist ); + app.MapGet ( "/proxyvideopart", ProxyHandler.ProxyVideoPart ); + app.MapGet ( "/playerws", ExternalPlayer.ExternalWebSocket ); + ++Console.WriteLine ($"BaseFolder: {GlobalConfiguration.BaseFolder}"); ++ + await TorrentHandler.LoadState (); + + app.Run (); +diff --git a/StreamHandler.cs b/StreamHandler.cs +index 43aa61c..7d26681 100644 +--- a/StreamHandler.cs ++++ b/StreamHandler.cs +@@ -110,7 +110,8 @@ namespace TorrentStream { + context.Response.StatusCode = 302; + context.Response.Headers.Location = ( RuntimeInformation.IsOSPlatform ( OSPlatform.Windows ) ? "file:///" : "file://" ) + currentFile.FullPath; + } +- } catch { ++ } catch (Exception e) { ++ Console.WriteLine($"Exception caught: {e.Message}"); + context.Response.StatusCode = 500; + } + } +@@ -192,7 +193,8 @@ namespace TorrentStream { + } + context.Response.StatusCode = 200; + await context.Response.WriteAsync ( "Downloading started" ); +- } catch { ++ } catch (Exception e) { ++ Console.WriteLine($"Exception caught: {e.Message}"); + context.Response.StatusCode = 500; + } + } diff --git a/pkgs/by-name/to/torrentstream/deps.nix b/pkgs/by-name/to/torrentstream/deps.nix new file mode 100644 index 000000000000..048d85c10a62 --- /dev/null +++ b/pkgs/by-name/to/torrentstream/deps.nix @@ -0,0 +1,39 @@ +# This file was automatically generated by passthru.fetch-deps. +# Please dont edit it manually, your changes might get overwritten! + +{ fetchNuGet }: [ + (fetchNuGet { pname = "Microsoft.Extensions.Configuration"; version = "7.0.0"; sha256 = "0n1grglxql9llmrsbbnlz5chx8mxrb5cpvjngm0hfyrkgzcwz90d"; }) + (fetchNuGet { pname = "Microsoft.Extensions.Configuration.Abstractions"; version = "7.0.0"; sha256 = "1as8cygz0pagg17w22nsf6mb49lr2mcl1x8i3ad1wi8lyzygy1a3"; }) + (fetchNuGet { pname = "Microsoft.Extensions.Configuration.Binder"; version = "7.0.0"; sha256 = "1qifb1pv7s76lih8wnjk418wdk4qwn87q2n6dx54knfvxai410bl"; }) + (fetchNuGet { pname = "Microsoft.Extensions.Configuration.CommandLine"; version = "7.0.0"; sha256 = "1pmgjrvwdzqrxjb24cg3fd624r64lgywbqc9symd5hyl4175pwk8"; }) + (fetchNuGet { pname = "Microsoft.Extensions.Configuration.EnvironmentVariables"; version = "7.0.0"; sha256 = "0nhh7rnh45s39x8sjn88czg7nyfpry85pkm0g619j8b468zj8nb4"; }) + (fetchNuGet { pname = "Microsoft.Extensions.Configuration.FileExtensions"; version = "7.0.0"; sha256 = "1fk7dcz6gfhd1k1d8ksz22rnjvj1waqjzk29ym4i3dz73rsq8j1i"; }) + (fetchNuGet { pname = "Microsoft.Extensions.Configuration.Json"; version = "7.0.0"; sha256 = "05zjmrpp99l128wijp1fy8asskc11ls871qaqr4mjnz3gbfycxnj"; }) + (fetchNuGet { pname = "Microsoft.Extensions.Configuration.UserSecrets"; version = "7.0.0"; sha256 = "0ks7lcyvfvr3ar36f5gp89bnnblxzic5vawppfcrvhw1ivas4mp1"; }) + (fetchNuGet { pname = "Microsoft.Extensions.DependencyInjection"; version = "7.0.0"; sha256 = "121zs4jp8iimgbpzm3wsglhjwkc06irg1pxy8c1zcdlsg34cfq1p"; }) + (fetchNuGet { pname = "Microsoft.Extensions.DependencyInjection.Abstractions"; version = "7.0.0"; sha256 = "181d7mp9307fs17lyy42f8cxnjwysddmpsalky4m0pqxcimnr6g7"; }) + (fetchNuGet { pname = "Microsoft.Extensions.FileProviders.Abstractions"; version = "7.0.0"; sha256 = "0ff20yklyjgyjzdyv7sybczgqhgd557m05dbwxzjznr0x41b180d"; }) + (fetchNuGet { pname = "Microsoft.Extensions.FileProviders.Physical"; version = "7.0.0"; sha256 = "1f1h0l47abw0spssd64qkhgd7b54pyzslyb586zp21milimcfmgv"; }) + (fetchNuGet { pname = "Microsoft.Extensions.FileSystemGlobbing"; version = "7.0.0"; sha256 = "1812vnkn8n0i4yr3k5azcxcfx1bbpcsmms95rdyxjfrzfksr05ai"; }) + (fetchNuGet { pname = "Microsoft.Extensions.Hosting"; version = "7.0.0"; sha256 = "0wx50kswqv8jw1vr8sma1hf1mm3wkwsnml0hzzlilvak9ql7cr3n"; }) + (fetchNuGet { pname = "Microsoft.Extensions.Hosting.Abstractions"; version = "7.0.0"; sha256 = "1h5szfsr1dalsvdj9c18y6362853chisfns0hfpsq44hz0pr8j9q"; }) + (fetchNuGet { pname = "Microsoft.Extensions.Hosting.Systemd"; version = "7.0.0"; sha256 = "07cr2lzmlczmz1f9sjv1i9sfqwinkcmkq1q0kkscnh9bqa85aaqd"; }) + (fetchNuGet { pname = "Microsoft.Extensions.Hosting.WindowsServices"; version = "7.0.0"; sha256 = "1cvc24ma18vi2hb3kwkb9k7hfx5v8lcfdvy9n8bc12d5nhmh9zcc"; }) + (fetchNuGet { pname = "Microsoft.Extensions.Logging"; version = "7.0.0"; sha256 = "1bqd3pqn5dacgnkq0grc17cgb2i0w8z1raw12nwm3p3zhrfcvgxf"; }) + (fetchNuGet { pname = "Microsoft.Extensions.Logging.Abstractions"; version = "7.0.0"; sha256 = "1gn7d18i1wfy13vrwhmdv1rmsb4vrk26kqdld4cgvh77yigj90xs"; }) + (fetchNuGet { pname = "Microsoft.Extensions.Logging.Configuration"; version = "7.0.0"; sha256 = "1f5fhpvzwyrwxh3g1ry027s4skmklf6mbm2w0p13h0x6fbmxcb24"; }) + (fetchNuGet { pname = "Microsoft.Extensions.Logging.Console"; version = "7.0.0"; sha256 = "1m8ri2m3vlv9vzk0068jkrx0vkk4sqmk1kxmn8pc3wys38d38qaf"; }) + (fetchNuGet { pname = "Microsoft.Extensions.Logging.Debug"; version = "7.0.0"; sha256 = "14p7hrhdd58fxdhjbyjwmlzr00vs03bmns3sf2f6alsgpvbf2h1i"; }) + (fetchNuGet { pname = "Microsoft.Extensions.Logging.EventLog"; version = "7.0.0"; sha256 = "0q1cgi456shngxs70ar0ibshpm5qk8whw369jrl6xdxnf1vxkkq8"; }) + (fetchNuGet { pname = "Microsoft.Extensions.Logging.EventSource"; version = "7.0.0"; sha256 = "11rskmrijf6xv78slm38zywj6l3wjlm017kijhan1kfg56f1kvdk"; }) + (fetchNuGet { pname = "Microsoft.Extensions.Options"; version = "7.0.0"; sha256 = "0b90zkrsk5dw3wr749rbynhpxlg4bgqdnd7d5vdlw2g9c7zlhgx6"; }) + (fetchNuGet { pname = "Microsoft.Extensions.Options.ConfigurationExtensions"; version = "7.0.0"; sha256 = "1liyprh0zha2vgmqh92n8kkjz61zwhr7g16f0gmr297z2rg1j5pj"; }) + (fetchNuGet { pname = "Microsoft.Extensions.Primitives"; version = "7.0.0"; sha256 = "1b4km9fszid9vp2zb3gya5ni9fn8bq62bzaas2ck2r7gs0sdys80"; }) + (fetchNuGet { pname = "Mono.Nat"; version = "3.0.0"; sha256 = "17lyjcpwp5j2dwx0gi975x710r7kqkx50c1wmyzwdyqhar3kszi8"; }) + (fetchNuGet { pname = "MonoTorrent"; version = "3.0.0-beta.rev0106"; sha256 = "0zz64nnb02d4pjpffs9x26jvbalm48yaghbgj3vc7j8ff0sm8xr4"; }) + (fetchNuGet { pname = "ReusableTasks"; version = "2.0.2"; sha256 = "0dkyirzspp8spmgd3ad9mak5jhqfmib6m437r2bmmyb3m4mxp5rb"; }) + (fetchNuGet { pname = "System.Diagnostics.EventLog"; version = "7.0.0"; sha256 = "16p8z975dnzmncfifa9gw9n3k9ycpr2qvz7lglpghsvx0fava8k9"; }) + (fetchNuGet { pname = "System.ServiceProcess.ServiceController"; version = "7.0.0"; sha256 = "0xgg9y06j6ch3h65lyrpnghb7iaf9g97w1kg5sz0ji6ikfiqlkxz"; }) + (fetchNuGet { pname = "System.Text.Encodings.Web"; version = "7.0.0"; sha256 = "1151hbyrcf8kyg1jz8k9awpbic98lwz9x129rg7zk1wrs6vjlpxl"; }) + (fetchNuGet { pname = "System.Text.Json"; version = "7.0.0"; sha256 = "0scb0lp7wbgcinaa4kqiqs7b8i5nx4ppfad81138jiwd1sl37pyp"; }) +] diff --git a/pkgs/by-name/to/torrentstream/package.nix b/pkgs/by-name/to/torrentstream/package.nix new file mode 100644 index 000000000000..44a92c7d850a --- /dev/null +++ b/pkgs/by-name/to/torrentstream/package.nix @@ -0,0 +1,46 @@ +{ lib +, buildDotnetModule +, fetchFromGitHub +, dotnetCorePackages +, fetchpatch +}: + +buildDotnetModule rec { + pname = "torrentstream"; + version = "1.0.1.6"; + + src = fetchFromGitHub { + owner = "trueromanus"; + repo = "TorrentStream"; + rev = version; + hash = "sha256-41zlzrQ+YGY2wEvq4Su/lp6lOmGW4u0F37ub2a3z+7o="; + }; + + sourceRoot = "source/src"; + + projectFile = "TorrentStream.sln"; + nugetDeps = ./deps.nix; + dotnet-sdk = dotnetCorePackages.sdk_7_0; + dotnet-runtime = dotnetCorePackages.aspnetcore_7_0; + executables = [ "TorrentStream" ]; + + patches = [ + (fetchpatch { + name = "allow-setting-listen-address.patch"; + url = "https://github.com/trueromanus/TorrentStream/compare/1.0.1.6..6900b6f33f2b4b94888a8a1355029a81767e66a4.patch"; + hash = "sha256-jOUs5SO2BnNnkz3wJ710Z4stVlhZ8nKqpmHr4BNlGs0="; + stripLen = 1; + excludes = [ "README.md" ]; + }) + ./0001-display-the-message-of-caught-exceptions.patch + ]; + + meta = { + homepage = "https://github.com/trueromanus/TorrentStream"; + description = "Simple web server for streaming torrent files in video players"; + license = lib.licenses.bsd2; + platforms = lib.platforms.all; + mainProgram = "TorrentStream"; + maintainers = with lib.maintainers; [ _3JlOy-PYCCKUi ]; + }; +}