Improve web UI sound deployment
This commit is contained in:
+7
-2
@@ -265,6 +265,7 @@ function reflectSettings() {
|
|||||||
/** @type {AudioContext} */
|
/** @type {AudioContext} */
|
||||||
let notificationAudioContext = null;
|
let notificationAudioContext = null;
|
||||||
let userNotificationSoundsReady = false;
|
let userNotificationSoundsReady = false;
|
||||||
|
let notificationSoundGainScale = 2.5;
|
||||||
|
|
||||||
function notificationSoundsEnabled() {
|
function notificationSoundsEnabled() {
|
||||||
return !!getSettings().notificationSounds;
|
return !!getSettings().notificationSounds;
|
||||||
@@ -309,7 +310,9 @@ function scheduleGlide(start, duration, fromFrequency, toFrequency, gainValue, t
|
|||||||
oscillator.frequency.setValueAtTime(fromFrequency, start);
|
oscillator.frequency.setValueAtTime(fromFrequency, start);
|
||||||
oscillator.frequency.exponentialRampToValueAtTime(toFrequency, start + duration);
|
oscillator.frequency.exponentialRampToValueAtTime(toFrequency, start + duration);
|
||||||
gain.gain.setValueAtTime(0, start);
|
gain.gain.setValueAtTime(0, start);
|
||||||
gain.gain.linearRampToValueAtTime(gainValue, start + 0.02);
|
gain.gain.linearRampToValueAtTime(
|
||||||
|
gainValue * notificationSoundGainScale, start + 0.02,
|
||||||
|
);
|
||||||
gain.gain.exponentialRampToValueAtTime(0.0001, start + duration);
|
gain.gain.exponentialRampToValueAtTime(0.0001, start + duration);
|
||||||
oscillator.connect(gain);
|
oscillator.connect(gain);
|
||||||
gain.connect(context.destination);
|
gain.connect(context.destination);
|
||||||
@@ -335,7 +338,9 @@ function scheduleTone(offset, duration, frequency, gainValue, type) {
|
|||||||
oscillator.type = type || 'sine';
|
oscillator.type = type || 'sine';
|
||||||
oscillator.frequency.setValueAtTime(frequency, start);
|
oscillator.frequency.setValueAtTime(frequency, start);
|
||||||
gain.gain.setValueAtTime(0, start);
|
gain.gain.setValueAtTime(0, start);
|
||||||
gain.gain.linearRampToValueAtTime(gainValue, start + 0.015);
|
gain.gain.linearRampToValueAtTime(
|
||||||
|
gainValue * notificationSoundGainScale, start + 0.015,
|
||||||
|
);
|
||||||
gain.gain.exponentialRampToValueAtTime(0.0001, start + duration);
|
gain.gain.exponentialRampToValueAtTime(0.0001, start + duration);
|
||||||
oscillator.connect(gain);
|
oscillator.connect(gain);
|
||||||
gain.connect(context.destination);
|
gain.connect(context.destination);
|
||||||
|
|||||||
@@ -193,11 +193,22 @@ func makeCachable(w http.ResponseWriter, p string, fi os.FileInfo, cachable bool
|
|||||||
cc := normalCacheControl
|
cc := normalCacheControl
|
||||||
if strings.HasPrefix(p, "/third-party/") {
|
if strings.HasPrefix(p, "/third-party/") {
|
||||||
cc = veryCachableCacheControl
|
cc = veryCachableCacheControl
|
||||||
|
} else if isFirstPartyWebAsset(p) {
|
||||||
|
cc = "no-cache"
|
||||||
}
|
}
|
||||||
|
|
||||||
w.Header().Set("Cache-Control", cc)
|
w.Header().Set("Cache-Control", cc)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func isFirstPartyWebAsset(p string) bool {
|
||||||
|
switch path.Ext(p) {
|
||||||
|
case ".css", ".html", ".js":
|
||||||
|
return true
|
||||||
|
default:
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// fileHandler is our custom reimplementation of http.FileServer
|
// fileHandler is our custom reimplementation of http.FileServer
|
||||||
type fileHandler struct {
|
type fileHandler struct {
|
||||||
root http.FileSystem
|
root http.FileSystem
|
||||||
|
|||||||
Reference in New Issue
Block a user