Skip to content

Commit

Permalink
Merge branch 'release/5.7.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaben committed Apr 5, 2020
2 parents 4627715 + 36b78e2 commit 3553f5b
Show file tree
Hide file tree
Showing 45 changed files with 526 additions and 252 deletions.
4 changes: 2 additions & 2 deletions Papercut.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26730.12
# Visual Studio Version 16
VisualStudioVersion = 16.0.29920.165
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Papercut", "src\Papercut.UI\Papercut.csproj", "{AC067042-66BD-4110-ADA1-E2CEA43E7947}"
EndProject
Expand Down
4 changes: 3 additions & 1 deletion Papercut.sln.DotSettings
Original file line number Diff line number Diff line change
Expand Up @@ -121,4 +121,6 @@ limitations under the License. 
<s:String x:Key="/Default/PatternsAndTemplates/StructuralSearch/Pattern/=E1F72DD6C4D1114A8329A3D37FCFBFA4/ReplaceComment/@EntryValue"></s:String>
<s:String x:Key="/Default/PatternsAndTemplates/StructuralSearch/Pattern/=E1F72DD6C4D1114A8329A3D37FCFBFA4/ReplacePattern/@EntryValue"></s:String>
<s:String x:Key="/Default/PatternsAndTemplates/StructuralSearch/Pattern/=E1F72DD6C4D1114A8329A3D37FCFBFA4/SearchPattern/@EntryValue"></s:String>
<s:String x:Key="/Default/PatternsAndTemplates/StructuralSearch/Pattern/=E1F72DD6C4D1114A8329A3D37FCFBFA4/Severity/@EntryValue">DO_NOT_SHOW</s:String></wpf:ResourceDictionary>
<s:String x:Key="/Default/PatternsAndTemplates/StructuralSearch/Pattern/=E1F72DD6C4D1114A8329A3D37FCFBFA4/Severity/@EntryValue">DO_NOT_SHOW</s:String>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Changemaker/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Papercut/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
![Papercut Logo](https://raw.githubusercontent.com/ChangemakerStudios/Papercut/develop/graphics/PapercutLogo.png)
The Simple SMTP Desktop Email Receiver
The Simple Desktop Email Helper

[![Build status](https://ci.appveyor.com/api/projects/status/bs2asxoafdwbkcxa?svg=true)](https://ci.appveyor.com/project/Jaben/papercut)
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/Jaben/Papercut?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
Expand Down
8 changes: 8 additions & 0 deletions ReleaseNotes.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Release Notes

## Papercut v5.7.0 [2020-04-05]
- Renamed product to "Papercut SMTP" to seperate from other products.
- Moved "Readme.eml" and logs to *\ProgramData\Changemaker Studios\Papercut SMTP* allowing it to be deleted.
- Changed default save directory for Papercut UI to *\%ApplicationData%\Changemaker Studios\Papercut SMTP*. Mail in legacy paths are still supported.
- Added support for embedded message mime types and the ability to save the embedded eml.
- Performance improvements loading messages.
- Misc bug fixes.

## Papercut v5.6.0 [2020-04-02]
- [#143](https://github.com/ChangemakerStudios/Papercut/issues/143) Added "Delete All" button.
- Switch "Self Hosted Web" to use OWIN/Katana -- which should fix issues with binding.
Expand Down
2 changes: 0 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
os: Visual Studio 2019

version: 1.0.{build}

configuration: Release

#before_build:
Expand Down
2 changes: 1 addition & 1 deletion build/ReleaseNotes.cake
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ src=""data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAOgAAAAyCAMAAABh0mcDAAAAGXRF
Subject = "Welcome to Papercut!",
Body = body.ToMessageBody(),
};
message.From.Add(new MimeKit.MailboxAddress("Papercut", "[email protected]"));
message.From.Add(new MimeKit.MailboxAddress("Papercut SMTP", "[email protected]"));
message.To.Add(new MimeKit.MailboxAddress("", "[email protected]"));
message.WriteTo(System.IO.Path.GetFullPath("..\\src\\Papercut.UI\\Readme.eml"));
}
Expand Down
4 changes: 2 additions & 2 deletions src/GlobalAssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
//------------------------------------------------------------------------------
using System.Reflection;

[assembly: AssemblyVersion("5.7.0.1")]
[assembly: AssemblyVersion("5.7.0.0")]
[assembly: AssemblyFileVersion("5.7.0.0")]
[assembly: AssemblyInformationalVersion("5.7.0-alpha.1+Branch.develop.Sha.261f93f0bfb133370872bf04ec42e4f1cc4b3360")]
[assembly: AssemblyInformationalVersion("5.7.0-alpha.7+Branch.develop.Sha.3f90c48c219dd1f5e87e5fa62a6f0134b68b0497")]

23 changes: 13 additions & 10 deletions src/Papercut.App.WebApi/Controllers/MessagesController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ namespace Papercut.App.WebApi.Controllers
using System.Net.Http;
using System.Net.Http.Headers;
using System.Net.Mime;
using System.Threading.Tasks;
using System.Web.Http;

using MimeKit;
Expand All @@ -47,16 +48,18 @@ public MessagesController(MessageRepository messageRepository, MimeMessageLoader
}

[HttpGet]
public HttpResponseMessage GetAll(int limit = 10, int start = 0)
public async Task<HttpResponseMessage> GetAll(int limit = 10, int start = 0)
{
var messageEntries = this._messageRepository.LoadMessages();

var messages = messageEntries
var messageTasks = messageEntries
.OrderByDescending(msg => msg.ModifiedDate)
.Skip(start)
.Take(limit)
.Select(e => MimeMessageEntry.RefDto.CreateFrom(new MimeMessageEntry(e, this._messageLoader.LoadMailMessage(e))))
.ToList();
.Select(async e =>
MimeMessageEntry.RefDto.CreateFrom(new MimeMessageEntry(e, await this._messageLoader.GetAsync(e))));

var messages = await Task.WhenAll(messageTasks);

return this.Request.CreateResponse(HttpStatusCode.OK, new
{
Expand Down Expand Up @@ -85,15 +88,15 @@ public HttpResponseMessage DeleteAll()
}

[HttpGet]
public HttpResponseMessage Get(string id)
public async Task<HttpResponseMessage> Get(string id)
{
var messageEntry = this._messageRepository.LoadMessages().FirstOrDefault(msg => msg.Name == id);
if (messageEntry == null)
{
return this.Request.CreateResponse(HttpStatusCode.NotFound);
}

var dto = MimeMessageEntry.DetailDto.CreateFrom(new MimeMessageEntry(messageEntry, this._messageLoader.LoadMailMessage(messageEntry)));
var dto = MimeMessageEntry.DetailDto.CreateFrom(new MimeMessageEntry(messageEntry, await this._messageLoader.GetAsync(messageEntry)));
return this.Request.CreateResponse(HttpStatusCode.OK, dto);
}

Expand All @@ -117,26 +120,26 @@ public HttpResponseMessage DownloadRaw(string messageId)
}

[HttpGet]
public HttpResponseMessage DownloadSection(string messageId, int index)
public Task<HttpResponseMessage> DownloadSection(string messageId, int index)
{
return this.DownloadSection(messageId, sections => (index >=0 && index < sections.Count ? sections[index] : null));
}

[HttpGet]
public HttpResponseMessage DownloadSectionContent(string messageId, string contentId)
public Task<HttpResponseMessage> DownloadSectionContent(string messageId, string contentId)
{
return this.DownloadSection(messageId, sections => sections.FirstOrDefault(s => s.ContentId == contentId));
}

HttpResponseMessage DownloadSection(string messageId, Func<List<MimePart>, MimePart> findSection)
async Task<HttpResponseMessage> DownloadSection(string messageId, Func<List<MimePart>, MimePart> findSection)
{
var messageEntry = this._messageRepository.LoadMessages().FirstOrDefault(msg => msg.Name == messageId);
if (messageEntry == null)
{
return this.Request.CreateResponse(HttpStatusCode.NotFound);
}

var mimeMessage = new MimeMessageEntry(messageEntry, this._messageLoader.LoadMailMessage(messageEntry));
var mimeMessage = new MimeMessageEntry(messageEntry, await this._messageLoader.GetAsync(messageEntry));
var sections = mimeMessage.MailMessage.BodyParts.OfType<MimePart>().ToList();

var mimePart = findSection(sections);
Expand Down
2 changes: 1 addition & 1 deletion src/Papercut.App.WebApi/assets/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<div class="col-md-2 col-sm-3">
<div class="navbar-header">
<a class="navbar-brand" href="#">
<img src="images/papercut-logo.png" height="20" alt="Papercut">
<img src="images/papercut-logo.png" height="20" alt="Papercut SMTP">
</a>
</div>
</div>
Expand Down
6 changes: 4 additions & 2 deletions src/Papercut.Bootstrapper/Bundle.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
Manufacturer="!(bind.packageManufacturer.PapercutMsi)"
UpgradeCode="72719c72-122e-4313-8a57-0a0fc666ba75"
AboutUrl="https://github.com/ChangemakerStudios/Papercut"
Copyright="Copyright (c) 2019 by Changemaker Studios"
Copyright="Copyright (c) 2020 by Changemaker Studios"
HelpUrl="https://github.com/ChangemakerStudios/Papercut"
IconSourceFile="Resources\App.ico">
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.HyperlinkSidebarLicense">
Expand All @@ -18,7 +18,8 @@
LogoSideFile="Resources\Papercut-Sidelogo.png" />
</BootstrapperApplicationRef>

<Variable Name="InstallFolder" Type="string" Value="[ProgramFilesFolder]!(bind.packageManufacturer.PapercutMsi)\Papercut"/>
<Variable Name="InstallFolder" Type="string" Value="[ProgramFilesFolder]!(bind.packageManufacturer.PapercutMsi)\Papercut SMTP"/>
<Variable Name="CommonDataFolder" Type="string" Value="[CommonAppDataFolder]!(bind.packageManufacturer.PapercutMsi)\Papercut SMTP"/>

<Chain>
<PackageGroupRef Id="NetFx45Web" />
Expand All @@ -31,6 +32,7 @@
DisplayInternalUI="yes"
Vital="yes">
<MsiProperty Name="INSTALLFOLDER" Value="[InstallFolder]" />
<MsiProperty Name="COMMONDATAFOLDER" Value="[CommonDataFolder]" />
</MsiPackage>
</Chain>
</Bundle>
Expand Down
2 changes: 1 addition & 1 deletion src/Papercut.Common/Helper/KeyValuePair.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
// want this to be in this namespace to match KeyValuePair namespace
namespace System.Collections.Generic
{
internal static class KeyValuePair
public static class KeyValuePair
{
public static KeyValuePair<TKey, TValue> Create<TKey, TValue>(TKey key, TValue value)
{
Expand Down
35 changes: 35 additions & 0 deletions src/Papercut.Core/AppConstants.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// Papercut
//
// Copyright © 2008 - 2012 Ken Robertson
// Copyright © 2013 - 2020 Jaben Cargman
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.


namespace Papercut.Core
{
using System;
using System.IO;

public static class AppConstants
{
public const string ApplicationName = "Papercut SMTP";

public const string CompanyName = "Changemaker Studios";

public static string DataDirectory { get; } =
Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData),
CompanyName,
ApplicationName);
}
}
12 changes: 7 additions & 5 deletions src/Papercut.Core/Domain/Paths/MessagePathConfigurator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ namespace Papercut.Core.Domain.Paths
using System.Linq;
using System.Text.RegularExpressions;

using Papercut.Common.Extensions;
using Common;

using Papercut.Common.Helper;

using Serilog;
Expand All @@ -33,7 +34,7 @@ public class MessagePathConfigurator : IMessagePathConfigurator
{
static readonly IDictionary<string, string> _templateDictionary;

static readonly Regex _templateRegex = new Regex(
static readonly Regex TemplateRegex = new Regex(
@"\%(?<name>.+?)\%",
RegexOptions.Compiled | RegexOptions.ExplicitCapture | RegexOptions.Singleline);

Expand All @@ -47,7 +48,8 @@ static MessagePathConfigurator()
{
_templateDictionary = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
{
{ "BaseDirectory", AppDomain.CurrentDomain.BaseDirectory }
{"BaseDirectory", AppDomain.CurrentDomain.BaseDirectory},
{"DataDirectory", AppConstants.DataDirectory}
};

foreach (
Expand Down Expand Up @@ -94,7 +96,7 @@ public string DefaultSavePath

return this._defaultSavePath;
}
private set { this._defaultSavePath = value; }
private set => this._defaultSavePath = value;
}

public IEnumerable<string> LoadPaths { get; private set; }
Expand Down Expand Up @@ -126,7 +128,7 @@ protected virtual void OnRefreshLoadPath()
string RenderPathTemplate(string pathTemplate)
{
IEnumerable<string> pathKeys =
_templateRegex.Matches(pathTemplate)
TemplateRegex.Matches(pathTemplate)
.OfType<Match>()
.Select(s => s.Groups["name"].Value);
string renderedPath = pathTemplate;
Expand Down
4 changes: 3 additions & 1 deletion src/Papercut.Core/Infrastructure/Logging/BootstrapLogger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ namespace Papercut.Core.Infrastructure.Logging
using System.IO;
using System.Threading.Tasks;

using Common;

using Serilog;
using Serilog.Events;
using Serilog.Formatting.Json;
Expand All @@ -34,7 +36,7 @@ static BootstrapLogger()
{
_rootLogger = new Lazy<ILogger>(() =>
{
string logFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory,
string logFilePath = Path.Combine(AppConstants.DataDirectory,
"Logs",
"PapercutCoreFailure.json");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ namespace Papercut.Infrastructure.IPComm.Network
using System.Net.Sockets;
using System.Text;

using Common;
using Common.Domain;

using Core;
using Core.Domain.Network;

using Serilog;
Expand Down Expand Up @@ -155,7 +157,7 @@ bool HandlePublishEvent<TEvent>(
{
string response = stream.ReadStringBuffered().Trim();

if (response != "PAPERCUT") return false;
if (response != AppConstants.ApplicationName.ToUpper()) return false;

var eventJson = PapercutIPCommSerializer.ToJson(@event);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ namespace Papercut.Infrastructure.IPComm.Network
using System.IO;
using System.Net.Sockets;

using Common;
using Common.Domain;
using Common.Extensions;

using Core;
using Core.Infrastructure.Json;
using Core.Infrastructure.MessageBus;

Expand All @@ -47,7 +49,7 @@ public override void Begin(Connection connection)
this.Connection = connection;
this.Logger.ForContext("ConnectionId", this.Connection.Id);

this.Connection.SendLine("PAPERCUT").Wait();
this.Connection.SendLine(AppConstants.ApplicationName.ToUpper()).Wait();
}

protected override void ProcessRequest(string incomingRequest)
Expand Down
Loading

0 comments on commit 3553f5b

Please sign in to comment.