Skip to content

Commit 98f9ad6

Browse files
committed
Merge branch 'main' into feat/message-templates
2 parents 26e1a7e + eabf384 commit 98f9ad6

File tree

10 files changed

+80
-35
lines changed

10 files changed

+80
-35
lines changed

.github/templates/README.template.md

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
<img align="center" width="1048" height="512" alt="Secure Proxy for Signal REST API" src="https://github.com/CodeShellDev/secured-signal-api/raw/refs/heads/main/logo/landscape" />
1+
<img align="center" width="1048" height="512" alt="Secure Proxy for Signal REST API" src="https://github.com/CodeShellDev/secured-signal-api/raw/refs/heads/main/logo/banner.png" />
22

33
<h3 align="center">Secure Proxy for <a href="https://github.com/bbernhard/signal-cli-rest-api">Signal Messenger REST API</a></h3>
44

55
<p align="center">
6-
Adding token-based authentication,
7-
endpoint restrictions, placeholders, and flexible configuration.
6+
token-based authentication,
7+
endpoint restrictions, placeholders, flexible configuration
88
</p>
99

1010
<p align="center">
@@ -125,11 +125,11 @@ If you are not comfortable / don't want to hardcode your Number for example and/
125125

126126
You can use [**Variable**](#variables) `{{.NUMBER}}` Placeholders and **Body** Placeholders `{{@data.key}}`.
127127

128-
| Type | Example |
129-
| :--- | :------ |
130-
| Body | `{"number": "{{ .NUMBER }}", "recipients": "{{ .RECIPIENTS }}"}` |
131-
| Query| `http://sec-signal-api:8880/v1/receive/?@number={{.NUMBER}}` |
132-
| Path | `http://sec-signal-api:8880/v1/receive/{{.NUMBER}}` |
128+
| Type | Example |
129+
| :---- | :--------------------------------------------------------------- |
130+
| Body | `{"number": "{{ .NUMBER }}", "recipients": "{{ .RECIPIENTS }}"}` |
131+
| Query | `http://sec-signal-api:8880/v1/receive/?@number={{.NUMBER}}` |
132+
| Path | `http://sec-signal-api:8880/v1/receive/{{.NUMBER}}` |
133133

134134
You can also combine them:
135135

@@ -335,10 +335,7 @@ settings:
335335
{ alias: "data.message", score: 79 },
336336
{ alias: "array[0].message", score: 78 },
337337
]
338-
".NUMBER":
339-
[
340-
{ alias: "phone_number", score: 100 },
341-
]
338+
".NUMBER": [{ alias: "phone_number", score: 100 }]
342339
```
343340

344341
Use `@` for aliasing Body Keys and `.` for aliasing Variables.
@@ -363,19 +360,26 @@ To change the Log Level set `logLevel` to: (default: `info`)
363360
| `fatal` |
364361
| `dev` |
365362

366-
</details>
363+
</details
367364

368365
## Contributing
369366

370367
Found a bug? Want to change or add something?
371-
Feel free to open up an issue or create a Pull Request!
368+
Feel free to open up an [Issue](https://github.com/codeshelldev/secured-signal-api/issues) or create a [Pull Request](https://github.com/codeshelldev/secured-signal-api/pulls)!
372369

373370
## Support
374371

375372
Has this Repo been helpful 👍️ to you? Then consider ⭐️'ing this Project.
376373

377374
:)
378375

376+
## Help
377+
378+
**Are you having Problems setting up Secured Signal API?**<br>
379+
No worries check out the [Discussions](https://github.com/codeshelldev/secured-signal-api/discussions) Tab and ask for help.
380+
381+
**We are all Volunteers**, so please be friendly and patient.
382+
379383
## License
380384

381385
[MIT](https://choosealicense.com/licenses/mit/)

Dockerfile

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
FROM alpine:latest
22
RUN apk --no-cache add ca-certificates
33

4-
ENV SERVER__PORT=8880
4+
ARG IMAGE_TAG
5+
ENV IMAGE_TAG=$IMAGE_TAG
6+
LABEL org.opencontainers.image.version=$IMAGE_TAG
57

6-
ENV DEFAULTS_PATH=/app/config/defaults.yml
8+
ENV SERVICE__PORT=8880
9+
10+
ENV DEFAULTS_PATH=/app/data/defaults.yml
11+
ENV FAVICON_PATH=/app/data/favicon.ico
712

813
ENV CONFIG_PATH=/config/config.yml
914
ENV TOKENS_DIR=/config/tokens

README.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
<img align="center" width="1048" height="512" alt="Secure Proxy for Signal REST API" src="https://github.com/CodeShellDev/secured-signal-api/raw/refs/heads/main/logo/landscape" />
1+
<img align="center" width="1048" height="512" alt="Secure Proxy for Signal REST API" src="https://github.com/CodeShellDev/secured-signal-api/raw/refs/heads/main/logo/banner.png" />
22

33
<h3 align="center">Secure Proxy for <a href="https://github.com/bbernhard/signal-cli-rest-api">Signal Messenger REST API</a></h3>
44

55
<p align="center">
66
token-based authentication,
7-
endpoint restrictions, placeholders, and flexible configuration.
7+
endpoint restrictions, placeholders, flexible configuration
88
</p>
99

1010
<p align="center">
@@ -457,19 +457,26 @@ To change the Log Level set `logLevel` to: (default: `info`)
457457
| `fatal` |
458458
| `dev` |
459459

460-
</details>
460+
</details
461461

462462
## Contributing
463463

464464
Found a bug? Want to change or add something?
465-
Feel free to open up an issue or create a Pull Request!
465+
Feel free to open up an [Issue](https://github.com/codeshelldev/secured-signal-api/issues) or create a [Pull Request](https://github.com/codeshelldev/secured-signal-api/pulls)!
466466

467467
## Support
468468

469469
Has this Repo been helpful 👍️ to you? Then consider ⭐️'ing this Project.
470470

471471
:)
472472

473+
## Help
474+
475+
**Are you having Problems setting up Secured Signal API?**<br>
476+
No worries check out the [Discussions](https://github.com/codeshelldev/secured-signal-api/discussions) Tab and ask for help.
477+
478+
**We are all Volunteers**, so please be friendly and patient.
479+
473480
## License
474481

475482
[MIT](https://choosealicense.com/licenses/mit/)
File renamed without changes.

data/favicon.ico

90.3 KB
Binary file not shown.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package middlewares
2+
3+
import (
4+
"net/http"
5+
6+
"github.com/codeshelldev/secured-signal-api/utils/config"
7+
)
8+
9+
type ServeMiddleware struct {
10+
Next http.Handler
11+
}
12+
13+
func (data ServeMiddleware) Use() http.Handler {
14+
mux := http.NewServeMux()
15+
16+
mux.HandleFunc("/favicon.ico", func(w http.ResponseWriter, req *http.Request) {
17+
http.ServeFile(w, req, config.ENV.FAVICON_PATH)
18+
})
19+
20+
mux.Handle("/", data.Next)
21+
22+
return mux
23+
}

internals/proxy/proxy.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ func Create(targetUrl string) *httputil.ReverseProxy {
1111
proxy := httputil.NewSingleHostReverseProxy(url)
1212

1313
return proxy
14-
}
14+
}
File renamed without changes.

main.go

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212
log "github.com/codeshelldev/secured-signal-api/utils/logger"
1313
)
1414

15-
var initHandler *httputil.ReverseProxy
15+
var proxy_last *httputil.ReverseProxy
1616

1717
var ENV *config.ENV_
1818

@@ -31,33 +31,37 @@ func main() {
3131

3232
log.Info("Initialized Logger with Level of ", log.Level())
3333

34-
initHandler = proxy.Create(ENV.API_URL)
34+
proxy_last = proxy.Create(ENV.API_URL)
3535

36-
mesg_m5 := middlewares.MessageMiddleware{
37-
Next: initHandler,
36+
mesg_m6 := middlewares.MessageMiddleware{
37+
Next: proxy_last,
3838
}
3939

40-
alias_m4 := middlewares.AliasMiddleware{
41-
Next: mesg_m5.Use(),
40+
alias_m5 := middlewares.AliasMiddleware{
41+
Next: mesg_m6.Use(),
4242
}
4343

44-
temp_m3 := middlewares.TemplateMiddleware{
45-
Next: alias_m4.Use(),
44+
temp_m4 := middlewares.TemplateMiddleware{
45+
Next: alias_m5.Use(),
4646
}
4747

48-
endp_m2 := middlewares.EndpointsMiddleware{
49-
Next: temp_m3.Use(),
48+
endp_m3 := middlewares.EndpointsMiddleware{
49+
Next: temp_m4.Use(),
5050
}
5151

52-
auth_m1 := middlewares.AuthMiddleware{
53-
Next: endp_m2.Use(),
52+
auth_m2 := middlewares.AuthMiddleware{
53+
Next: endp_m3.Use(),
54+
}
55+
56+
serv_m1 := middlewares.ServeMiddleware{
57+
Next: auth_m2.Use(),
5458
}
5559

5660
log_m0 := middlewares.LogMiddleware{
57-
Next: auth_m1.Use(),
61+
Next: serv_m1.Use(),
5862
}
5963

60-
log.Info("Initialized Proxy Handler")
64+
log.Info("Initialized Middlewares")
6165

6266
addr := "0.0.0.0:" + ENV.PORT
6367

utils/config/loader.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import (
1717
type ENV_ struct {
1818
CONFIG_PATH string
1919
DEFAULTS_PATH string
20+
FAVICON_PATH string
2021
TOKENS_DIR string
2122
LOG_LEVEL string
2223
PORT string
@@ -38,6 +39,7 @@ var ENV *ENV_ = &ENV_{
3839
CONFIG_PATH: os.Getenv("CONFIG_PATH"),
3940
DEFAULTS_PATH: os.Getenv("DEFAULTS_PATH"),
4041
TOKENS_DIR: os.Getenv("TOKENS_DIR"),
42+
FAVICON_PATH: os.Getenv("FAVICON_PATH"),
4143
API_TOKENS: []string{},
4244
SETTINGS: map[string]*SETTING_{
4345

0 commit comments

Comments
 (0)