From 03c35d64469be1ec63e9a4bcb3595f2f0972e9a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20Schw=C3=B6rer?= Date: Mon, 21 Nov 2022 22:52:44 +0100 Subject: [PATCH] update HTML with new methods --- server/Makefile | 10 +-- server/README.md | 4 +- server/api/handler/api.go | 3 + server/api/handler/message.go | 11 +-- server/api/handler/website.go | 43 +++++++--- server/config.go | 51 +++++++----- server/models/user.go | 4 + server/swagger/swagger.json | 30 ++----- server/swagger/swagger.yaml | 26 ++---- server/website/api.html | 25 +++--- server/website/api_more.html | 129 +++++++---------------------- server/website/css/style.css | 54 +++++++++++- server/website/index.html | 17 ++-- server/website/js/logic.js | 52 ++++++------ server/website/js/message_sent.js | 5 +- server/website/message_sent.html | 13 +-- server/website/scn_send.html | 131 ++++++++++++++++++++++++++++++ 17 files changed, 374 insertions(+), 234 deletions(-) create mode 100644 server/website/scn_send.html diff --git a/server/Makefile b/server/Makefile index 9962ec1..2cbb343 100644 --- a/server/Makefile +++ b/server/Makefile @@ -5,7 +5,7 @@ PORT=9090 NAMESPACE=$(shell git rev-parse --abbrev-ref HEAD) HASH=$(shell git rev-parse HEAD) -build: +build: swagger fmt rm -f ./_build/scn_backend CGO_ENABLED=1 go build -v -o _build/scn_backend -tags timetzdata ./cmd/scnserver @@ -13,7 +13,7 @@ run: build mkdir -p .run-data _build/scn_backend -docker: +docker: build [ ! -f "DOCKER_GIT_INFO" ] || rm DOCKER_GIT_INFO git rev-parse --abbrev-ref HEAD >> DOCKER_GIT_INFO git rev-parse HEAD >> DOCKER_GIT_INFO @@ -33,7 +33,7 @@ swagger: which swag || go install github.com/swaggo/swag/cmd/swag@latest swag init -generalInfo api/router.go --output ./swagger/ --outputTypes "json,yaml" -run-docker-local: +run-docker-local: docker mkdir -p .run-data docker run --rm \ --init \ @@ -42,7 +42,7 @@ run-docker-local: --publish "8080:80" \ $(DOCKER_NAME):latest -inspect-docker: +inspect-docker: docker mkdir -p .run-data docker run -ti \ --rm \ @@ -50,7 +50,7 @@ inspect-docker: $(DOCKER_NAME):latest \ bash -push-docker: +push-docker: docker docker image push "$(DOCKER_REPO)/$(DOCKER_NAME):$(HASH)" docker image push "$(DOCKER_REPO)/$(DOCKER_NAME):$(NAMESPACE)-latest" docker image push "$(DOCKER_REPO)/$(DOCKER_NAME):latest" diff --git a/server/README.md b/server/README.md index 7017727..8e48ea2 100644 --- a/server/README.md +++ b/server/README.md @@ -2,6 +2,8 @@ //TODO + - remove fcm/goog_api keys from repo (and invalidate them !!) + - migration script for existing data - ack/read deliveries && return ack-count (? or not, how to query?) @@ -9,8 +11,8 @@ - verify pro_token - full-text-search: https://www.sqlite.org/fts5.html#contentless_tables - - update html (--channel, api doku, better send route, etc) - dark mode toggle for html + - app-store link in HTML - deploy diff --git a/server/api/handler/api.go b/server/api/handler/api.go index c0712f8..50291e8 100644 --- a/server/api/handler/api.go +++ b/server/api/handler/api.go @@ -1356,6 +1356,9 @@ func (h APIHandler) CreateMessage(g *gin.Context) ginresp.HTTPResponse { if b.Content != nil && len(*b.Content) > user.MaxContentLength() { return ginresp.SendAPIError(g, 400, apierr.CONTENT_TOO_LONG, 104, fmt.Sprintf("Content too long (%d characters; max := %d characters)", len(*b.Content), user.MaxContentLength()), nil) } + if len(channelName) > user.MaxChannelNameLength() { + return ginresp.SendAPIError(g, 400, apierr.CONTENT_TOO_LONG, 106, fmt.Sprintf("Channel too long (max %d characters)", user.MaxChannelNameLength()), nil) + } if b.UserMessageID != nil { msg, err := h.database.GetMessageByUserMessageID(ctx, *b.UserMessageID) diff --git a/server/api/handler/message.go b/server/api/handler/message.go index 590d75e..a620de6 100644 --- a/server/api/handler/message.go +++ b/server/api/handler/message.go @@ -44,7 +44,6 @@ func NewMessageHandler(app *logic.Application) MessageHandler { // @Failure 400 {object} ginresp.apiError // @Failure 401 {object} ginresp.apiError // @Failure 403 {object} ginresp.apiError -// @Failure 404 {object} ginresp.apiError // @Failure 500 {object} ginresp.apiError // // @Router /send.php [POST] @@ -93,10 +92,9 @@ func (h MessageHandler) SendMessageCompat(g *gin.Context) ginresp.HTTPResponse { // // @Success 200 {object} handler.sendMessageInternal.response // @Failure 400 {object} ginresp.apiError -// @Failure 401 {object} ginresp.apiError -// @Failure 403 {object} ginresp.apiError -// @Failure 404 {object} ginresp.apiError -// @Failure 500 {object} ginresp.apiError +// @Failure 401 {object} ginresp.apiError "The user_id was not found or the user_key is wrong" +// @Failure 403 {object} ginresp.apiError "The user has exceeded its daily quota - wait 24 hours or upgrade your account" +// @Failure 500 {object} ginresp.apiError "An internal server error occurred - try again later" // // @Router / [POST] // @Router /send [POST] @@ -212,6 +210,9 @@ func (h MessageHandler) sendMessageInternal(g *gin.Context, ctx *logic.AppContex if Content != nil && len(*Content) > user.MaxContentLength() { return ginresp.SendAPIError(g, 400, apierr.CONTENT_TOO_LONG, 104, fmt.Sprintf("Content too long (%d characters; max := %d characters)", len(*Content), user.MaxContentLength()), nil) } + if len(channelName) > user.MaxChannelNameLength() { + return ginresp.SendAPIError(g, 400, apierr.CONTENT_TOO_LONG, 106, fmt.Sprintf("Channel too long (max %d characters)", user.MaxChannelNameLength()), nil) + } if UserMessageID != nil { msg, err := h.database.GetMessageByUserMessageID(ctx, *UserMessageID) diff --git a/server/api/handler/website.go b/server/api/handler/website.go index b93d539..0df6148 100644 --- a/server/api/handler/website.go +++ b/server/api/handler/website.go @@ -4,43 +4,47 @@ import ( "blackforestbytes.com/simplecloudnotifier/common/ginresp" "blackforestbytes.com/simplecloudnotifier/logic" "blackforestbytes.com/simplecloudnotifier/website" + "errors" "github.com/gin-gonic/gin" "net/http" + "regexp" "strings" ) type WebsiteHandler struct { - app *logic.Application + app *logic.Application + rexTemplate *regexp.Regexp } func NewWebsiteHandler(app *logic.Application) WebsiteHandler { return WebsiteHandler{ - app: app, + app: app, + rexTemplate: regexp.MustCompile("{{template\\|[A-Za-z0-9_\\-.]+}}"), } } func (h WebsiteHandler) Index(g *gin.Context) ginresp.HTTPResponse { - return h.serveAsset(g, "index.html") + return h.serveAsset(g, "index.html", true) } func (h WebsiteHandler) APIDocs(g *gin.Context) ginresp.HTTPResponse { - return h.serveAsset(g, "api.html") + return h.serveAsset(g, "api.html", true) } func (h WebsiteHandler) APIDocsMore(g *gin.Context) ginresp.HTTPResponse { - return h.serveAsset(g, "api_more.html") + return h.serveAsset(g, "api_more.html", true) } func (h WebsiteHandler) MessageSent(g *gin.Context) ginresp.HTTPResponse { - return h.serveAsset(g, "message_sent.html") + return h.serveAsset(g, "message_sent.html", true) } func (h WebsiteHandler) FaviconIco(g *gin.Context) ginresp.HTTPResponse { - return h.serveAsset(g, "favicon.ico") + return h.serveAsset(g, "favicon.ico", false) } func (h WebsiteHandler) FaviconPNG(g *gin.Context) ginresp.HTTPResponse { - return h.serveAsset(g, "favicon.png") + return h.serveAsset(g, "favicon.png", false) } func (h WebsiteHandler) Javascript(g *gin.Context) ginresp.HTTPResponse { @@ -53,7 +57,7 @@ func (h WebsiteHandler) Javascript(g *gin.Context) ginresp.HTTPResponse { return ginresp.JSON(http.StatusBadRequest, gin.H{"error": err.Error()}) } - return h.serveAsset(g, "js/"+u.Filename) + return h.serveAsset(g, "js/"+u.Filename, false) } func (h WebsiteHandler) CSS(g *gin.Context) ginresp.HTTPResponse { @@ -66,15 +70,32 @@ func (h WebsiteHandler) CSS(g *gin.Context) ginresp.HTTPResponse { return ginresp.JSON(http.StatusBadRequest, gin.H{"error": err.Error()}) } - return h.serveAsset(g, "css/"+u.Filename) + return h.serveAsset(g, "css/"+u.Filename, false) } -func (h WebsiteHandler) serveAsset(g *gin.Context, fn string) ginresp.HTTPResponse { +func (h WebsiteHandler) serveAsset(g *gin.Context, fn string, repl bool) ginresp.HTTPResponse { data, err := website.Assets.ReadFile(fn) if err != nil { return ginresp.Status(http.StatusNotFound) } + if repl { + failed := false + data = h.rexTemplate.ReplaceAllFunc(data, func(match []byte) []byte { + prefix := len("{{template|") + suffix := len("}}") + fnSub := match[prefix : len(match)-suffix] + subdata, err := website.Assets.ReadFile(string(fnSub)) + if err != nil { + failed = true + } + return subdata + }) + if failed { + return ginresp.InternalError(errors.New("template replacement failed")) + } + } + mime := "text/plain" lowerFN := strings.ToLower(fn) diff --git a/server/config.go b/server/config.go index 4078f91..e8bf45d 100644 --- a/server/config.go +++ b/server/config.go @@ -1,6 +1,7 @@ package server import ( + "fmt" "github.com/rs/zerolog/log" "os" "time" @@ -14,8 +15,8 @@ type Config struct { DBFile string RequestTimeout time.Duration ReturnRawErrors bool - FirebaseProjectID string FirebaseTokenURI string + FirebaseProjectID string FirebasePrivKeyID string FirebaseClientMail string FirebasePrivateKey string @@ -31,11 +32,11 @@ var configLocHost = Config{ DBFile: ".run-data/db.sqlite3", RequestTimeout: 16 * time.Second, ReturnRawErrors: true, - FirebaseProjectID: "simplecloudnotifier-ea7ef", FirebaseTokenURI: "https://oauth2.googleapis.com/token", - FirebasePrivKeyID: "5bfab19fca25034e87c5b3bd1a4334499d2d1f85", - FirebaseClientMail: "firebase-adminsdk-42grv@simplecloudnotifier-ea7ef.iam.gserviceaccount.com", - FirebasePrivateKey: "-----BEGIN PRIVATE KEY-----\nMIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQD2NWOQDcalRdkp\nHtQHABLlu3GMBQBJrGiCxzOZhi/lLwrw2MJEmg1VFz6TVkX2z3SCzXCPOgGriM70\nuWCNLyZQvUng7u6/WH9hlpCg0vJpkw6BvOBt1zYu3gbb5M0SKEOR+lDVccEjAnT4\nexebXdJHJcbaYAcPnBQ9tgP+cozQBnr2EfxYL0bGMgiH9fErJSGMBDFI996uUW9a\nbtfkZ/XpZqYAvyGQMEjknGnQ8t8PHAnsS9dc1PXSWfBvz07ba3fkypWcpTsIYUiZ\nSpwTLV8awihKHJuphoTWb4x6p/ijop05qr1p3fe8gZd9qOGgALe+JT4IBLgNYKrP\nLMSKH3TdAgMBAAECggEAdFcWDOP1kfNHgl7G4efvBg9kwD08vZNybxmiEFGQIEPy\nb4x9f90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NoeK2SdY+ghWPlxC6u5Nxpnk+bZ8TJe\np7U2nY0SQDLCmPgGWs3KBb/zR49X2b7JS3CXXqQSrLxBe2phZg6kE5nB6NPUDc/i\n6WG8tG20rCfgwlXeXl0+Ow==\n-----END PRIVATE KEY-----\n", + FirebaseProjectID: "", + FirebasePrivKeyID: "", + FirebaseClientMail: "", + FirebasePrivateKey: "", } var configLocDocker = Config{ @@ -46,11 +47,11 @@ var configLocDocker = Config{ DBFile: "/data/scn_docker.sqlite3", RequestTimeout: 16 * time.Second, ReturnRawErrors: true, - FirebaseProjectID: "simplecloudnotifier-ea7ef", FirebaseTokenURI: "https://oauth2.googleapis.com/token", - FirebasePrivKeyID: "5bfab19fca25034e87c5b3bd1a4334499d2d1f85", - FirebaseClientMail: "firebase-adminsdk-42grv@simplecloudnotifier-ea7ef.iam.gserviceaccount.com", - FirebasePrivateKey: "TODO", + FirebaseProjectID: "", + FirebasePrivKeyID: "", + FirebaseClientMail: "", + FirebasePrivateKey: "", } var configDev = Config{ @@ -61,11 +62,11 @@ var configDev = Config{ DBFile: "/data/scn.sqlite3", RequestTimeout: 16 * time.Second, ReturnRawErrors: true, - FirebaseProjectID: "simplecloudnotifier-ea7ef", FirebaseTokenURI: "https://oauth2.googleapis.com/token", - FirebasePrivKeyID: "5bfab19fca25034e87c5b3bd1a4334499d2d1f85", - FirebaseClientMail: "firebase-adminsdk-42grv@simplecloudnotifier-ea7ef.iam.gserviceaccount.com", - FirebasePrivateKey: "TODO", + FirebaseProjectID: confEnv("FB_PROJECTID"), + FirebasePrivKeyID: confEnv("FB_PRIVATEKEYID"), + FirebaseClientMail: confEnv("FB_CLIENTEMAIL"), + FirebasePrivateKey: confEnv("FB_PRIVATEKEY"), } var configStag = Config{ @@ -76,11 +77,11 @@ var configStag = Config{ DBFile: "/data/scn.sqlite3", RequestTimeout: 16 * time.Second, ReturnRawErrors: true, - FirebaseProjectID: "simplecloudnotifier-ea7ef", FirebaseTokenURI: "https://oauth2.googleapis.com/token", - FirebasePrivKeyID: "5bfab19fca25034e87c5b3bd1a4334499d2d1f85", - FirebaseClientMail: "firebase-adminsdk-42grv@simplecloudnotifier-ea7ef.iam.gserviceaccount.com", - FirebasePrivateKey: "TODO", + FirebaseProjectID: confEnv("FB_PROJECTID"), + FirebasePrivKeyID: confEnv("FB_PRIVATEKEYID"), + FirebaseClientMail: confEnv("FB_CLIENTEMAIL"), + FirebasePrivateKey: confEnv("FB_PRIVATEKEY"), } var configProd = Config{ @@ -91,11 +92,11 @@ var configProd = Config{ DBFile: "/data/scn.sqlite3", RequestTimeout: 16 * time.Second, ReturnRawErrors: false, - FirebaseProjectID: "simplecloudnotifier-ea7ef", FirebaseTokenURI: "https://oauth2.googleapis.com/token", - FirebasePrivKeyID: "5bfab19fca25034e87c5b3bd1a4334499d2d1f85", - FirebaseClientMail: "firebase-adminsdk-42grv@simplecloudnotifier-ea7ef.iam.gserviceaccount.com", - FirebasePrivateKey: "TODO", + FirebaseProjectID: confEnv("FB_PROJECTID"), + FirebasePrivKeyID: confEnv("FB_PRIVATEKEYID"), + FirebaseClientMail: confEnv("FB_CLIENTEMAIL"), + FirebasePrivateKey: confEnv("FB_PRIVATEKEY"), } var allConfig = []Config{ @@ -118,6 +119,14 @@ func getConfig(ns string) (Config, bool) { return Config{}, false } +func confEnv(key string) string { + if v, ok := os.LookupEnv(key); ok { + return v + } else { + panic(fmt.Sprintf("Missing required environment variable '%s'", key)) + } +} + func init() { ns := os.Getenv("CONF_NS") diff --git a/server/models/user.go b/server/models/user.go index 6507f86..25f085a 100644 --- a/server/models/user.go +++ b/server/models/user.go @@ -79,6 +79,10 @@ func (u User) DefaultChannel() string { return "main" } +func (u User) MaxChannelNameLength() int { + return 120 +} + type UserJSON struct { UserID UserID `json:"user_id"` Username *string `json:"username"` diff --git a/server/swagger/swagger.json b/server/swagger/swagger.json index 97274d1..a47740c 100644 --- a/server/swagger/swagger.json +++ b/server/swagger/swagger.json @@ -127,25 +127,19 @@ } }, "401": { - "description": "Unauthorized", + "description": "The user_id was not found or the user_key is wrong", "schema": { "$ref": "#/definitions/ginresp.apiError" } }, "403": { - "description": "Forbidden", - "schema": { - "$ref": "#/definitions/ginresp.apiError" - } - }, - "404": { - "description": "Not Found", + "description": "The user has exceeded its daily quota - wait 24 hours or upgrade your account", "schema": { "$ref": "#/definitions/ginresp.apiError" } }, "500": { - "description": "Internal Server Error", + "description": "An internal server error occurred - try again later", "schema": { "$ref": "#/definitions/ginresp.apiError" } @@ -1871,25 +1865,19 @@ } }, "401": { - "description": "Unauthorized", + "description": "The user_id was not found or the user_key is wrong", "schema": { "$ref": "#/definitions/ginresp.apiError" } }, "403": { - "description": "Forbidden", - "schema": { - "$ref": "#/definitions/ginresp.apiError" - } - }, - "404": { - "description": "Not Found", + "description": "The user has exceeded its daily quota - wait 24 hours or upgrade your account", "schema": { "$ref": "#/definitions/ginresp.apiError" } }, "500": { - "description": "Internal Server Error", + "description": "An internal server error occurred - try again later", "schema": { "$ref": "#/definitions/ginresp.apiError" } @@ -1999,12 +1987,6 @@ "$ref": "#/definitions/ginresp.apiError" } }, - "404": { - "description": "Not Found", - "schema": { - "$ref": "#/definitions/ginresp.apiError" - } - }, "500": { "description": "Internal Server Error", "schema": { diff --git a/server/swagger/swagger.yaml b/server/swagger/swagger.yaml index 4051d90..8997793 100644 --- a/server/swagger/swagger.yaml +++ b/server/swagger/swagger.yaml @@ -514,19 +514,16 @@ paths: schema: $ref: '#/definitions/ginresp.apiError' "401": - description: Unauthorized + description: The user_id was not found or the user_key is wrong schema: $ref: '#/definitions/ginresp.apiError' "403": - description: Forbidden - schema: - $ref: '#/definitions/ginresp.apiError' - "404": - description: Not Found + description: The user has exceeded its daily quota - wait 24 hours or upgrade + your account schema: $ref: '#/definitions/ginresp.apiError' "500": - description: Internal Server Error + description: An internal server error occurred - try again later schema: $ref: '#/definitions/ginresp.apiError' summary: Send a new message @@ -1687,19 +1684,16 @@ paths: schema: $ref: '#/definitions/ginresp.apiError' "401": - description: Unauthorized + description: The user_id was not found or the user_key is wrong schema: $ref: '#/definitions/ginresp.apiError' "403": - description: Forbidden - schema: - $ref: '#/definitions/ginresp.apiError' - "404": - description: Not Found + description: The user has exceeded its daily quota - wait 24 hours or upgrade + your account schema: $ref: '#/definitions/ginresp.apiError' "500": - description: Internal Server Error + description: An internal server error occurred - try again later schema: $ref: '#/definitions/ginresp.apiError' summary: Send a new message @@ -1768,10 +1762,6 @@ paths: description: Forbidden schema: $ref: '#/definitions/ginresp.apiError' - "404": - description: Not Found - schema: - $ref: '#/definitions/ginresp.apiError' "500": description: Internal Server Error schema: diff --git a/server/website/api.html b/server/website/api.html index 8e3f4b8..77d42b5 100644 --- a/server/website/api.html +++ b/server/website/api.html @@ -19,22 +19,27 @@
- + API Documentation + Send

Simple Cloud Notifier

Get your user-id and user-key from the app and send notifications to your phone by performing a POST request against https://simplecloudnotifier.blackforestbytes.com/

-
curl                                          \
-    --data "user_id={userid}"                 \
-    --data "user_key={userkey}"               \
-    --data "title={message_title}"            \
-    --data "content={message_body}"           \
-    --data "priority={0|1|2}"                 \
-    --data "msg_id={unique_message_id}"       \
+        
+curl                                           \
+    --data "user_id=${userid}"                 \
+    --data "user_key=${userkey}"               \
+    --data "title=${message_title}"            \
+    --data "content=${message_body}"           \
+    --data "priority=${0|1|2}"                 \
+    --data "msg_id=$(uuidgen)"                 \
+    --data "timestamp=$(date +%s)"             \
+    --data "channel={channel_name}"            \
     https://scn.blackforestbytes.com/
-

The content, priority and msg_id parameters are optional, you can also send message with only a title and the default priority

-
curl                                          \
+    

Most parameters are optional, you can send a message with only a title (default priority and channel will be used)

+
+curl                                          \
     --data "user_id={userid}"                 \
     --data "user_key={userkey}"               \
     --data "title={message_title}"            \
diff --git a/server/website/api_more.html b/server/website/api_more.html
index f86c54a..0dfde2a 100644
--- a/server/website/api_more.html
+++ b/server/website/api_more.html
@@ -19,7 +19,8 @@
     
- + API Documentation + Send

Simple Cloud Notifier

@@ -30,7 +31,7 @@ With this API you can send push notifications to your phone.

- To recieve them you will need to install the SimpleCloudNotifier app from the play store. + To receive them you will need to install the SimpleCloudNotifier app from the play store. When you open the app you can click on the account tab to see you unique user_id and user_key. These two values are used to identify and authenticate your device so that send messages can be routed to your phone.

@@ -45,7 +46,7 @@

Quota

- By default you can send up to 100 messages per day per device. + By default you can send up to 50 messages per day per device. If you need more you can upgrade your account in the app to get 1000 messages per day, this has the additional benefit of removing ads and supporting the development of the app (and making sure I can pay the server costs).

@@ -54,10 +55,10 @@

To send a new notification you send a POST request to the URL https://scn.blackforestbytes.com/. - All Parameters can either directly be submitted as URL parameters or they can be put into the POST body. + All Parameters can either directly be submitted as URL parameters or they can be put into the POST body (either multipart/form-data or JSON).

- You need to supply a valid user_id - user_key pair and a title for your message, all other parameter are optional. + You need to supply a valid [user_id, user_key] pair and a title for your message, all other parameter are optional.

@@ -81,7 +82,7 @@ "quota_max":100 }

- If the operation is not successful the API will respond with an 4xx HTTP statuscode. + If the operation is not successful the API will respond with a 4xx or 500 HTTP statuscode.

@@ -107,10 +108,6 @@ - - - - @@ -122,10 +119,10 @@ The success field is always there and in the error state you the message field to get a descritpion of the problem.

{
-    "success":false,
-    "error":2101,
-    "errhighlight":-1,
-    "message":"Daily quota reached (100)"
+    "success": false,
+    "error": 2101,
+    "errhighlight": -1,
+    "message": "Daily quota reached (100)"
 }
@@ -133,7 +130,7 @@

Every message must have a title set. - But you also (optionally) add more content, while the title has a max length of 120 characters, the conntent can be up to 10.000 characters. + But you also (optionally) add more content, while the title has a max length of 120 characters, the content can be up to 10.000 characters. You can see the whole message with title and content in the app or when clicking on the notification.

@@ -165,6 +162,21 @@ https://scn.blackforestbytes.com/s

+

Channels

+
+

+ By default all messages are sent to the user default channel (typically main) + You can specify a different channel with the channel parameter, if the channel does not already exist it will be created. + Channel names are case-insensitive and can only contain letters, numbers, underscores and minuses ( /[[:alnum:]\-_]+/ ) +

+
curl                                          \
+    --data "user_id={userid}"                 \
+    --data "user_key={userkey}"               \
+    --data "title={message_title}"            \
+    --data "channel={my_channel}"             \
+    https://scn.blackforestbytes.com/s
+
+

Message Uniqueness

@@ -172,7 +184,7 @@

To ensure that a message is only send once you can generate a unique id for your message (I would recommend a simple uuidgen). - If you send a message with an UUID that was already used in the near past the API still returns OK, but no new message is sent. + If you send a message with a UUID that was already used in the near past the API still returns OK, but no new message is sent.

The message_id is optional - but if you want to use it you need to supply it via the msg_id parameter. @@ -208,90 +220,9 @@

Depending on your use case it can be useful to create a bash script that handles things like resending messages if you have connection problems or waiting if there is no quota left.
- Here is an example how such a scrippt could look like, you can put it into /usr/local/sbin and call it with scn_send "title" "content" -

-
#!/usr/bin/env bash
-
-#
-# Call with   `scn_send title`
-#        or   `scn_send title content`
-#        or   `scn_send title content priority`
-#
-#
-
-if [ "$#" -lt 1 ]; then
-    echo "no title supplied via parameter"
-    exit 1
-fi
-
-################################################################################
-# INSERT YOUR DATA HERE                                                        #
-################################################################################
-user_id=999
-user_key="????????????????????????????????????????????????????????????????"
-################################################################################
-
-title=$1
-content=""
-sendtime=$(date +%s)
-
-if [ "$#" -gt 1 ]; then
-    content=$2
-fi
-
-priority=1
-
-if [ "$#" -gt 2 ]; then
-    priority=$3
-fi
-
-usr_msg_id=$(uuidgen)
-
-while true ; do
-
-    curlresp=$(curl -s -o /dev/null -w "%{http_code}" \
-                    -d "user_id=$user_id" -d "user_key=$user_key" -d "title=$title" -d "timestamp=$sendtime" \
-                    -d "content=$content" -d "priority=$priority" -d "msg_id=$usr_msg_id" \
-                    https://scn.blackforestbytes.com/)
-
-    if [ "$curlresp" == 200 ] ; then
-        echo "Successfully send"
-        exit 0
-    fi
-
-    if [ "$curlresp" == 400 ] ; then
-        echo "Bad request - something went wrong"
-        exit 1
-    fi
-
-    if [ "$curlresp" == 401 ] ; then
-        echo "Unauthorized - wrong userid/userkey"
-        exit 1
-    fi
-
-    if [ "$curlresp" == 403 ] ; then
-        echo "Quota exceeded - wait one hour before re-try"
-        sleep 3600
-    fi
-
-    if [ "$curlresp" == 412 ] ; then
-        echo "Precondition Failed - No device linked"
-        exit 1
-    fi
-
-    if [ "$curlresp" == 500 ] ; then
-        echo "Internal server error - waiting for better times"
-        sleep 60
-    fi
-
-    # if none of the above matched we probably hav no network ...
-    echo "Send failed (response code $curlresp) ... try again in 5s"
-    sleep 5
-done
-
-

- Be aware that the server only saves send messages for a short amount of time. Because of that you can only use this to prevent duplicates in a short time-frame, older messages with the same ID are probably already deleted and the message will be send again. + Here is an example how such a scrippt could look like, you can put it into /usr/local/sbin and call it with scn_send "title" "content" (or with more parameters, see the script itself)

+
{{template|scn_send.html}}
diff --git a/server/website/css/style.css b/server/website/css/style.css index 3ac9347..0e04e7e 100644 --- a/server/website/css/style.css +++ b/server/website/css/style.css @@ -22,19 +22,18 @@ body #mainpnl { box-shadow: 0 0 32px #DDD; - //animation:blink-shadow ease-in-out 4s infinite; width: 87%; min-width: 300px; max-width: 900px; position: relative; - min-height: 570px; + min-height: 525px; background: var(--form-back-color); color: var(--form-fore-color); border: .0625rem solid var(--form-border-color); border-radius: var(--universal-border-radius); margin: 32px .5rem; - padding: calc(2 * var(--universal-padding)) var(--universal-padding); + padding: calc(2 * var(--universal-padding)) var(--universal-padding) var(--universal-padding); } .red-code @@ -126,7 +125,7 @@ body text-align: center; } -#tl_link +#tl_link1 { position: absolute; top: 0; @@ -137,6 +136,37 @@ body padding: 4px 4px 0 4px; } +#tl_link2 +{ + position: absolute; + top: 0; + left: 48px; + margin: -1px 0 0 -1px; + border-top-right-radius: 0; + border-bottom-left-radius: 0; + padding: 4px 4px 0 4px; +} + +#tl_linkDocs +{ + position: absolute; + top: 0; + left: 0; + margin: -1px 0 0 -1px; + border-top-right-radius: 0; + border-bottom-left-radius: 0; + padding: 4px; + display: flex; +} + +.tl_btntxt +{ + margin-left: 0.66rem; + margin-right: 0.33rem; + margin-top: -1px; + align-self: center; +} + .icn-google-play { display: inline-block; width: 32px; @@ -145,6 +175,22 @@ body background-size: 100%; } +.icn-app-store { + display: inline-block; + width: 32px; + height: 32px; + background: url('data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm94PSIwIDAgMTAwMCAxMDAwIj4KCTxwYXRoIGZpbGw9IiM0NDQiIGQ9Ik05MjEuMiw3MjljLTIzLDUxLTM0LjEsNzMuOC02My43LDExOC45Yy00MS4zLDYyLjktOTkuNiwxNDEuMy0xNzEuOSwxNDJjLTY0LjIsMC42LTgwLjYtNDEuOC0xNjcuOC00MS4zYy04Ny4xLDAuNS0xMDUuMyw0Mi0xNjkuNSw0MS40Yy03Mi4yLTAuNy0xMjcuNS03MS41LTE2OC44LTEzNC40QzYzLjksNjc5LjYsNTEuOCw0NzMsMTIzLjEsMzYzLjJjNTAuNy03OCwxMzAuNy0xMjMuNywyMDUuOS0xMjMuN2M3Ni42LDAsMTI0LjcsNDIsMTg4LDQyYzYxLjQsMCw5OC44LTQyLDE4Ny4zLTQyYzY2LjksMCwxMzcuOCwzNi40LDE4OC4zLDk5LjRDNzI3LjEsNDI5LjUsNzU0LDY2NS44LDkyMS4yLDcyOXogTTYzNy4xLDE2OS4xYzMyLjItNDEuMyw1Ni42LTk5LjYsNDcuNy0xNTkuMWMtNTIuNSwzLjYtMTE0LDM3LTE0OS45LDgwLjZjLTMyLjYsMzkuNS01OS40LDk4LjItNDksMTU1LjJDNTQzLjQsMjQ3LjYsNjAyLjcsMjEzLjMsNjM3LjEsMTY5LjF6Ii8+Cjwvc3ZnPg==') 50% 50% no-repeat; + background-size: 100%; +} + +.icn-openapi { + display: inline-block; + width: 32px; + height: 32px; + background: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+Cgo8c3ZnCiAg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zQ1NjMsMy42ODMgLTcuNjQzODEyLDcuNjQzODEgLTcuNjQxMTY2LDIwLjAzNjkgMCwyNy42ODA3MDYgNy42NDY0NTksNy42NDM4MSAyMC4wNDIxODgsNy42NDExNiAyNy42ODYwMDQsMCA2LjA5ODY0LC02LjA5ODY0NiA3LjMxNTczLC0xNS4yMTM1MzYgMy42ODMsLTIyLjUzMTkxNiBMIDE0OS43Mjg1MywzNy42Nzg5NyBjIDcuMzIxMDIsMy42MzAwOSAxNi40MzMyNywyLjQxMyAyMi41MzE5MSwtMy42ODU2NCA3LjY0MzgyLC03LjY0MTE2OSA3LjY0MzgyLC0yMC4wMzQyNTIgMCwtMjcuNjc4MDY1MSB6IgogICAgICAgZmlsbD0iIzQyNDE0MyIKICAgICAgIGlkPSJwYXRoMjciCiAgICAgICBzdHlsZT0ic3Ryb2tlLXdpZHRoOjAuMjY0NTgzIiAvPgogIDwvZz4KPC9zdmc+Cg=='); + background-size: 100%; +} + #btnSend { height: 42px; diff --git a/server/website/index.html b/server/website/index.html index 0c553a0..0a29f1a 100644 --- a/server/website/index.html +++ b/server/website/index.html @@ -21,7 +21,9 @@ - + + + API

Simple Cloud Notifier

@@ -36,6 +38,11 @@
+
+
+
+
+
@@ -48,13 +55,13 @@
-
-
+
+
-
-
+
+
diff --git a/server/website/js/logic.js b/server/website/js/logic.js index 756a965..53b03b3 100644 --- a/server/website/js/logic.js +++ b/server/website/js/logic.js @@ -10,22 +10,24 @@ function send() let uid = document.getElementById("uid"); let key = document.getElementById("ukey"); - let msg = document.getElementById("msg"); - let txt = document.getElementById("txt"); + let tit = document.getElementById("tit"); + let cnt = document.getElementById("cnt"); let pio = document.getElementById("prio"); + let cha = document.getElementById("chan"); uid.classList.remove('input-invalid'); key.classList.remove('input-invalid'); msg.classList.remove('input-invalid'); - txt.classList.remove('input-invalid'); + cnt.classList.remove('input-invalid'); pio.classList.remove('input-invalid'); let data = new FormData(); data.append('user_id', uid.value); data.append('user_key', key.value); - data.append('title', msg.value); - data.append('content', txt.value); - data.append('priority', pio.value); + if (tit.value !== '') data.append('title', tit.value); + if (cnt.value !== '') data.append('content', cnt.value); + if (pio.value !== '') data.append('priority', pio.value); + if (cha.value !== '') data.append('channel', cha.value); let xhr = new XMLHttpRequest(); xhr.open('POST', '/send.php', true); @@ -41,9 +43,10 @@ function send() { if (resp.errhighlight === 101) uid.classList.add('input-invalid'); if (resp.errhighlight === 102) key.classList.add('input-invalid'); - if (resp.errhighlight === 103) msg.classList.add('input-invalid'); - if (resp.errhighlight === 104) txt.classList.add('input-invalid'); + if (resp.errhighlight === 103) tit.classList.add('input-invalid'); + if (resp.errhighlight === 104) cnt.classList.add('input-invalid'); if (resp.errhighlight === 105) pio.classList.add('input-invalid'); + if (resp.errhighlight === 106) cha.classList.add('input-invalid'); Toastify({ text: resp.message, @@ -62,7 +65,8 @@ function send() '"a_remain=' + (resp.quota_max-resp.quota) + '"a_max=' + resp.quota_max + '&preset_user_id=' + uid.value + - '&preset_user_key=' + key.value; + '&preset_user_key=' + key.value + + '&preset_channel=' + cha.value; } } else @@ -85,23 +89,21 @@ window.addEventListener("load", function () { const qp = new URLSearchParams(window.location.search); - const btnSend = document.getElementById("btnSend"); - const selPrio = document.getElementById("prio"); - const txtKey = document.getElementById("ukey"); - const txtUID = document.getElementById("uid"); - const txtTitl = document.getElementById("msg"); - const txtCont = document.getElementById("txt"); + let btn = document.getElementById("btnSend"); + let uid = document.getElementById("uid"); + let key = document.getElementById("ukey"); + let tit = document.getElementById("tit"); + let cnt = document.getElementById("cnt"); + let pio = document.getElementById("prio"); + let cha = document.getElementById("chan"); - btnSend.onclick = function () { send(); return false; }; + btn.onclick = function () { send(); return false; }; - if (qp.has('preset_priority')) selPrio.selectedIndex = parseInt(qp.get("preset_priority")); - - if (qp.has('preset_user_key')) txtKey.value = qp.get("preset_user_key"); - - if (qp.has('preset_user_id')) txtUID.value = qp.get("preset_user_id"); - - if (qp.has('preset_title')) txtTitl.value = qp.get("preset_title"); - - if (qp.has('preset_content')) txtCont.value = qp.get("preset_content"); + if (qp.has('preset_priority')) pio.selectedIndex = parseInt(qp.get("preset_priority")); + if (qp.has('preset_user_key')) key.value = qp.get("preset_user_key"); + if (qp.has('preset_user_id')) uid.value = qp.get("preset_user_id"); + if (qp.has('preset_title')) tit.value = qp.get("preset_title"); + if (qp.has('preset_content')) cnt.value = qp.get("preset_content"); + if (qp.has('preset_channel')) cha.value = qp.get("preset_channel"); }, false); \ No newline at end of file diff --git a/server/website/js/message_sent.js b/server/website/js/message_sent.js index 28dfdc9..a15b524 100644 --- a/server/website/js/message_sent.js +++ b/server/website/js/message_sent.js @@ -14,7 +14,10 @@ window.addEventListener("load", function () const preset_user_id = qp.get('preset_user_id') ?? 'ERR'; const preset_user_key = qp.get('preset_user_key') ?? 'ERR'; - linkSucc.setAttribute("href", "/?preset_user_id="+preset_user_id+"&preset_user_key="+preset_user_key); + let hrefBack = "/?preset_user_id="+preset_user_id+"&preset_user_key="+preset_user_key + if (qp.has('preset_channel') && qp.get('preset_channel') !== '') hrefBack += "&preset_channel="+qp.get('preset_channel') + + linkSucc.setAttribute("href", hrefBack); if (qp.get("ok") === "1") { diff --git a/server/website/message_sent.html b/server/website/message_sent.html index ca84126..ade52e6 100644 --- a/server/website/message_sent.html +++ b/server/website/message_sent.html @@ -20,9 +20,16 @@
+ + + + Send + +

Simple Cloud Notifier

+ diff --git a/server/website/scn_send.html b/server/website/scn_send.html new file mode 100644 index 0000000..008c37b --- /dev/null +++ b/server/website/scn_send.html @@ -0,0 +1,131 @@ + + + +#!/usr/bin/env bash + +# +# Wrapper around SCN ( https://scn.blackforestbytes.com/ ) +# ======================================================== +# +# ./scn_send [@channel] title [content] [priority] +# +# +# Call with scn_send "${title}" +# or scn_send "${title}" ${content}" +# or scn_send "${title}" ${content}" "${priority:0|1|2}" +# or scn_send "@${channel} "${title}" +# or scn_send "@${channel} "${title}" ${content}" +# or scn_send "@${channel} "${title}" ${content}" "${priority:0|1|2}" +# +# + +################################################################################ +# INSERT YOUR DATA HERE # +################################################################################ +user_id="999" +user_key="??" +################################################################################ + +usage() { + echo "Usage: " + echo " scn_send [@channel] title [content] [priority]" + echo "" +} + +args=( "$@" ) + +title=$1 +content="" +channel="" +priority=1 +usr_msg_id=$(uuidgen) +sendtime=$(date +%s) + +if [ ${#args[@]} -lt 1 ]; then + echo "[ERROR]: no title supplied via parameter" 1>&2 + usage + exit 1 +fi + +if [[ "${args[0]}" =~ ^@.* ]]; then + channel="${args[0]}" + unset "args[0]" + channel="${channel:1}" +fi + +if [ ${#args[@]} -lt 1 ]; then + echo "[ERROR]: no title supplied via parameter" 1>&2 + usage + exit 1 +fi + +title="${args[0]}" +content="" +sendtime=$(date +%s) + +if [ ${#args[@]} -gt 1 ]; then + content="${args[0]}" + unset "args[0]" +fi + +if [ ${#args[@]} -gt 1 ]; then + priority="${args[0]}" + unset "args[0]" +fi + +if [ ${#args[@]} -gt 1 ]; then + echo "Too many arguments to scn_send" 1>&2 + usage + exit 1 +fi + + +while true ; do + + curlresp=$(curl --silent \ + --output /dev/null \ + --write-out "%{http_code}" \ + --data "user_id=$user_id" \ + --data "user_key=$user_key" \ + --data "title=$title" \ + --data "timestamp=$sendtime" \ + --data "content=$content" \ + --data "priority=$priority" \ + --data "msg_id=$usr_msg_id" \ + --data "channel=$channel" \ + "https://scn.blackforestbytes.com/" ) + + if [ "$curlresp" == 200 ] ; then + echo "Successfully send" + exit 0 + fi + + if [ "$curlresp" == 400 ] ; then + echo "Bad request - something went wrong" 1>&2 + exit 1 + fi + + if [ "$curlresp" == 401 ] ; then + echo "Unauthorized - wrong userid/userkey" 1>&2 + exit 1 + fi + + if [ "$curlresp" == 403 ] ; then + echo "Quota exceeded - wait one hour before re-try" 1>&2 + sleep 3600 + fi + + if [ "$curlresp" == 412 ] ; then + echo "Precondition Failed - No device linked" 1>&2 + exit 1 + fi + + if [ "$curlresp" == 500 ] ; then + echo "Internal server error - waiting for better times" 1>&2 + sleep 60 + fi + + # if none of the above matched we probably hav no network ... + echo "Send failed (response code $curlresp) ... try again in 5s" 1>&2 + sleep 5 +done
403 (Forbidden) The user has exceeded its daily quota - wait 24 hours or upgrade your account
412 (Precondition Failed)There is no device connected with this account - open the app and press the refresh button in the account tab
500 (Internal Server Error) There was an internal error while sending your data - try again later