Trim whitespace and protocol / path information
This commit is contained in:
@@ -144,7 +144,7 @@ export class SetCustomWebInstanceView extends TemplateView {
|
|||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
const form = evt.target;
|
const form = evt.target;
|
||||||
const {instanceHostname} = form.elements;
|
const {instanceHostname} = form.elements;
|
||||||
this.value.setCustomWebInstance(instanceHostname.value || undefined);
|
this.value.setCustomWebInstance(instanceHostname.value);
|
||||||
this.value.closeCustomWebInstanceForm();
|
this.value.closeCustomWebInstanceForm();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -262,8 +262,11 @@ export class ClientViewModel extends ViewModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
setCustomWebInstance(hostname) {
|
setCustomWebInstance(hostname) {
|
||||||
|
if (hostname) {
|
||||||
|
hostname = hostname.trim().replace(/^https:\/\//, '').replace(/\/.*$/, '');
|
||||||
|
}
|
||||||
this.preferences.setClient(this._client.id, hostname ? this._webPlatform : (this._nativePlatform || this._webPlatform));
|
this.preferences.setClient(this._client.id, hostname ? this._webPlatform : (this._nativePlatform || this._webPlatform));
|
||||||
this.preferences.setCustomWebInstance(this._client.id, hostname);
|
this.preferences.setCustomWebInstance(this._client.id, hostname || undefined);
|
||||||
this._update();
|
this._update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user