feat(PublicPage): add http padding to website, facebook, twitter and instagram
This commit is contained in:
parent
359274ca0b
commit
61a9a703e9
1 changed files with 30 additions and 24 deletions
|
@ -170,30 +170,36 @@ export default class PublicController {
|
||||||
// }
|
// }
|
||||||
// console.log(version.contacts.websiteLabel)
|
// console.log(version.contacts.websiteLabel)
|
||||||
// }
|
// }
|
||||||
// if (Utils.isStrUsable(version.contacts, 'facebook')) {
|
const httpPadding = (url: string) => {
|
||||||
|
if (url.indexOf('http://') !== 0 && url.indexOf('https://') !== 0) {
|
||||||
|
return 'http://' + url
|
||||||
|
}
|
||||||
|
return url
|
||||||
|
}
|
||||||
|
if (Utils.isStrUsable(version.contacts, 'website')) {
|
||||||
|
version.contacts.website = httpPadding(version.contacts.website)
|
||||||
|
}
|
||||||
|
if (Utils.isStrUsable(version.contacts, 'facebook')) {
|
||||||
// try {
|
// try {
|
||||||
// version.contacts.facebookLabel = new URL(version.contacts.facebook).pathname.replace('/', '')
|
// version.contacts.facebookLabel = new URL(version.contacts.facebook).pathname.replace('/', '')
|
||||||
// } catch (err) {
|
// } catch (err) {
|
||||||
// console.error(err)
|
// console.error(err)
|
||||||
// version.contacts.facebook = version.contacts.facebookLabel = "OULA, c'est pas bon :("
|
// version.contacts.facebook = version.contacts.facebookLabel = "OULA, c'est pas bon :("
|
||||||
// }
|
// }
|
||||||
// }
|
version.contacts.facebook = httpPadding(version.contacts.facebook)
|
||||||
// if (Utils.isStrUsable(version.contacts, 'twitter')) {
|
}
|
||||||
|
if (Utils.isStrUsable(version.contacts, 'twitter')) {
|
||||||
// try {
|
// try {
|
||||||
// version.contacts.twitterLabel = new URL(version.contacts.twitter).pathname.replace('/', '')
|
// version.contacts.twitterLabel = new URL(version.contacts.twitter).pathname.replace('/', '')
|
||||||
// } catch (err) {
|
// } catch (err) {
|
||||||
// console.error(err)
|
// console.error(err)
|
||||||
// version.contacts.twitter = version.contacts.twitterLabel = "OULA, c'est pas bon :("
|
// version.contacts.twitter = version.contacts.twitterLabel = "OULA, c'est pas bon :("
|
||||||
// }
|
// }
|
||||||
// }
|
version.contacts.twitter = httpPadding(version.contacts.twitter)
|
||||||
// if (Utils.isStrUsable(version.contacts, 'instagram')) {
|
}
|
||||||
// try {
|
if (Utils.isStrUsable(version.contacts, 'instagram')) {
|
||||||
// version.contacts.instagramLabel = new URL(version.contacts.instagram).pathname.replace('/', '')
|
version.contacts.instagram = httpPadding(version.contacts.instagram)
|
||||||
// } catch (err) {
|
}
|
||||||
// console.error(err)
|
|
||||||
// version.contacts.instagram = version.contacts.instagramLabel = "OULA, c'est pas bon :("
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue