Skip to content

Commit

Permalink
Big rewrite
Browse files Browse the repository at this point in the history
  • Loading branch information
adampresley committed Aug 4, 2015
1 parent 8a23bc9 commit 9b7bda3
Show file tree
Hide file tree
Showing 74 changed files with 1,757 additions and 8,128 deletions.
3 changes: 3 additions & 0 deletions .bowerrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"directory": "www/assets"
}
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,7 @@ _testmain.go
*.exe
mail.db
mailslurper.db
#mailslurper
mailslurper
node_modules
www/assets/*
!www/assets/mailslurper
70 changes: 54 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,60 @@
# MailSlurper
MailSlurper
===========

Simple mail SMTP server that slurps mail into oblivion! Useful only for local development MailSlurper runs on your local machine and listens for outgoing mail send requests. When one is received the mail item is stored in a database and display in a web-based application.
Simple mail SMTP server that slurps mail into oblivion! MailSlurper Server is designed to run on a small network server for multiple developers to use for development and debugging of mail functionality in their applications. When a mail is received the mail item is stored in a database and display in a web-based application.

This application uses a lot of libraries.


### Copyright Information
This application makes use of the following libraries.

* [Gorilla WebSocket](https://github.com/gorilla/websocket) - BSD
* [Gorilla Mux](https://github.com/gorilla/mux) - Modified BSD?
* [Alice Middleware](https://github.com/justinas/alice) - MIT
* [Open-Golang](https://github.com/skratchdot/open-golang) - MIT
* [Bootstrap](http://getbootstrap.com/) - MIT
* [Featherlight](https://github.com/noelboss/featherlight/) - MIT
* [Grapnel](https://github.com/EngineeringMode/Grapnel.js) - MIT
* [Gorilla Mux](http://www.gorillatoolkit.org/pkg/mux)
* [Gorilla Context](http://www.gorillatoolkit.org/pkg/context)
* [Alice](https://github.com/justinas/alice)
* [GoHttpService](https://github.com/adampresley/GoHttpService)
* [Logging](https://github.com/adampresley/logging)
* [Bootstrap](http://getbootstrap.com/)
* [Font Awesome](http://fortawesome.github.io/Font-Awesome/)
* [Promiscuous](https://github.com/RubenVerborgh/promiscuous)
* [jQuery](http://jquery.com/) - MIT
* [jQuery UI](http://jqueryui.com) - MIT
* [jQuery.layout](http://layout.jquery-dev.com) - MIT & GPL
* [Moment.js](http://momentjs.com) - MIT
* [Ractive](http://ractivejs.org) - MIT
* [RequireJS](http://requirejs.org) - MIT

Compiling
---------
The instructions below assume you have the following tools.

* NodeJS/NPM
* Bower
* Go 1.4.2 (or higher)

```bash
$ bower install
$ npm install
$ cd www/assets/promiscuous
$ node ./build/build.js
$ cd ../../../
$ go get
$ go build
```

License
-------
The MIT License (MIT)

Copyright (c) 2015 Adam Presley

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.
30 changes: 30 additions & 0 deletions bower.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"name": "MailSlurper Server",
"version": "1.0.0",
"authors": [
"Adam Presley <[email protected]>"
],
"license": "MIT",
"private": true,
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
],
"dependencies": {
"bootstrap": "~3.3.5",
"moment": "~2.10.3",
"promiscuous": "~0.6.0",
"handlebars": "~3.0.3",
"requirejs": "~2.1.19",
"fontawesome": "~4.3.0",
"blockui": "*",
"bootstrap-growl": "~1.1.0",
"require-handlebars-plugin": "~0.11.3",
"lightbox2": "~2.8.1",
"bootstrap-dialog": "~1.34.5",
"bootstrap-daterangepicker": "~2.0.4"
}
}
22 changes: 15 additions & 7 deletions controllers/homeController/Index.go → controllers/Index.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,30 @@
// Use of this source code is governed by the MIT license
// that can be found in the LICENSE file.

package homeController
package controllers

import (
"fmt"
"io/ioutil"
"net/http"

"github.com/adampresley/GoHttpService"
"github.com/gorilla/context"
)

/*
Index is the main view. Here you look at mail.
*/
func Index(writer http.ResponseWriter, request *http.Request) {
body, err := ioutil.ReadFile("./www/index.html")
layout := (context.Get(request, "layout")).(GoHttpService.Layout)

data := struct {
Title string
}{
"Mail",
}

err := layout.RenderView(writer, "index", data)
if err != nil {
GoHttpService.Error(writer, "There was an error loading the index page")
GoHttpService.Error(writer, err.Error())
return
}

fmt.Fprintf(writer, string(body))
}
31 changes: 31 additions & 0 deletions controllers/SavedSearches.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Copyright 2013-3014 Adam Presley. All rights reserved
// Use of this source code is governed by the MIT license
// that can be found in the LICENSE file.

package controllers

import (
"net/http"

"github.com/adampresley/GoHttpService"
"github.com/gorilla/context"
)

/*
ManageSavedSearches is the page for managing saved searches
*/
func ManageSavedSearches(writer http.ResponseWriter, request *http.Request) {
layout := (context.Get(request, "layout")).(GoHttpService.Layout)

data := struct {
Title string
}{
"Manage Saved Searches",
}

err := layout.RenderView(writer, "manageSavedSearches", data)
if err != nil {
GoHttpService.Error(writer, err.Error())
return
}
}
30 changes: 30 additions & 0 deletions controllers/ServiceSettings.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// Copyright 2013-3014 Adam Presley. All rights reserved
// Use of this source code is governed by the MIT license
// that can be found in the LICENSE file.

package controllers

import (
"net/http"

"github.com/adampresley/GoHttpService"
"github.com/gorilla/context"
"github.com/mailslurper/libmailslurper/configuration"
"github.com/mailslurper/mailslurper/model"
)

/*
GetServiceSettings returns the settings necessary to talk to the MailSlurper
back-end service tier.
*/
func GetServiceSettings(writer http.ResponseWriter, request *http.Request) {
config := (context.Get(request, "config")).(*configuration.Configuration)

settings := model.ServiceSettings{
ServiceAddress: config.ServiceAddress,
ServicePort: config.ServicePort,
Version: "v1",
}

GoHttpService.WriteJson(writer, settings, 200)
}
15 changes: 15 additions & 0 deletions controllers/Version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package controllers

import (
"fmt"
"net/http"

"github.com/mailslurper/mailslurper/global"
)

/*
GetVersion outputs the current running version of this MailSlurper server instance
*/
func GetVersion(writer http.ResponseWriter, request *http.Request) {
fmt.Fprintf(writer, global.SERVER_VERSION)
}
24 changes: 0 additions & 24 deletions controllers/settingsController/ServiceSettings.go

This file was deleted.

47 changes: 0 additions & 47 deletions controllers/webSocketController/Receiver.go

This file was deleted.

7 changes: 3 additions & 4 deletions global/Global.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package global

import (
"github.com/mailslurper/libmailslurper/configuration"
const (
// Version of the MailSlurper Server application
SERVER_VERSION string = "1.0.0"
)

var Config *configuration.Configuration
Loading

0 comments on commit 9b7bda3

Please sign in to comment.