mirror of
https://github.com/OliveTin/OliveTin
synced 2026-05-03 20:50:39 +00:00
fix: #803 enable custom JS (again!)
Build & Release pipeline / build (push) Has been cancelled
Build & Release pipeline / build (push) Has been cancelled
This commit is contained in:
@@ -61,6 +61,14 @@ async function initClient () {
|
||||
window.client = createClient(OliveTinApiService, transport)
|
||||
window.initResponse = await window.client.init({})
|
||||
|
||||
if (window.initResponse.enableCustomJs) {
|
||||
const script = document.createElement('script')
|
||||
script.src = '/custom-webui/custom.js'
|
||||
script.async = true
|
||||
script.id = 'olivetin-custom-js'
|
||||
document.head.appendChild(script)
|
||||
}
|
||||
|
||||
const i18nSettings = createI18n({
|
||||
legacy: false,
|
||||
locale: getSelectedLanguage(),
|
||||
|
||||
@@ -231,6 +231,7 @@ function updateHeaderFromInit() {
|
||||
}
|
||||
|
||||
applyStyleMods()
|
||||
loadCustomJsIfEnabled()
|
||||
|
||||
renderNavigation()
|
||||
applyTheme()
|
||||
@@ -369,6 +370,17 @@ function applyTheme() {
|
||||
}
|
||||
}
|
||||
|
||||
function loadCustomJsIfEnabled() {
|
||||
if (!window.initResponse?.enableCustomJs || document.getElementById('olivetin-custom-js')) {
|
||||
return
|
||||
}
|
||||
const script = document.createElement('script')
|
||||
script.src = '/custom-webui/custom.js'
|
||||
script.async = true
|
||||
script.id = 'olivetin-custom-js'
|
||||
document.head.appendChild(script)
|
||||
}
|
||||
|
||||
function applyStyleMods() {
|
||||
if (!window.initResponse || !window.initResponse.styleMods) {
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user