Skip to content
This repository has been archived by the owner on Nov 4, 2020. It is now read-only.

Commit

Permalink
Update to Vapor 3, User Permissions, Deleting Faxes and Messages
Browse files Browse the repository at this point in the history
  • Loading branch information
chandlerhuff committed Jun 16, 2018
1 parent e7fe6c2 commit ad0589d
Show file tree
Hide file tree
Showing 82 changed files with 5,462 additions and 2,474 deletions.
5 changes: 0 additions & 5 deletions Config/app.json

This file was deleted.

12 changes: 0 additions & 12 deletions Config/crypto.json

This file was deleted.

3 changes: 0 additions & 3 deletions Config/development/app.json

This file was deleted.

9 changes: 0 additions & 9 deletions Config/droplet.json

This file was deleted.

5 changes: 0 additions & 5 deletions Config/mongo.json

This file was deleted.

3 changes: 0 additions & 3 deletions Config/production/app.json

This file was deleted.

4 changes: 0 additions & 4 deletions Config/production/server.json

This file was deleted.

Empty file removed Config/secrets/.gitkeep
Empty file.
5 changes: 0 additions & 5 deletions Config/server.json

This file was deleted.

30 changes: 30 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
FROM ubuntu:16.04

LABEL maintainer="bludesign"

# Set Default Timezone
RUN echo GMT > /etc/timezone

# Install CURL and tzdata
RUN apt-get update && \
apt-get -y install curl libcurl4-openssl-dev tzdata && \
rm -rf /var/lib/apt/lists/*;

# Configure tzdata
RUN dpkg-reconfigure -f noninteractive tzdata

# Get Vapor repo including Swift
RUN curl -sL https://apt.vapor.sh | bash;

# Installing Swift & Vapor
RUN apt-get update && \
apt-get -y install swift vapor && \
rm -rf /var/lib/apt/lists/*;

# Clone and build Reaumur
RUN git clone https://github.com/bludesign/FaxServer.git
WORKDIR "/FaxServer"
RUN vapor build --release --verbose

# Serve
CMD bash -c ".build/release/App"
54 changes: 38 additions & 16 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,24 +1,46 @@
// swift-tools-version:4.0
import PackageDescription

let package = Package(
name: "Server",
targets: [
Target(name: "Server"),
Target(name: "App", dependencies: ["Server"])
],
dependencies: [
.Package(url: "https://github.com/vapor/vapor.git", majorVersion: 2),
.Package(url: "https://github.com/vapor/leaf-provider.git", majorVersion: 1),
.Package(url: "https://github.com/vapor/validation.git", majorVersion: 1),
.Package(url: "https://github.com/OpenKitten/MongoKitten.git", majorVersion: 4),
.Package(url: "https://github.com/bludesign/vapor-apns", majorVersion: 2)
.package(url: "https://github.com/vapor/vapor.git", .upToNextMajor(from: "3.0.0")),
.package(url: "https://github.com/vapor/jwt.git", .upToNextMajor(from: "3.0.0-rc")),
.package(url: "https://github.com/vapor/leaf.git", .upToNextMajor(from: "3.0.0-rc")),
.package(url: "https://github.com/vapor/console.git", .upToNextMajor(from: "3.0.0")),
.package(url: "https://github.com/vapor/websocket", .upToNextMajor(from: "1.0.0")),
.package(url: "https://github.com/vapor/validation.git", .upToNextMajor(from: "2.0.0")),
.package(url: "https://github.com/vapor-community/clibressl.git", .upToNextMajor(from: "1.0.0")),
.package(url: "https://github.com/vapor-community/copenssl.git", .upToNextMajor(from: "1.0.0-rc")),
.package(url: "https://github.com/OpenKitten/MongoKitten.git", .upToNextMajor(from: "4.0.0")),
.package(url: "https://github.com/BrettRToomey/Jobs.git", .upToNextMajor(from: "1.0.0")),
.package(url: "https://github.com/reaumur/CCurl.git", .upToNextMajor(from: "1.0.0")),
.package(url: "https://github.com/tadija/AEXML.git", .upToNextMajor(from: "4.0.0"))
],
exclude: [
"Config",
"Deploy",
"Public",
"Resources",
"Tests",
"Database"
targets: [
.target(name: "Server",
dependencies: [
"Vapor",
"JWT",
"Leaf",
"Console",
"WebSocket",
"Validation",
"CLibreSSL",
"COpenSSL",
"MongoKitten",
"Jobs",
"CCurl",
"AEXML"
],
exclude: [
"Config",
"Deploy",
"Public",
"Resources",
"Tests",
"Database"
]),
.target(name: "App", dependencies: ["Server"])
]
)
32 changes: 0 additions & 32 deletions [email protected]

This file was deleted.

2 changes: 1 addition & 1 deletion Public/vendors/js/intlTelInput.js

Large diffs are not rendered by default.

11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<img src="http://img.shields.io/badge/api-documentation-92A8D1.svg" alt="API Documentation">
</a>
<a href="https://vapor.codes/">
<img src="https://img.shields.io/badge/vapor-2.0-blue.svg" alt="Vapor">
<img src="https://img.shields.io/badge/vapor-3.0-blue.svg" alt="Vapor">
</a>
<a href="LICENSE">
<img src="http://img.shields.io/badge/license-MIT-brightgreen.svg" alt="MIT License">
Expand All @@ -32,13 +32,13 @@ The easiest way to install is with [Docker](https://www.docker.com)
cd FaxServer
docker-compose up

After the Vapor is finished building the (~5-10min) the server will be running at [http://127.0.0.1:8080](http://127.0.0.1:8080)
After starting the server will be running at [http://127.0.0.1:8080](http://127.0.0.1:8080)

To run the server in the background run `docker-compose up -d`

#### Manually

If it is not already installed install [MongoDB](https://docs.mongodb.com/manual/installation/) and configure the connection settings in the [/Config/mongo.json](./Config/mongo.json) file.
If it is not already installed install [MongoDB](https://docs.mongodb.com/manual/installation/) if you are using authentication or a non-standard port set it with the `MONGO_HOST`, `MONGO_PORT`, `MONGO_USERNAME`, `MONGO_PASSWORD` environment variables.

Next install Vapor and Swift here for [macOS](https://docs.vapor.codes/2.0/getting-started/install-on-macos/) or [Ubuntu](https://docs.vapor.codes/2.0/getting-started/install-on-ubuntu/).

Expand All @@ -47,9 +47,9 @@ Then build and run the project:
git clone --depth=1 [email protected]:bludesign/FaxServer.git
cd FaxServer
vapor build --release
vapor run serve --env=production --release
.build/release/App

The server will now be running at [http://127.0.0.1:8080](http://127.0.0.1:8080)
The server will now be running at [http://127.0.0.1:8080](http://127.0.0.1:8080). Note running the server with `vapor run serve` will not work it must be run directly with the `App` in `.build/release` directory.

### 🚀 Deploy

Expand Down Expand Up @@ -92,6 +92,7 @@ First visit the Fax Server's address and register a new user account after you c

> SMS messages can only be received from Nexmo so no accounts need to be added in Fax Server to receive messages.
- In your Nexmo account settings under API settings make sure the HTTP method is set to POST.
- Under Numbers in Nexmo set the SMS webhook URL to `https://(Server Address Here)/message/nexmo`
- Nexmo must be enabled in Fax Server settings if it has been disabled.

Expand Down
25 changes: 12 additions & 13 deletions Resources/Views/account.leaf
Original file line number Diff line number Diff line change
@@ -1,31 +1,29 @@
#extend("base")

#export("title") { Account }
#export("css") {
#set("title") { Account }
#set("css") {
<link rel="stylesheet" href="/vendors/css/intlTelInput.css">
}
#export("scripts") {
#set("scripts") {
<script src="/vendors/js/intlTelInput.js"></script>
<script>
$("#()phoneNumber").intlTelInput({
$("#phoneNumber").intlTelInput({
autoPlaceholder: "off",
initialCountry: "auto",
allowDropdown: false,
geoIpLookup: function(callback) {
$.get("https://ipinfo.io", function() {}, "jsonp").always(function(resp) {
$.get("https://ipinfo.io", function() {\}, "jsonp").always(function(resp) {
var countryCode = (resp && resp.country) ? resp.country : "";
callback(countryCode);
});
},
\});
\},
utilsScript: "/vendors/js/utils.js"
});
\});
function Submit(){
document.form.phoneNumber.value = $("#()phoneNumber").intlTelInput("getNumber", intlTelInputUtils.numberFormat.E164);
document.form.phoneNumber.value = $("#phoneNumber").intlTelInput("getNumber", intlTelInputUtils.numberFormat.E164);
return true;
}
\}
</script>
}
#export("main") {
#set("main") {
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="/account">Accounts</a></li>
<li class="breadcrumb-item active">Account</li>
Expand Down Expand Up @@ -111,3 +109,4 @@
</div>
</div>
}
#embed("base")
28 changes: 14 additions & 14 deletions Resources/Views/accounts.leaf
Original file line number Diff line number Diff line change
@@ -1,31 +1,30 @@
#extend("base")

#export("title") { Accounts }
#export("css") {
#set("title") { Accounts }
#set("css") {
<link rel="stylesheet" href="/vendors/css/intlTelInput.css">
}
#export("scripts") {
#set("scripts") {
<script src="/vendors/js/intlTelInput.js"></script>

<script>
$("#()phoneNumber").intlTelInput({
$("#phoneNumber").intlTelInput({
autoPlaceholder: "off",
initialCountry: "auto",
allowDropdown: false,
geoIpLookup: function(callback) {
$.get("https://ipinfo.io", function() {}, "jsonp").always(function(resp) {
$.get("https://ipinfo.io", function() {\}, "jsonp").always(function(resp) {
var countryCode = (resp && resp.country) ? resp.country : "";
callback(countryCode);
});
},
\});
\},
utilsScript: "/vendors/js/utils.js"
});
\});
function Submit(){
document.form.phoneNumber.value = $("#()phoneNumber").intlTelInput("getNumber", intlTelInputUtils.numberFormat.E164);
document.form.phoneNumber.value = $("#phoneNumber").intlTelInput("getNumber", intlTelInputUtils.numberFormat.E164);
return true;
}
\}
</script>
}
#export("main") {
#set("main") {
<ol class="breadcrumb">
<li class="breadcrumb-item active">Accounts</li>
</ol>
Expand All @@ -47,7 +46,7 @@
</tr>
</thead>
<tbody>
#raw(tableData)
#get(tableData)
</tbody>
</table>
</div>
Expand Down Expand Up @@ -115,3 +114,4 @@
</div>
</div>
}
#embed("base")
Loading

0 comments on commit ad0589d

Please sign in to comment.