Browse Source

- Updated mail storage to be by bytes.

- Added upload limits to multiple spots
tags/5.1.0
Teknikode 2 weeks ago
parent
commit
7f1efd40d5

+ 1
- 1
BillingService/Program.cs View File

@@ -94,7 +94,7 @@ namespace Teknik.BillingService
if (emailPrice != null)
{
UserHelper.EnableUserEmail(config, email);
UserHelper.EditUserEmailMaxSize(config, email, (int)emailPrice.Storage);
UserHelper.EditUserEmailMaxSize(config, email, emailPrice.Storage);
}
}
else

+ 4
- 4
MailService/HMailService.cs View File

@@ -35,14 +35,14 @@ namespace Teknik.MailService
_App = InitApp();
}

public void CreateAccount(string username, string password, int size)
public void CreateAccount(string username, string password, long size)
{
var domain = _App.Domains.ItemByName[_Domain];
var newAccount = domain.Accounts.Add();
newAccount.Address = username;
newAccount.Password = password;
newAccount.Active = true;
newAccount.MaxSize = size;
newAccount.MaxSize = (int)(size / 1000000);

newAccount.Save();
}
@@ -94,10 +94,10 @@ namespace Teknik.MailService
mySQL.Execute(sql, new object[] { maxPerDay, username });
}

public void EditMaxSize(string username, int size)
public void EditMaxSize(string username, long size)
{
var account = GetAccount(username);
account.MaxSize = size;
account.MaxSize = (int)(size / 1000000);
account.Save();
}


+ 2
- 2
MailService/IMailService.cs View File

@@ -10,11 +10,11 @@ namespace Teknik.MailService

bool Enabled(string username);

void CreateAccount(string username, string password, int size);
void CreateAccount(string username, string password, long size);

void EditPassword(string username, string password);

void EditMaxSize(string username, int size);
void EditMaxSize(string username, long size);

void EditMaxEmailsPerDay(string username, int maxPerDay);


+ 1
- 1
Teknik/Areas/Billing/BillingHelper.cs View File

@@ -44,7 +44,7 @@ namespace Teknik.Areas.Billing
if (active)
{
UserHelper.EnableUserEmail(config, email);
UserHelper.EditUserEmailMaxSize(config, email, (int)price.Storage);
UserHelper.EditUserEmailMaxSize(config, email, price.Storage);
}
else
{

+ 2
- 0
Teknik/Areas/Billing/Controllers/BillingController.cs View File

@@ -34,6 +34,8 @@ namespace Teknik.Areas.Billing.Controllers
[AllowAnonymous]
public IActionResult ViewSubscriptions()
{
ViewBag.Title = "Subscriptions";

var subVM = new SubscriptionsViewModel();

// Get Biling Service

+ 4
- 0
Teknik/Areas/User/Controllers/UserController.cs View File

@@ -580,6 +580,10 @@ namespace Teknik.Areas.Users.Controllers
model.Page = "Upload";
model.UserID = user.UserId;
model.Username = user.Username;

model.MaxStorage = user.UploadSettings.MaxUploadStorage ?? _config.UploadConfig.MaxStorage;
model.MaxFileSize = user.UploadSettings.MaxUploadFileSize ?? _config.UploadConfig.MaxUploadFileSize;

model.Encrypt = user.UploadSettings.Encrypt;
model.ExpirationLength = user.UploadSettings.ExpirationLength;
model.ExpirationUnit = user.UploadSettings.ExpirationUnit;

+ 1
- 1
Teknik/Areas/User/Utility/UserHelper.cs View File

@@ -751,7 +751,7 @@ If you recieved this email and you did not reset your password, you can ignore t
}
}

public static void EditUserEmailMaxSize(Config config, string email, int size)
public static void EditUserEmailMaxSize(Config config, string email, long size)
{
try
{

+ 3
- 0
Teknik/Areas/User/ViewModels/UploadSettingsViewModel.cs View File

@@ -10,6 +10,9 @@ namespace Teknik.Areas.Users.ViewModels
{
public class UploadSettingsViewModel : SettingsViewModel
{
public long MaxStorage { get; set; }
public long MaxFileSize { get; set; }

public bool Encrypt { get; set; }
public int ExpirationLength { get; set; }
public ExpirationUnit ExpirationUnit { get; set; }

+ 16
- 0
Teknik/Areas/User/Views/User/Settings/UploadSettings.cshtml View File

@@ -12,6 +12,22 @@

<bundle src="css/user.settings.upload.min.css" append-version="true"></bundle>

<div class="row">
<div class="col-md-12">
<h3 class="text-center">Upload Limits</h3>
<div class="row">
<div class="col-md-2 col-sm-offset-1"><strong>Storage</strong></div>
<div class="col-md-9"><strong>@StringHelper.GetBytesReadable(Model.MaxStorage)</strong></div>
</div>
<div class="row">
<div class="col-md-2 col-sm-offset-1"><strong>File Size</strong></div>
<div class="col-md-9"><strong>@StringHelper.GetBytesReadable(Model.MaxFileSize)</strong></div>
</div>
</div>
</div>
<br />
<hr />

<!form class="form" action="##" method="post" id="updateForm">

<div class="row form-horizontal">

Loading…
Cancel
Save