1
0
mirror of https://git.teknik.io/Teknikode/Teknik.git synced 2023-08-02 14:16:22 +02:00

Changed canary message to pul from file.

This commit is contained in:
Uncled1023 2016-05-13 19:10:30 -07:00
parent 5823cb0af2
commit 1c35fcfd7b
6 changed files with 158 additions and 139 deletions

View File

@ -21,6 +21,8 @@ namespace Teknik.Areas.Transparency.Controllers
ViewBag.Description = "Teknik transparency and statistics.";
TransparencyViewModel model = new TransparencyViewModel();
if (Config.TransparencyConfig.Enabled)
{
Upload.Models.Upload upload = db.Uploads.OrderByDescending(u => u.UploadId).FirstOrDefault();
model.UploadCount = (upload != null) ? upload.UploadId : 0;
model.UploadSize = (upload != null) ? db.Uploads.Sum(u => (long)u.ContentLength) : 0;
@ -87,6 +89,13 @@ namespace Teknik.Areas.Transparency.Controllers
model.Takedowns = db.Takedowns.OrderByDescending(b => b.DateRequested).ToList();
// Grab canary file
if (System.IO.File.Exists(Config.TransparencyConfig.CanaryPath))
{
model.Canary = System.IO.File.ReadAllText(Config.TransparencyConfig.CanaryPath);
}
}
return View(model);
}
}

View File

@ -20,6 +20,8 @@ namespace Teknik.Areas.Transparency.ViewModels
public int ShortenedUrlCount { get; set; }
public string Canary { get; set; }
public Dictionary<string, double> TotalBills { get; set; }
public Dictionary<string, double> TotalOneTimes { get; set; }

View File

@ -255,26 +255,7 @@
</div>
<div class="row">
<div class="col-sm-8 col-sm-offset-2">
<pre>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
Beginning January 1st, 2014 until today, May 12, 2016, Teknik has not received a national security letter, FISA order, or any other classified request for user information.
This notice is valid until June 12, 2016.
-----BEGIN PGP SIGNATURE-----
Version: Keybase OpenPGP v2.0.53
Comment: https://keybase.io/crypto
wsBcBAABCgAGBQJXNhfXAAoJEFEhCHsN5mi3R2EH/24A7o0FVGtYOV6mY+0I6AYP
dRu58ocp4Q+N5LMPxXAhYu9lHeu9hWOp/x5UxtPA3uKILtq7sAeBa6iA0jyu9b4C
xKcY9iLy2lntN8lWr9w6qjtKp4JTWHR/R1J1vkQUrC+/HQZS/gFRVyopDjXes5Sj
mLBaweep4ejYMLWed0kJWJLqXmJk6U/ONLdN2GrfqEPDhdfX8DCy3RADNozgyIz/
sdDAV25Wa9Gq4ZIG+TJQhaQ3hm6UADesV4IAy2L/tREGQSvpX9ADb3oOCsTn4YqJ
lfmyMyljqic67qmAr6ffHv7ptm0DLtNSBOTL8puhK0C9zlu52yCkg/w5UfWIw2M=
=6s3W
-----END PGP SIGNATURE-----
</pre>
<pre>@Model.Canary</pre>
</div>
</div>
</div>

View File

@ -33,6 +33,7 @@ namespace Teknik.Configuration
private PodcastConfig _PodcastConfig;
private StreamConfig _StreamConfig;
private ShortenerConfig _ShortenerConfig;
private TransparencyConfig _TransparencyConfig;
private DatabaseConfig _DatabaseConfig;
private PiwikConfig _PiwikConfig;
@ -82,6 +83,9 @@ namespace Teknik.Configuration
// Shortener Configuration
public ShortenerConfig ShortenerConfig { get { return _ShortenerConfig; } set { _ShortenerConfig = value; } }
// Shortener Configuration
public TransparencyConfig TransparencyConfig { get { return _TransparencyConfig; } set { _TransparencyConfig = value; } }
// Database Configuration
public DatabaseConfig DatabaseConfig { get { return _DatabaseConfig; } set { _DatabaseConfig = value; } }
@ -121,6 +125,7 @@ namespace Teknik.Configuration
PodcastConfig = new PodcastConfig();
StreamConfig = new StreamConfig();
ShortenerConfig = new ShortenerConfig();
TransparencyConfig = new TransparencyConfig();
DatabaseConfig = new DatabaseConfig();
PiwikConfig = new PiwikConfig();
}

View File

@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Teknik.Configuration
{
public class TransparencyConfig
{
public bool Enabled { get; set; }
public string CanaryPath { get; set; }
public TransparencyConfig()
{
Enabled = false;
CanaryPath = string.Empty;
}
}
}

View File

@ -246,6 +246,7 @@
<Compile Include="Areas\Upload\ViewModels\UploadViewModel.cs" />
<Compile Include="Configuration\PiwikConfig.cs" />
<Compile Include="Configuration\ShortenerConfig.cs" />
<Compile Include="Configuration\TransparencyConfig.cs" />
<Compile Include="Configuration\StreamConfig.cs" />
<Compile Include="Configuration\ApiConfig.cs" />
<Compile Include="Configuration\DatabaseConfig.cs" />