Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
One Time Service Home Assistant Add-on
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Leon Schmidt
One Time Service Home Assistant Add-on
Commits
314ee2a9
Verified
Commit
314ee2a9
authored
1 year ago
by
Leon Schmidt
Browse files
Options
Downloads
Patches
Plain Diff
Closes
#20
parent
66c8346b
Branches
Branches containing commit
Tags
0.2.1
Tags containing commit
No related merge requests found
Pipeline
#1287
passed
1 year ago
Stage: check
Stage: build
Stage: push
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
CHANGELOG.md
+4
-0
4 additions, 0 deletions
CHANGELOG.md
backend/routes-public.go
+12
-6
12 additions, 6 deletions
backend/routes-public.go
config.yaml
+1
-1
1 addition, 1 deletion
config.yaml
with
17 additions
and
7 deletions
CHANGELOG.md
+
4
−
0
View file @
314ee2a9
# 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
...
...
This diff is collapsed.
Click to expand it.
backend/routes-public.go
+
12
−
6
View file @
314ee2a9
...
...
@@ -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`
\n
Executed macro: `%s`
\n
Submitter IP: `%s`
\n
Submission time: `%s`"
,
msg
:=
fmt
.
Sprintf
(
"Token: `%s`
\n
Executed macro: `%s`
\n
Submitter IP: `%s`
\n
Submission 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
(
"
\n
Comment: `%s`"
,
*
details
.
Comment
)
}
if
err
:=
CreateHomeassistantNotification
(
"One Time Service Token submitted"
,
msg
,
);
err
!=
nil
{
c
.
JSON
(
http
.
StatusInternalServerError
,
GenericResponse
{
Error
:
err
.
Error
(),
...
...
This diff is collapsed.
Click to expand it.
config.yaml
+
1
−
1
View file @
314ee2a9
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
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment