Skip to content

Commit cd2a093

Browse files
committed
update docs according to new message template changes
1 parent 0703492 commit cd2a093

19 files changed

Lines changed: 233 additions & 189 deletions

File tree

.github/templates/README.template.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,6 @@ endpoint restrictions, placeholders, flexible configuration
5050
> [!IMPORTANT]
5151
> Check out the [**Official Documentation**](https://codeshelldev.github.io/secured-signal-api) for up-to-date instructions and additional content!
5252
53-
> [!WARNING]
54-
> We are slowly moving away from this README and instead are trying to make the [**Official Documentation**](https://codeshelldev.github.io/secured-signal-api) the only source of truth
55-
5653
- [Getting Started](#getting-started)
5754
- [Usage](#usage)
5855
- [Features](#features)
@@ -72,6 +69,7 @@ endpoint restrictions, placeholders, flexible configuration
7269
- [Port](https://codeshelldev.github.io/secured-signal-api/docs/configuration/port)
7370
- [Hostnames](https://codeshelldev.github.io/secured-signal-api/docs/configuration/hostnames)
7471
- [Auth Methods](https://codeshelldev.github.io/secured-signal-api/docs/configuration/auth)
72+
- [CORS](https://codeshelldev.github.io/secured-signal-api/docs/configuration/cors)
7573
- [Reverse Proxy](https://codeshelldev.github.io/secured-signal-api/docs/reverse-proxy)
7674
- [Integrations](https://codeshelldev.github.io/secured-signal-api/docs/integrations)
7775
- [Contributing](#contributing)

docs/configuration/examples/config.yml

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,25 @@ settings:
2222
X-Custom: "xyz"
2323

2424
message:
25+
messageTemplate: |
26+
You've got a Notification:
27+
{{ @message }}
28+
At {{ @data.timestamp }} on {{ @data.date }}.
29+
Send using {{ .NUMBER }}.
30+
2531
templating:
26-
messageTemplate: |
27-
You've got a Notification:
28-
{{ @message }}
29-
At {{ @data.timestamp }} on {{ @data.date }}.
30-
Send using {{ .NUMBER }}.
32+
body: true
33+
query: true
34+
path: true
35+
36+
scheduling:
37+
enabled: true
38+
maxHorizon: 10d
39+
40+
injecting:
41+
urlToBody:
42+
query: true
43+
path: true
3144

3245
variables:
3346
number: "+123400001"
Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,24 @@
11
settings:
22
message:
3-
templating:
4-
messageTemplate: |
5-
{{- $greeting := "Hello" -}}
6-
{{ $greeting }}, {{ @name }}!
7-
{{ if @age -}}
8-
You are {{ @age }} years old.
9-
{{- else -}}
10-
Age unknown.
11-
{{- end }}
12-
Your friends:
13-
{{- range @friends }}
14-
- {{ . }}
15-
{{- else }}
16-
You have no friends.
17-
{{- end }}
18-
Profile details:
19-
{{- range $key, $value := @profile }}
20-
- {{ $key }}: {{ $value }}
21-
{{- end }}
22-
{{ define "footer" -}}
23-
This is the footer for {{ @name }}.
24-
{{- end }}
25-
{{ template "footer" . -}}
3+
messageTemplate: |
4+
{{- $greeting := "Hello" -}}
5+
{{ $greeting }}, {{ @name }}!
6+
{{ if @age -}}
7+
You are {{ @age }} years old.
8+
{{- else -}}
9+
Age unknown.
10+
{{- end }}
11+
Your friends:
12+
{{- range @friends }}
13+
- {{ . }}
14+
{{- else }}
15+
You have no friends.
16+
{{- end }}
17+
Profile details:
18+
{{- range $key, $value := @profile }}
19+
- {{ $key }}: {{ $value }}
20+
{{- end }}
21+
{{ define "footer" -}}
22+
This is the footer for {{ @name }}.
23+
{{- end }}
24+
{{ template "footer" . -}}

docs/configuration/examples/token.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,11 @@ settings:
1616
X-Custom: "Lorem Ipsum Dolor"
1717

1818
message:
19-
template: # disable
19+
scheduling: # disable
20+
injecting: # disable
21+
templating: # disable
22+
messageTemplate: # disable
23+
2024
variables: # overwrite main config variables
2125
number: "+123400010"
2226
recipients: ["+123400020", "group.id", "user.id"]
@@ -30,6 +34,8 @@ settings:
3034
trustedIPs: # disable
3135
trustedProxies: # disable
3236
ipFilter: # disable
37+
fieldPolicies: # disable
38+
cors: # disable
3339

3440
endpoints: # overwrite main config endpoints
3541
allowed:
@@ -41,7 +47,3 @@ settings:
4147
rateLimiting:
4248
limit: 100
4349
period: 10h # overwrite main config period
44-
45-
fieldPolicies: # disable
46-
47-
cors: # disable
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
title: Message Template
3+
---
4+
5+
# Message Template
6+
7+
**Message Template** are the best way to **structure** and **customize** your messages and can be very useful for **compatibility** between different services.
8+
9+
Configure them by using the `message.messageTemplate` setting in you config.
10+
11+
These support Go templates (see [Formatting](../usage/formatting#templates)) and work by templating the `message` field in the request's body.
12+
13+
Here is an example:
14+
15+
```yaml
16+
+{{{ read "./examples/message-template.yml" }}}
17+
```
18+
19+
+{{{ readArgs "../templates/request-keys.md.gtmpl" "variables" "body" "headers" }}}

docs/configuration/templating.md

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,3 @@ curl -X POST \
2626
-d '{ "number": "{{.NUMBER}}" }' \
2727
'http://sec-signal-api:8880/{{.PATH}}/v1/send?@message={{.MESSAGE}}'
2828
```
29-
30-
## Message Templates
31-
32-
**Message Templates** are the best way to **structure** and **customize** your messages and can be very useful for **compatibility** between different services.
33-
34-
Configure them by using the `message.template` attribute in you config.
35-
36-
These support Go templates (see [Formatting](../usage/formatting#templates)) and work by templating the `message` field in the request's body.
37-
38-
Here is an example:
39-
40-
```yaml
41-
+{{{ read "./examples/message-template.yml" }}}
42-
```
43-
44-
+{{{ readArgs "../templates/request-keys.md.gtmpl" "variables" "body" "headers" }}}

docs/features/features.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Look at this complex template for example:
2121
It can extract needed data from the body and headers to then process them using Go's templating library
2222
and finally output a message packed with so much information.
2323

24-
Head to [Configuration](./configuration/templating#message-template) to see how-to use.
24+
Head to [Configuration](./configuration/message-template) to see how-to use.
2525

2626
## Placeholders
2727

@@ -68,3 +68,11 @@ Limit those rates [here](./configuration/rate-limiting).
6868
**IP Filters** are used for restricting access to **Secured Signal API** by blocking or specifically allowing IPs and CIDR ranges.
6969

7070
Configure your _mini firewall_ [here](./configuration/ip-filter).
71+
72+
## CORS
73+
74+
> Enable secure browser access
75+
76+
**CORS** support allows web applications running in a browser to access the API directly from a different origin.
77+
78+
Learn more about browser integration [here](./configuration/ip-filter).

docs/usage/formatting.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ As a result, any valid Go template string works in Secured Signal API.
1515
> [!NOTE]
1616
> The following features use Go’s templating library:
1717
>
18-
> - [Message Templates](../configuration/templating#message-templates)
18+
> - [Message Templates](../configuration/message-templates)
1919
> - [URL-to-Body Injection](./advanced#url-to-body-injection)
2020
> - [Placeholders](./advanced#placeholders)
2121
Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
message:
22
# prettier-ignore
3-
templating:
4-
messageTemplate: |
5-
**Your Verification Code**
6-
7-
Use the verification code below to complete your sign-in:
8-
9-
{{ @token }}
10-
11-
This code expires in 5 minutes⏱️.
12-
If you didn't request it, you can ignore this message.
3+
messageTemplate: |
4+
**Your Verification Code**
5+
6+
Use the verification code below to complete your sign-in:
7+
8+
{{ @token }}
9+
10+
This code expires in 5 minutes⏱️.
11+
If you didn't request it, you can ignore this message.
Lines changed: 31 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,37 @@
11
message:
22
# prettier-ignore
3-
templating:
4-
messageTemplate: |
5-
{{- /* === ISSUE === */ -}}
6-
{{- if and @issue (ne @issue nil) (not @is_pull) -}}
7-
📝 **#{{@issue.number}} {{@issue.title}}**
8-
{{ if eq @issue.state "open" -}}🟢{{- else if eq @issue.state "closed" -}}🔴{{- else -}}{{@issue.state}}{{- end }} | 👤 {{@sender.full_name}}
9-
🔗 {{@issue.html_url}}
10-
{{- end -}}
3+
messageTemplate: |
4+
{{- /* === ISSUE === */ -}}
5+
{{- if and @issue (ne @issue nil) (not @is_pull) -}}
6+
📝 **#{{@issue.number}} {{@issue.title}}**
7+
{{ if eq @issue.state "open" -}}🟢{{- else if eq @issue.state "closed" -}}🔴{{- else -}}{{@issue.state}}{{- end }} | 👤 {{@sender.full_name}}
8+
🔗 {{@issue.html_url}}
9+
{{- end -}}
1110
12-
{{- /* === PULL REQUEST === */ -}}
13-
{{- if and @pull_request (ne @pull_request nil) -}}
14-
🚀 **#{{@pull_request.number}} {{@pull_request.title}}**
15-
{{ if eq @pull_request.state "open" -}}🟢{{- else if eq @pull_request.state "closed" -}}🔴{{- else if eq @pull_request.state "merged" -}}🟣{{- else -}}{{@pull_request.state}}{{- end }} | 👤 {{@sender.full_name}}
16-
🔗 {{@pull_request.html_url}}
17-
{{- end -}}
11+
{{- /* === PULL REQUEST === */ -}}
12+
{{- if and @pull_request (ne @pull_request nil) -}}
13+
🚀 **#{{@pull_request.number}} {{@pull_request.title}}**
14+
{{ if eq @pull_request.state "open" -}}🟢{{- else if eq @pull_request.state "closed" -}}🔴{{- else if eq @pull_request.state "merged" -}}🟣{{- else -}}{{@pull_request.state}}{{- end }} | 👤 {{@sender.full_name}}
15+
🔗 {{@pull_request.html_url}}
16+
{{- end -}}
1817
19-
{{- /* === COMMIT === */ -}}
20-
{{- if and @commits (gt (len @commits) 0) -}}
21-
📥️ **Push** → *{{@ref}}*
22-
📁 {{@repository.full_name}} | 👤 {{@pusher.full_name}} | 🔢 {{@total_commits}}
23-
{{- range @commits }}
24-
- 🧾 *{{.message}}*
25-
{{- if .added }}
26-
{{- range .added }} ➕ {{.}} {{- end }}
27-
{{- end -}}
28-
{{- if .modified }}
29-
{{- range .modified }} ✏️ {{.}} {{- end }}
30-
{{- end -}}
31-
{{- if .removed }}
32-
{{- range .removed }} ❌ {{.}} {{- end }}
33-
{{- end }}
34-
🔗 {{.url}}
18+
{{- /* === COMMIT === */ -}}
19+
{{- if and @commits (gt (len @commits) 0) -}}
20+
📥️ **Push** → *{{@ref}}*
21+
📁 {{@repository.full_name}} | 👤 {{@pusher.full_name}} | 🔢 {{@total_commits}}
22+
{{- range @commits }}
23+
- 🧾 *{{.message}}*
24+
{{- if .added }}
25+
{{- range .added }} ➕ {{.}} {{- end }}
26+
{{- end -}}
27+
{{- if .modified }}
28+
{{- range .modified }} ✏️ {{.}} {{- end }}
29+
{{- end -}}
30+
{{- if .removed }}
31+
{{- range .removed }} ❌ {{.}} {{- end }}
3532
{{- end }}
33+
🔗 {{.url}}
34+
{{- end }}
3635
37-
🔎 Compare: {{@compare_url}}
38-
{{- end -}}
36+
🔎 Compare: {{@compare_url}}
37+
{{- end -}}

0 commit comments

Comments
 (0)