1
0
Fork 0
mirror of https://github.com/binwiederhier/ntfy.git synced 2025-05-29 01:45:35 +02:00

Disallow subscribing to /docs

This commit is contained in:
Philipp Heckel 2021-12-08 22:13:59 -05:00
parent 9a56c24dbe
commit b437a87266
2 changed files with 16 additions and 2 deletions

View file

@ -23,6 +23,16 @@ func FileExists(filename string) bool {
return stat != nil
}
// InStringList returns true if needle is contained in haystack
func InStringList(haystack []string, needle string) bool {
for _, s := range haystack {
if s == needle {
return true
}
}
return false
}
// RandomString returns a random string with a given length
func RandomString(length int) string {
randomMutex.Lock() // Who would have thought that random.Intn() is not thread-safe?!