Tone3000 API fix for [::1] address.

This commit is contained in:
Robin E.R. Davies
2026-06-01 14:44:04 -04:00
parent b8b68e13de
commit 2f10bfcba2
2 changed files with 11 additions and 6 deletions
+4 -4
View File
@@ -539,7 +539,7 @@ static std::string GetNonLinkLocalAddressForInterface(const std::string &name)
} }
return result; return result;
} }
static std::string GetNonLinkLocalAddressForIp4Interface(const std::string &name) static std::string GetIp4NonLinkLocalAddressForInterface(const std::string &name)
{ {
struct ifaddrs *ifap = nullptr; struct ifaddrs *ifap = nullptr;
if (getifaddrs(&ifap) != 0) if (getifaddrs(&ifap) != 0)
@@ -694,13 +694,13 @@ std::string pipedal::GetNonLinkLocalAddress(const std::string &fromAddress)
int8_t *pAddr = (int8_t *)&inetAddr6; int8_t *pAddr = (int8_t *)&inetAddr6;
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 = GetNonLinkLocalAddressForIp4Interface(interfaceName); result = GetIp4NonLinkLocalAddressForInterface(interfaceName);
} }
else else
{ {
std::string interfaceName = GetInterfaceForIp6Address(inetAddr6); 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) 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) // std::string getNonLinkLocalAddress(const std::string&address, const std::string&interface)
+7 -2
View File
@@ -179,7 +179,7 @@ export async function startSelectFlowPopup(
const url = buildAuthorizeUrl(publishableKey, redirectUri, extra, pkce); const url = buildAuthorizeUrl(publishableKey, redirectUri, extra, pkce);
if (T3K_DEBUG) { 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 width = options?.width ?? 480;
const height = options?.height ?? 700; const height = options?.height ?? 700;
@@ -476,7 +476,8 @@ export async function handleOAuthCallback(
const url = new URL(responseUri); const url = new URL(responseUri);
const params = new URLSearchParams(url.search); const params = new URLSearchParams(url.search);
const code = params.get('code'); 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 returnedState = params.get('state');
const toneId = params.get('tone_id') ?? undefined; const toneId = params.get('tone_id') ?? undefined;
const modelId = params.get('model_id') ?? undefined; const modelId = params.get('model_id') ?? undefined;
@@ -498,6 +499,10 @@ export async function handleOAuthCallback(
if (canceled && !code) { if (canceled && !code) {
return { ok: false, error: 'canceled', canceled: true }; 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" // Access denied — e.g. model is private and user clicked "Back"
if (error) { if (error) {