List of addresses in the About dialog
This commit is contained in:
+32
-12
@@ -5,6 +5,7 @@ import Typography from '@mui/material/Typography';
|
|||||||
import { PiPedalModel, PiPedalModelFactory, State } from './PiPedalModel';
|
import { PiPedalModel, PiPedalModelFactory, State } from './PiPedalModel';
|
||||||
import AppBar from '@mui/material/AppBar';
|
import AppBar from '@mui/material/AppBar';
|
||||||
import Toolbar from '@mui/material/Toolbar';
|
import Toolbar from '@mui/material/Toolbar';
|
||||||
|
import Divider from '@mui/material/Divider';
|
||||||
import ArrowBackIcon from '@mui/icons-material//ArrowBack';
|
import ArrowBackIcon from '@mui/icons-material//ArrowBack';
|
||||||
|
|
||||||
import JackHostStatus from './JackHostStatus';
|
import JackHostStatus from './JackHostStatus';
|
||||||
@@ -138,22 +139,17 @@ const AboutDialog = withStyles(styles, { withTheme: true })(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
startFossRequest()
|
startFossRequest() {
|
||||||
{
|
if (this.state.openSourceNotices === "") {
|
||||||
if (this.state.openSourceNotices === "")
|
|
||||||
{
|
|
||||||
fetch("var/notices.txt")
|
fetch("var/notices.txt")
|
||||||
.then((request)=>
|
.then((request) => {
|
||||||
{
|
if (!request.ok) {
|
||||||
if (!request.ok)
|
|
||||||
{
|
|
||||||
throw new PiPedalError("notices request failed.");
|
throw new PiPedalError("notices request failed.");
|
||||||
}
|
}
|
||||||
return request.text();
|
return request.text();
|
||||||
})
|
})
|
||||||
.then((text) => {
|
.then((text) => {
|
||||||
if (this.mounted)
|
if (this.mounted) {
|
||||||
{
|
|
||||||
this.setState({ openSourceNotices: text });
|
this.setState({ openSourceNotices: text });
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -221,15 +217,39 @@ const AboutDialog = withStyles(styles, { withTheme: true })(
|
|||||||
<Typography display="block" variant="body2" style={{ marginBottom: 12 }} >
|
<Typography display="block" variant="body2" style={{ marginBottom: 12 }} >
|
||||||
Copyright © 2022 Robin Davies.
|
Copyright © 2022 Robin Davies.
|
||||||
</Typography>
|
</Typography>
|
||||||
<Typography display="block" variant="body2" style={{marginBottom: 12}} >
|
{this.model.isAndroidHosted() && (
|
||||||
|
<Typography display="block" variant="body2" style={{ marginBottom: 0 }} >
|
||||||
{this.model.getAndroidHostVersion()}
|
{this.model.getAndroidHostVersion()}
|
||||||
</Typography>
|
</Typography>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{this.model.isAndroidHosted() && (
|
||||||
|
<Typography display="block" variant="body2" style={{ marginBottom: 12 }} >
|
||||||
|
Copyright © 2022 Robin Davies.
|
||||||
|
</Typography>
|
||||||
|
)}
|
||||||
|
<Divider />
|
||||||
|
<Typography display="block" variant="caption" >
|
||||||
|
ADDRESSES
|
||||||
|
</Typography>
|
||||||
|
<div style={{marginBottom: 16}}>
|
||||||
|
{
|
||||||
|
this.model.serverVersion?.webAddresses.map((address) =>
|
||||||
|
(
|
||||||
|
<Typography display="block" variant="body2" style={{ marginBottom: 0, marginLeft: 24 }} >
|
||||||
|
{address}
|
||||||
|
</Typography>
|
||||||
|
))
|
||||||
|
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<Divider />
|
||||||
<Typography display="block" variant="caption" >
|
<Typography display="block" variant="caption" >
|
||||||
LEGAL NOTICES
|
LEGAL NOTICES
|
||||||
</Typography>
|
</Typography>
|
||||||
<div dangerouslySetInnerHTML={{__html: this.state.openSourceNotices}} style={{fontSize: "0.8em" }}>
|
<div dangerouslySetInnerHTML={{ __html: this.state.openSourceNotices }} style={{ fontSize: "0.8em",maxWidth: 400 }}>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
+10
-2
@@ -576,6 +576,13 @@ const AppThemed = withStyles(appStyles)(class extends ResizeResponsiveComponent<
|
|||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
handleReload() {
|
||||||
|
if (this.model_.isAndroidHosted()) {
|
||||||
|
this.model_.chooseNewDevice();
|
||||||
|
} else {
|
||||||
|
window.location.reload();
|
||||||
|
}
|
||||||
|
}
|
||||||
render() {
|
render() {
|
||||||
|
|
||||||
const { classes } = this.props;
|
const { classes } = this.props;
|
||||||
@@ -787,7 +794,8 @@ const AppThemed = withStyles(appStyles)(class extends ResizeResponsiveComponent<
|
|||||||
<JackStatusView />
|
<JackStatusView />
|
||||||
<div className={classes.errorContent} style={{
|
<div className={classes.errorContent} style={{
|
||||||
display: (this.state.displayState === State.Reconnecting || this.state.displayState === State.ApplyingChanges)
|
display: (this.state.displayState === State.Reconnecting || this.state.displayState === State.ApplyingChanges)
|
||||||
? "block" : "none" }}
|
? "block" : "none"
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<div className={classes.errorContentMask} />
|
<div className={classes.errorContentMask} />
|
||||||
|
|
||||||
@@ -816,7 +824,7 @@ const AppThemed = withStyles(appStyles)(class extends ResizeResponsiveComponent<
|
|||||||
</div>
|
</div>
|
||||||
<div style={{ paddingTop: 50, paddingLeft: 36, textAlign: "left" }}>
|
<div style={{ paddingTop: 50, paddingLeft: 36, textAlign: "left" }}>
|
||||||
<Button variant='contained' color="primary" component='button'
|
<Button variant='contained' color="primary" component='button'
|
||||||
onClick={() => window.location.reload()} >
|
onClick={() => this.handleReload()} >
|
||||||
Reload
|
Reload
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
|
|||||||
@@ -159,6 +159,7 @@ export type PiPedalVersion = {
|
|||||||
operatingSystem: string;
|
operatingSystem: string;
|
||||||
osVersion: string;
|
osVersion: string;
|
||||||
debug: boolean;
|
debug: boolean;
|
||||||
|
webAddresses: string[];
|
||||||
};
|
};
|
||||||
|
|
||||||
export class PresetIndexEntry {
|
export class PresetIndexEntry {
|
||||||
|
|||||||
+15
-4
@@ -100,7 +100,9 @@ bool pipedal::ParseHttpAddress(const std::string address,
|
|||||||
*pUser = address.substr(0, start);
|
*pUser = address.substr(0, start);
|
||||||
}
|
}
|
||||||
start = start + 1;
|
start = start + 1;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
start = 0;
|
start = 0;
|
||||||
if (pUser)
|
if (pUser)
|
||||||
{
|
{
|
||||||
@@ -130,7 +132,9 @@ bool pipedal::ParseHttpAddress(const std::string address,
|
|||||||
if (*p >= '0' && *p <= '9')
|
if (*p >= '0' && *p <= '9')
|
||||||
{
|
{
|
||||||
portNumber = portNumber * 10 + *p - '0';
|
portNumber = portNumber * 10 + *p - '0';
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -354,7 +358,7 @@ static std::string GetLinkLocalAddressForIp4Interface(const std::string&name)
|
|||||||
struct ifaddrs *ifap = nullptr;
|
struct ifaddrs *ifap = nullptr;
|
||||||
if (getifaddrs(&ifap) != 0)
|
if (getifaddrs(&ifap) != 0)
|
||||||
return "";
|
return "";
|
||||||
std::string result = "notlocalsubnet.error";
|
std::string result = "";
|
||||||
for (ifaddrs *p = ifap; p != nullptr; p = p->ifa_next)
|
for (ifaddrs *p = ifap; p != nullptr; p = p->ifa_next)
|
||||||
{
|
{
|
||||||
if (p->ifa_addr->sa_family == AF_INET && p->ifa_addr != nullptr && p->ifa_netmask != nullptr)
|
if (p->ifa_addr->sa_family == AF_INET && p->ifa_addr != nullptr && p->ifa_netmask != nullptr)
|
||||||
@@ -427,7 +431,9 @@ std::string pipedal::GetLinkLocalAddress(const std::string fromAddress)
|
|||||||
uint32_t remoteAddress = htonl(*(int32_t *)(pAddr + 12));
|
uint32_t remoteAddress = htonl(*(int32_t *)(pAddr + 12));
|
||||||
std::string interfaceName = GetInterfaceForIp4Address(remoteAddress);
|
std::string interfaceName = GetInterfaceForIp4Address(remoteAddress);
|
||||||
result = GetLinkLocalAddressForIp4Interface(interfaceName);
|
result = GetLinkLocalAddressForIp4Interface(interfaceName);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
std::string interfaceName;
|
std::string interfaceName;
|
||||||
if (IsIpv4MappedAddress(inetAddr6))
|
if (IsIpv4MappedAddress(inetAddr6))
|
||||||
@@ -449,3 +455,8 @@ std::string pipedal::GetLinkLocalAddress(const std::string fromAddress)
|
|||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string pipedal::GetInterfaceIpv4Address(const std::string& interfaceName)
|
||||||
|
{
|
||||||
|
return GetLinkLocalAddressForIp4Interface(interfaceName);
|
||||||
|
}
|
||||||
|
|||||||
@@ -24,6 +24,9 @@
|
|||||||
namespace pipedal {
|
namespace pipedal {
|
||||||
|
|
||||||
|
|
||||||
|
std::string GetInterfaceIpv4Address(const std::string& interfaceName);
|
||||||
|
|
||||||
|
|
||||||
std::string GetLinkLocalAddress(const std::string fromAddress);
|
std::string GetLinkLocalAddress(const std::string fromAddress);
|
||||||
|
|
||||||
bool IsOnLocalSubnet(const std::string&fromAddress);
|
bool IsOnLocalSubnet(const std::string&fromAddress);
|
||||||
|
|||||||
@@ -154,7 +154,7 @@ public:
|
|||||||
PiPedalModel();
|
PiPedalModel();
|
||||||
virtual ~PiPedalModel();
|
virtual ~PiPedalModel();
|
||||||
|
|
||||||
|
uint16_t GetWebPort() const { return webPort; }
|
||||||
void Close();
|
void Close();
|
||||||
|
|
||||||
void UpdateDnsSd();
|
void UpdateDnsSd();
|
||||||
|
|||||||
@@ -926,7 +926,7 @@ public:
|
|||||||
}
|
}
|
||||||
else if (message == "version")
|
else if (message == "version")
|
||||||
{
|
{
|
||||||
PiPedalVersion version;
|
PiPedalVersion version(this->model);
|
||||||
|
|
||||||
Reply(replyTo, "version", version);
|
Reply(replyTo, "version", version);
|
||||||
}
|
}
|
||||||
|
|||||||
+42
-1
@@ -18,8 +18,10 @@
|
|||||||
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
|
#include "PiPedalModel.hpp"
|
||||||
#include "config.hpp"
|
#include "config.hpp"
|
||||||
#include "PiPedalVersion.hpp"
|
#include "PiPedalVersion.hpp"
|
||||||
|
#include "Ipv6Helpers.hpp"
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include "windows.h"
|
#include "windows.h"
|
||||||
@@ -36,9 +38,21 @@ JSON_MAP_BEGIN(PiPedalVersion)
|
|||||||
JSON_MAP_REFERENCE(PiPedalVersion,operatingSystem)
|
JSON_MAP_REFERENCE(PiPedalVersion,operatingSystem)
|
||||||
JSON_MAP_REFERENCE(PiPedalVersion,osVersion)
|
JSON_MAP_REFERENCE(PiPedalVersion,osVersion)
|
||||||
JSON_MAP_REFERENCE(PiPedalVersion,debug)
|
JSON_MAP_REFERENCE(PiPedalVersion,debug)
|
||||||
|
JSON_MAP_REFERENCE(PiPedalVersion,webAddresses)
|
||||||
JSON_MAP_END()
|
JSON_MAP_END()
|
||||||
|
|
||||||
PiPedalVersion::PiPedalVersion()
|
|
||||||
|
static std::string MakeWebAddress(const std::string &address, uint16_t port)
|
||||||
|
{
|
||||||
|
if (port == 80)
|
||||||
|
{
|
||||||
|
return SS("http://" << address << '/');
|
||||||
|
} else {
|
||||||
|
return SS("http://" << address << ':' << port << '/');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
PiPedalVersion::PiPedalVersion(PiPedalModel&model)
|
||||||
{
|
{
|
||||||
server_ = "PiPedal Server";
|
server_ = "PiPedal Server";
|
||||||
// defined on build command line.
|
// defined on build command line.
|
||||||
@@ -71,4 +85,31 @@ PiPedalVersion::PiPedalVersion()
|
|||||||
#else
|
#else
|
||||||
debug_ = false;
|
debug_ = false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
uint16_t port = model.GetWebPort();
|
||||||
|
|
||||||
|
char hostName[512];
|
||||||
|
gethostname(hostName,sizeof(hostName));
|
||||||
|
|
||||||
|
this->webAddresses_.push_back(MakeWebAddress(SS(hostName << ".local"),port));
|
||||||
|
|
||||||
|
std::string ethAddr = GetInterfaceIpv4Address("eth0");
|
||||||
|
if (ethAddr.length() != 0)
|
||||||
|
{
|
||||||
|
this->webAddresses_.push_back(MakeWebAddress(ethAddr,port));
|
||||||
|
}
|
||||||
|
std::string wlanAddr = GetInterfaceIpv4Address("wlan0");
|
||||||
|
if (wlanAddr.length() != 0)
|
||||||
|
{
|
||||||
|
this->webAddresses_.push_back(MakeWebAddress(wlanAddr,port));
|
||||||
|
|
||||||
|
}
|
||||||
|
std::string p2pAddr = GetInterfaceIpv4Address("p2p-wlan0-0");
|
||||||
|
if (p2pAddr.length() != 0)
|
||||||
|
{
|
||||||
|
this->webAddresses_.push_back(MakeWebAddress(p2pAddr,port));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,16 +22,19 @@
|
|||||||
|
|
||||||
namespace pipedal {
|
namespace pipedal {
|
||||||
|
|
||||||
|
class PiPedalModel;
|
||||||
|
|
||||||
class PiPedalVersion {
|
class PiPedalVersion {
|
||||||
private:
|
private:
|
||||||
std::string server_;
|
std::string server_;
|
||||||
std::string serverVersion_;
|
std::string serverVersion_;
|
||||||
std::string operatingSystem_;
|
std::string operatingSystem_;
|
||||||
std::string osVersion_;
|
std::string osVersion_;
|
||||||
|
std::vector<std::string> webAddresses_;
|
||||||
bool debug_;
|
bool debug_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PiPedalVersion();
|
PiPedalVersion(PiPedalModel&model);
|
||||||
~PiPedalVersion() = default;
|
~PiPedalVersion() = default;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user