From 76b8513d6bae4e3f6a7c7bb6f2e0d97138714f4d Mon Sep 17 00:00:00 2001 From: Roger Far Date: Tue, 7 Apr 2020 18:40:58 -0600 Subject: [PATCH] Fixed some issues, first release beta. --- .gitignore | 3 + client/angular-proxy.json | 2 +- client/angular.json | 2 +- client/package-lock.json | 127 +++++++++++++++--- client/package.json | 26 ++-- client/src/favicon.ico | Bin 948 -> 1150 bytes server/RdtClient.Data/Data/TorrentData.cs | 22 +-- .../Services/DownloadManager.cs | 5 +- .../RdtClient.Service/Services/QBittorrent.cs | 8 +- .../RdtClient.Service/Services/Scheduler.cs | 7 +- .../RdtClient.Web/.config/dotnet-tools.json | 12 ++ .../Controllers/QBittorrentController.cs | 13 +- server/RdtClient.Web/Program.cs | 33 +++-- .../PublishProfiles/FolderProfile.pubxml | 21 +++ .../Properties/launchSettings.json | 3 +- server/RdtClient.Web/RdtClient.Web.csproj | 1 + server/RdtClient.Web/Startup.cs | 6 - server/RdtClient.Web/appsettings.json | 3 +- server/RdtClient.Web/wwwroot/index.html | 14 +- 19 files changed, 222 insertions(+), 86 deletions(-) create mode 100644 server/RdtClient.Web/.config/dotnet-tools.json create mode 100644 server/RdtClient.Web/Properties/PublishProfiles/FolderProfile.pubxml diff --git a/.gitignore b/.gitignore index 5678a21..21c5f32 100644 --- a/.gitignore +++ b/.gitignore @@ -38,3 +38,6 @@ server/*.user # Common node modules locations server/wwwroot/ server/.vs +server/RdtClient.Web/wwwroot/ +server/RdtClient.Web/Properties/PublishProfiles/FolderProfile.pubxml.user +*.user diff --git a/client/angular-proxy.json b/client/angular-proxy.json index 009373c..9cd334e 100644 --- a/client/angular-proxy.json +++ b/client/angular-proxy.json @@ -1,6 +1,6 @@ { "/Api": { - "target": "http://localhost:4201/", + "target": "http://localhost:6500/", "secure": false } } diff --git a/client/angular.json b/client/angular.json index 92c90da..28937af 100644 --- a/client/angular.json +++ b/client/angular.json @@ -17,7 +17,7 @@ "build": { "builder": "@angular-devkit/build-angular:browser", "options": { - "outputPath": "dist/rdt-client", + "outputPath": "../server/RdtClient.Web/wwwroot", "index": "src/index.html", "main": "src/main.ts", "polyfills": "src/polyfills.ts", diff --git a/client/package-lock.json b/client/package-lock.json index 8b3e947..76db1d7 100644 --- a/client/package-lock.json +++ b/client/package-lock.json @@ -12,6 +12,17 @@ "requires": { "@angular-devkit/core": "9.1.0", "rxjs": "6.5.4" + }, + "dependencies": { + "rxjs": { + "version": "6.5.4", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.5.4.tgz", + "integrity": "sha512-naMQXcgEo3csAEGvw/NydRA0fuS2nDZJiw1YUWFKU7aPPAPGZEsD4Iimit96qwCieH6y614MCLYwdkrWx7z/7Q==", + "dev": true, + "requires": { + "tslib": "^1.9.0" + } + } } }, "@angular-devkit/build-angular": { @@ -81,6 +92,17 @@ "webpack-sources": "1.4.3", "webpack-subresource-integrity": "1.4.0", "worker-plugin": "4.0.2" + }, + "dependencies": { + "rxjs": { + "version": "6.5.4", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.5.4.tgz", + "integrity": "sha512-naMQXcgEo3csAEGvw/NydRA0fuS2nDZJiw1YUWFKU7aPPAPGZEsD4Iimit96qwCieH6y614MCLYwdkrWx7z/7Q==", + "dev": true, + "requires": { + "tslib": "^1.9.0" + } + } } }, "@angular-devkit/build-optimizer": { @@ -105,6 +127,17 @@ "@angular-devkit/architect": "0.901.0", "@angular-devkit/core": "9.1.0", "rxjs": "6.5.4" + }, + "dependencies": { + "rxjs": { + "version": "6.5.4", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.5.4.tgz", + "integrity": "sha512-naMQXcgEo3csAEGvw/NydRA0fuS2nDZJiw1YUWFKU7aPPAPGZEsD4Iimit96qwCieH6y614MCLYwdkrWx7z/7Q==", + "dev": true, + "requires": { + "tslib": "^1.9.0" + } + } } }, "@angular-devkit/core": { @@ -118,6 +151,17 @@ "magic-string": "0.25.7", "rxjs": "6.5.4", "source-map": "0.7.3" + }, + "dependencies": { + "rxjs": { + "version": "6.5.4", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.5.4.tgz", + "integrity": "sha512-naMQXcgEo3csAEGvw/NydRA0fuS2nDZJiw1YUWFKU7aPPAPGZEsD4Iimit96qwCieH6y614MCLYwdkrWx7z/7Q==", + "dev": true, + "requires": { + "tslib": "^1.9.0" + } + } } }, "@angular-devkit/schematics": { @@ -129,6 +173,17 @@ "@angular-devkit/core": "9.1.0", "ora": "4.0.3", "rxjs": "6.5.4" + }, + "dependencies": { + "rxjs": { + "version": "6.5.4", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.5.4.tgz", + "integrity": "sha512-naMQXcgEo3csAEGvw/NydRA0fuS2nDZJiw1YUWFKU7aPPAPGZEsD4Iimit96qwCieH6y614MCLYwdkrWx7z/7Q==", + "dev": true, + "requires": { + "tslib": "^1.9.0" + } + } } }, "@angular/animations": { @@ -1427,6 +1482,17 @@ "enhanced-resolve": "4.1.1", "rxjs": "6.5.4", "webpack-sources": "1.4.3" + }, + "dependencies": { + "rxjs": { + "version": "6.5.4", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.5.4.tgz", + "integrity": "sha512-naMQXcgEo3csAEGvw/NydRA0fuS2nDZJiw1YUWFKU7aPPAPGZEsD4Iimit96qwCieH6y614MCLYwdkrWx7z/7Q==", + "dev": true, + "requires": { + "tslib": "^1.9.0" + } + } } }, "@npmcli/ci-detect": { @@ -1513,6 +1579,17 @@ "rxjs": "6.5.4", "semver": "7.1.3", "semver-intersect": "1.4.0" + }, + "dependencies": { + "rxjs": { + "version": "6.5.4", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.5.4.tgz", + "integrity": "sha512-naMQXcgEo3csAEGvw/NydRA0fuS2nDZJiw1YUWFKU7aPPAPGZEsD4Iimit96qwCieH6y614MCLYwdkrWx7z/7Q==", + "dev": true, + "requires": { + "tslib": "^1.9.0" + } + } } }, "@tootallnate/once": { @@ -1566,9 +1643,9 @@ "dev": true }, "@types/node": { - "version": "12.12.34", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.34.tgz", - "integrity": "sha512-BneGN0J9ke24lBRn44hVHNeDlrXRYF+VRp0HbSUNnEZahXGAysHZIqnf/hER6aabdBgzM4YOV4jrR8gj4Zfi0g==", + "version": "13.11.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-13.11.0.tgz", + "integrity": "sha512-uM4mnmsIIPK/yeO+42F2RQhGUIs39K2RFmugcJANppXe6J1nvH87PvzPZYpza7Xhhs8Yn9yIAVdLZ84z61+0xQ==", "dev": true }, "@types/q": { @@ -6318,12 +6395,20 @@ "dev": true }, "jasmine-spec-reporter": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/jasmine-spec-reporter/-/jasmine-spec-reporter-4.2.1.tgz", - "integrity": "sha512-FZBoZu7VE5nR7Nilzy+Np8KuVIOxF4oXDPDknehCYBDE080EnlPu0afdZNmpGDBRCUBv3mj5qgqCRmk6W/K8vg==", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/jasmine-spec-reporter/-/jasmine-spec-reporter-5.0.1.tgz", + "integrity": "sha512-RrOZ+bSPnbk1/9KKs5lm0Nl0cqDCh/XXVlCmu3nkhEJH6HTDh4hoJZu3q8e9aq37C0eXEf/JEJnYy+t4m3arZQ==", "dev": true, "requires": { - "colors": "1.1.2" + "colors": "1.4.0" + }, + "dependencies": { + "colors": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/colors/-/colors-1.4.0.tgz", + "integrity": "sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==", + "dev": true + } } }, "jasminewd2": { @@ -6548,9 +6633,9 @@ } }, "karma-jasmine": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/karma-jasmine/-/karma-jasmine-3.0.3.tgz", - "integrity": "sha512-80iBR8/hLFY2Uw3S2GG6EndWtMCGMJjrCYNwYROWsJFVTjWrRSsLqcA2ye+U3ygW5sjOQo8f+78L8cGUxjC/+A==", + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/karma-jasmine/-/karma-jasmine-3.1.1.tgz", + "integrity": "sha512-pxBmv5K7IkBRLsFSTOpgiK/HzicQT3mfFF+oHAC7nxMfYKhaYFgxOa5qjnHW4sL5rUnmdkSajoudOnnOdPyW4Q==", "dev": true, "requires": { "jasmine-core": "^3.5.0" @@ -9696,9 +9781,9 @@ } }, "rxjs": { - "version": "6.5.4", - "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.5.4.tgz", - "integrity": "sha512-naMQXcgEo3csAEGvw/NydRA0fuS2nDZJiw1YUWFKU7aPPAPGZEsD4Iimit96qwCieH6y614MCLYwdkrWx7z/7Q==", + "version": "6.5.5", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.5.5.tgz", + "integrity": "sha512-WfQI+1gohdf0Dai/Bbmk5L5ItH5tYqm3ki2c5GdWhKjalzjg93N3avFjVStyZZz+A2Em+ZxKH5bNghw9UeylGQ==", "requires": { "tslib": "^1.9.0" } @@ -11321,16 +11406,16 @@ "dev": true }, "ts-node": { - "version": "8.3.0", - "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-8.3.0.tgz", - "integrity": "sha512-dyNS/RqyVTDcmNM4NIBAeDMpsAdaQ+ojdf0GOLqE6nwJOgzEkdRNzJywhDfwnuvB10oa6NLVG1rUJQCpRN7qoQ==", + "version": "8.8.2", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-8.8.2.tgz", + "integrity": "sha512-duVj6BpSpUpD/oM4MfhO98ozgkp3Gt9qIp3jGxwU2DFvl/3IRaEAvbLa8G60uS7C77457e/m5TMowjedeRxI1Q==", "dev": true, "requires": { "arg": "^4.1.0", "diff": "^4.0.1", "make-error": "^1.1.1", "source-map-support": "^0.5.6", - "yn": "^3.0.0" + "yn": "3.1.1" } }, "tslib": { @@ -11339,9 +11424,9 @@ "integrity": "sha512-aZW88SY8kQbU7gpV19lN24LtXh/yD4ZZg6qieAJDDg+YBsJcSmLGK9QpnUjAKVG/xefmvJGd1WUmfpT/g6AJGA==" }, "tslint": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/tslint/-/tslint-6.1.0.tgz", - "integrity": "sha512-fXjYd/61vU6da04E505OZQGb2VCN2Mq3doeWcOIryuG+eqdmFUXTYVwdhnbEu2k46LNLgUYt9bI5icQze/j0bQ==", + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/tslint/-/tslint-6.1.1.tgz", + "integrity": "sha512-kd6AQ/IgPRpLn6g5TozqzPdGNZ0q0jtXW4//hRcj10qLYBaa3mTUU2y2MCG+RXZm8Zx+KZi0eA+YCrMyNlF4UA==", "dev": true, "requires": { "@babel/code-frame": "^7.0.0", @@ -11352,7 +11437,7 @@ "glob": "^7.1.1", "js-yaml": "^3.13.1", "minimatch": "^3.0.4", - "mkdirp": "^0.5.1", + "mkdirp": "^0.5.3", "resolve": "^1.3.2", "semver": "^5.3.0", "tslib": "^1.10.0", diff --git a/client/package.json b/client/package.json index d4695e8..f966442 100644 --- a/client/package.json +++ b/client/package.json @@ -22,29 +22,29 @@ "@fortawesome/fontawesome-free": "^5.13.0", "bulma": "^0.8.1", "ngx-filesize": "^2.0.13", - "rxjs": "~6.5.4", - "tslib": "^1.10.0", - "zone.js": "~0.10.2" + "rxjs": "~6.5.5", + "tslib": "^1.11.1", + "zone.js": "~0.10.3" }, "devDependencies": { "@angular-devkit/build-angular": "~0.901.0", "@angular/cli": "~9.1.0", "@angular/compiler-cli": "~9.1.0", "@angular/language-service": "~9.1.0", - "@types/node": "^12.11.1", - "@types/jasmine": "~3.5.0", - "@types/jasminewd2": "~2.0.3", - "codelyzer": "^5.1.2", + "@types/node": "^13.11.0", + "@types/jasmine": "~3.5.10", + "@types/jasminewd2": "~2.0.8", + "codelyzer": "^5.2.2", "jasmine-core": "~3.5.0", - "jasmine-spec-reporter": "~4.2.1", + "jasmine-spec-reporter": "~5.0.1", "karma": "~4.4.1", "karma-chrome-launcher": "~3.1.0", - "karma-coverage-istanbul-reporter": "~2.1.0", - "karma-jasmine": "~3.0.1", - "karma-jasmine-html-reporter": "^1.4.2", + "karma-coverage-istanbul-reporter": "~2.1.1", + "karma-jasmine": "~3.1.1", + "karma-jasmine-html-reporter": "^1.5.3", "protractor": "~5.4.3", - "ts-node": "~8.3.0", - "tslint": "~6.1.0", + "ts-node": "~8.8.2", + "tslint": "~6.1.1", "typescript": "~3.8.3" } } diff --git a/client/src/favicon.ico b/client/src/favicon.ico index 997406ad22c29aae95893fb3d666c30258a09537..9b3bd1e9f6250ac980fceedda779f5310aa75252 100644 GIT binary patch literal 1150 zcmZuvNl#N@6uk`+aRj4*1u@{p;KIaUV)zeYV#2}z8;zPM8)D)Z4T3TX1xiPu13^$C zAVX^>M9NI*@Y({MD1?FxZC!vvB!JY@A`JoZa^Ah~ynF6F-$2B|6BkE#C)2${MDawF z0)PUu%_9)u-|1u92!HQ-$&F2i{w0X5BVN(xETgFbUW}iSen5{cczA%>J-{kwLXno=*SJr!msl{or6rU2 zD(3%zz76x|01szep18O6pzn6^WAcuQ5}>sQEHXW`-{9ZQb*K^!sy~Qx^j1e>4J|n1 zF6`eB->qI2c(fO)y*&q&@8hngrjn15=E27`&ZHs_^EU)jn!CbDB~{uK`|5WSqS;=e zem%{NiqdgU;@Rd;De&MDxHU$2ND_LqgnYLooL4(l#Gld<*Z!HE!XS1Bt; zR=}#Xblm1Sl)w3IjS4=l2&c7C0@MmU-6R4+`Fp#X&_5n$b%Skg&(7;_I%-w3>6NaY z^1n!9(Bn0Htf9ve=1URpK$jkdTXPeAtH7CYPJP9LO_xeXnCBYU7IjCFmI-B}4sMJt3^s9NVg!P0 z6hDQy(L`XWMkB@zOLgN$4KYz;j0zZxq9KKdpZE#5@k0crP^5f9KO};h)ZDQ%ybhht z%t9#h|nu0K(bJ ztIkhEr!*UyrZWQ1k2+YkGqDi8Z<|mIN&$kzpKl{cNP=OQzXHz>vn+c)F)zO|Bou>E z2|-d_=qY#Y+yOu1a}XI?cU}%04)zz%anD(XZC{#~WreV!a$7k2Ug`?&CUEc0EtrkZ zL49MB)h!_K{H(*l_93D5tO0;BUnvYlo+;yss%n^&qjt6fZOa+}+FDO(~2>G z2dx@=JZ?DHP^;b7*Y1as5^uphBsh*s*z&MBd?e@I>-9kU>63PjP&^#5YTOb&x^6Cf z?674rmSHB5Fk!{Gv7rv!?qX#ei_L(XtwVqLX3L}$MI|kJ*w(rhx~tc&L&xP#?cQow zX_|gx$wMr3pRZIIr_;;O|8fAjd;1`nOeu5K(pCu7>^3E&D2OBBq?sYa(%S?GwG&_0-s%_v$L@R!5H_fc)lOb9ZoOO#p`Nn`KU z3LTTBtjwo`7(HA6 z7gmO$yTR!5L>Bsg!X8616{JUngg_@&85%>W=mChTR;x4`P=?PJ~oPuy5 zU-L`C@_!34D21{fD~Y8NVnR3t;aqZI3fIhmgmx}$oc-dKDC6Ap$Gy>a!`A*x2L1v0 WcZ@i?LyX}70000 m.Downloads) .ToListAsync(); - foreach (var torrent in results) + foreach (var file in results.SelectMany(torrent => torrent.Downloads)) { - foreach (var file in torrent.Downloads) - { - file.Torrent = null; - } + file.Torrent = null; } return results; @@ -53,9 +51,12 @@ namespace RdtClient.Data.Data .Include(m => m.Downloads) .FirstOrDefaultAsync(m => m.TorrentId == id); - foreach (var file in results.Downloads) + if (results != null) { - file.Torrent = null; + foreach (var file in results.Downloads) + { + file.Torrent = null; + } } return results; @@ -68,9 +69,12 @@ namespace RdtClient.Data.Data .Include(m => m.Downloads) .FirstOrDefaultAsync(m => m.Hash == hash); - foreach (var file in results.Downloads) + if (results != null) { - file.Torrent = null; + foreach (var file in results.Downloads) + { + file.Torrent = null; + } } return results; diff --git a/server/RdtClient.Service/Services/DownloadManager.cs b/server/RdtClient.Service/Services/DownloadManager.cs index 0318cc1..985a28c 100644 --- a/server/RdtClient.Service/Services/DownloadManager.cs +++ b/server/RdtClient.Service/Services/DownloadManager.cs @@ -79,14 +79,11 @@ namespace RdtClient.Service.Services ActiveDownloads[download.DownloadId].Progress = (Int32) (fileStream.Length * 100 / responseLength); - if (DateTime.UtcNow > ActiveDownloads[download.DownloadId] - .NextUpdate) + if (DateTime.UtcNow > ActiveDownloads[download.DownloadId].NextUpdate) { ActiveDownloads[download.DownloadId].Speed = fileStream.Length - ActiveDownloads[download.DownloadId].BytesLastUpdate; ActiveDownloads[download.DownloadId].NextUpdate = DateTime.UtcNow.AddSeconds(1); ActiveDownloads[download.DownloadId].BytesLastUpdate = fileStream.Length; - - Debug.WriteLine($"{fileStream.Length}/{responseLength} {ActiveDownloads[download.DownloadId].Speed}"); } } else diff --git a/server/RdtClient.Service/Services/QBittorrent.cs b/server/RdtClient.Service/Services/QBittorrent.cs index 08946b3..bf5b7fe 100644 --- a/server/RdtClient.Service/Services/QBittorrent.cs +++ b/server/RdtClient.Service/Services/QBittorrent.cs @@ -255,10 +255,10 @@ namespace RdtClient.Service.Services NumSeeds = 100, Priority = ++prio, Progress = (Int64) (torrent.RdProgress / 100.0), - Ratio = 9999, - RatioLimit = -2, + Ratio = 1, + RatioLimit = 1, SavePath = savePath, - SeedingTimeLimit = -2, + SeedingTimeLimit = 1, SeenComplete = DateTimeOffset.UtcNow.ToUnixTimeSeconds(), SeqDl = false, Size = torrent.RdSize, @@ -320,7 +320,7 @@ namespace RdtClient.Service.Services PiecesNum = torrent.Files.Count, Reannounce = 0, SavePath = savePath, - SeedingTime = torrent.RdEnded.HasValue ? (Int32) (DateTimeOffset.UtcNow - torrent.RdEnded.Value).TotalSeconds : 0, + SeedingTime = 1, Seeds = 100, SeedsTotal = 100, ShareRatio = 9999, diff --git a/server/RdtClient.Service/Services/Scheduler.cs b/server/RdtClient.Service/Services/Scheduler.cs index b575915..98e6767 100644 --- a/server/RdtClient.Service/Services/Scheduler.cs +++ b/server/RdtClient.Service/Services/Scheduler.cs @@ -1,5 +1,4 @@ -using System.IO; -using System.Linq; +using System.Linq; using System.Threading.Tasks; using Hangfire; using RdtClient.Data.Enums; @@ -53,10 +52,8 @@ namespace RdtClient.Service.Services return; } - var folderPath = Path.Combine(destinationFolderPath, download.Torrent.RdName); - download.Torrent = null; - BackgroundJob.Enqueue(() => DownloadManager.Download(download, folderPath)); + BackgroundJob.Enqueue(() => DownloadManager.Download(download, destinationFolderPath)); await Task.Delay(1000); } diff --git a/server/RdtClient.Web/.config/dotnet-tools.json b/server/RdtClient.Web/.config/dotnet-tools.json new file mode 100644 index 0000000..22ec382 --- /dev/null +++ b/server/RdtClient.Web/.config/dotnet-tools.json @@ -0,0 +1,12 @@ +{ + "version": 1, + "isRoot": true, + "tools": { + "dotnet-ef": { + "version": "3.1.3", + "commands": [ + "dotnet-ef" + ] + } + } +} \ No newline at end of file diff --git a/server/RdtClient.Web/Controllers/QBittorrentController.cs b/server/RdtClient.Web/Controllers/QBittorrentController.cs index df0f92e..0a0f854 100644 --- a/server/RdtClient.Web/Controllers/QBittorrentController.cs +++ b/server/RdtClient.Web/Controllers/QBittorrentController.cs @@ -50,7 +50,7 @@ namespace RdtClient.Web.Controllers [AllowAnonymous] [Route("auth/login")] [HttpPost] - public async Task AuthLoginPost([FromBody] QBAuthLoginRequest request) + public async Task AuthLoginPost([FromForm] QBAuthLoginRequest request) { return await AuthLogin(request); } @@ -72,7 +72,6 @@ namespace RdtClient.Web.Controllers } } - [Authorize] [Route("app/version")] [HttpGet] [HttpPost] @@ -81,7 +80,6 @@ namespace RdtClient.Web.Controllers return Ok("v4.2.3"); } - [Authorize] [Route("app/webapiVersion")] [HttpGet] [HttpPost] @@ -90,7 +88,6 @@ namespace RdtClient.Web.Controllers return Ok("2.4.1"); } - [Authorize] [Route("app/buildInfo")] [HttpGet] [HttpPost] @@ -202,7 +199,7 @@ namespace RdtClient.Web.Controllers [Authorize] [Route("torrents/properties")] [HttpPost] - public async Task>> TorrentsPropertiesPost([FromBody] QBTorrentsHashRequest request) + public async Task>> TorrentsPropertiesPost([FromForm] QBTorrentsHashRequest request) { return await TorrentsProperties(request); } @@ -259,7 +256,7 @@ namespace RdtClient.Web.Controllers [Authorize] [Route("torrents/delete")] [HttpPost] - public async Task TorrentsDeletePost([FromBody] QBTorrentsDeleteRequest request) + public async Task TorrentsDeletePost([FromForm] QBTorrentsDeleteRequest request) { return await TorrentsDelete(request); } @@ -289,7 +286,7 @@ namespace RdtClient.Web.Controllers [Authorize] [Route("torrents/add")] [HttpPost] - public async Task TorrentsAddPost([FromBody] QBTorrentsAddRequest request) + public async Task TorrentsAddPost([FromForm] QBTorrentsAddRequest request) { return await TorrentsAdd(request); } @@ -319,7 +316,7 @@ namespace RdtClient.Web.Controllers [Authorize] [Route("torrents/setCategory")] [HttpPost] - public async Task TorrentsSetCategoryPost([FromBody] QBTorrentsSetCategoryRequest request) + public async Task TorrentsSetCategoryPost([FromForm] QBTorrentsSetCategoryRequest request) { return await TorrentsSetCategory(request); } diff --git a/server/RdtClient.Web/Program.cs b/server/RdtClient.Web/Program.cs index 46c8501..0b39dc9 100644 --- a/server/RdtClient.Web/Program.cs +++ b/server/RdtClient.Web/Program.cs @@ -1,7 +1,10 @@ using System; +using System.IO; +using Microsoft.AspNetCore; using Microsoft.AspNetCore.Hosting; -using Microsoft.Extensions.Hosting; +using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Logging; +using RdtClient.Data.Models.Internal; namespace RdtClient.Web { @@ -9,22 +12,32 @@ namespace RdtClient.Web { public static void Main(String[] args) { - CreateHostBuilder(args) - .Build() - .Run(); - } + var configuration = new ConfigurationBuilder() + .SetBasePath(Directory.GetCurrentDirectory()) + .AddJsonFile("appsettings.json", true, false) + .Build(); - private static IHostBuilder CreateHostBuilder(String[] args) - { - return Host - .CreateDefaultBuilder(args) + var hostUrl = configuration["HostUrl"]; + + if (String.IsNullOrWhiteSpace(hostUrl)) + { + hostUrl = "http://0.0.0.0:6500"; + } + + WebHost.CreateDefaultBuilder(args) + .UseStartup() .ConfigureLogging(logging => { logging.ClearProviders(); logging.AddConsole(); logging.AddFile($"{AppContext.BaseDirectory}app.log"); }) - .ConfigureWebHostDefaults(webBuilder => { webBuilder.UseStartup(); }); + .CaptureStartupErrors(false) + .UseUrls(hostUrl) + .UseKestrel() + .UseIISIntegration() + .Build() + .Run(); } } } \ No newline at end of file diff --git a/server/RdtClient.Web/Properties/PublishProfiles/FolderProfile.pubxml b/server/RdtClient.Web/Properties/PublishProfiles/FolderProfile.pubxml new file mode 100644 index 0000000..7897233 --- /dev/null +++ b/server/RdtClient.Web/Properties/PublishProfiles/FolderProfile.pubxml @@ -0,0 +1,21 @@ + + + + + FileSystem + FileSystem + Release + Any CPU + + True + False + netcoreapp3.1 + a8c7f095-89c6-4cd1-afb2-27106f470d62 + false + bin\Release\netcoreapp3.1\publish\ + True + + \ No newline at end of file diff --git a/server/RdtClient.Web/Properties/launchSettings.json b/server/RdtClient.Web/Properties/launchSettings.json index 8c47cc0..df931c0 100644 --- a/server/RdtClient.Web/Properties/launchSettings.json +++ b/server/RdtClient.Web/Properties/launchSettings.json @@ -17,12 +17,11 @@ }, "RdtClient.Web": { "commandName": "Project", - "launchBrowser": true, "launchUrl": "weatherforecast", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" }, - "applicationUrl": "https://localhost:5001;http://localhost:5000" + "applicationUrl": "http://localhost:6500" } } } \ No newline at end of file diff --git a/server/RdtClient.Web/RdtClient.Web.csproj b/server/RdtClient.Web/RdtClient.Web.csproj index cee51d4..33a6dd0 100644 --- a/server/RdtClient.Web/RdtClient.Web.csproj +++ b/server/RdtClient.Web/RdtClient.Web.csproj @@ -17,6 +17,7 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/server/RdtClient.Web/Startup.cs b/server/RdtClient.Web/Startup.cs index 5458c7c..14dd689 100644 --- a/server/RdtClient.Web/Startup.cs +++ b/server/RdtClient.Web/Startup.cs @@ -54,8 +54,6 @@ namespace RdtClient.Web }); }); - services.AddHttpsRedirection(options => { options.HttpsPort = 443; }); - services.AddHttpClient(); services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme) @@ -104,10 +102,6 @@ namespace RdtClient.Web app.UseCors("Dev"); app.UseDeveloperExceptionPage(); } - else - { - app.UseHttpsRedirection(); - } app.Use(async (context, next) => { diff --git a/server/RdtClient.Web/appsettings.json b/server/RdtClient.Web/appsettings.json index 1553cb2..c52e395 100644 --- a/server/RdtClient.Web/appsettings.json +++ b/server/RdtClient.Web/appsettings.json @@ -13,5 +13,6 @@ "MaxRollingFiles": 5 } }, - "AllowedHosts": "*" + "AllowedHosts": "*", + "HostUrl": "http://0.0.0.0:6500" } diff --git a/server/RdtClient.Web/wwwroot/index.html b/server/RdtClient.Web/wwwroot/index.html index 6d5e026..5e162dd 100644 --- a/server/RdtClient.Web/wwwroot/index.html +++ b/server/RdtClient.Web/wwwroot/index.html @@ -1 +1,13 @@ -Test \ No newline at end of file + + + + + Real-Debrid Torrent Client + + + + + + + +