fix(embed): standardize `instance` or `b` parameter
This commit is contained in:
parent
8f6338b76d
commit
85b4845427
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
// Params
|
// Params
|
||||||
const params = new URL(location.href).searchParams
|
const params = new URL(location.href).searchParams
|
||||||
const baseUrl = params.get('instance') ?? params.get('b') ?? ''
|
let baseUrl = params.get('instance') ?? params.get('b') ?? location.origin
|
||||||
const type = params.get('type')
|
const type = params.get('type')
|
||||||
const id = params.get('id')
|
const id = params.get('id')
|
||||||
|
|
||||||
|
@ -34,6 +34,14 @@
|
||||||
error.value = `The embed widget couldn't read the provided media ID: ${id}.`
|
error.value = `The embed widget couldn't read the provided media ID: ${id}.`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Standardize base URL
|
||||||
|
try {
|
||||||
|
baseUrl = new URL(baseUrl).origin
|
||||||
|
} catch (err) {
|
||||||
|
console.error(err)
|
||||||
|
error.value = `The embed widget couldn't read the provided instance URL: ${baseUrl}.`
|
||||||
|
}
|
||||||
|
|
||||||
// Cover
|
// Cover
|
||||||
const DEFAULT_COVER = '/embed-default-cover.jpeg'
|
const DEFAULT_COVER = '/embed-default-cover.jpeg'
|
||||||
const cover = reactive({ value: DEFAULT_COVER })
|
const cover = reactive({ value: DEFAULT_COVER })
|
||||||
|
|
Loading…
Reference in New Issue