Skip to content

Commit

Permalink
4.0.0 gm (#2278)
Browse files Browse the repository at this point in the history
* gm

* update Authenticator protocol to return Void (#2260)

* update Authenticator protocol to return Void

* cleanup deprecations

* Make testing with password easier with Password Service (#2275)

* Add Password Hasher protocol

* Add Password hasher and verifier services

* Add test for the BCrypt service

* Improve the PlaintextVerifier and test the service

* Improve the API

* Stop the tests crashing

* Allow Client to be Changed (#2279)

* First stab at making the client configurable

* Wrapped HTTPClient in our own wrapped type and get the tests working

* Remove commented out code

* Update Sources/Vapor/Client/Application+Client.swift

Co-Authored-By: Jari (LotU) <j.koopman@jarict.nl>

* Rename WrappedClient into AsyncHTTPClient

* Backfill test to ensure configuration can't be changed

* Make it clear in the code that config can't be changed

* Migrate client tests into their own file

* Add app.client back and expose AsyncHTTPClient's driver

* Move configuration down a layer to AsyncHTTPClient

Co-authored-by: Jari (LotU) <j.koopman@jarict.nl>

* update verifier

* client cleanup

* server override

* server tests

* server + client cleanup

* rm deprecations

* folder cleanup

* test folder cleanup

* remove dead code

* remove apt script

* Allow nested route building to throw and rethrow (#2148)

* rethrows test

* Foundation.url query support, fixes #2191

* AllowOriginSetting adjustments (#2053)

* fixes #2034

* remove content-type check in JSONDecoder content conformance, fixes #2065

* test #2130

* fix leaking promise when port too large, fixes #2245

* port int.max

* add SameSite=None, fixes #2259

* custom client test

* move docs

* remove utils folder

* 2020 license

* use swift coc

* update contributing

* add new sponsors

* remove inactive

* api docs cleanup

* Minor grammatical edits (GM Branch) (#2290)

* Added needed apostrophes

* Removed unneeded apostrophes

* Create Environment+Process.swift

Created a new file Environment+Process.swift to replace/rename Environment+Proccess.swift [sic]

* Delete Environment+Proccess.swift

Removed Environment+Proccess.swift and replaced with Environment+Process.swift to correct the spelling in the file name

* sessions updates

* session updates

* Fix tests

* DefaultResponder fixes

* Fix the "Server starting on ..." message to report the actual hostname and port being served. (#2296)

* Async password verifier (#2284)

* async password verifier

* possibility to both use sync and async on request

* fix indent

* fixes

* refactor tests

* test async uses provider2

* password updates

* fix max body size

* fix chunk test

* fix ws max frame size

* docs updates

* fix devel configure

Co-authored-by: Tim <0xTim@users.noreply.github.com>
Co-authored-by: Jari (LotU) <j.koopman@jarict.nl>
Co-authored-by: Nicolas Bachschmidt <nicolas@nunk.net>
Co-authored-by: Caleb <cak@fastmail.com>
Co-authored-by: Hayden McCabe <hayden@haydenmccabe.com>
Co-authored-by: Gwynne Raskind <gwynne@darkrainfall.org>
Co-authored-by: Mads Odgaard <mads@madsodgaard.com>
  • Loading branch information
8 people committed Apr 9, 2020
1 parent cb4537a commit 633b2a8
Show file tree
Hide file tree
Showing 131 changed files with 3,051 additions and 2,740 deletions.
1 change: 1 addition & 0 deletions .github/code_of_conduct.md
@@ -0,0 +1 @@
Vapor adopts Swift's code of conduct: https://swift.org/community/#code-of-conduct
15 changes: 3 additions & 12 deletions Docs/contributing.md → .github/contributing.md
Expand Up @@ -2,22 +2,13 @@

👋 Welcome to the Vapor team!

## Linux

You can use the included bash script to test your PR on macOS and Linux before submitting (you must have Docker installed).

```sh
Utilities/contributor_test.sh
```

## Testing

Once in Xcode, select the `Vapor-Package` scheme and use `CMD+U` to run the tests.
Once in Xcode, select the `vapor-Package` scheme and use `CMD+U` to run the tests.

You can use the `Boilerplate...` and `Development` executables for testing out your code.
You can use the `Development` executables for testing out your code.

When adding new tests (please do 😁), don't forget to add the method name to the `allTests` array.
If you add a new `XCTestCase` subclass, make sure to add it to the `Tests/LinuxMain.swift` file.
Don't forget to add tests for your new features.

If you are fixing a single GitHub issue in particular, you can add a test named `testGH<issue number>` to ensure
that your fix is working. This will also help prevent regression.
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
46 changes: 0 additions & 46 deletions Docs/code_of_conduct.md

This file was deleted.

2 changes: 1 addition & 1 deletion LICENSE
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2018 Qutheory, LLC
Copyright (c) 2020 Qutheory, LLC

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
8 changes: 4 additions & 4 deletions Package.swift
Expand Up @@ -15,16 +15,16 @@ let package = Package(
.package(url: "https://github.com/swift-server/async-http-client.git", from: "1.0.0"),

// Sugary extensions for the SwiftNIO library
.package(url: "https://github.com/vapor/async-kit.git", from: "1.0.0-rc.1"),
.package(url: "https://github.com/vapor/async-kit.git", from: "1.0.0"),

// 💻 APIs for creating interactive CLI tools.
.package(url: "https://github.com/vapor/console-kit.git", from: "4.0.0-rc.1"),
.package(url: "https://github.com/vapor/console-kit.git", from: "4.0.0"),

// 🔑 Hashing (BCrypt, SHA2, HMAC), encryption (AES), public-key (RSA), and random data generation.
.package(url: "https://github.com/apple/swift-crypto.git", from: "1.0.0"),

// 🚍 High-performance trie-node router.
.package(url: "https://github.com/vapor/routing-kit.git", from: "4.0.0-rc.1"),
.package(url: "https://github.com/vapor/routing-kit.git", from: "4.0.0"),

// 💥 Backtraces for Swift on Linux
.package(url: "https://github.com/swift-server/swift-backtrace.git", from: "1.1.1"),
Expand All @@ -48,7 +48,7 @@ let package = Package(
.package(url: "https://github.com/apple/swift-metrics.git", from: "2.0.0"),

// WebSocket client library built on SwiftNIO
.package(url: "https://github.com/vapor/websocket-kit.git", from: "2.0.0-rc.1"),
.package(url: "https://github.com/vapor/websocket-kit.git", from: "2.0.0"),
],
targets: [
// C helpers
Expand Down
60 changes: 48 additions & 12 deletions README.md
Expand Up @@ -81,6 +81,12 @@ Support Vapor's development by [becoming a backer](https://github.com/users/tann
href="https://github.com/Yasumoto">
<img src="https://avatars3.githubusercontent.com/u/48383?s=120" width="60px">
</a>
<a
data-amt="25"
data-since="3/11/20"
href="https://github.com/hjuraev">
<img src="https://avatars3.githubusercontent.com/u/5513926?s=120" width="60px">
</a>
<a
data-amt="10"
data-since="10/14/19"
Expand All @@ -99,12 +105,6 @@ Support Vapor's development by [becoming a backer](https://github.com/users/tann
href="https://github.com/ScottRobbins">
<img src="https://avatars3.githubusercontent.com/u/6894359?s=120" width="60px">
</a>
<a
data-amt="10"
data-since="10/15/19"
href="https://github.com/ksmandersen">
<img src="https://avatars3.githubusercontent.com/u/178181?s=120" width="60px">
</a>
<a
data-amt="10"
data-since="10/15/19"
Expand All @@ -117,6 +117,24 @@ Support Vapor's development by [becoming a backer](https://github.com/users/tann
href="https://github.com/mikkelu">
<img src="https://avatars3.githubusercontent.com/u/17051694?s=120" width="60px">
</a>
<a
data-amt="10"
data-since="2/28/20"
href="https://github.com/timothymiko">
<img src="https://avatars3.githubusercontent.com/u/2555306?s=120" width="60px">
</a>
<a
data-amt="10"
data-since="2/28/20"
href="https://github.com/jstevison">
<img src="https://avatars3.githubusercontent.com/u/149974?s=120" width="60px">
</a>
<a
data-amt="10"
data-since="4/1/20"
href="https://github.com/jstorm31">
<img src="https://avatars3.githubusercontent.com/u/16023539?s=120" width="60px">
</a>
<a
data-amt="5"
data-since="10/15/19"
Expand Down Expand Up @@ -159,12 +177,6 @@ Support Vapor's development by [becoming a backer](https://github.com/users/tann
href="https://github.com/Mordil">
<img src="https://avatars3.githubusercontent.com/u/3506776?s=120" width="60px">
</a>
<a
data-amt="5"
data-since="11/09/19"
href="https://github.com/danielinoa">
<img src="https://avatars3.githubusercontent.com/u/972877?s=120" width="60px">
</a>
<a
data-amt="5"
data-since="11/14/19"
Expand All @@ -189,6 +201,30 @@ Support Vapor's development by [becoming a backer](https://github.com/users/tann
href="https://github.com/jordanebelanger">
<img src="https://avatars3.githubusercontent.com/u/1856085?s=120" width="60px">
</a>
<a
data-amt="5"
data-since="12/21/19"
href="https://github.com/StefanCosminR">
<img src="https://avatars3.githubusercontent.com/u/17311242?s=120" width="60px">
</a>
<a
data-amt="5"
data-since="2/1/20"
href="https://github.com/piers12">
<img src="https://avatars3.githubusercontent.com/u/37227905?s=120" width="60px">
</a>
<a
data-amt="5"
data-since="2/26/20"
href="https://github.com/iq3addLi">
<img src="https://avatars3.githubusercontent.com/u/16850104?s=120" width="60px">
</a>
<a
data-amt="5"
data-since="3/20/20"
href="https://github.com/lmcd">
<img src="https://avatars3.githubusercontent.com/u/363540?s=120" width="60px">
</a>
<a
data-amt="5"
data-since="04/07/20"
Expand Down
9 changes: 0 additions & 9 deletions Sources/Development/app.swift

This file was deleted.

8 changes: 4 additions & 4 deletions Sources/Development/configure.swift
@@ -1,11 +1,11 @@
import Vapor

public func configure(_ app: Application) throws {
app.server.configuration.hostname = "127.0.0.1"
app.http.server.configuration.hostname = "127.0.0.1"
switch app.environment {
case .tls:
app.server.configuration.port = 8443
try app.server.configuration.tlsConfiguration = .forServer(
app.http.server.configuration.port = 8443
try app.http.server.configuration.tlsConfiguration = .forServer(
certificateChain: [
.certificate(.init(
file: "/Users/tanner0101/dev/vapor/net-kit/certs/cert.pem",
Expand All @@ -15,7 +15,7 @@ public func configure(_ app: Application) throws {
privateKey: .file("/Users/tanner0101/dev/vapor/net-kit/certs/key.pem")
)
default:
app.server.configuration.port = 8080
app.http.server.configuration.port = 8080
}

// routes
Expand Down
17 changes: 8 additions & 9 deletions Sources/Development/routes.swift
Expand Up @@ -120,17 +120,16 @@ public func routes(_ app: Application) throws {
}

let sessions = app.grouped("sessions")
.grouped(SessionsMiddleware(session: app.sessions.driver))
sessions.get("get") { req -> String in
return req.session.data["name"] ?? "n/a"
.grouped(app.sessions.middleware)
sessions.get("set", ":value") { req -> HTTPStatus in
req.session.data["name"] = req.parameters.get("value")
return .ok
}
sessions.get("set", ":value") { req -> String in
let name = req.parameters.get("value")!
req.session.data["name"] = name
return name
sessions.get("get") { req -> String in
req.session.data["name"] ?? "n/a"
}
sessions.get("del") { req -> String in
req.destroySession()
req.session.destroy()
return "done"
}

Expand Down Expand Up @@ -197,7 +196,7 @@ struct TestError: AbortError {
line: UInt = #line,
column: UInt = #column,
range: Range<UInt>? = nil,
stackTrace: StackTrace = .capture()
stackTrace: StackTrace? = .capture()
) {
self.source = .init(
file: file,
Expand Down
14 changes: 11 additions & 3 deletions Sources/Vapor/Application.swift
@@ -1,7 +1,5 @@
import Backtrace

public protocol LockKey { }

public final class Application {
public var environment: Environment
public let eventLoopGroupProvider: EventLoopGroupProvider
Expand All @@ -21,6 +19,7 @@ public final class Application {
self.handlers.append(handler)
}
}

public var lifecycle: Lifecycle

public final class Locks {
Expand All @@ -46,7 +45,9 @@ public final class Application {
}
}
}

public var locks: Locks

public var sync: Lock {
self.locks.main
}
Expand Down Expand Up @@ -77,11 +78,16 @@ public final class Application {
self.isBooted = false
self.core.initialize()
self.views.initialize()
self.passwords.use(.bcrypt)
self.sessions.initialize()
self.sessions.use(.memory)
self.responder.initialize()
self.responder.use(.default)
self.commands.use(self.server.command, as: "serve", isDefault: true)
self.servers.initialize()
self.servers.use(.http)
self.clients.initialize()
self.clients.use(.http)
self.commands.use(self.servers.command, as: "serve", isDefault: true)
self.commands.use(RoutesCommand(), as: "routes")
// Load specific .env first since values are not overridden.
self.loadDotEnv(named: ".env.\(self.environment.name)")
Expand Down Expand Up @@ -162,3 +168,5 @@ public final class Application {
}
}
}

public protocol LockKey { }

0 comments on commit 633b2a8

Please sign in to comment.