BUG: Tone3000 downloads don't work with .local addresses.

This commit is contained in:
Robin E.R. Davies
2026-05-29 00:20:14 -04:00
parent 7c8f18d83b
commit a146cc5cd5
3 changed files with 26 additions and 30 deletions
+7 -11
View File
@@ -467,17 +467,10 @@ export class Tone3000DownloadHandler {
private popupWindow: Window | null = null;
private redirectUrl(): string {
let hostname = window.location.hostname;
let port = window.location.port;
let protocol = window.location.protocol;
let varServerURL = new URL(this.model.varServerUrl);
let serverUrl: string;
if (protocol === "http:" && (port === "80" || port === "")) {
serverUrl = `${protocol}//${hostname}`;
} else if (protocol === "https:" && (port === "443" || port === "")) {
serverUrl = `${protocol}//${hostname}`;
} else {
serverUrl = `${protocol}//${hostname}:${port}`;
}
serverUrl = varServerURL.origin;
return `${serverUrl}/html/t3k_response.html`;
// return `${serverUrl}/t3k_response.html`; // for a debuggable react version of the page
}
@@ -519,7 +512,9 @@ export class Tone3000DownloadHandler {
public async launchTone3000Popup(
downloadType: Tone3000DownloadType,
downloadPath: string,
options?: {
userName?: string;
}
): Promise<void> {
if (this.progress.transferring) {
return;
@@ -584,6 +579,7 @@ export class Tone3000DownloadHandler {
menubar: true,
width: popupWidth,
height: popupHeight,
userName: options?.userName
},
);
+18 -18
View File
@@ -49,7 +49,7 @@ function floatToModelType(value: number): NamModelType {
default: return NamModelType.None;
}
}
// offset 0: an integer with the folloing bits set.
// offset 0: an integer with the following bits set.
// Must match ToobAmp/src/NeuralAmpModeler_Lv2Extensions.hpp enum TOOB_NAM_METADATA_OFFSETS
class TOOB_NAM_METADATA_OFFSETS {
static readonly flags = 0;
@@ -61,7 +61,7 @@ class TOOB_NAM_METADATA_OFFSETS {
static readonly has_slimmable_weights = 6;
static readonly model_weight = 7;
static readonly model_type = 8;
static readonly max_medatadata = 9;
static readonly max_metadata = 9;
};
@@ -87,8 +87,8 @@ class ModelMetadata {
this.loudness = metadataValues[TOOB_NAM_METADATA_OFFSETS.loudness];
this.gain = metadataValues[TOOB_NAM_METADATA_OFFSETS.gain];
this.inputlevelDBU = metadataValues[TOOB_NAM_METADATA_OFFSETS.input_level_dbu];
this.outputlevelDBU = metadataValues[TOOB_NAM_METADATA_OFFSETS.output_level_dbu];
this.inputLevelDBU = metadataValues[TOOB_NAM_METADATA_OFFSETS.input_level_dbu];
this.outputLevelDBU = metadataValues[TOOB_NAM_METADATA_OFFSETS.output_level_dbu];
this.preset_version = metadataValues[TOOB_NAM_METADATA_OFFSETS.preset_version];
this.hasSlimmableWeights = metadataValues[TOOB_NAM_METADATA_OFFSETS.has_slimmable_weights] !== 0;
this.modelWeight = metadataValues[TOOB_NAM_METADATA_OFFSETS.model_weight];
@@ -103,8 +103,8 @@ class ModelMetadata {
this.loudness = 0;
this.gain = 0;
this.hasSlimmableWeights = false;
this.inputlevelDBU = 0;
this.outputlevelDBU = 0;
this.inputLevelDBU = 0;
this.outputLevelDBU = 0;
this.preset_version = 1;
this.modelWeight = -1;
}
@@ -122,8 +122,8 @@ class ModelMetadata {
loudness: number;
gain: number;
inputlevelDBU: number;
outputlevelDBU: number;
inputLevelDBU: number;
outputLevelDBU: number;
}
@@ -138,7 +138,7 @@ interface ToobNamViewProps extends WithStyles<typeof styles> {
}
interface ToobNamViewState {
showEqSection: boolean;
enableCalibration: boolean;
enableInputCalibration: boolean;
showCalibration: boolean;
enableOutputNormalization: boolean;
modelMetadata: ModelMetadata;
@@ -161,14 +161,14 @@ const ToobNamView =
this.state = {
showEqSection: false,
showCalibration: false,
enableCalibration: false,
enableInputCalibration: false,
enableOutputNormalization: false,
modelMetadata: new ModelMetadata(),
modelWeight: -1
}
let pluginInfo: UiPlugin | null = this.model.getUiPlugin(this.props.item.uri);
if (pluginInfo === null) {
throw new Error("Plugin not fouund.");
throw new Error("Plugin not found.");
}
let inputCalibrationControl = pluginInfo.getControl("inputCalibrationMode");
if (!inputCalibrationControl) {
@@ -225,7 +225,7 @@ const ToobNamView =
if (this.state.showCalibration) {
calibrationGroup.controls[0] = host.makeStandardControl(this.patchedInputControl, this.props.item.controlValues);
if (this.state.enableCalibration) {
if (this.state.enableInputCalibration) {
calibrationGroup.controls[0] = host.makeStandardControl(this.patchedInputControl, this.props.item.controlValues);
} else {
@@ -263,7 +263,7 @@ const ToobNamView =
private handleConnectionStateChanged(state: State) {
if (state === State.Ready) {
this.unsubscribeFromMetadata();
this.subscribeToMetdata();
this.subscribeToMetadata();
}
}
@@ -276,15 +276,15 @@ const ToobNamView =
showEqSection: metadata.preset_version === 0,
showCalibration: (
metadata.hasInputLevelDBU || metadata.hasOutputLevelDBU ||
(metadata.hasLoudness && metadata.hasGain)) && metadata.hasModel,
enableCalibration: metadata.hasInputLevelDBU && metadata.hasModel,
metadata.hasLoudness) && metadata.hasModel,
enableInputCalibration: metadata.hasInputLevelDBU && metadata.hasModel,
enableOutputNormalization: metadata.hasLoudness && metadata.hasModel,
modelWeight: metadata.modelWeight
});
}
}
subscribeToMetdata() {
subscribeToMetadata() {
this.subscribedId = this.props.instanceId;
this.listenHandle = this.model.monitorPatchProperty(
this.props.instanceId,
@@ -315,7 +315,7 @@ const ToobNamView =
if (super.componentDidMount) {
super.componentDidMount();
}
this.subscribeToMetdata();
this.subscribeToMetadata();
this.model.state.addOnChangedHandler(this.handleConnectionStateChanged);
}
componentWillUnmount() {
@@ -331,7 +331,7 @@ const ToobNamView =
componentDidUpdate() {
if (this.props.instanceId !== this.subscribedId) {
this.unsubscribeFromMetadata();
this.subscribeToMetdata();
this.subscribeToMetadata();
}
}
+1 -1
View File
@@ -164,7 +164,7 @@ export async function startSelectFlowPopup(
redirectUri: string,
options?: {
gears?: string; platform?: string; menubar?: boolean, loginHint?: string, architecture?: number
width?: number, height?: number
width?: number, height?: number, userName?: string;
}
): Promise<Window | null> {
// Set before window.open so the popup inherits this flag via sessionStorage copy;