Tone3000 API fix for [::1] address.
This commit is contained in:
+4
-4
@@ -539,7 +539,7 @@ static std::string GetNonLinkLocalAddressForInterface(const std::string &name)
|
||||
}
|
||||
return result;
|
||||
}
|
||||
static std::string GetNonLinkLocalAddressForIp4Interface(const std::string &name)
|
||||
static std::string GetIp4NonLinkLocalAddressForInterface(const std::string &name)
|
||||
{
|
||||
struct ifaddrs *ifap = nullptr;
|
||||
if (getifaddrs(&ifap) != 0)
|
||||
@@ -694,13 +694,13 @@ std::string pipedal::GetNonLinkLocalAddress(const std::string &fromAddress)
|
||||
int8_t *pAddr = (int8_t *)&inetAddr6;
|
||||
uint32_t remoteAddress = htonl(*(int32_t *)(pAddr + 12));
|
||||
std::string interfaceName = GetInterfaceForIp4Address(remoteAddress);
|
||||
result = GetNonLinkLocalAddressForIp4Interface(interfaceName);
|
||||
result = GetIp4NonLinkLocalAddressForInterface(interfaceName);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
std::string interfaceName = GetInterfaceForIp6Address(inetAddr6);
|
||||
result = GetNonLinkLocalAddressForInterface(interfaceName);
|
||||
result = GetIp4NonLinkLocalAddressForInterface(interfaceName);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -713,7 +713,7 @@ std::string pipedal::GetNonLinkLocalAddress(const std::string &fromAddress)
|
||||
|
||||
std::string pipedal::GetInterfaceIpv4Address(const std::string &interfaceName)
|
||||
{
|
||||
return GetNonLinkLocalAddressForIp4Interface(interfaceName);
|
||||
return GetIp4NonLinkLocalAddressForInterface(interfaceName);
|
||||
}
|
||||
|
||||
// std::string getNonLinkLocalAddress(const std::string&address, const std::string&interface)
|
||||
|
||||
@@ -179,7 +179,7 @@ export async function startSelectFlowPopup(
|
||||
const url = buildAuthorizeUrl(publishableKey, redirectUri, extra, pkce);
|
||||
|
||||
if (T3K_DEBUG) {
|
||||
console.debug("PiPedal startSelectFlowPopup URL:" + url + "(from buildAuthorizeUrl)");
|
||||
console.debug("PiPedal startSelectFlowPopup URL:" + url + " (from buildAuthorizeUrl)");
|
||||
}
|
||||
const width = options?.width ?? 480;
|
||||
const height = options?.height ?? 700;
|
||||
@@ -476,7 +476,8 @@ export async function handleOAuthCallback(
|
||||
const url = new URL(responseUri);
|
||||
const params = new URLSearchParams(url.search);
|
||||
const code = params.get('code');
|
||||
const error = params.get('error');
|
||||
let error = params.get('error');
|
||||
const error_description = params.get('error_description');
|
||||
const returnedState = params.get('state');
|
||||
const toneId = params.get('tone_id') ?? undefined;
|
||||
const modelId = params.get('model_id') ?? undefined;
|
||||
@@ -498,6 +499,10 @@ export async function handleOAuthCallback(
|
||||
if (canceled && !code) {
|
||||
return { ok: false, error: 'canceled', canceled: true };
|
||||
}
|
||||
// build full error description
|
||||
if (error && error_description) {
|
||||
error = `${error}: ${error_description}`;
|
||||
}
|
||||
|
||||
// Access denied — e.g. model is private and user clicked "Back"
|
||||
if (error) {
|
||||
|
||||
Reference in New Issue
Block a user