Skip to content
Snippets Groups Projects
Verified Commit 314ee2a9 authored by Leon Schmidt's avatar Leon Schmidt
Browse files

Closes #20

parent 66c8346b
Branches
Tags 0.2.1
No related merge requests found
Pipeline #1287 passed
# Changelog
## 0.2.1
- Feature: Comment is now shown on the submission notification if available
## 0.2.0
- Feature: Tokens can now be used multiple times
......
......@@ -64,14 +64,20 @@ func handleCodeSubmit(c *gin.Context) {
ts := time.Now()
tsString := ts.Local().Format("02.01.2006, 15:04:05 MST")
if err := CreateHomeassistantNotification(
"One Time Service Token submitted",
fmt.Sprintf("Token: `%s`\nExecuted macro: `%s`\nSubmitter IP: `%s`\nSubmission time: `%s`",
msg := fmt.Sprintf("Token: `%s`\nExecuted macro: `%s`\nSubmitter IP: `%s`\nSubmission time: `%s`",
tokenParam,
details.MacroName,
c.ClientIP(),
tsString,
),
)
if details.Comment != nil {
// add comment field if one was set or the token
msg += fmt.Sprintf("\nComment: `%s`", *details.Comment)
}
if err := CreateHomeassistantNotification(
"One Time Service Token submitted",
msg,
); err != nil {
c.JSON(http.StatusInternalServerError, GenericResponse{
Error: err.Error(),
......
name: "One Time Service"
description: "Call a service with a one time token from outside Home Assistant!"
slug: "one-time-service"
version: "0.2.0"
version: "0.2.1"
stage: stable
url: https://git.leon.wtf/leon/one-time-service
arch:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment