Skip to content

Basic web ui features #63

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 21 commits into from
Aug 1, 2017
Merged
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
c9ad90c
Added a web UI project to Provides a web UI to manage the email messa…
Jun 29, 2017
cf4c57b
Added Papercut.WebUI.Tests project
Jun 30, 2017
062f9e2
test webUI server start
Jun 30, 2017
7ca6c79
extract webServer and factsBase
Jun 30, 2017
bf957b0
Added cases to test getting messages; Put the initliazation logic int…
Jun 30, 2017
205fea9
Added load all message api.
Jun 30, 2017
a486b40
revert papercut other modules changes
Jun 30, 2017
2745858
Convert message to dynamic
Jun 30, 2017
3bab44e
return MimeMessageEntry.Dto when load all messages
Jul 3, 2017
c6f689a
mock HttpServer for test; use random dir to store email
Jul 4, 2017
5d42515
Added a new API to serve mail message detail (except attachments...)
Jul 4, 2017
3ff7c97
Minor refactoring: Adjusted extension method classes
Jul 4, 2017
e92aba5
Return 404 if cannot find id
Jul 5, 2017
401c069
Successfully launched the WebUI for the first Time! Fixed package ref…
Jul 6, 2017
8f40969
Implemented a static file API to serve html/css/js content
Jul 6, 2017
582c953
Refactored mailhog HTML to use Papercut API; Removed not-yet-implemen…
Jul 7, 2017
61158d3
Implemented pagination on the web ui; UI improvements
Jul 7, 2017
37a4532
Made HttpPort configurable; Use Papercut icon as web page favicon
Jul 7, 2017
09589a5
Use Fody.Costura to merge generated assembly for Papercut.Module.WebU…
Jul 11, 2017
5273677
lanch the web UI server in desktop UI mode as well. Use logger to ou…
Jul 12, 2017
67d227a
Copy output to release configuration as well.
Jul 25, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Added a web UI project to Provides a web UI to manage the email messa…
…ges for Papercut.
  • Loading branch information
Jijie authored and blink03 committed Jul 7, 2017
commit c9ad90cceb8a00967c99f68676c0e839ad37b921
7 changes: 7 additions & 0 deletions Papercut.sln
Original file line number Diff line number Diff line change
@@ -29,6 +29,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Papercut.Network", "src\Pap
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Papercut.Common", "src\Papercut.Common\Papercut.Common.csproj", "{5FA0E4AA-27AF-4801-B6CA-8C97DADD6DA6}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Papercut.WebUI", "src\Papercut.WebUI\Papercut.WebUI.csproj", "{A1C924F3-3CFB-4844-B79F-8BFFEC60EEBF}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -69,12 +71,17 @@ Global
{5FA0E4AA-27AF-4801-B6CA-8C97DADD6DA6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5FA0E4AA-27AF-4801-B6CA-8C97DADD6DA6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5FA0E4AA-27AF-4801-B6CA-8C97DADD6DA6}.Release|Any CPU.Build.0 = Release|Any CPU
{A1C924F3-3CFB-4844-B79F-8BFFEC60EEBF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A1C924F3-3CFB-4844-B79F-8BFFEC60EEBF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A1C924F3-3CFB-4844-B79F-8BFFEC60EEBF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A1C924F3-3CFB-4844-B79F-8BFFEC60EEBF}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{5E6526B3-4DA9-41F4-8171-C34146AC2E55} = {8B3498DF-6DDE-44F5-8428-1B82749933BE}
{F60D44E1-100E-464A-A280-CA6BAF652177} = {8B3498DF-6DDE-44F5-8428-1B82749933BE}
{A1C924F3-3CFB-4844-B79F-8BFFEC60EEBF} = {8B3498DF-6DDE-44F5-8428-1B82749933BE}
EndGlobalSection
EndGlobal
4 changes: 2 additions & 2 deletions src/Papercut.UI/Behaviors/InteractivityBlurBase.cs
Original file line number Diff line number Diff line change
@@ -34,8 +34,8 @@ public class InteractivityBlurBase<T> : Behavior<T>

public int BlurRadius
{
get => (int)GetValue(BlurRadiusProperty);
set => SetValue(BlurRadiusProperty, value);
get { return (int) GetValue(BlurRadiusProperty); }
set { SetValue(BlurRadiusProperty, value); }
}

protected virtual BlurEffect GetBlurEffect()
67 changes: 67 additions & 0 deletions src/Papercut.WebUI/Papercut.WebUI.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{A1C924F3-3CFB-4844-B79F-8BFFEC60EEBF}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Papercut.WebUI</RootNamespace>
<AssemblyName>Papercut.WebUI</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Autofac, Version=3.5.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
<HintPath>..\..\packages\Autofac.3.5.2\lib\net40\Autofac.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="WebUIPluginModule.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Papercut.Core\Papercut.Core.csproj">
<Project>{eedd1016-6442-48ce-8f8e-1d350829fbde}</Project>
<Name>Papercut.Core</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
36 changes: 36 additions & 0 deletions src/Papercut.WebUI/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Papercut.WebUI")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Papercut.WebUI")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("a1c924f3-3cfb-4844-b79f-8bffec60eebf")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
23 changes: 23 additions & 0 deletions src/Papercut.WebUI/WebUIPluginModule.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@


namespace Papercut.WebUI
{
using Autofac.Core;
using Core.Infrastructure.Plugins;

public class WebUIPluginModule: IPluginModule, IModule
{
public IModule Module => this;
public string Name => "WebUI";
public string Version => "1.0.0";
public string Description => "Provides a web UI to manage the email messages for Papercut.";




public void Configure(IComponentRegistry componentRegistry)
{

}
}
}
5 changes: 5 additions & 0 deletions src/Papercut.WebUI/assets/css/bootstrap-3.3.2.min.css

Large diffs are not rendered by default.

1,178 changes: 1,178 additions & 0 deletions src/Papercut.WebUI/assets/css/jquery-ui-1.10.4-smoothness.css

Large diffs are not rendered by default.

162 changes: 162 additions & 0 deletions src/Papercut.WebUI/assets/css/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
/*********/
/* Modal */
.modal-dialog {
margin-top: 65px;
}

/*******/
/* Nav */
.navbar .col-md-10 {
padding-left: 0;
}

.navbar-brand > img {
display: inline-block;
}

.navbar-form {
padding-left: 0;
}

/**************/
/* Search bar */
#search {
width: 500px;
}
@media (max-width: 991px) {
#search {
width: 420px;
}
}

/* http://stackoverflow.com/questions/18838964/add-bootstrap-glyphicon-to-input-box */
.left-inner-addon {
position: relative;
}

.left-inner-addon input {
padding-left: 30px;
}

.left-inner-addon .glyphicon {
color: #aaa;
position: absolute;
padding: 9px 10px;
pointer-events: none;
}

/***************/
/* Sidebar nav */
.nav-stacked {
margin-top: 10px;
}

.has-event-source {
color: green;
}

.no-event-source {
color: red;
}

/*******/
/* Jim */
.jim-well {
margin-top: 20px;
}

.jim-well h3 {
margin-top: 0;
}

.jim-config {
margin-top: 3px;
padding: 5px;
font-size: 0.9em;
}

.jim-config .jim-config-item {
margin-bottom: 2px;
}

/***********/
/* Toolbar */
.toolbar {
padding: 5px;
border-bottom: 1px solid #ccc;
}

.toolbar .btn {
padding-left: 20px;
padding-right: 20px;
}

.toolbar .spacer {
display: inline-block;
width: 20px;
}

.message-count {
padding-right: 10px;
}

/***********/
/* Content */
.content {
position: fixed;
right: 0;
top: 51px;
bottom: 0;
overflow-y: scroll;
padding-bottom: 80px;
}

.mail-content {
margin-top: 20px;
}

.msglist-message {
border-bottom: 1px solid #ccc;
padding: 5px 0;
cursor: pointer;
}

.msglist-message .subject.unread {
color: #666;
font-weight: bold;
}

/***********/
/* Preview */
#preview-plain, #preview-source {
white-space: pre;
font-family: Courier New, Courier, System, fixed-width;
padding: 10px;
}

.preview .tab-content {
overflow-y: scroll;
}

.headers {
margin-top: 10px;
}

.headers tbody td {
width: 100%;
}

.headers tbody th {
white-space: nowrap;
text-align: right;
color: #666;
font-weight: normal;
}

.haeders table td, .headers table th {
padding: 2px 10px
}

.mime-part {
padding: 10px;
}
288 changes: 288 additions & 0 deletions src/Papercut.WebUI/assets/fonts/glyphicons-halflings-regular.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added src/Papercut.WebUI/assets/images/github.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/Papercut.WebUI/assets/images/hog.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
455 changes: 455 additions & 0 deletions src/Papercut.WebUI/assets/index.html

Large diffs are not rendered by default.

26,070 changes: 26,070 additions & 0 deletions src/Papercut.WebUI/assets/js/angular-1.3.8.js

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions src/Papercut.WebUI/assets/js/bootstrap-3.3.2.min.js

Large diffs are not rendered by default.

605 changes: 605 additions & 0 deletions src/Papercut.WebUI/assets/js/controllers.js

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions src/Papercut.WebUI/assets/js/filesize-3.1.2.min.js
7 changes: 7 additions & 0 deletions src/Papercut.WebUI/assets/js/iso88591_map.js
4 changes: 4 additions & 0 deletions src/Papercut.WebUI/assets/js/jquery-1.11.0.min.js

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions src/Papercut.WebUI/assets/js/jquery-ui-1.10.4.min.js

Large diffs are not rendered by default.

2,936 changes: 2,936 additions & 0 deletions src/Papercut.WebUI/assets/js/moment-2.8.4.js

Large diffs are not rendered by default.

161 changes: 161 additions & 0 deletions src/Papercut.WebUI/assets/js/punycode.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
// https://raw.githubusercontent.com/jupiter/node-strutil/master/lib/punycode.js

// Almost literal translation of the C code in
// http://www.ietf.org/rfc/rfc3492.txt to JavaScript.
// Comments removed. Removed "case_flags" support.

function InitPunyCode() {
var BASE = 36;
var TMIN = 1;
var TMAX = 26;
var SKEW = 38;
var DAMP = 700;
var INITIAL_BIAS = 72;
var INITIAL_N = 0x80;
var DELIMITER = 0x2D;
var MAXINT = Math.pow(2, 31) -1; // In 32-bit signed integer.

function basic(cp) {
return cp < 0x80;
}

function delim(cp) {
return cp == DELIMITER;
}

function decode_digit(cp) {
return (cp - 48 < 10 ? cp - 22 : cp - 65 < 26 ? cp - 65 :
cp - 97 < 26 ? cp - 97 : BASE);
}

function encode_digit(d, flag) {
return (d + 22 + 75 * (d < 26) - ((flag != 0) << 5));
}

function flagged(bcp) {
return (bcp - 65 < 26);
}

function encode_basic(bcp, flag) {
bcp -= (bcp - 97 < 26) << 5;
return bcp + ((!flag && (bcp - 65 < 26)) << 5);
}

function adapt(delta, numpoints, firsttime) {
var k;
delta = Math.floor(firsttime ? delta / DAMP : delta / 2);
delta += Math.floor(delta / numpoints);
for (k = 0; delta > Math.floor(((BASE - TMIN) * TMAX) / 2); k += BASE) {
delta = Math.floor(delta / (BASE - TMIN));
}
return Math.floor(k + (BASE - TMIN + 1) * delta / (delta + SKEW));
}

// Encodes "input" in punycode. On success, returns true
// and stores the result in "output". Both "input" and
// "output" are arrays of Unicode code points.
function punycode_encode(input, output) {
var n = INITIAL_N;
var delta = 0;
var out = 0;
var bias = INITIAL_BIAS;

for (var j = 0; j < input.length; ++j) {
if (basic(input[j])) {
output.push(input[j]);
}
}

var h = out;
var b = out;
if (b > 0) output.push(DELIMITER);

while (h < input.length) {
var m = MAXINT;
for (var j = 0; j < input.length; ++j) {
if (input[j] >= n && input[j] < m) m = input[j];
}

if (m - n > Math.floor((MAXINT - delta) / (h + 1)))
return false;
delta += (m - n) * (h + 1);
n = m;

for (var j = 0; j < input.length; ++j) {
if (input[j] < n /* || basic(input[j]) */ ) {
if (++delta == 0) return false;
}

if (input[j] == n) {
var q = delta;
for (var k = BASE; ; k += BASE) {
var t = k <= bias ? TMIN :
k >= bias + TMAX ? TMAX : k - bias;
if (q < t) break;
output.push(encode_digit(t + (q - t) % (BASE - t), 0));
q = Math.floor((q - t) / (BASE - t));
}

output.push(encode_digit(q, false));
bias = adapt(delta, h + 1, h == b);
delta = 0;
++h;
}
}
++delta;
++n;
}
return true;
}

// Decodes "input" to Unicode code points. On success,
// returns true and stores the result in "output". Both
// "input" and "output" are arrays of Unicode code points.
function punycode_decode(input, output) {
var n = INITIAL_N;
var out = 0;
var bias = INITIAL_BIAS;

var b = 0;
for (var j = 0; j < input.length; ++j) if (delim(input[j])) b = j;

for (var j = 0; j < b; ++j) {
if (!basic(input[j])) return false;
output.push(input[j]);
}

var i = 0;
var inp = b > 0 ? b + 1 : 0;
for (; inp < input.length; ++out) {
var oldi = i;
var w = 1;
for (var k = BASE; ; k += BASE) {
if (inp >= input.length) return false;
var digit = decode_digit(input[inp++]);
if (digit >= BASE) return false;
if (digit > Math.floor((MAXINT - i) / w)) return false;
i += digit * w;
var t = (k <= bias ? TMIN :
k >= bias + TMAX ? TMAX : k - bias);
if (digit < t) break;
if (w > Math.floor(MAXINT / (BASE - t))) return false;
w *= (BASE - t);
}

bias = adapt(i - oldi, out + 1, oldi == 0);

if (i / (out + 1) > MAXINT - n) return false;
n += Math.floor(i / (out + 1));
i %= (out + 1);
output.splice(i, 0, n);
++i;
}
return true;
}

// Exported functions.
return { encode: punycode_encode,
decode: punycode_decode };
};

var PunyCode = exports.PunyCode = InitPunyCode();
7 changes: 7 additions & 0 deletions src/Papercut.WebUI/assets/js/sjis_map.js

Large diffs are not rendered by default.

993 changes: 993 additions & 0 deletions src/Papercut.WebUI/assets/js/strutil.js

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions src/Papercut.WebUI/packages.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Autofac" version="3.5.2" targetFramework="net461" />
</packages>