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 287c234
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions 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,6 +287,7 @@ export default defineComponent({
}
function setAxios(currentTabSetting: string) {
currentTabSetting = addHttp(currentTabSetting)
axiosBaseUrl.setUrl(`http://${currentTabSetting}`)
}
Expand Down

0 comments on commit 287c234

Please sign in to comment.