Skip to content

Commit

Permalink
Allow passing of protocols in Electron input box
Browse files Browse the repository at this point in the history
  • Loading branch information
maggie44 committed Sep 1, 2022
1 parent 48a61ce commit 01a85a8
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion ui/src/layouts/AppPortal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@
<q-input
ref="validateHostInput"
v-model="reqHostname"
type="url"
clearable
:rules="[
(value: string) =>
Expand Down Expand Up @@ -243,6 +244,13 @@ export default defineComponent({
}
})
function addHttp(url: string) {
if (!/^(?:f|ht)tps?:\/\//.test(url)) {
url = `http://${url}`
}
return url
}
// Electron toolbar controls
function closeTab(index: number) {
currentTab.value = 'welcome'
Expand Down Expand Up @@ -279,7 +287,8 @@ export default defineComponent({
}
function setAxios(currentTabSetting: string) {
axiosBaseUrl.setUrl(`http://${currentTabSetting}`)
currentTabSetting = addHttp(currentTabSetting)
axiosBaseUrl.setUrl(currentTabSetting)
}
function setHostname(reqHost: string) {
Expand Down

0 comments on commit 01a85a8

Please sign in to comment.