generated from autoblog/Seo
feat(theme): rewrite appearance linkage in user repo
This commit is contained in:
parent
58ae8d3203
commit
efdf548a8e
4 changed files with 272 additions and 176 deletions
|
|
@ -18,14 +18,13 @@
|
||||||
<script type="module" src="/src/main.tsx"></script>
|
<script type="module" src="/src/main.tsx"></script>
|
||||||
|
|
||||||
<!-- Theme Auto-Updater injected by autoblogia -->
|
<!-- Theme Auto-Updater injected by autoblogia -->
|
||||||
<script>
|
<script>
|
||||||
window.addEventListener('message', (event) => {
|
function applySettings(settings) {
|
||||||
if (event.data && event.data.type === 'UPDATE_APPEARANCE') {
|
|
||||||
const settings = event.data.settings;
|
|
||||||
if (!settings) return;
|
if (!settings) return;
|
||||||
let css = '';
|
let css = '';
|
||||||
if (settings.primaryColor) {
|
if (settings.primaryColor) {
|
||||||
css += "\n:root { " +
|
css += "
|
||||||
|
:root { " +
|
||||||
"--color-brand-primary: " + settings.primaryColor + " !important; " +
|
"--color-brand-primary: " + settings.primaryColor + " !important; " +
|
||||||
"--color-brand-blue: " + settings.primaryColor + " !important; " +
|
"--color-brand-blue: " + settings.primaryColor + " !important; " +
|
||||||
"--color-brand-gold: " + settings.primaryColor + " !important; " +
|
"--color-brand-gold: " + settings.primaryColor + " !important; " +
|
||||||
|
|
@ -34,34 +33,59 @@
|
||||||
"--color-emerald-500: " + settings.primaryColor + " !important; " +
|
"--color-emerald-500: " + settings.primaryColor + " !important; " +
|
||||||
"--color-emerald-600: " + settings.primaryColor + " !important; " +
|
"--color-emerald-600: " + settings.primaryColor + " !important; " +
|
||||||
"} " +
|
"} " +
|
||||||
".text-brand-blue, .text-blue-600, .group-hover\\:text-blue-600:hover, .text-brand-gold, .text-emerald-600, .text-blue-500, .text-emerald-500 { color: " + settings.primaryColor + " !important; } " +
|
".text-brand-blue, .text-blue-600, .group-hover\:text-blue-600:hover, .text-brand-gold, .text-emerald-600, .text-blue-500, .text-emerald-500 { color: " + settings.primaryColor + " !important; } " +
|
||||||
".bg-brand-blue, .bg-blue-600, .hover\\:bg-blue-500:hover, .bg-brand-gold, .bg-emerald-600, .bg-blue-500, .bg-emerald-500 { background-color: " + settings.primaryColor + " !important; } " +
|
".bg-brand-blue, .bg-blue-600, .hover\:bg-blue-500:hover, .bg-brand-gold, .bg-emerald-600, .bg-blue-500, .bg-emerald-500 { background-color: " + settings.primaryColor + " !important; } " +
|
||||||
".border-brand-blue, .border-blue-600, .focus\\:border-blue-600:focus, .border-brand-gold, .border-emerald-600, .border-blue-500, .border-emerald-500 { border-color: " + settings.primaryColor + " !important; } " +
|
".border-brand-blue, .border-blue-600, .focus\:border-blue-600:focus, .border-brand-gold, .border-emerald-600, .border-blue-500, .border-emerald-500 { border-color: " + settings.primaryColor + " !important; } " +
|
||||||
".fill-blue-600, .fill-emerald-600 { fill: " + settings.primaryColor + " !important; }";
|
".fill-blue-600, .fill-emerald-600 { fill: " + settings.primaryColor + " !important; }";
|
||||||
}
|
}
|
||||||
if (settings.backgroundColor) {
|
if (settings.backgroundColor) {
|
||||||
css += "\n:root { --color-brand-bg: " + settings.backgroundColor + " !important; } body { background-color: " + settings.backgroundColor + " !important; }";
|
css += "
|
||||||
|
:root { --color-brand-bg: " + settings.backgroundColor + " !important; } body { background-color: " + settings.backgroundColor + " !important; }";
|
||||||
}
|
}
|
||||||
if (settings.fontFamily) {
|
if (settings.fontFamily) {
|
||||||
const fontLink = document.getElementById('dynamic-font');
|
const fontLink = document.getElementById('dynamic-font');
|
||||||
const fontName = settings.fontFamily.replace(/ /g, '+');
|
const fontName = settings.fontFamily.replace(/ /g, '+');
|
||||||
const fontUrl = 'https://fonts.googleapis.com/css2?family=' + fontName + ':wght@300;400;500;600;700&display=swap';
|
const fontUrl = 'https://fonts.googleapis.com/css2?family=' + fontName + ':wght@300;400;500;600;700&display=swap';
|
||||||
if (fontLink) { (fontLink as HTMLLinkElement).href = fontUrl; } else {
|
if (fontLink) { fontLink.href = fontUrl; } else {
|
||||||
const link = document.createElement('link'); link.id = 'dynamic-font'; link.rel = 'stylesheet'; link.href = fontUrl; document.head.appendChild(link);
|
const link = document.createElement('link'); link.id = 'dynamic-font'; link.rel = 'stylesheet'; link.href = fontUrl; document.head.appendChild(link);
|
||||||
}
|
}
|
||||||
css += "\n:root { " +
|
css += "
|
||||||
"--font-sans: \"" + settings.fontFamily + "\", sans-serif !important; " +
|
:root { " +
|
||||||
"--font-serif: \"" + settings.fontFamily + "\", serif !important; " +
|
"--font-sans: '" + settings.fontFamily + "', sans-serif !important; " +
|
||||||
"--font-mono: \"" + settings.fontFamily + "\", monospace !important; " +
|
"--font-serif: '" + settings.fontFamily + "', serif !important; " +
|
||||||
"} * { font-family: \"" + settings.fontFamily + "\", sans-serif !important; }";
|
"--font-mono: '" + settings.fontFamily + "', monospace !important; " +
|
||||||
|
"} * { font-family: '" + settings.fontFamily + "', sans-serif !important; }";
|
||||||
}
|
}
|
||||||
let styleNode = document.getElementById('dynamic-theme-style');
|
let styleNode = document.getElementById('dynamic-theme-style');
|
||||||
if (!styleNode) { styleNode = document.createElement('style'); styleNode.id = 'dynamic-theme-style'; document.head.appendChild(styleNode); }
|
if (!styleNode) { styleNode = document.createElement('style'); styleNode.id = 'dynamic-theme-style'; document.head.appendChild(styleNode); }
|
||||||
styleNode.innerHTML = css;
|
styleNode.innerHTML = css;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
window.addEventListener('message', (event) => {
|
||||||
|
if (event.data && event.data.type === 'UPDATE_APPEARANCE') {
|
||||||
|
applySettings(event.data.settings);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
window.parent.postMessage({ type: 'IFRAME_READY' }, '*');
|
window.parent.postMessage({ type: 'IFRAME_READY' }, '*');
|
||||||
</script>
|
|
||||||
</body>
|
// Fetch on load
|
||||||
|
try {
|
||||||
|
const host = window.location.hostname;
|
||||||
|
const SUPABASE_URL = 'https://ccfezpxxmwpngqhlsbxz.supabase.co';
|
||||||
|
const SUPABASE_KEY = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImNjZmV6cHh4bXdwbmdxaGxzYnh6Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NzU2ODk4NTcsImV4cCI6MjA5MTI2NTg1N30.TqXoUsunJoX9xQwOOq3PTugltyrMGn1OrZysO6C9hRM';
|
||||||
|
fetch(SUPABASE_URL + '/rest/v1/sites?select=settings&custom_domain=ilike.*' + host + '*', {
|
||||||
|
headers: {
|
||||||
|
'apikey': SUPABASE_KEY,
|
||||||
|
'Authorization': 'Bearer ' + SUPABASE_KEY
|
||||||
|
}
|
||||||
|
}).then(r => r.json()).then(data => {
|
||||||
|
if (data && data.length > 0 && data[0].settings) {
|
||||||
|
applySettings(data[0].settings);
|
||||||
|
}
|
||||||
|
}).catch(console.error);
|
||||||
|
} catch(e) {}
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,14 +29,13 @@
|
||||||
<script type="module" src="/src/main.tsx"></script>
|
<script type="module" src="/src/main.tsx"></script>
|
||||||
|
|
||||||
<!-- Theme Auto-Updater injected by autoblogia -->
|
<!-- Theme Auto-Updater injected by autoblogia -->
|
||||||
<script>
|
<script>
|
||||||
window.addEventListener('message', (event) => {
|
function applySettings(settings) {
|
||||||
if (event.data && event.data.type === 'UPDATE_APPEARANCE') {
|
|
||||||
const settings = event.data.settings;
|
|
||||||
if (!settings) return;
|
if (!settings) return;
|
||||||
let css = '';
|
let css = '';
|
||||||
if (settings.primaryColor) {
|
if (settings.primaryColor) {
|
||||||
css += "\n:root { " +
|
css += "
|
||||||
|
:root { " +
|
||||||
"--color-brand-primary: " + settings.primaryColor + " !important; " +
|
"--color-brand-primary: " + settings.primaryColor + " !important; " +
|
||||||
"--color-brand-blue: " + settings.primaryColor + " !important; " +
|
"--color-brand-blue: " + settings.primaryColor + " !important; " +
|
||||||
"--color-brand-gold: " + settings.primaryColor + " !important; " +
|
"--color-brand-gold: " + settings.primaryColor + " !important; " +
|
||||||
|
|
@ -45,34 +44,59 @@
|
||||||
"--color-emerald-500: " + settings.primaryColor + " !important; " +
|
"--color-emerald-500: " + settings.primaryColor + " !important; " +
|
||||||
"--color-emerald-600: " + settings.primaryColor + " !important; " +
|
"--color-emerald-600: " + settings.primaryColor + " !important; " +
|
||||||
"} " +
|
"} " +
|
||||||
".text-brand-blue, .text-blue-600, .group-hover\\:text-blue-600:hover, .text-brand-gold, .text-emerald-600, .text-blue-500, .text-emerald-500 { color: " + settings.primaryColor + " !important; } " +
|
".text-brand-blue, .text-blue-600, .group-hover\:text-blue-600:hover, .text-brand-gold, .text-emerald-600, .text-blue-500, .text-emerald-500 { color: " + settings.primaryColor + " !important; } " +
|
||||||
".bg-brand-blue, .bg-blue-600, .hover\\:bg-blue-500:hover, .bg-brand-gold, .bg-emerald-600, .bg-blue-500, .bg-emerald-500 { background-color: " + settings.primaryColor + " !important; } " +
|
".bg-brand-blue, .bg-blue-600, .hover\:bg-blue-500:hover, .bg-brand-gold, .bg-emerald-600, .bg-blue-500, .bg-emerald-500 { background-color: " + settings.primaryColor + " !important; } " +
|
||||||
".border-brand-blue, .border-blue-600, .focus\\:border-blue-600:focus, .border-brand-gold, .border-emerald-600, .border-blue-500, .border-emerald-500 { border-color: " + settings.primaryColor + " !important; } " +
|
".border-brand-blue, .border-blue-600, .focus\:border-blue-600:focus, .border-brand-gold, .border-emerald-600, .border-blue-500, .border-emerald-500 { border-color: " + settings.primaryColor + " !important; } " +
|
||||||
".fill-blue-600, .fill-emerald-600 { fill: " + settings.primaryColor + " !important; }";
|
".fill-blue-600, .fill-emerald-600 { fill: " + settings.primaryColor + " !important; }";
|
||||||
}
|
}
|
||||||
if (settings.backgroundColor) {
|
if (settings.backgroundColor) {
|
||||||
css += "\n:root { --color-brand-bg: " + settings.backgroundColor + " !important; } body { background-color: " + settings.backgroundColor + " !important; }";
|
css += "
|
||||||
|
:root { --color-brand-bg: " + settings.backgroundColor + " !important; } body { background-color: " + settings.backgroundColor + " !important; }";
|
||||||
}
|
}
|
||||||
if (settings.fontFamily) {
|
if (settings.fontFamily) {
|
||||||
const fontLink = document.getElementById('dynamic-font');
|
const fontLink = document.getElementById('dynamic-font');
|
||||||
const fontName = settings.fontFamily.replace(/ /g, '+');
|
const fontName = settings.fontFamily.replace(/ /g, '+');
|
||||||
const fontUrl = 'https://fonts.googleapis.com/css2?family=' + fontName + ':wght@300;400;500;600;700&display=swap';
|
const fontUrl = 'https://fonts.googleapis.com/css2?family=' + fontName + ':wght@300;400;500;600;700&display=swap';
|
||||||
if (fontLink) { (fontLink as HTMLLinkElement).href = fontUrl; } else {
|
if (fontLink) { fontLink.href = fontUrl; } else {
|
||||||
const link = document.createElement('link'); link.id = 'dynamic-font'; link.rel = 'stylesheet'; link.href = fontUrl; document.head.appendChild(link);
|
const link = document.createElement('link'); link.id = 'dynamic-font'; link.rel = 'stylesheet'; link.href = fontUrl; document.head.appendChild(link);
|
||||||
}
|
}
|
||||||
css += "\n:root { " +
|
css += "
|
||||||
"--font-sans: \"" + settings.fontFamily + "\", sans-serif !important; " +
|
:root { " +
|
||||||
"--font-serif: \"" + settings.fontFamily + "\", serif !important; " +
|
"--font-sans: '" + settings.fontFamily + "', sans-serif !important; " +
|
||||||
"--font-mono: \"" + settings.fontFamily + "\", monospace !important; " +
|
"--font-serif: '" + settings.fontFamily + "', serif !important; " +
|
||||||
"} * { font-family: \"" + settings.fontFamily + "\", sans-serif !important; }";
|
"--font-mono: '" + settings.fontFamily + "', monospace !important; " +
|
||||||
|
"} * { font-family: '" + settings.fontFamily + "', sans-serif !important; }";
|
||||||
}
|
}
|
||||||
let styleNode = document.getElementById('dynamic-theme-style');
|
let styleNode = document.getElementById('dynamic-theme-style');
|
||||||
if (!styleNode) { styleNode = document.createElement('style'); styleNode.id = 'dynamic-theme-style'; document.head.appendChild(styleNode); }
|
if (!styleNode) { styleNode = document.createElement('style'); styleNode.id = 'dynamic-theme-style'; document.head.appendChild(styleNode); }
|
||||||
styleNode.innerHTML = css;
|
styleNode.innerHTML = css;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
window.addEventListener('message', (event) => {
|
||||||
|
if (event.data && event.data.type === 'UPDATE_APPEARANCE') {
|
||||||
|
applySettings(event.data.settings);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
window.parent.postMessage({ type: 'IFRAME_READY' }, '*');
|
window.parent.postMessage({ type: 'IFRAME_READY' }, '*');
|
||||||
</script>
|
|
||||||
</body>
|
// Fetch on load
|
||||||
|
try {
|
||||||
|
const host = window.location.hostname;
|
||||||
|
const SUPABASE_URL = 'https://ccfezpxxmwpngqhlsbxz.supabase.co';
|
||||||
|
const SUPABASE_KEY = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImNjZmV6cHh4bXdwbmdxaGxzYnh6Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NzU2ODk4NTcsImV4cCI6MjA5MTI2NTg1N30.TqXoUsunJoX9xQwOOq3PTugltyrMGn1OrZysO6C9hRM';
|
||||||
|
fetch(SUPABASE_URL + '/rest/v1/sites?select=settings&custom_domain=ilike.*' + host + '*', {
|
||||||
|
headers: {
|
||||||
|
'apikey': SUPABASE_KEY,
|
||||||
|
'Authorization': 'Bearer ' + SUPABASE_KEY
|
||||||
|
}
|
||||||
|
}).then(r => r.json()).then(data => {
|
||||||
|
if (data && data.length > 0 && data[0].settings) {
|
||||||
|
applySettings(data[0].settings);
|
||||||
|
}
|
||||||
|
}).catch(console.error);
|
||||||
|
} catch(e) {}
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,14 +29,13 @@
|
||||||
<script type="module" src="/src/main.tsx"></script>
|
<script type="module" src="/src/main.tsx"></script>
|
||||||
|
|
||||||
<!-- Theme Auto-Updater injected by autoblogia -->
|
<!-- Theme Auto-Updater injected by autoblogia -->
|
||||||
<script>
|
<script>
|
||||||
window.addEventListener('message', (event) => {
|
function applySettings(settings) {
|
||||||
if (event.data && event.data.type === 'UPDATE_APPEARANCE') {
|
|
||||||
const settings = event.data.settings;
|
|
||||||
if (!settings) return;
|
if (!settings) return;
|
||||||
let css = '';
|
let css = '';
|
||||||
if (settings.primaryColor) {
|
if (settings.primaryColor) {
|
||||||
css += "\n:root { " +
|
css += "
|
||||||
|
:root { " +
|
||||||
"--color-brand-primary: " + settings.primaryColor + " !important; " +
|
"--color-brand-primary: " + settings.primaryColor + " !important; " +
|
||||||
"--color-brand-blue: " + settings.primaryColor + " !important; " +
|
"--color-brand-blue: " + settings.primaryColor + " !important; " +
|
||||||
"--color-brand-gold: " + settings.primaryColor + " !important; " +
|
"--color-brand-gold: " + settings.primaryColor + " !important; " +
|
||||||
|
|
@ -45,34 +44,59 @@
|
||||||
"--color-emerald-500: " + settings.primaryColor + " !important; " +
|
"--color-emerald-500: " + settings.primaryColor + " !important; " +
|
||||||
"--color-emerald-600: " + settings.primaryColor + " !important; " +
|
"--color-emerald-600: " + settings.primaryColor + " !important; " +
|
||||||
"} " +
|
"} " +
|
||||||
".text-brand-blue, .text-blue-600, .group-hover\\:text-blue-600:hover, .text-brand-gold, .text-emerald-600, .text-blue-500, .text-emerald-500 { color: " + settings.primaryColor + " !important; } " +
|
".text-brand-blue, .text-blue-600, .group-hover\:text-blue-600:hover, .text-brand-gold, .text-emerald-600, .text-blue-500, .text-emerald-500 { color: " + settings.primaryColor + " !important; } " +
|
||||||
".bg-brand-blue, .bg-blue-600, .hover\\:bg-blue-500:hover, .bg-brand-gold, .bg-emerald-600, .bg-blue-500, .bg-emerald-500 { background-color: " + settings.primaryColor + " !important; } " +
|
".bg-brand-blue, .bg-blue-600, .hover\:bg-blue-500:hover, .bg-brand-gold, .bg-emerald-600, .bg-blue-500, .bg-emerald-500 { background-color: " + settings.primaryColor + " !important; } " +
|
||||||
".border-brand-blue, .border-blue-600, .focus\\:border-blue-600:focus, .border-brand-gold, .border-emerald-600, .border-blue-500, .border-emerald-500 { border-color: " + settings.primaryColor + " !important; } " +
|
".border-brand-blue, .border-blue-600, .focus\:border-blue-600:focus, .border-brand-gold, .border-emerald-600, .border-blue-500, .border-emerald-500 { border-color: " + settings.primaryColor + " !important; } " +
|
||||||
".fill-blue-600, .fill-emerald-600 { fill: " + settings.primaryColor + " !important; }";
|
".fill-blue-600, .fill-emerald-600 { fill: " + settings.primaryColor + " !important; }";
|
||||||
}
|
}
|
||||||
if (settings.backgroundColor) {
|
if (settings.backgroundColor) {
|
||||||
css += "\n:root { --color-brand-bg: " + settings.backgroundColor + " !important; } body { background-color: " + settings.backgroundColor + " !important; }";
|
css += "
|
||||||
|
:root { --color-brand-bg: " + settings.backgroundColor + " !important; } body { background-color: " + settings.backgroundColor + " !important; }";
|
||||||
}
|
}
|
||||||
if (settings.fontFamily) {
|
if (settings.fontFamily) {
|
||||||
const fontLink = document.getElementById('dynamic-font');
|
const fontLink = document.getElementById('dynamic-font');
|
||||||
const fontName = settings.fontFamily.replace(/ /g, '+');
|
const fontName = settings.fontFamily.replace(/ /g, '+');
|
||||||
const fontUrl = 'https://fonts.googleapis.com/css2?family=' + fontName + ':wght@300;400;500;600;700&display=swap';
|
const fontUrl = 'https://fonts.googleapis.com/css2?family=' + fontName + ':wght@300;400;500;600;700&display=swap';
|
||||||
if (fontLink) { (fontLink as HTMLLinkElement).href = fontUrl; } else {
|
if (fontLink) { fontLink.href = fontUrl; } else {
|
||||||
const link = document.createElement('link'); link.id = 'dynamic-font'; link.rel = 'stylesheet'; link.href = fontUrl; document.head.appendChild(link);
|
const link = document.createElement('link'); link.id = 'dynamic-font'; link.rel = 'stylesheet'; link.href = fontUrl; document.head.appendChild(link);
|
||||||
}
|
}
|
||||||
css += "\n:root { " +
|
css += "
|
||||||
"--font-sans: \"" + settings.fontFamily + "\", sans-serif !important; " +
|
:root { " +
|
||||||
"--font-serif: \"" + settings.fontFamily + "\", serif !important; " +
|
"--font-sans: '" + settings.fontFamily + "', sans-serif !important; " +
|
||||||
"--font-mono: \"" + settings.fontFamily + "\", monospace !important; " +
|
"--font-serif: '" + settings.fontFamily + "', serif !important; " +
|
||||||
"} * { font-family: \"" + settings.fontFamily + "\", sans-serif !important; }";
|
"--font-mono: '" + settings.fontFamily + "', monospace !important; " +
|
||||||
|
"} * { font-family: '" + settings.fontFamily + "', sans-serif !important; }";
|
||||||
}
|
}
|
||||||
let styleNode = document.getElementById('dynamic-theme-style');
|
let styleNode = document.getElementById('dynamic-theme-style');
|
||||||
if (!styleNode) { styleNode = document.createElement('style'); styleNode.id = 'dynamic-theme-style'; document.head.appendChild(styleNode); }
|
if (!styleNode) { styleNode = document.createElement('style'); styleNode.id = 'dynamic-theme-style'; document.head.appendChild(styleNode); }
|
||||||
styleNode.innerHTML = css;
|
styleNode.innerHTML = css;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
window.addEventListener('message', (event) => {
|
||||||
|
if (event.data && event.data.type === 'UPDATE_APPEARANCE') {
|
||||||
|
applySettings(event.data.settings);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
window.parent.postMessage({ type: 'IFRAME_READY' }, '*');
|
window.parent.postMessage({ type: 'IFRAME_READY' }, '*');
|
||||||
</script>
|
|
||||||
</body>
|
// Fetch on load
|
||||||
|
try {
|
||||||
|
const host = window.location.hostname;
|
||||||
|
const SUPABASE_URL = 'https://ccfezpxxmwpngqhlsbxz.supabase.co';
|
||||||
|
const SUPABASE_KEY = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImNjZmV6cHh4bXdwbmdxaGxzYnh6Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NzU2ODk4NTcsImV4cCI6MjA5MTI2NTg1N30.TqXoUsunJoX9xQwOOq3PTugltyrMGn1OrZysO6C9hRM';
|
||||||
|
fetch(SUPABASE_URL + '/rest/v1/sites?select=settings&custom_domain=ilike.*' + host + '*', {
|
||||||
|
headers: {
|
||||||
|
'apikey': SUPABASE_KEY,
|
||||||
|
'Authorization': 'Bearer ' + SUPABASE_KEY
|
||||||
|
}
|
||||||
|
}).then(r => r.json()).then(data => {
|
||||||
|
if (data && data.length > 0 && data[0].settings) {
|
||||||
|
applySettings(data[0].settings);
|
||||||
|
}
|
||||||
|
}).catch(console.error);
|
||||||
|
} catch(e) {}
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,14 +29,13 @@
|
||||||
<script type="module" src="/src/main.tsx"></script>
|
<script type="module" src="/src/main.tsx"></script>
|
||||||
|
|
||||||
<!-- Theme Auto-Updater injected by autoblogia -->
|
<!-- Theme Auto-Updater injected by autoblogia -->
|
||||||
<script>
|
<script>
|
||||||
window.addEventListener('message', (event) => {
|
function applySettings(settings) {
|
||||||
if (event.data && event.data.type === 'UPDATE_APPEARANCE') {
|
|
||||||
const settings = event.data.settings;
|
|
||||||
if (!settings) return;
|
if (!settings) return;
|
||||||
let css = '';
|
let css = '';
|
||||||
if (settings.primaryColor) {
|
if (settings.primaryColor) {
|
||||||
css += "\n:root { " +
|
css += "
|
||||||
|
:root { " +
|
||||||
"--color-brand-primary: " + settings.primaryColor + " !important; " +
|
"--color-brand-primary: " + settings.primaryColor + " !important; " +
|
||||||
"--color-brand-blue: " + settings.primaryColor + " !important; " +
|
"--color-brand-blue: " + settings.primaryColor + " !important; " +
|
||||||
"--color-brand-gold: " + settings.primaryColor + " !important; " +
|
"--color-brand-gold: " + settings.primaryColor + " !important; " +
|
||||||
|
|
@ -45,34 +44,59 @@
|
||||||
"--color-emerald-500: " + settings.primaryColor + " !important; " +
|
"--color-emerald-500: " + settings.primaryColor + " !important; " +
|
||||||
"--color-emerald-600: " + settings.primaryColor + " !important; " +
|
"--color-emerald-600: " + settings.primaryColor + " !important; " +
|
||||||
"} " +
|
"} " +
|
||||||
".text-brand-blue, .text-blue-600, .group-hover\\:text-blue-600:hover, .text-brand-gold, .text-emerald-600, .text-blue-500, .text-emerald-500 { color: " + settings.primaryColor + " !important; } " +
|
".text-brand-blue, .text-blue-600, .group-hover\:text-blue-600:hover, .text-brand-gold, .text-emerald-600, .text-blue-500, .text-emerald-500 { color: " + settings.primaryColor + " !important; } " +
|
||||||
".bg-brand-blue, .bg-blue-600, .hover\\:bg-blue-500:hover, .bg-brand-gold, .bg-emerald-600, .bg-blue-500, .bg-emerald-500 { background-color: " + settings.primaryColor + " !important; } " +
|
".bg-brand-blue, .bg-blue-600, .hover\:bg-blue-500:hover, .bg-brand-gold, .bg-emerald-600, .bg-blue-500, .bg-emerald-500 { background-color: " + settings.primaryColor + " !important; } " +
|
||||||
".border-brand-blue, .border-blue-600, .focus\\:border-blue-600:focus, .border-brand-gold, .border-emerald-600, .border-blue-500, .border-emerald-500 { border-color: " + settings.primaryColor + " !important; } " +
|
".border-brand-blue, .border-blue-600, .focus\:border-blue-600:focus, .border-brand-gold, .border-emerald-600, .border-blue-500, .border-emerald-500 { border-color: " + settings.primaryColor + " !important; } " +
|
||||||
".fill-blue-600, .fill-emerald-600 { fill: " + settings.primaryColor + " !important; }";
|
".fill-blue-600, .fill-emerald-600 { fill: " + settings.primaryColor + " !important; }";
|
||||||
}
|
}
|
||||||
if (settings.backgroundColor) {
|
if (settings.backgroundColor) {
|
||||||
css += "\n:root { --color-brand-bg: " + settings.backgroundColor + " !important; } body { background-color: " + settings.backgroundColor + " !important; }";
|
css += "
|
||||||
|
:root { --color-brand-bg: " + settings.backgroundColor + " !important; } body { background-color: " + settings.backgroundColor + " !important; }";
|
||||||
}
|
}
|
||||||
if (settings.fontFamily) {
|
if (settings.fontFamily) {
|
||||||
const fontLink = document.getElementById('dynamic-font');
|
const fontLink = document.getElementById('dynamic-font');
|
||||||
const fontName = settings.fontFamily.replace(/ /g, '+');
|
const fontName = settings.fontFamily.replace(/ /g, '+');
|
||||||
const fontUrl = 'https://fonts.googleapis.com/css2?family=' + fontName + ':wght@300;400;500;600;700&display=swap';
|
const fontUrl = 'https://fonts.googleapis.com/css2?family=' + fontName + ':wght@300;400;500;600;700&display=swap';
|
||||||
if (fontLink) { (fontLink as HTMLLinkElement).href = fontUrl; } else {
|
if (fontLink) { fontLink.href = fontUrl; } else {
|
||||||
const link = document.createElement('link'); link.id = 'dynamic-font'; link.rel = 'stylesheet'; link.href = fontUrl; document.head.appendChild(link);
|
const link = document.createElement('link'); link.id = 'dynamic-font'; link.rel = 'stylesheet'; link.href = fontUrl; document.head.appendChild(link);
|
||||||
}
|
}
|
||||||
css += "\n:root { " +
|
css += "
|
||||||
"--font-sans: \"" + settings.fontFamily + "\", sans-serif !important; " +
|
:root { " +
|
||||||
"--font-serif: \"" + settings.fontFamily + "\", serif !important; " +
|
"--font-sans: '" + settings.fontFamily + "', sans-serif !important; " +
|
||||||
"--font-mono: \"" + settings.fontFamily + "\", monospace !important; " +
|
"--font-serif: '" + settings.fontFamily + "', serif !important; " +
|
||||||
"} * { font-family: \"" + settings.fontFamily + "\", sans-serif !important; }";
|
"--font-mono: '" + settings.fontFamily + "', monospace !important; " +
|
||||||
|
"} * { font-family: '" + settings.fontFamily + "', sans-serif !important; }";
|
||||||
}
|
}
|
||||||
let styleNode = document.getElementById('dynamic-theme-style');
|
let styleNode = document.getElementById('dynamic-theme-style');
|
||||||
if (!styleNode) { styleNode = document.createElement('style'); styleNode.id = 'dynamic-theme-style'; document.head.appendChild(styleNode); }
|
if (!styleNode) { styleNode = document.createElement('style'); styleNode.id = 'dynamic-theme-style'; document.head.appendChild(styleNode); }
|
||||||
styleNode.innerHTML = css;
|
styleNode.innerHTML = css;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
window.addEventListener('message', (event) => {
|
||||||
|
if (event.data && event.data.type === 'UPDATE_APPEARANCE') {
|
||||||
|
applySettings(event.data.settings);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
window.parent.postMessage({ type: 'IFRAME_READY' }, '*');
|
window.parent.postMessage({ type: 'IFRAME_READY' }, '*');
|
||||||
</script>
|
|
||||||
</body>
|
// Fetch on load
|
||||||
|
try {
|
||||||
|
const host = window.location.hostname;
|
||||||
|
const SUPABASE_URL = 'https://ccfezpxxmwpngqhlsbxz.supabase.co';
|
||||||
|
const SUPABASE_KEY = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImNjZmV6cHh4bXdwbmdxaGxzYnh6Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NzU2ODk4NTcsImV4cCI6MjA5MTI2NTg1N30.TqXoUsunJoX9xQwOOq3PTugltyrMGn1OrZysO6C9hRM';
|
||||||
|
fetch(SUPABASE_URL + '/rest/v1/sites?select=settings&custom_domain=ilike.*' + host + '*', {
|
||||||
|
headers: {
|
||||||
|
'apikey': SUPABASE_KEY,
|
||||||
|
'Authorization': 'Bearer ' + SUPABASE_KEY
|
||||||
|
}
|
||||||
|
}).then(r => r.json()).then(data => {
|
||||||
|
if (data && data.length > 0 && data[0].settings) {
|
||||||
|
applySettings(data[0].settings);
|
||||||
|
}
|
||||||
|
}).catch(console.error);
|
||||||
|
} catch(e) {}
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue