mirror of
https://github.com/jellyfin/jellyfin-plugin-nextpvr.git
synced 2024-11-23 05:59:41 +00:00
Increase sid security
Add sid on Live TV. Allow files instead of URLs for recordings.
This commit is contained in:
parent
159b638042
commit
9d926c41a5
@ -21,6 +21,7 @@ namespace Jellyfin.Plugin.NextPVR.Configuration
|
||||
public bool ShowRepeat { get; set; }
|
||||
public bool GetEpisodeImage { get; set; }
|
||||
public string RecordingDefault { get; set; }
|
||||
public int RecordingTransport { get; set; }
|
||||
public int PrePaddingSeconds { get; set; }
|
||||
public int PostPaddingSeconds { get; set; }
|
||||
/// <summary>
|
||||
@ -35,6 +36,7 @@ public SerializableDictionary<String, List<String>> GenreMappings { get; set; }
|
||||
EnableDebugLogging = false;
|
||||
NewEpisodes = false;
|
||||
RecordingDefault = "2";
|
||||
RecordingTransport = 1;
|
||||
// Initialise this
|
||||
GenreMappings = new SerializableDictionary<string, List<string>>();
|
||||
GenreMappings["GENRESPORT"] = new List<string>() { "Sports", "Football", "Baseball", "Basketball", "Hockey", "Soccer" };
|
||||
|
@ -40,6 +40,13 @@
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="selectContainer">
|
||||
<select is="emby-select" id="selRecTransport" label="Recording Protocol">
|
||||
<option value="1">Streaming</option>
|
||||
<option value="2">Filename</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="checkboxContainer">
|
||||
<label>
|
||||
<input is="emby-checkbox" type="checkbox" id="chkNewEpisodes" />
|
||||
@ -87,7 +94,6 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
var NextPvrConfigurationPage = {
|
||||
pluginUniqueId: "9574ac10-bf23-49bc-949f-924f23cfa48f"
|
||||
@ -103,6 +109,7 @@
|
||||
page.querySelector('#chkDebugLogging').checked = config.EnableDebugLogging;
|
||||
page.querySelector('#chkNewEpisodes').checked = config.NewEpisodes;
|
||||
$('#selRecDefault', page).val(config.RecordingDefault);
|
||||
$('#selRecTransport', page).val(config.RecordingTransport);
|
||||
loadGenres(config, page);
|
||||
Dashboard.hideLoadingMsg();
|
||||
});
|
||||
@ -115,11 +122,10 @@
|
||||
ApiClient.getPluginConfiguration(NextPvrConfigurationPage.pluginUniqueId).then(function(config) {
|
||||
config.WebServiceUrl = $('#txtWebServiceUrl', form).val();
|
||||
config.Pin = $('#txtPin', form).val();
|
||||
config.EnableDebugLogging = document.getElementById('chkDebugLogging').checked;
|
||||
//config.EnableDebugLogging = $('#chkDebugLogging', form).checked();
|
||||
config.EnableDebugLogging = form.querySelector('#chkDebugLogging').checked;
|
||||
config.NewEpisodes = form.querySelector('#chkNewEpisodes').checked;
|
||||
config.RecordingDefault = $('#selRecDefault', form).val();
|
||||
config.RecordingTransport = $('#selRecTransport', form).val();
|
||||
// Copy over the genre mapping fields
|
||||
config.GenreMappings = {
|
||||
"GENREMOVIE": $('#txtMovieGenre', form).val().split(","),
|
||||
|
@ -1,4 +1,4 @@
|
||||
using MediaBrowser.Common.Extensions;
|
||||
using MediaBrowser.Common.Extensions;
|
||||
using MediaBrowser.Common.Net;
|
||||
using MediaBrowser.Controller.Drawing;
|
||||
using MediaBrowser.Controller.LiveTv;
|
||||
@ -128,7 +128,7 @@ namespace Jellyfin.Plugin.NextPVR
|
||||
|
||||
var strb = new StringBuilder();
|
||||
var md5Result = GetMd5Hash(strb.Append(":").Append(GetMd5Hash(pin)).Append(":").Append(salt).ToString());
|
||||
|
||||
|
||||
var httpClient = _httpClientFactory.CreateClient(NamedClient.Default);
|
||||
await using var stream = await httpClient.GetStreamAsync(string.Format("{0}/service?method=session.login&md5={1}&sid={2}", baseUrl, md5Result, sid));
|
||||
{
|
||||
@ -342,7 +342,7 @@ namespace Jellyfin.Plugin.NextPVR
|
||||
|
||||
if (recurringType == 3 || recurringType == 4)
|
||||
url += "×lot=true";
|
||||
|
||||
|
||||
await CreateUpdateSeriesTimerAsync(info, url, cancellationToken);
|
||||
}
|
||||
|
||||
@ -386,7 +386,7 @@ namespace Jellyfin.Plugin.NextPVR
|
||||
info.PostPaddingSeconds / 60,
|
||||
info.KeepUpTo,
|
||||
info.Id);
|
||||
|
||||
|
||||
int recurringType = 2;
|
||||
|
||||
if (info.RecordAnyChannel)
|
||||
@ -415,7 +415,7 @@ namespace Jellyfin.Plugin.NextPVR
|
||||
}
|
||||
url += string.Format("&recurring_type={0}", recurringType);
|
||||
}
|
||||
if (info.RecordNewOnly)
|
||||
if (info.RecordNewOnly)
|
||||
url += "&only_new=true";
|
||||
|
||||
await CreateUpdateSeriesTimerAsync(info, url, cancellationToken);
|
||||
@ -495,7 +495,7 @@ namespace Jellyfin.Plugin.NextPVR
|
||||
var baseUrl = Plugin.Instance.Configuration.WebServiceUrl;
|
||||
_liveStreams++;
|
||||
|
||||
string streamUrl = string.Format("{0}/live?channeloid={1}&client=jellyfin.{2}", baseUrl, channelOid, _liveStreams.ToString());
|
||||
string streamUrl = string.Format("{0}/live?channeloid={1}&client=jellyfin.{2}&sid={3}", baseUrl, channelOid, _liveStreams.ToString(), Sid);
|
||||
_logger.LogInformation("[NextPVR] Streaming " + streamUrl);
|
||||
return new MediaSourceInfo
|
||||
{
|
||||
@ -648,7 +648,7 @@ namespace Jellyfin.Plugin.NextPVR
|
||||
|
||||
//Version Check
|
||||
var httpClient = _httpClientFactory.CreateClient(NamedClient.Default);
|
||||
|
||||
|
||||
bool upgradeAvailable;
|
||||
string serverVersion;
|
||||
|
||||
@ -663,7 +663,7 @@ namespace Jellyfin.Plugin.NextPVR
|
||||
|
||||
//Tuner information
|
||||
List<LiveTvTunerInfo> tvTunerInfos;
|
||||
|
||||
|
||||
using (var stream = await httpClient.GetStreamAsync(string.Format("{0}/service/method=system.status?sid={1}", baseUrl, Sid), cancellationToken).ConfigureAwait(false))
|
||||
{
|
||||
var tuners = new TunerResponse(stream, _jsonSerializer);
|
||||
@ -683,7 +683,7 @@ namespace Jellyfin.Plugin.NextPVR
|
||||
_logger.LogDebug("[NextPVR] GetLastUpdateTime");
|
||||
DateTimeOffset retTime = DateTimeOffset.FromUnixTimeSeconds(0);
|
||||
var baseUrl = Plugin.Instance.Configuration.WebServiceUrl;
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
await using var stream = await _httpClientFactory.CreateClient(NamedClient.Default)
|
||||
|
@ -92,7 +92,14 @@ namespace Jellyfin.Plugin.NextPVR.Responses
|
||||
|
||||
if (i.file != null)
|
||||
{
|
||||
info.Url = _baseUrl + "/live?recording=" + i.id;
|
||||
if (Plugin.Instance.Configuration.RecordingTransport == 2)
|
||||
{
|
||||
info.Url = i.file;
|
||||
}
|
||||
else
|
||||
{
|
||||
info.Url = String.Format("{0}/live?recording={1}", _baseUrl, i.id);
|
||||
}
|
||||
}
|
||||
|
||||
info.Status = ParseStatus(i.status);
|
||||
|
Loading…
Reference in New Issue
Block a user