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