master
wanggang 4 years ago
parent 436d8a5d7c
commit ab0ca7af82

@ -40,6 +40,17 @@
</Content>
</ItemGroup>
<ItemGroup>
<None Remove="wwwroot\favicon.ico" />
</ItemGroup>
<ItemGroup>
<Content Update="wwwroot\favicon.ico">
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<None Update="license.dat">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>

@ -6,6 +6,7 @@ using Serilog;
using Serilog.Core;
using Serilog.Events;
using System.Diagnostics;
using System.Net;
namespace PhotoCollector;
@ -81,9 +82,35 @@ internal static class Program
webBuilder.UseSetting(WebHostDefaults.DetailedErrorsKey, "true");
webBuilder.UseContentRoot(AppContext.BaseDirectory);
webBuilder.UseStartup<Startup>();
webBuilder.UseUrls("http://localhost:8440");
webBuilder.UseUrls($"http://localhost:{GetDynamicFreePort()}");
//webBuilder.UseUrls("http://localhost:48440");
})
.Build();
await WebHost.StartAsync();
}
}
public static int GetDynamicFreePort()
{
var port = 49152;
while (port < 65535)
{
var listener = new HttpListener();
listener.Prefixes.Add($"http://localhost:{port}/");
try
{
listener.Start();
break;
}
catch
{
port++;
}
finally
{
listener.Stop();
listener.Close();
}
}
return port;
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

@ -245,10 +245,11 @@
select.innerHTML = "";
devices.forEach(function (device) {
console.log(device);
if (device.kind === 'videoinput' && device.label) {
select.insertAdjacentHTML('beforeend', `<option value="${device.deviceId}">${device.label}</option>`);
if (device.kind === 'videoinput' && device.groupId) {
select.insertAdjacentHTML('beforeend', `<option value="${device.deviceId}">${device.label ?? device.groupId}</option>`);
}
});
console.dir(select);
if (select.children.length) {
select.children[0].setAttribute("selected", "selected");
select.dispatchEvent(new Event('change'));
@ -258,8 +259,8 @@
console.log(err.name + ": " + err.message);
});
}
//setInterval(init, 5000);
init();
setInterval(init,2000);
//init();
</script>
</body>
</html>
Loading…
Cancel
Save