v2026.06.03 — Media3 like button + Bluetooth/UPnP picker + system playlist daily rotation #77
@@ -21,7 +21,8 @@ import (
|
|||||||
// loader and the stream handler share.
|
// loader and the stream handler share.
|
||||||
func SignStreamToken(secret []byte, trackID string, exp int64) string {
|
func SignStreamToken(secret []byte, trackID string, exp int64) string {
|
||||||
mac := hmac.New(sha256.New, secret)
|
mac := hmac.New(sha256.New, secret)
|
||||||
fmt.Fprintf(mac, "%s|%d", trackID, exp)
|
// hash.Hash.Write is documented as never returning an error.
|
||||||
|
_, _ = fmt.Fprintf(mac, "%s|%d", trackID, exp)
|
||||||
return hex.EncodeToString(mac.Sum(nil))
|
return hex.EncodeToString(mac.Sum(nil))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -201,7 +201,7 @@ func TestStreamSecret_EnvOverride(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestStreamSecret_AutoGenPersistsToDataDir(t *testing.T) {
|
func TestStreamSecret_AutoGenPersistsToDataDir(t *testing.T) {
|
||||||
os.Unsetenv("MINSTREL_STREAM_SECRET")
|
_ = os.Unsetenv("MINSTREL_STREAM_SECRET")
|
||||||
dataDir := t.TempDir()
|
dataDir := t.TempDir()
|
||||||
t.Setenv("MINSTREL_STORAGE_DATA_DIR", dataDir)
|
t.Setenv("MINSTREL_STORAGE_DATA_DIR", dataDir)
|
||||||
|
|
||||||
@@ -235,7 +235,7 @@ func TestStreamSecret_AutoGenPersistsToDataDir(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestStreamSecret_LoadsPersistedOnSecondBoot(t *testing.T) {
|
func TestStreamSecret_LoadsPersistedOnSecondBoot(t *testing.T) {
|
||||||
os.Unsetenv("MINSTREL_STREAM_SECRET")
|
_ = os.Unsetenv("MINSTREL_STREAM_SECRET")
|
||||||
dataDir := t.TempDir()
|
dataDir := t.TempDir()
|
||||||
t.Setenv("MINSTREL_STORAGE_DATA_DIR", dataDir)
|
t.Setenv("MINSTREL_STORAGE_DATA_DIR", dataDir)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user