3
0

Add https to-all urls input values across corteza

This commit is contained in:
Atanas Yonkov
2023-05-04 11:30:05 +03:00
parent 4c702b9b13
commit dc4864927c
7 changed files with 16 additions and 6 deletions

View File

@@ -8,7 +8,7 @@
v-if="src"
ref="iframe"
class="h-100 w-100 border-0"
:src="src"
:src="src | checkValidURL"
/>
</wrap>
</template>

View File

@@ -59,7 +59,7 @@
>
<a
class="dropdown-item"
:href="dropdown.url"
:href="dropdown.url | checkValidURL"
:disabled="navItem.options.disabled"
:target="selectTargetOption(dropdown.target)"
:style="{ order: dIndex * 2 }"
@@ -165,7 +165,7 @@ export default {
return
}
return navItem.type === 'url' ? navItem.options.item.url : ''
return navItem.type === 'url' ? this.$options.filters.checkValidURL(navItem.options.item.url) : ''
},
},
}

View File

@@ -88,7 +88,8 @@ export default {
}
// is this a twitter url?
if (url && url.indexOf('twitter.com')) {
if (url && url.indexOf('twitter.com') > -1) {
url = this.$options.filters.checkValidURL(url)
twitterHandle = this.getTwitterHandle(url)
if (twitterHandle === '') {
// failed to get twitter handle from the url

View File

@@ -1,4 +1,5 @@
import { Apply } from '../../../../cast'
import { PageBlock } from '../base';
interface DropdownItem {
label: string;

View File

@@ -63,7 +63,7 @@
<b-dropdown-item
v-for="(helpLink, index) in helpLinks"
:key="index"
:href="helpLink.url"
:href="helpLink.url | checkValidURL"
:target="helpLink.newTab ? '_blank' : ''"
>
{{ helpLink.handle }}
@@ -150,7 +150,7 @@
<b-dropdown-item
v-for="(profileLink, index) in profileLinks"
:key="index"
:href="profileLink.url"
:href="profileLink.url | checkValidURL"
:target="profileLink.newTab ? '_blank' : ''"
>
{{ profileLink.handle }}

View File

@@ -1 +1,2 @@
export * from './date'
export * from './url'

View File

@@ -0,0 +1,7 @@
export function checkValidURL (url: string): string {
if (url.indexOf('://') > 0) { // do not modify the link if it has sth before "://"", e.g. ftp, http, etc.
return url
} else {
return 'http://' + url
}
}