mirror of
https://github.com/binwiederhier/ntfy.git
synced 2025-04-05 14:07:39 +03:00
Fully working email feature
This commit is contained in:
parent
f553cdb282
commit
11b5ac49c0
7 changed files with 259 additions and 15 deletions
20
util/util.go
20
util/util.go
|
@ -134,6 +134,26 @@ func ParsePriority(priority string) (int, error) {
|
|||
}
|
||||
}
|
||||
|
||||
// PriorityString converts a priority number to a string
|
||||
func PriorityString(priority int) (string, error) {
|
||||
switch priority {
|
||||
case 0:
|
||||
return "default", nil
|
||||
case 1:
|
||||
return "min", nil
|
||||
case 2:
|
||||
return "low", nil
|
||||
case 3:
|
||||
return "default", nil
|
||||
case 4:
|
||||
return "high", nil
|
||||
case 5:
|
||||
return "urgent", nil
|
||||
default:
|
||||
return "", errInvalidPriority
|
||||
}
|
||||
}
|
||||
|
||||
// ExpandHome replaces "~" with the user's home directory
|
||||
func ExpandHome(path string) string {
|
||||
return os.ExpandEnv(strings.ReplaceAll(path, "~", "$HOME"))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue