Skip to content

Commit 1ee1e25

Browse files
committed
fixes
1 parent 98f2154 commit 1ee1e25

9 files changed

Lines changed: 113 additions & 28 deletions

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,4 @@ nunit-*.xml
5555

5656
.vs/
5757
appsettings.Development.json
58+
Properties/PublishProfiles/

AmberAlerting.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
<TargetFramework>net8.0</TargetFramework>
55
<Nullable>enable</Nullable>
66
<ImplicitUsings>enable</ImplicitUsings>
7-
<AspNetCoreHostingModel>OutOfProcess</AspNetCoreHostingModel>
87
<PlatformTarget>x64</PlatformTarget>
98
</PropertyGroup>
109

AmberAlerting.csproj.user

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<PropertyGroup>
44
<ActiveDebugProfile>https</ActiveDebugProfile>
5-
<NameOfLastUsedPublishProfile>D:\AmberAlerting\Properties\PublishProfiles\amberalerting - Zip Deploy.pubxml</NameOfLastUsedPublishProfile>
5+
<NameOfLastUsedPublishProfile>D:\AmberAlerting\Properties\PublishProfiles\FolderProfile1.pubxml</NameOfLastUsedPublishProfile>
66
</PropertyGroup>
77
</Project>

AmberAlerting.sln

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.14.36301.6 d17.14
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AmberAlerting", "AmberAlerting.csproj", "{F8BE9B64-CC84-42E0-B7DD-125CAEF67420}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{F8BE9B64-CC84-42E0-B7DD-125CAEF67420}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{F8BE9B64-CC84-42E0-B7DD-125CAEF67420}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{F8BE9B64-CC84-42E0-B7DD-125CAEF67420}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{F8BE9B64-CC84-42E0-B7DD-125CAEF67420}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {0CB41521-FE14-4B33-A87E-33E53CF4807F}
24+
EndGlobalSection
25+
EndGlobal

Properties/PublishProfiles/FolderProfile.pubxml

Lines changed: 0 additions & 15 deletions
This file was deleted.

Properties/PublishProfiles/FolderProfile.pubxml.user

Lines changed: 0 additions & 9 deletions
This file was deleted.

Properties/PublishProfiles/amberalerting - Zip Deploy.pubxml.user

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ by editing this MSBuild file. In order to learn more about this please visit htt
66
<Project>
77
<PropertyGroup>
88
<TimeStampOfAssociatedLegacyPublishXmlFile />
9-
<EncryptedPassword>AQAAANCMnd8BFdERjHoAwE/Cl+sBAAAAqKTQ1v/DVk63bu6LLw1fBQAAAAACAAAAAAAQZgAAAAEAACAAAAA4nIg9AhsQMsPsSuMYjJPBsAbCifxH18njSi4agMuUwgAAAAAOgAAAAAIAACAAAADkUdj8l3+vkRsOD+I6wYKMN/RuAdLDt/g+tagAHRGF/aAAAAD5L/y4e4MyV63KFK2FOHL+Vm2ERAwFQybs46SjQ19Vn51mREqn1J2UuqAh9TGnHqF/yPMbheZZO3eObs6tp5p5ceGlxC7fjiSeW6tz0xPaYtSqITv99wzRtRa8yncc49NO2ekgK8jLVXrLMlttEgvVwAlNIMFllmR8PGHb1dSrOgKdjnZ3TRTXwsQTeJ3FzFCu9fqjKWX+m844cYZIwCufQAAAAKHCgaX7oQiutYQoHBgh7tXCxXL5Z/Uh5ZniToNCC2GPIgHwTBVyFqLFF2o5x+PvQ7wY5bUVzeiDHpBuzTtIxQc=</EncryptedPassword>
10-
<History>True|2025-07-24T16:55:47.0537413Z||;</History>
9+
<History>False|2025-07-28T23:53:13.2552431Z||;True|2025-07-24T09:55:47.0537413-07:00||;</History>
1110
<LastFailureDetails />
1211
</PropertyGroup>
1312
</Project>

Views/Home/Index.cshtml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,71 @@
5151

5252
<script>
5353
let alertTimers = new Map(); // Store individual timers for each alert
54+
let alertSoundPlayed = new Set(); // Track which alerts have played their sound
55+
56+
// Initialize audio with multiple sound options
57+
const alertSounds = {
58+
chime: new Audio('data:audio/wav;base64,UklGRnoGAABXQVZFZm10IBAAAAABAAEARKwAAIhYAQACABAAZGF0YQAAAAAAAAAA'),
59+
bell: new Audio('https://www.soundjay.com/misc/sounds/bell-ringing-05.wav'),
60+
notification: new Audio('https://notificationsounds.com/storage/sounds/file-sounds-1150-pristine.ogg')
61+
};
62+
63+
// Use a simple chime sound encoded as base64 (fallback)
64+
const defaultAlertSound = new Audio('data:audio/wav;base64,UklGRnoGAABXQVZFZm10IBAAAAABAAEAQB8AAEAfAAABAAgAZGF0YQoGAACBhYqFbF1fdJivrJBhNjVgodDbq2EcBj+a2/LDciUFLIHO8tiJNwgZaLvt559NEAxQp+PwtmMcBjiR1/LMeSwFJHfH8N2QQAoUXrTp66hVFApGn+DyvmwhBSyBzvLYiTcIG2m98OScTgwOUarm7blmFgU7k9n1unEiBC13yO/eizEIHWq+8+OWT' +
65+
'AsLVqzn87JlHAU2jdDv0IkwByte0/PkkEQHFGHC7eqfUgwKVqjj8LtyKAUqgNDy0ok3CBpnuuztm08MAlCs5O+1aB4GN5DY9Lh0KAUuhM/y3Ys3Bhplt+3snEwMAVWq4+6zYhwGOJLW8cx2KAUkdMrv3Y1AAhVdtOnqp1YPBlGj5vCuXh8GLYXJs+OKOAgZaLvt559NEAxQp+PwtmMcBjiP1/PMeS0GI3fH8N+RQAoUXrTp66hVFApGnt/yvmwhBCuBzvLZiTgIG2m98OScTgwOUqnl7blmFgU7k9n1unEiBC14yu7eizEIHWq+8+OWTAsLVqzn87Jl');
66+
67+
// Try to use Web Audio API for better sound
68+
function playAlertSound() {
69+
try {
70+
// Create a simple beep using Web Audio API
71+
const audioContext = new (window.AudioContext || window.webkitAudioContext)();
72+
73+
// Create oscillators for a pleasant chime
74+
const now = audioContext.currentTime;
75+
76+
// First tone
77+
const osc1 = audioContext.createOscillator();
78+
const gainNode1 = audioContext.createGain();
79+
osc1.connect(gainNode1);
80+
gainNode1.connect(audioContext.destination);
81+
osc1.frequency.value = 800;
82+
gainNode1.gain.setValueAtTime(0.3, now);
83+
gainNode1.gain.exponentialRampToValueAtTime(0.01, now + 0.5);
84+
osc1.start(now);
85+
osc1.stop(now + 0.5);
86+
87+
// Second tone
88+
const osc2 = audioContext.createOscillator();
89+
const gainNode2 = audioContext.createGain();
90+
osc2.connect(gainNode2);
91+
gainNode2.connect(audioContext.destination);
92+
osc2.frequency.value = 1000;
93+
gainNode2.gain.setValueAtTime(0.3, now + 0.2);
94+
gainNode2.gain.exponentialRampToValueAtTime(0.01, now + 0.7);
95+
osc2.start(now + 0.2);
96+
osc2.stop(now + 0.7);
97+
98+
// Third tone
99+
const osc3 = audioContext.createOscillator();
100+
const gainNode3 = audioContext.createGain();
101+
osc3.connect(gainNode3);
102+
gainNode3.connect(audioContext.destination);
103+
osc3.frequency.value = 1200;
104+
gainNode3.gain.setValueAtTime(0.3, now + 0.4);
105+
gainNode3.gain.exponentialRampToValueAtTime(0.01, now + 0.9);
106+
osc3.start(now + 0.4);
107+
osc3.stop(now + 0.9);
108+
109+
} catch (error) {
110+
console.error('Error playing sound:', error);
111+
// Fallback to default audio element
112+
try {
113+
defaultAlertSound.play().catch(e => console.error('Fallback audio failed:', e));
114+
} catch (e) {
115+
console.error('All audio methods failed:', e);
116+
}
117+
}
118+
}
54119
55120
// Load alerts from API
56121
async function loadAlerts() {
@@ -66,6 +131,7 @@
66131
// Clear all timers
67132
alertTimers.forEach(timer => clearInterval(timer));
68133
alertTimers.clear();
134+
alertSoundPlayed.clear();
69135
container.innerHTML = '<div class="text-center py-5 text-muted"><i class="fas fa-inbox fa-3x mb-3"></i><br><h5>No active alerts</h5><p>Create your first alert above!</p></div>';
70136
return;
71137
}
@@ -76,6 +142,7 @@
76142
if (!currentAlertIds.has(alertId)) {
77143
clearInterval(timer);
78144
alertTimers.delete(alertId);
145+
alertSoundPlayed.delete(alertId);
79146
}
80147
});
81148
@@ -178,6 +245,12 @@
178245
179246
// Check if time's up
180247
if (remainingSeconds <= 0) {
248+
// Play sound only once per alert
249+
if (!alertSoundPlayed.has(alert.id)) {
250+
alertSoundPlayed.add(alert.id);
251+
playAlertSound();
252+
}
253+
181254
// Update styling when expired
182255
const alertDiv = document.getElementById(`alert-${alert.id}`);
183256
if (alertDiv && !alertDiv.innerHTML.includes("TIME'S UP!")) {
@@ -256,6 +329,7 @@
256329
clearInterval(alertTimers.get(id));
257330
alertTimers.delete(id);
258331
}
332+
alertSoundPlayed.delete(id);
259333
loadAlerts();
260334
}
261335
} catch (error) {

web.config

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<configuration>
3+
<location path="." inheritInChildApplications="false">
4+
<system.webServer>
5+
<handlers>
6+
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
7+
</handlers>
8+
<aspNetCore processPath="dotnet" arguments=".\AmberAlerting.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="outofprocess" />
9+
</system.webServer>
10+
</location>
11+
</configuration>

0 commit comments

Comments
 (0)