Skip to content
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

v2.7.0 #986

Merged
merged 59 commits into from
Jun 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
914cc50
#901: Multiple endpoint support for SMTP, plus Implicit and Explicit …
Badgerati Apr 7, 2022
5128ec5
#901: get default port for explicit tls on smtp, change Command to an…
Badgerati Apr 9, 2022
d385d5b
#901: fix explicit tls so send-mailmessage works, and update docs
Badgerati Apr 9, 2022
432a478
Merge pull request #959 from Badgerati/Issue-901
Badgerati Apr 9, 2022
99e31f6
add 2 simple missing smtp commands
Badgerati Apr 10, 2022
d399cce
Merge pull request #960 from Badgerati/extra-smtp-commands
Badgerati Apr 10, 2022
7bd567c
#958: some smtp attachment boundaries can include double quotes
Badgerati Apr 11, 2022
5d8e9e0
#957: fix for some openapi props not being rendered
Badgerati Apr 11, 2022
7e2b045
#957: clean-up
Badgerati Apr 11, 2022
785e5aa
#902: overhaul of the hidden TCP server type
Badgerati Apr 12, 2022
e03d845
#902: remove tcp from handlers
Badgerati Apr 12, 2022
f55d96c
#902: fix tests, update psd1
Badgerati Apr 13, 2022
4983176
#902: add new tcp server docs, and move smtp docs to new Servers section
Badgerati Apr 15, 2022
7113d3c
#902: fixes from testing, and docs updates
Badgerati Apr 16, 2022
36553a5
#902: fixes from reviewing pr
Badgerati Apr 16, 2022
e2766ec
Merge pull request #961 from Badgerati/Issue-958
Badgerati Apr 16, 2022
165b394
Merge pull request #962 from Badgerati/Issue-957
Badgerati Apr 16, 2022
7558a3e
#902: slight tweak to docs
Badgerati Apr 17, 2022
23b1927
Merge pull request #963 from Badgerati/Issue-902
Badgerati Apr 17, 2022
a0d6b5d
#895: initial work to have pode connect to websockets as a client
Badgerati Apr 28, 2022
5a9ecc5
#895: fixes for text encoding, and adhoc connecting
Badgerati Apr 29, 2022
7d2f20f
#895: test fixes, cleanup, and some tweaks
Badgerati May 4, 2022
4a9573d
#895: separate out remove and disconnect functions
Badgerati May 12, 2022
2e035b1
#895: add extra verbose logging, and fix websocket close hanging
Badgerati May 22, 2022
5cf5d47
#895: add initial docs
Badgerati May 23, 2022
54df2aa
Fixes for client websocket disconnecting, and errounous pong data
Badgerati May 29, 2022
f1659a5
change ws exception to debug output
Badgerati May 29, 2022
edded58
Merge pull request #968 from Badgerati/Issue-895
Badgerati May 29, 2022
d530588
#954: add -AllowAnon switch to routes, and new Test-PodeAuthUser to s…
Badgerati May 30, 2022
f06c1b3
#954: add docs
Badgerati May 30, 2022
533dc05
Merge pull request #970 from Badgerati/Issue-954
Badgerati May 30, 2022
675a0b4
#965: fix for importing ps1 files
Badgerati May 30, 2022
efd6d2d
Merge pull request #971 from Badgerati/Issue-965
Badgerati May 30, 2022
6a799c4
#956: fix for importing funcs with inline parameters
Badgerati May 30, 2022
3234362
Merge pull request #972 from Badgerati/Issue-956
Badgerati May 30, 2022
416bbf4
quick doc tweak
Badgerati May 30, 2022
cedad64
add initial support for route groups
Badgerati May 31, 2022
084ab8f
add function summarys
Badgerati Jun 1, 2022
342a105
docs for route grouping
Badgerati Jun 1, 2022
6bcb44a
Merge pull request #976 from Badgerati/route-group
Badgerati Jun 2, 2022
84814f2
#974: add Position=0 to response funcs
Badgerati Jun 2, 2022
0fd5896
add * level for errors to enable everything
Badgerati Jun 2, 2022
5b8b475
minor fix for docker links in docs
Badgerati Jun 2, 2022
cc52974
add switch for AccessControl to create global Options route
Badgerati Jun 2, 2022
76ef78c
testing new icon
Badgerati Jun 3, 2022
e3f12e2
css?
Badgerati Jun 3, 2022
49251da
just show icon
Badgerati Jun 3, 2022
d07413f
add png icon, and extra donations sites
Badgerati Jun 3, 2022
e81ebab
Merge pull request #978 from Badgerati/new-icon-testing
Badgerati Jun 3, 2022
f85d39c
minor readme fix
Badgerati Jun 4, 2022
2592684
#984: bump versions in docker
Badgerati Jun 12, 2022
301c951
Merge pull request #981 from Badgerati/opts-route
Badgerati Jun 12, 2022
e99943a
Merge pull request #982 from Badgerati/all-errors
Badgerati Jun 12, 2022
0cd1d0e
Merge pull request #983 from Badgerati/Issue-974
Badgerati Jun 12, 2022
005d541
#984: helps to spell
Badgerati Jun 12, 2022
4cbd7a0
#984: only windows/linux
Badgerati Jun 12, 2022
0d0cf46
Merge pull request #985 from Badgerati/Issue-984
Badgerati Jun 13, 2022
0e893f9
add missing function summaries
Badgerati Jun 21, 2022
da92730
add v2.7.0 release notes
Badgerati Jun 22, 2022
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
2 changes: 2 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# These are supported funding model platforms

github: [Badgerati]
ko_fi: badgerati
custom: ["https://www.paypal.me/badgerati"]
8 changes: 7 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,10 @@ jobs:
shell: pwsh
run: |
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Invoke-Build Test
Invoke-Build Test

- name: Test docker builds
shell: pwsh
run: |
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Invoke-Build DockerPack -Version '0.0.0'
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM mcr.microsoft.com/powershell:7.2.1-ubuntu-20.04
FROM mcr.microsoft.com/powershell:7.2-ubuntu-20.04
LABEL maintainer="Matthew Kelly (Badgerati)"
RUN mkdir -p /usr/local/share/powershell/Modules/Pode
COPY ./pkg/ /usr/local/share/powershell/Modules/Pode
23 changes: 14 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
# <img src="https://github.com/Badgerati/Pode/blob/develop/images/icon-transparent.png?raw=true" width="30" style="margin-bottom:-5px;margin-right:-3px" /> Pode
<p align="center">
<img src="https://github.com/Badgerati/Pode/raw/develop/images/icon-new.svg?raw=true" width="250" />
</p>

[![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/Badgerati/Pode/master/LICENSE.txt)
[![Documentation](https://img.shields.io/github/v/release/badgerati/pode?label=docs)](https://badgerati.github.io/Pode)
[![Documentation](https://img.shields.io/github/v/release/badgerati/pode?label=docs&logo=readthedocs&logoColor=white)](https://badgerati.github.io/Pode)
[![GitHub Actions](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2Fbadgerati%2Fpode%2Fbadge&style=flat&label=GitHub)](https://actions-badge.atrox.dev/badgerati/pode/goto)
[![Code Coverage](https://coveralls.io/repos/github/Badgerati/Pode/badge.svg?branch=develop)](https://coveralls.io/github/Badgerati/Pode?branch=develop)
[![Discord](https://img.shields.io/discord/887398607727255642)](https://discord.gg/fRqeGcbF6h)
[![GitHub Sponsors](https://img.shields.io/github/sponsors/Badgerati?color=%23ff69b4&logo=github&style=flat&label=Sponsers)](https://github.com/sponsors/Badgerati)
[![Discord](https://img.shields.io/discord/887398607727255642?logo=discord&logoColor=white)](https://discord.gg/fRqeGcbF6h)

[![Chocolatey](https://img.shields.io/chocolatey/dt/pode.svg?label=Chocolatey&colorB=a1301c)](https://chocolatey.org/packages/pode)
[![PowerShell](https://img.shields.io/powershellgallery/dt/pode.svg?label=PowerShell&colorB=085298)](https://www.powershellgallery.com/packages/Pode)
[![Docker](https://img.shields.io/docker/pulls/badgerati/pode.svg?label=Docker)](https://hub.docker.com/r/badgerati/pode/)
[![Chocolatey](https://img.shields.io/chocolatey/dt/pode.svg?label=Chocolatey&colorB=a1301c&logo=chocolatey&logoColor=white)](https://chocolatey.org/packages/pode)
[![PowerShell](https://img.shields.io/powershellgallery/dt/pode.svg?label=PowerShell&colorB=085298&logo=powershell&logoColor=white)](https://www.powershellgallery.com/packages/Pode)
[![Docker](https://img.shields.io/docker/pulls/badgerati/pode.svg?label=Docker&logoColor=white&logo=docker)](https://hub.docker.com/r/badgerati/pode/)

[![GitHub Sponsors](https://img.shields.io/github/sponsors/Badgerati?color=%23ff69b4&logo=github&style=flat&label=Sponsers)](https://github.com/sponsors/Badgerati)
[![Ko-fi](https://img.shields.io/static/v1?logo=kofi&label=Ko-fi&logoColor=white&message=Buy+me+a+coffee&color=ff5f5f)](https://ko-fi.com/badgerati)
[![PayPal](https://img.shields.io/static/v1?logo=paypal&label=PayPal&logoColor=white&message=Donate&color=00457C)](https://paypal.me/badgerati)

> 💝 A lot of my free time, evenings, and weekends goes into making Pode happen; please do consider sponsoring as it will really help! 😊

Pode is a Cross-Platform framework for creating web servers to host [REST APIs](https://badgerati.github.io/Pode/Tutorials/Routes/Overview/), [Web Pages](https://badgerati.github.io/Pode/Tutorials/Routes/Examples/WebPages/), and [SMTP/TCP](https://badgerati.github.io/Pode/Hosting/SmtpServer/) Servers. Pode also allows you to render dynamic files using [`.pode`](https://badgerati.github.io/Pode/Tutorials/Views/Pode/) files, which are just embedded PowerShell, or other [Third-Party](https://badgerati.github.io/Pode/Tutorials/Views/ThirdParty/) template engines. Plus many more features, including [Azure Functions](https://badgerati.github.io/Pode/Hosting/AzureFunctions/) and [AWS Lambda](https://badgerati.github.io/Pode/Hosting/AwsLambda/) support!
Pode is a Cross-Platform framework for creating web servers to host [REST APIs](https://badgerati.github.io/Pode/Tutorials/Routes/Overview/), [Web Pages](https://badgerati.github.io/Pode/Tutorials/Routes/Examples/WebPages/), and [SMTP/TCP](https://badgerati.github.io/Pode/Servers/) Servers. Pode also allows you to render dynamic files using [`.pode`](https://badgerati.github.io/Pode/Tutorials/Views/Pode/) files, which are just embedded PowerShell, or other [Third-Party](https://badgerati.github.io/Pode/Tutorials/Views/ThirdParty/) template engines. Plus many more features, including [Azure Functions](https://badgerati.github.io/Pode/Hosting/AzureFunctions/) and [AWS Lambda](https://badgerati.github.io/Pode/Hosting/AwsLambda/) support!

<p align="center">
<img src="https://github.com/Badgerati/Pode/blob/develop/images/example_code_2.png?raw=true" />
Expand All @@ -40,7 +45,7 @@ Then navigate to `http://127.0.0.1:8000` in your browser.
* Azure Functions, AWS Lambda, and IIS support
* OpenAPI, Swagger, and ReDoc support
* Listen on a single or multiple IP address/hostnames
* Cross-platform support for HTTP, HTTPS, TCP and SMTP
* Cross-platform support for HTTP(S), SMTP(S), and TCP(S)
* Cross-platform support for WebSockets, including secure WebSockets
* Host REST APIs, Web Pages, and Static Content (with caching)
* Support for custom error pages
Expand Down
2 changes: 1 addition & 1 deletion alpine.dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM mcr.microsoft.com/powershell:7.2.1-alpine-3.14-20211209
FROM mcr.microsoft.com/powershell:7.2-alpine-3.14
LABEL maintainer="Matthew Kelly (Badgerati)"
RUN mkdir -p /usr/local/share/powershell/Modules/Pode
COPY ./pkg/ /usr/local/share/powershell/Modules/Pode
2 changes: 1 addition & 1 deletion arm32.dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM mcr.microsoft.com/powershell:7.2.1-arm32v7-ubuntu-18.04-20211209
FROM mcr.microsoft.com/powershell:7.2-arm32v7-ubuntu-18.04
LABEL maintainer="Matthew Kelly (Badgerati)"
RUN mkdir -p /usr/local/share/powershell/Modules/Pode
COPY ./pkg/ /usr/local/share/powershell/Modules/Pode
6 changes: 3 additions & 3 deletions docs/Getting-Started/Installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Install-Module -Name Pode
[![Docker](https://img.shields.io/docker/stars/badgerati/pode.svg?label=Stars)](https://hub.docker.com/r/badgerati/pode/)
[![Docker](https://img.shields.io/docker/pulls/badgerati/pode.svg?label=Pulls)](https://hub.docker.com/r/badgerati/pode/)

Pode can run on *nix environments, therefore it only makes sense for there to be Docker images for you to use! The images use PowerShell v7.2.1 on either an Ubuntu Focal image (default), an Alpine image, or an ARM32 image (for Raspberry Pis).
Pode can run on *nix environments, therefore it only makes sense for there to be Docker images for you to use! The images use PowerShell v7.2 on either an Ubuntu Focal image (default), an Alpine image, or an ARM32 image (for Raspberry Pis).

* To pull down the latest Pode image you can do:

Expand Down Expand Up @@ -73,7 +73,7 @@ docker pull badgerati/pode:latest-arm32
docker pull badgerati/pode:2.2.2-arm32
```

Once pulled, you can [view here](../Docker) on how to use the image.
Once pulled, you can [view here](../../Hosting/Docker) on how to use the image.

## GitHub Package Registry

Expand Down Expand Up @@ -109,7 +109,7 @@ docker pull docker.pkg.github.com/badgerati/pode/pode:latest-arm32
docker pull docker.pkg.github.com/badgerati/pode/pode:2.2.2-arm32
```

Once pulled, you can [view here](../Docker) on how to use the image.
Once pulled, you can [view here](../../Hosting/Docker) on how to use the image.

## Using the Module

Expand Down
2 changes: 1 addition & 1 deletion docs/Getting-Started/Migrating/0X-to-1X.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ The `gui` function use to take a Name with a hashtable of options. This function

## Handlers

([Tutorial](../../../Hosting/SmtpServer))
([Tutorial](../../../Servers/SMTP))

The biggest change the Handlers is that you can now create multiple handlers for each of SMTP, TCP and Service - rather than just one. With this, the new [`Add-PodeHandler`](../../../Functions/Handlers/Add-PodeHandler) requires a `-Name` to be supplied.

Expand Down
2 changes: 1 addition & 1 deletion docs/Hosting/AwsLambda.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ Start-PodeServer -Request $LambdaInput -ServerlessType AwsLambda -RootPath '/tmp

### Static Content

Unlike Azure Functions, static content in AWS Functions can be served up in the normal way - assuming your function can recieve multiple routes.
Unlike Azure Functions, static content in AWS Functions can be served up in the normal way - assuming your function can receive multiple routes.

For example, if you have a CSS stylesheet at `/tmp/www/styles/main.css.pode`, then your `index.pode` view would get this as such:

Expand Down
4 changes: 2 additions & 2 deletions docs/Hosting/Docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Pode has a Docker image that you can use to host your server, for instructions on pulling these images you can [look here](../../Installation).

The images use PowerShell v7.2.1 on either an Ubuntu Focal (default), Alpine, or ARM32 image.
The images use PowerShell v7.2 on either an Ubuntu Focal (default), Alpine, or ARM32 image.

## Images

Expand All @@ -11,7 +11,7 @@ The images use PowerShell v7.2.1 on either an Ubuntu Focal (default), Alpine, or

### Default

The default Pode image is an Ubuntu Focal image with PowerShell v7.2.1 and Pode installed. An example of using this image in your Dockerfile could be as follows:
The default Pode image is an Ubuntu Focal image with PowerShell v7.2 and Pode installed. An example of using this image in your Dockerfile could be as follows:

```dockerfile
# pull down the pode image
Expand Down
45 changes: 37 additions & 8 deletions docs/Hosting/SmtpServer.md → docs/Servers/SMTP.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
# SMTP Server
# SMTP

Pode has an inbuilt SMTP server for receiving Email which automatically creates a TCP listener on port 25 - unless you specify a different port via the [`Add-PodeEndpoint`](../../Functions/Core/Add-PodeEndpoint) function.

Unlike with web servers that use the Route functions, SMTP servers use the Handler functions, which let you specify logic for handling responses from TCP streams.
Pode has an inbuilt SMTP server for receiving emails, with support for non-TLS as well as implicit and explicit TLS. Unlike with web servers that use the Route functions, an SMTP server use the Handler functions, which let you specify logic for handling responses from TCP streams.

!!! tip
You can setup multiple different Handlers to run different logic for one Email.
You can setup multiple different Handlers to run different logic for one email.

## Usage

To create a Handler for the inbuilt SMTP server you can use the following example:
To create a Handler for the SMTP server you can use the following example:

```powershell
Start-PodeServer {
Expand All @@ -23,14 +21,43 @@ Start-PodeServer {
}
```

Starting this server will listen for incoming email on `localhost:25`. The Handler will have access to the `$SmtpEvent` object (see below), which contains information about the Email.
Starting this server will listen for incoming email on `localhost:25`. The Handler will have access to an `$SmtpEvent` object (see below), which contains information about the received email.

An example of sending Email to the above server via `Send-MailMessage`:
An example of sending an email to the above server via `Send-MailMessage`:

```powershell
Send-MailMessage -SmtpServer localhost -To 'to@example.com' -From 'from@example.com' -Body 'Hello' -Subject 'Hi there' -Port 25
```

## TLS

You can enable TLS for your endpoints by supplying the normal relevant certificates parameters on [`Add-PodeEndpoint`](../../Functions/Core/Add-PodeEndpoint), and setting the `-Protocol` to `Smtps`. You can also toggle between implicit and explicit TLS by using the `-TlsMode` parameter.

By default the TLS mode is implicit, and the default port for implicit TLS is 465; for explicit TLS it's 587. These can of course be customised using `-Port`.

```powershell
Start-PodeServer {
Add-PodeEndpoint -Address * -Protocol Smtps -SelfSigned -TlsMode Explicit
Add-PodeEndpoint -Address * -Protocol Smtps -SelfSigned -TlsMode Implicit

Add-PodeHandler -Type Smtp -Name 'Main' -ScriptBlock {
Write-Host $SmtpEvent.Email.From
Write-Host $SmtpEvent.Email.To
Write-Host $SmtpEvent.Email.Body
}
}
```

.NET only supports explicit TLS, so an example of sending an email to the explicit TLS endpoint, on port 587, is as follows:

```powershell
# if using a self signed cert, make sure to run the below
[System.Net.ServicePointManager]::ServerCertificateValidationCallback = { return $true }

# send the email
Send-MailMessage -SmtpServer localhost -To 'to@pode.com' -From 'from@pode.com' -Body 'Hello' -Subject 'Hi there' -Port 587 -UseSSL
```

## Attachments

The SMTP server also accepts attachments, which are available in a Handler via `$SmtpEvent.Email.Attachments`. This property contains a list of available attachments on the Email, each attachment has a `Name` and `Bytes` properties - the latter being the raw byte content of the attachment.
Expand All @@ -55,6 +82,8 @@ The SMTP Handler will be passed the `$SmtpEvent` object, that contains the Reque
| Response | object | The raw Response object |
| Lockable | hashtable | A synchronized hashtable that can be used with `Lock-PodeObject` |
| Email | hashtable | An object containing data from the email, as seen below |
| Endpoint | hashtable | Contains the Address and Protocol of the endpoint being hit - such as "pode.example.com" or "127.0.0.2", or HTTP or HTTPS for the Protocol |
| Timestamp | datetime | The current date and time of the Request |

### Email

Expand Down
Loading