-
-
Notifications
You must be signed in to change notification settings - Fork 401
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Added a visual indication on the UI to tell the admin there is a up…
…date available. - We are now also recording the last scheduled run in the database
- v4.46.7
- v4.46.6
- v4.46.5
- v4.46.4
- v4.46.3
- v4.46.2
- v4.46.1
- v4.46.0
- v4.45.1
- v4.45.0
- v4.44.1
- v4.44.0
- v4.43.22
- v4.43.21
- v4.43.20
- v4.43.19
- v4.43.18
- v4.43.17
- v4.43.16
- v4.43.15
- v4.43.14
- v4.43.13
- v4.43.12
- v4.43.11
- v4.43.10
- v4.43.9
- v4.43.8
- v4.43.7
- v4.43.6
- v4.43.5
- v4.43.4
- v4.43.3
- v4.43.2
- v4.43.1
- v4.43.0
- v4.42.3
- v4.42.2
- v4.42.1
- v4.42.0
- v4.41.1
- v4.41.0
- v4.40.0
- v4.39.1
- v4.39.0
- v4.38.2
- v4.38.1
- v4.38.0
- v4.37.3
- v4.37.2
- v4.37.1
- v4.37.0
- v4.36.1
- v4.36.0
- v4.35.19
- v4.35.18
- v4.35.17
- v4.35.16
- v4.35.15
- v4.35.14
- v4.35.13
- v4.35.12
- v4.35.11
- v4.35.10
- v4.35.9
- v4.35.8
- v4.35.7
- v4.35.6
- v4.35.5
- v4.35.4
- v4.35.3
- v4.35.2
- v4.35.1
- v4.35.0
- v4.34.1
- v4.34.0
- v4.33.1
- v4.33.0
- v4.32.3
- v4.32.2
- v4.32.1
- v4.32.0
- v4.31.0
- v4.30.0
- v4.29.3
- v4.29.2
- v4.29.1
- v4.29.0
- v4.28.1
- v4.28.0
- v4.27.8
- v4.27.7
- v4.27.6
- v4.27.5
- v4.27.4
- v4.27.3
- v4.27.2
- v4.27.1
- v4.27.0
- v4.26.0
- v4.25.1
- v4.25.0
- v4.24.0
- v4.23.2
- v4.23.1
- v4.23.0
- v4.22.5
- v4.22.4
- v4.22.3
- v4.22.2
- v4.22.1
- v4.22.0
- v4.21.2
- v4.21.1
- v4.21.0
- v4.20.4
- v4.20.3
- v4.20.2
- v4.20.1
- v4.20.0
- v4.19.1
- v4.19.0
- v4.18.0
- v4.17.0
- v4.16.17
- v4.16.16
- v4.16.15
- v4.16.14
- v4.16.13
- v4.16.12
- v4.16.11
- v4.16.10
- v4.16.9
- v4.16.8
- v4.16.7
- v4.16.6
- v4.16.5
- v4.16.4
- v4.16.3
- v4.16.2
- v4.16.1
- v4.16.0
- v4.15.6
- v4.15.5
- v4.15.4
- v4.15.3
- v4.15.2
- v4.15.1
- v4.15.0
- v4.14.4
- v4.14.3
- v4.14.2
- v4.14.1
- v4.14.0
- v4.13.2
- v4.13.1
- v4.13.0
- v4.12.7
- v4.12.6
- v4.12.5
- v4.12.4
- v4.12.3
- v4.12.2
- v4.12.1
- v4.12.0
- v4.11.8
- v4.11.7
- v4.11.6
- v4.11.5
- v4.11.4
- v4.11.3
- v4.11.2
- v4.11.1
- v4.11.0
- v4.10.4
- v4.10.3
- v4.10.2
- v4.10.1
- v4.10.0
- v4.9.2
- v4.9.1
- v4.9.0
- v4.8.1
- v4.8.0
- v4.7.11
- v4.7.10
- v4.7.9
- v4.7.8
- v4.7.7
- v4.7.6
- v4.7.5
- v4.7.4
- v4.7.3
- v4.7.2
- v4.7.1
- v4.7.0
- v4.6.5
- v4.6.4
- v4.6.3
- v4.6.2
- v4.6.1
- v4.6.0
- v4.4.0
- v4.3.3
- v4.3.2
- v4.3.1
- v4.3.0
- v4.2.13
- v4.2.12
- v4.2.11
- v4.2.10
- v4.2.9
- v4.2.8
- v4.2.7
- v4.2.6
- v4.2.5
- v4.2.4
- v4.2.3
- v4.2.2
- v4.2.1
- v4.2.0
- v4.1.1
- v4.1.0
- v4.0.1602
- v4.0.1601
- v4.0.1599
- v4.0.1511
- v4.0.1510
- v4.0.1506
- v4.0.1499
- v4.0.1488
- v4.0.1487
- v4.0.1483
- v4.0.1482
- v4.0.1477
- v4.0.1476
- v4.0.1475
- v4.0.1474
- v4.0.1470
- v4.0.1468
- v4.0.1466
- v4.0.1463
- v4.0.1458
- v4.0.1451
- v4.0.1449
- v4.0.1448
- v4.0.1447
- v4.0.1446
- v4.0.1443
- v4.0.1442
- v4.0.1440
- v4.0.1435
- v4.0.1433
- v4.0.1432
- v4.0.1431
- v4.0.1430
- v4.0.1425
- v4.0.1424
- v4.0.1423
- v4.0.1422
- v4.0.1421
- v4.0.1420
- v4.0.1417
- v4.0.1412
- v4.0.1404
- v4.0.1403
- v4.0.1402
- v4.0.1398
- v4.0.1396
- v4.0.1394
- v4.0.1387
- v4.0.1386
- v4.0.1375
- v4.0.1371
- v4.0.1370
- v4.0.1363
- v4.0.1361
- v4.0.1360
- v4.0.1358
- v4.0.1354
- v4.0.1353
- v4.0.1351
- v4.0.1350
- v4.0.1349
- v4.0.1348
- v4.0.1347
- v4.0.1345
- v4.0.1344
- v4.0.1342
- v4.0.1340
- v4.0.1339
- v4.0.1338
- v4.0.1336
- v4.0.1334
- v4.0.1333
- v4.0.1332
- v4.0.1329
- v4.0.1328
- v4.0.1324
- v4.0.1322
- v4.0.1319
- v4.0.1314
- v4.0.1313
- v4.0.1309
- v4.0.1299
- v4.0.1292
- v4.0.1290
- v4.0.1286
- v4.0.1282
- v4.0.1281
- v4.0.1277
- v4.0.1275
- v4.0.1262
- v4.0.1261
- v4.0.1260
- v4.0.1259
- v4.0.1257
- v4.0.1256
- v4.0.1255
- v4.0.1222
- v4.0.1204
- v4.0.1203
- v4.0.1156
- v4.0.1155
- v4.0.1154
- v4.0.1153
- v4.0.1152
- v4.0.1151
- v4.0.1150
- v4.0.1142
- v4.0.1139
- v4.0.1136
- v4.0.1135
- v4.0.1134
- v4.0.1133
- v4.0.1132
- v4.0.1131
- v4.0.1128
- v4.0.1122
- v4.0.1120
- v4.0.1119
- v4.0.1118
- v4.0.1117
- v4.0.1116
- v4.0.1112
- v4.0.1104
- v4.0.1103
- v4.0.1102
- v4.0.1095
- v4.0.1090
- v4.0.1089
- v4.0.1085
- v4.0.1080
- v4.0.1078
- v4.0.1067
- v4.0.1062
- v4.0.1040
- v4.0.1039
- v4.0.1037
- v4.0.1036
- v4.0.1035
- v4.0.1032
- v4.0.1014
- v4.0.1013
- v4.0.1012
- v4.0.1011
- v4.0.1009
- v4.0.999
- v4.0.994
- v3.0.5223
- v3.0.5218
- v3.0.5202
- v3.0.4892
- v3.0.4887
- v3.0.4880
- v3.0.4817
- v3.0.4680
- v3.0.4659
- v3.0.4654
- v3.0.4256
- v3.0.4248
- v3.0.4119
- v3.0.4036
- v3.0.3988
- v3.0.3945
- v3.0.3923
- v3.0.3919
- v3.0.3795
- v3.0.3786
- v3.0.3776
- v3.0.3587
- v3.0.3477
- v3.0.3421
- v3.0.3407
- v3.0.3383
- v3.0.3368
- v3.0.3346
- v3.0.3330
- v3.0.3304
- v3.0.3293
- v3.0.3268
- v3.0.3239
- v3.0.3185
- v3.0.3173
- v3.0.3164
- v3.0.3111
- v3.0.3030
- v3.0.3020
- v3.0.3000
- v3.0.2970
- v3.0.0
- v2.2.1
- v2.2.0
- v2.1.0
- v2.0.1
- v2.0.0
- v2.0
- v1.10.1
- v1.10.0
- v1.9.7
- v1.9.6
- v1.9.5
- v1.9.4
- v1.9.3
- v1.9.2
- v1.9.1
- v1.9.0
- v1.8.4
- v1.8.3
- v1.8.2
- v1.8.1
- v1.8.0
- v1.7.5
- v1.7.4
- v1.7.3
- v1.7.2
- v1.7.1
- v1.7.0
- v1.7
- PlexRequests-v1.10.1086
- PlexRequests-v1.7.407
- Ombi-v3.0.3923
- Ombi-v3.0.2948
- Ombi-v3.0.2881
tidusjar
committed
Apr 29, 2016
1 parent
af028f0
commit df3dc4a
Showing
28 changed files
with
392 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#region Copyright | ||
// /************************************************************************ | ||
// Copyright (c) 2016 Jamie Rees | ||
// File: IJobRecord.cs | ||
// Created By: Jamie Rees | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining | ||
// a copy of this software and associated documentation files (the | ||
// "Software"), to deal in the Software without restriction, including | ||
// without limitation the rights to use, copy, modify, merge, publish, | ||
// distribute, sublicense, and/or sell copies of the Software, and to | ||
// permit persons to whom the Software is furnished to do so, subject to | ||
// the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be | ||
// included in all copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | ||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
// ************************************************************************/ | ||
#endregion | ||
namespace PlexRequests.Services.Interfaces | ||
{ | ||
public interface IJobRecord | ||
{ | ||
void Record(string jobName); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#region Copyright | ||
// /************************************************************************ | ||
// Copyright (c) 2016 Jamie Rees | ||
// File: JobNames.cs | ||
// Created By: Jamie Rees | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining | ||
// a copy of this software and associated documentation files (the | ||
// "Software"), to deal in the Software without restriction, including | ||
// without limitation the rights to use, copy, modify, merge, publish, | ||
// distribute, sublicense, and/or sell copies of the Software, and to | ||
// permit persons to whom the Software is furnished to do so, subject to | ||
// the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be | ||
// included in all copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | ||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
// ************************************************************************/ | ||
#endregion | ||
namespace PlexRequests.Services | ||
{ | ||
public static class JobNames | ||
{ | ||
public const string StoreBackup = "Database Backup"; | ||
public const string CpCacher = "CouchPotato Cacher"; | ||
public const string SonarrCacher = "Sonarr Cacher"; | ||
public const string SrCacher = "SickRage Cacher"; | ||
public const string PlexChecker = "Plex Availability Cacher"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
#region Copyright | ||
// /************************************************************************ | ||
// Copyright (c) 2016 Jamie Rees | ||
// File: JobRecord.cs | ||
// Created By: Jamie Rees | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining | ||
// a copy of this software and associated documentation files (the | ||
// "Software"), to deal in the Software without restriction, including | ||
// without limitation the rights to use, copy, modify, merge, publish, | ||
// distribute, sublicense, and/or sell copies of the Software, and to | ||
// permit persons to whom the Software is furnished to do so, subject to | ||
// the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be | ||
// included in all copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | ||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
// ************************************************************************/ | ||
#endregion | ||
using System; | ||
using System.Linq; | ||
|
||
using PlexRequests.Services.Interfaces; | ||
using PlexRequests.Store.Models; | ||
using PlexRequests.Store.Repository; | ||
|
||
namespace PlexRequests.Services | ||
{ | ||
public class JobRecord : IJobRecord | ||
{ | ||
public JobRecord(IRepository<ScheduledJobs> repo) | ||
{ | ||
Repo = repo; | ||
} | ||
private IRepository<ScheduledJobs> Repo { get; } | ||
public void Record(string jobName) | ||
{ | ||
var allJobs = Repo.GetAll(); | ||
var storeJob = allJobs.FirstOrDefault(x => x.Name == jobName); | ||
if (storeJob != null) | ||
{ | ||
storeJob.LastRun = DateTime.UtcNow; | ||
Repo.Update(storeJob); | ||
} | ||
else | ||
{ | ||
var job = new ScheduledJobs { LastRun = DateTime.UtcNow, Name = jobName }; | ||
Repo.Insert(job); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#region Copyright | ||
// /************************************************************************ | ||
// Copyright (c) 2016 Jamie Rees | ||
// File: LogEntity.cs | ||
// Created By: Jamie Rees | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining | ||
// a copy of this software and associated documentation files (the | ||
// "Software"), to deal in the Software without restriction, including | ||
// without limitation the rights to use, copy, modify, merge, publish, | ||
// distribute, sublicense, and/or sell copies of the Software, and to | ||
// permit persons to whom the Software is furnished to do so, subject to | ||
// the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be | ||
// included in all copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | ||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
// ************************************************************************/ | ||
#endregion | ||
using System; | ||
|
||
using Dapper.Contrib.Extensions; | ||
|
||
namespace PlexRequests.Store.Models | ||
{ | ||
[Table("ScheduledJobs")] | ||
public class ScheduledJobs : Entity | ||
{ | ||
public string Name { get; set; } | ||
public DateTime LastRun { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#region Copyright | ||
// /************************************************************************ | ||
// Copyright (c) 2016 Jamie Rees | ||
// File: JsonUpdateAvailableModel.cs | ||
// Created By: Jamie Rees | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining | ||
// a copy of this software and associated documentation files (the | ||
// "Software"), to deal in the Software without restriction, including | ||
// without limitation the rights to use, copy, modify, merge, publish, | ||
// distribute, sublicense, and/or sell copies of the Software, and to | ||
// permit persons to whom the Software is furnished to do so, subject to | ||
// the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be | ||
// included in all copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | ||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
// ************************************************************************/ | ||
#endregion | ||
namespace PlexRequests.UI.Models | ||
{ | ||
public class JsonUpdateAvailableModel | ||
{ | ||
public bool UpdateAvailable { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
#region Copyright | ||
// /************************************************************************ | ||
// Copyright (c) 2016 Jamie Rees | ||
// File: UpdateCheckerModule.cs | ||
// Created By: Jamie Rees | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining | ||
// a copy of this software and associated documentation files (the | ||
// "Software"), to deal in the Software without restriction, including | ||
// without limitation the rights to use, copy, modify, merge, publish, | ||
// distribute, sublicense, and/or sell copies of the Software, and to | ||
// permit persons to whom the Software is furnished to do so, subject to | ||
// the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be | ||
// included in all copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | ||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
// ************************************************************************/ | ||
#endregion | ||
using System; | ||
|
||
using Nancy; | ||
|
||
using NLog; | ||
|
||
using PlexRequests.Core; | ||
using PlexRequests.Helpers; | ||
using PlexRequests.UI.Models; | ||
|
||
namespace PlexRequests.UI.Modules | ||
{ | ||
public class UpdateCheckerModule : BaseAuthModule | ||
{ | ||
public UpdateCheckerModule(ICacheProvider provider) : base("updatechecker") | ||
{ | ||
Cache = provider; | ||
|
||
Get["/"] = _ => CheckLatestVersion(); | ||
} | ||
|
||
private ICacheProvider Cache { get; } | ||
|
||
private static Logger Log = LogManager.GetCurrentClassLogger(); | ||
|
||
private Response CheckLatestVersion() | ||
{ | ||
try | ||
{ | ||
if (!IsAdmin) | ||
{ | ||
return Response.AsJson(new JsonUpdateAvailableModel { UpdateAvailable = false }); | ||
} | ||
|
||
var checker = new StatusChecker(); | ||
var release = Cache.GetOrSet(CacheKeys.LastestProductVersion, () => checker.GetStatus(), 30); | ||
|
||
if (release.UpdateAvailable) | ||
{ | ||
return Response.AsJson(new JsonUpdateAvailableModel { UpdateAvailable = true}); | ||
} | ||
|
||
return Response.AsJson(new JsonUpdateAvailableModel { UpdateAvailable = false }); | ||
} | ||
catch (Exception e) | ||
{ | ||
Log.Warn("Exception Thrown when attempting to check the status"); | ||
Log.Warn(e); | ||
return Response.AsJson(new JsonUpdateAvailableModel { UpdateAvailable = false }); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
df3dc4a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#184
df3dc4a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#189