chore(*): use prettier for formatting
This commit is contained in:
parent
6c659fe1d0
commit
029caaaa9e
73 changed files with 1390 additions and 794 deletions
|
@ -1,52 +1,52 @@
|
|||
class SelectPagination extends HTMLElement {
|
||||
static register(tagName = 'select-pagination') {
|
||||
if ("customElements" in window) customElements.define(tagName, this)
|
||||
if ('customElements' in window) customElements.define(tagName, this);
|
||||
}
|
||||
|
||||
static get observedAttributes() {
|
||||
return ['data-base-index']
|
||||
return ['data-base-index'];
|
||||
}
|
||||
|
||||
get baseIndex() {
|
||||
return parseInt(this.getAttribute('data-base-index') || '0', 10)
|
||||
return parseInt(this.getAttribute('data-base-index') || '0', 10);
|
||||
}
|
||||
|
||||
connectedCallback() {
|
||||
if (this.shadowRoot) return
|
||||
if (this.shadowRoot) return;
|
||||
|
||||
this.attachShadow({ mode: 'open' }).appendChild(document.createElement('slot'))
|
||||
this.attachShadow({ mode: 'open' }).appendChild(document.createElement('slot'));
|
||||
|
||||
const uriSegments = window.location.pathname.split('/').filter(Boolean)
|
||||
let pageNumber = this.extractPageNumber(uriSegments)
|
||||
if (pageNumber === null) pageNumber = this.baseIndex
|
||||
const uriSegments = window.location.pathname.split('/').filter(Boolean);
|
||||
let pageNumber = this.extractPageNumber(uriSegments);
|
||||
if (pageNumber === null) pageNumber = this.baseIndex;
|
||||
|
||||
this.control = this.querySelector('select')
|
||||
this.control.value = pageNumber.toString()
|
||||
this.control = this.querySelector('select');
|
||||
this.control.value = pageNumber.toString();
|
||||
this.control.addEventListener('change', (event) => {
|
||||
pageNumber = parseInt(event.target.value)
|
||||
const updatedUrlSegments = this.updateUrlSegments(uriSegments, pageNumber)
|
||||
window.location.href = `${window.location.origin}/${updatedUrlSegments.join('/')}`
|
||||
})
|
||||
pageNumber = parseInt(event.target.value);
|
||||
const updatedUrlSegments = this.updateUrlSegments(uriSegments, pageNumber);
|
||||
window.location.href = `${window.location.origin}/${updatedUrlSegments.join('/')}`;
|
||||
});
|
||||
}
|
||||
|
||||
extractPageNumber(segments) {
|
||||
const lastSegment = segments[segments.length - 1]
|
||||
return !isNaN(lastSegment) ? parseInt(lastSegment) : null
|
||||
const lastSegment = segments[segments.length - 1];
|
||||
return !isNaN(lastSegment) ? parseInt(lastSegment) : null;
|
||||
}
|
||||
|
||||
updateUrlSegments(segments, pageNumber) {
|
||||
const lastIsPage = !isNaN(segments[segments.length - 1])
|
||||
const lastIsPage = !isNaN(segments[segments.length - 1]);
|
||||
|
||||
if (lastIsPage) {
|
||||
segments[segments.length - 1] = pageNumber.toString()
|
||||
segments[segments.length - 1] = pageNumber.toString();
|
||||
} else {
|
||||
segments.push(pageNumber.toString())
|
||||
segments.push(pageNumber.toString());
|
||||
}
|
||||
|
||||
if (pageNumber === this.baseIndex) segments.pop()
|
||||
if (pageNumber === this.baseIndex) segments.pop();
|
||||
|
||||
return segments
|
||||
return segments;
|
||||
}
|
||||
}
|
||||
|
||||
SelectPagination.register()
|
||||
SelectPagination.register();
|
||||
|
|
|
@ -21,7 +21,9 @@ window.addEventListener('load', () => {
|
|||
if (isDynamic && !isLoaded) {
|
||||
const markdownFields = dialog.dataset.markdown || '';
|
||||
try {
|
||||
const res = await fetch(`/api/query.php?data=${isDynamic}&id=${dialogId}&markdown=${encodeURIComponent(markdownFields)}`);
|
||||
const res = await fetch(
|
||||
`/api/query.php?data=${isDynamic}&id=${dialogId}&markdown=${encodeURIComponent(markdownFields)}`
|
||||
);
|
||||
const [data] = await res.json();
|
||||
const firstField = markdownFields.split(',')[0]?.trim();
|
||||
const html = data?.[`${firstField}_html`] || '<p>No notes available.</p>';
|
||||
|
|
|
@ -7,22 +7,23 @@ const staticAssets = [
|
|||
'/assets/fonts/dmi.woff2',
|
||||
'/assets/fonts/ml.woff2',
|
||||
'/assets/scripts/index.js',
|
||||
'/assets/scripts/components/select-pagination.js',
|
||||
'/assets/scripts/components/select-pagination.js'
|
||||
];
|
||||
|
||||
self.addEventListener('install', event => {
|
||||
self.addEventListener('install', (event) => {
|
||||
event.waitUntil(
|
||||
caches.open(cacheName)
|
||||
.then(cache => cache.addAll(staticAssets))
|
||||
caches
|
||||
.open(cacheName)
|
||||
.then((cache) => cache.addAll(staticAssets))
|
||||
.then(() => self.skipWaiting())
|
||||
);
|
||||
});
|
||||
|
||||
self.addEventListener('activate', event => {
|
||||
self.addEventListener('activate', (event) => {
|
||||
event.waitUntil(
|
||||
(async () => {
|
||||
const keys = await caches.keys();
|
||||
await Promise.all(keys.filter(key => key !== cacheName).map(key => caches.delete(key)));
|
||||
await Promise.all(keys.filter((key) => key !== cacheName).map((key) => caches.delete(key)));
|
||||
|
||||
if (self.registration.navigationPreload) await self.registration.navigationPreload.enable();
|
||||
|
||||
|
@ -31,7 +32,7 @@ self.addEventListener('activate', event => {
|
|||
);
|
||||
});
|
||||
|
||||
self.addEventListener('fetch', event => {
|
||||
self.addEventListener('fetch', (event) => {
|
||||
const request = event.request;
|
||||
|
||||
if (request.method !== 'GET') return;
|
||||
|
@ -51,6 +52,5 @@ self.addEventListener('fetch', event => {
|
|||
return;
|
||||
}
|
||||
|
||||
event.respondWith(caches.match(request).then(response => response || fetch(request))
|
||||
);
|
||||
event.respondWith(caches.match(request).then((response) => response || fetch(request)));
|
||||
});
|
||||
|
|
|
@ -1,46 +1,46 @@
|
|||
@font-face {
|
||||
font-family: "Space Grotesk";
|
||||
src: url("/assets/fonts/sg.woff2") format("woff2");
|
||||
font-family: 'Space Grotesk';
|
||||
src: url('/assets/fonts/sg.woff2') format('woff2');
|
||||
font-weight: 700;
|
||||
font-style: normal;
|
||||
font-display: swap;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: "DM Sans";
|
||||
src: url("/assets/fonts/dm-regular.woff2") format("woff2");
|
||||
font-family: 'DM Sans';
|
||||
src: url('/assets/fonts/dm-regular.woff2') format('woff2');
|
||||
font-weight: 400;
|
||||
font-style: normal;
|
||||
font-display: swap;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: "DM Sans";
|
||||
src: url("/assets/fonts/dm-bold.woff2") format("woff2");
|
||||
font-family: 'DM Sans';
|
||||
src: url('/assets/fonts/dm-bold.woff2') format('woff2');
|
||||
font-weight: 700;
|
||||
font-style: normal;
|
||||
font-display: swap;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: "DM Sans";
|
||||
src: url("/assets/fonts/dm-regular-italic.woff2") format("woff2");
|
||||
font-family: 'DM Sans';
|
||||
src: url('/assets/fonts/dm-regular-italic.woff2') format('woff2');
|
||||
font-weight: 400;
|
||||
font-style: italic;
|
||||
font-display: optional;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: "DM Sans";
|
||||
src: url("/assets/fonts/dm-bold-italic.woff2") format("woff2");
|
||||
font-family: 'DM Sans';
|
||||
src: url('/assets/fonts/dm-bold-italic.woff2') format('woff2');
|
||||
font-weight: 700;
|
||||
font-style: italic;
|
||||
font-display: optional;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: "MonoLisa";
|
||||
src: url("/assets/fonts/ml.woff2") format("woff2");
|
||||
font-family: 'MonoLisa';
|
||||
src: url('/assets/fonts/ml.woff2') format('woff2');
|
||||
font-weight: 400;
|
||||
font-style: normal;
|
||||
font-display: swap;
|
||||
|
|
|
@ -82,7 +82,7 @@ img {
|
|||
border-radius: var(--border-radius-slight);
|
||||
|
||||
&.image-banner {
|
||||
border: var(--border-gray);
|
||||
border: var(--border-gray);
|
||||
height: auto;
|
||||
width: var(--sizing-full);
|
||||
margin: var(--margin-vertical-base-horizontal-zero);
|
||||
|
@ -302,7 +302,9 @@ a {
|
|||
}
|
||||
|
||||
/* headers */
|
||||
h1, h2, h3 {
|
||||
h1,
|
||||
h2,
|
||||
h3 {
|
||||
font-family: var(--font-heading);
|
||||
font-weight: var(--font-weight-bold);
|
||||
line-height: var(--line-height-md);
|
||||
|
@ -440,7 +442,7 @@ td {
|
|||
text-overflow: ellipsis;
|
||||
|
||||
&::after {
|
||||
content: "";
|
||||
content: '';
|
||||
position: absolute;
|
||||
inset-block-start: 0;
|
||||
inset-inline-end: 0;
|
||||
|
@ -492,7 +494,7 @@ main {
|
|||
|
||||
main,
|
||||
footer {
|
||||
width: calc(var(--sizing-full) * .8);
|
||||
width: calc(var(--sizing-full) * 0.8);
|
||||
|
||||
@media screen and (min-width: 768px) {
|
||||
max-width: 768px;
|
||||
|
|
|
@ -71,9 +71,10 @@
|
|||
--border-gray: 1px solid var(--gray-light);
|
||||
|
||||
/* fonts */
|
||||
--font-body: "DM Sans", Helvetica Neue, Helvetica, Arial, system-ui, sans-serif;
|
||||
--font-heading: "Space Grotesk", "Arial Black", "Arial Bold", Gadget, sans-serif;
|
||||
--font-code: "MonoLisa", SFMono-Regular, Menlo, Consolas, Monaco, Liberation Mono, Lucida Console, monospace;
|
||||
--font-body: 'DM Sans', Helvetica Neue, Helvetica, Arial, system-ui, sans-serif;
|
||||
--font-heading: 'Space Grotesk', 'Arial Black', 'Arial Bold', Gadget, sans-serif;
|
||||
--font-code:
|
||||
'MonoLisa', SFMono-Regular, Menlo, Consolas, Monaco, Liberation Mono, Lucida Console, monospace;
|
||||
|
||||
/* text */
|
||||
--font-size-xs: 0.7rem;
|
||||
|
@ -152,7 +153,7 @@
|
|||
}
|
||||
|
||||
/* transitions */
|
||||
--transition-ease-in-out: cubic-bezier(.4, 0, .2, 1);
|
||||
--transition-ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
|
||||
--transition-duration-default: 300ms;
|
||||
|
||||
/* transforms */
|
||||
|
@ -165,10 +166,10 @@
|
|||
--button-offset-hover: 0;
|
||||
}
|
||||
|
||||
/* filters */
|
||||
--filter-image-default: contrast(1) saturate(1) brightness(1);
|
||||
--filter-image-light: contrast(1.2) saturate(1.2) brightness(0.9);
|
||||
--filter-image-dark: contrast(1.1) saturate(1.1) brightness(1.1);
|
||||
/* filters */
|
||||
--filter-image-default: contrast(1) saturate(1) brightness(1);
|
||||
--filter-image-light: contrast(1.2) saturate(1.2) brightness(0.9);
|
||||
--filter-image-dark: contrast(1.1) saturate(1.1) brightness(1.1);
|
||||
|
||||
/* svgs */
|
||||
--stroke-width-default: 1.3;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
@import url("./text-toggle.css");
|
||||
@import url('./text-toggle.css');
|
||||
|
||||
button:not([data-dialog-button]),
|
||||
.button {
|
||||
|
|
|
@ -1,11 +1,23 @@
|
|||
@keyframes fadeIn {
|
||||
from { opacity: 0; transform: scale(0.95); }
|
||||
to { opacity: 1; transform: scale(1); }
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: scale(0.95);
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: scale(1);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes fadeOut {
|
||||
from { opacity: 1; transform: scale(1); }
|
||||
to { opacity: 0; transform: scale(0.95); }
|
||||
from {
|
||||
opacity: 1;
|
||||
transform: scale(1);
|
||||
}
|
||||
to {
|
||||
opacity: 0;
|
||||
transform: scale(0.95);
|
||||
}
|
||||
}
|
||||
|
||||
.dialog-open,
|
||||
|
@ -14,7 +26,8 @@
|
|||
vertical-align: middle;
|
||||
color: var(--section-color, var(--accent-color));
|
||||
transform: var(--transform-icon-default);
|
||||
transition: color var(--transition-duration-default) var(--transition-ease-in-out),
|
||||
transition:
|
||||
color var(--transition-duration-default) var(--transition-ease-in-out),
|
||||
transform var(--transition-duration-default) var(--transition-ease-in-out);
|
||||
|
||||
&:is(:hover, :focus, :active) {
|
||||
|
@ -61,9 +74,9 @@ dialog {
|
|||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
max-width: calc(var(--sizing-full) * .6);
|
||||
max-height: calc(var(--sizing-full) * .75);
|
||||
inset: calc(var(--sizing-full) * .125) calc(var(--sizing-full) * .2);
|
||||
max-width: calc(var(--sizing-full) * 0.6);
|
||||
max-height: calc(var(--sizing-full) * 0.75);
|
||||
inset: calc(var(--sizing-full) * 0.125) calc(var(--sizing-full) * 0.2);
|
||||
border: var(--border-gray);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
::placeholder {
|
||||
color: var(--text-color);
|
||||
opacity: .5;
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
input {
|
||||
accent-color: var(--section-color, var(--accent-color));
|
||||
}
|
||||
|
||||
input:not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="checkbox"]),
|
||||
input:not([type='button']):not([type='submit']):not([type='reset']):not([type='checkbox']),
|
||||
textarea {
|
||||
width: var(--sizing-full);
|
||||
}
|
||||
|
||||
input:not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="checkbox"]),
|
||||
input:not([type='button']):not([type='submit']):not([type='reset']):not([type='checkbox']),
|
||||
textarea,
|
||||
select {
|
||||
color: var(--text-color);
|
||||
|
@ -23,7 +23,7 @@ select {
|
|||
}
|
||||
|
||||
form,
|
||||
input:not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="checkbox"]),
|
||||
input:not([type='button']):not([type='submit']):not([type='reset']):not([type='checkbox']),
|
||||
textarea {
|
||||
margin-bottom: var(--spacing-base);
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ label svg {
|
|||
cursor: pointer;
|
||||
}
|
||||
|
||||
detail label:has(input[type="checkbox"]) {
|
||||
detail label:has(input[type='checkbox']) {
|
||||
display: inline-flex;
|
||||
gap: var(--spacing-xs);
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
|
||||
progress {
|
||||
@media screen and (min-width: 768px) {
|
||||
max-width: calc(var(--sizing-full) * .8);
|
||||
max-width: calc(var(--sizing-full) * 0.8);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,10 +11,10 @@
|
|||
&::after {
|
||||
position: absolute;
|
||||
z-index: 1;
|
||||
content: "";
|
||||
content: '';
|
||||
box-shadow: var(--box-shadow-text-toggle);
|
||||
width: var(--sizing-full);
|
||||
height: calc(var(--sizing-full) * .2);
|
||||
height: calc(var(--sizing-full) * 0.2);
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
}
|
||||
|
|
|
@ -1,36 +1,36 @@
|
|||
@layer reset, defaults, base, page, components, plugins;
|
||||
|
||||
/* style resets */
|
||||
@import url("./base/reset.css") layer(reset);
|
||||
@import url('./base/reset.css') layer(reset);
|
||||
|
||||
/* core defaults */
|
||||
@import url("./base/fonts.css") layer(defaults);
|
||||
@import url("./base/vars.css") layer(defaults);
|
||||
@import url('./base/fonts.css') layer(defaults);
|
||||
@import url('./base/vars.css') layer(defaults);
|
||||
|
||||
/* base styles */
|
||||
@import url("./base/index.css") layer(base);
|
||||
@import url('./base/index.css') layer(base);
|
||||
|
||||
/* page styles */
|
||||
@import url("./pages/contact.css") layer(page);
|
||||
@import url("./pages/links.css") layer(page);
|
||||
@import url("./pages/media.css") layer(page);
|
||||
@import url("./pages/music.css") layer(page);
|
||||
@import url("./pages/reading.css") layer(page);
|
||||
@import url("./pages/watching.css") layer(page);
|
||||
@import url("./pages/webrings.css") layer(page);
|
||||
@import url('./pages/contact.css') layer(page);
|
||||
@import url('./pages/links.css') layer(page);
|
||||
@import url('./pages/media.css') layer(page);
|
||||
@import url('./pages/music.css') layer(page);
|
||||
@import url('./pages/reading.css') layer(page);
|
||||
@import url('./pages/watching.css') layer(page);
|
||||
@import url('./pages/webrings.css') layer(page);
|
||||
|
||||
/* plugins */
|
||||
@import url("./plugins/prism.css") layer(plugins);
|
||||
@import url('./plugins/prism.css') layer(plugins);
|
||||
|
||||
/* component styles */
|
||||
@import url("./components/banners.css") layer(components);
|
||||
@import url("./components/buttons.css") layer(components);
|
||||
@import url("./components/forms.css") layer(components);
|
||||
@import url("./components/header.css") layer(components);
|
||||
@import url("./components/media-grid.css") layer(components);
|
||||
@import url("./components/nav.css") layer(components);
|
||||
@import url("./components/dialog.css") layer(components);
|
||||
@import url("./components/music-chart.css") layer(components);
|
||||
@import url("./components/paginator.css") layer(components);
|
||||
@import url("./components/progress-bar.css") layer(components);
|
||||
@import url("./components/youtube-player.css") layer(components);
|
||||
@import url('./components/banners.css') layer(components);
|
||||
@import url('./components/buttons.css') layer(components);
|
||||
@import url('./components/forms.css') layer(components);
|
||||
@import url('./components/header.css') layer(components);
|
||||
@import url('./components/media-grid.css') layer(components);
|
||||
@import url('./components/nav.css') layer(components);
|
||||
@import url('./components/dialog.css') layer(components);
|
||||
@import url('./components/music-chart.css') layer(components);
|
||||
@import url('./components/paginator.css') layer(components);
|
||||
@import url('./components/progress-bar.css') layer(components);
|
||||
@import url('./components/youtube-player.css') layer(components);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* generic helper to hide client side content */
|
||||
.client-side {
|
||||
display:none
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* unset text toggle implementation on artist + genre pages */
|
||||
|
|
|
@ -1,26 +1,23 @@
|
|||
import EleventyFetch from "@11ty/eleventy-fetch";
|
||||
import EleventyFetch from '@11ty/eleventy-fetch';
|
||||
|
||||
const { POSTGREST_URL, POSTGREST_API_KEY } = process.env;
|
||||
|
||||
const fetchAlbumReleases = async () => {
|
||||
try {
|
||||
const data = await EleventyFetch(
|
||||
`${POSTGREST_URL}/optimized_album_releases`,
|
||||
{
|
||||
duration: "1d",
|
||||
type: "json",
|
||||
fetchOptions: {
|
||||
method: "GET",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Authorization: `Bearer ${POSTGREST_API_KEY}`,
|
||||
},
|
||||
},
|
||||
},
|
||||
);
|
||||
const data = await EleventyFetch(`${POSTGREST_URL}/optimized_album_releases`, {
|
||||
duration: '1d',
|
||||
type: 'json',
|
||||
fetchOptions: {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: `Bearer ${POSTGREST_API_KEY}`
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
const pacificNow = new Date().toLocaleString("en-US", {
|
||||
timeZone: "America/Los_Angeles",
|
||||
const pacificNow = new Date().toLocaleString('en-US', {
|
||||
timeZone: 'America/Los_Angeles'
|
||||
});
|
||||
const pacificDate = new Date(pacificNow);
|
||||
pacificDate.setHours(0, 0, 0, 0);
|
||||
|
@ -32,25 +29,23 @@ const fetchAlbumReleases = async () => {
|
|||
|
||||
return {
|
||||
...album,
|
||||
description: album.artist?.description || "No description",
|
||||
date: releaseDate.toLocaleDateString("en-US", {
|
||||
year: "numeric",
|
||||
month: "long",
|
||||
day: "numeric",
|
||||
}),
|
||||
description: album.artist?.description || 'No description',
|
||||
date: releaseDate.toLocaleDateString('en-US', {
|
||||
year: 'numeric',
|
||||
month: 'long',
|
||||
day: 'numeric'
|
||||
})
|
||||
};
|
||||
})
|
||||
.sort((a, b) => a.release_timestamp - b.release_timestamp);
|
||||
|
||||
const upcoming = all.filter(
|
||||
(album) =>
|
||||
album.release_timestamp > todayTimestamp &&
|
||||
album.total_plays === 0,
|
||||
(album) => album.release_timestamp > todayTimestamp && album.total_plays === 0
|
||||
);
|
||||
|
||||
return { all, upcoming };
|
||||
} catch (error) {
|
||||
console.error("Error fetching and processing album releases:", error);
|
||||
console.error('Error fetching and processing album releases:', error);
|
||||
return { all: [], upcoming: [] };
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,27 +1,24 @@
|
|||
import EleventyFetch from "@11ty/eleventy-fetch";
|
||||
import EleventyFetch from '@11ty/eleventy-fetch';
|
||||
|
||||
const { POSTGREST_URL, POSTGREST_API_KEY } = process.env;
|
||||
|
||||
export default async function fetchAllActivity() {
|
||||
try {
|
||||
const data = await EleventyFetch(
|
||||
`${POSTGREST_URL}/optimized_all_activity`,
|
||||
{
|
||||
duration: "1h",
|
||||
type: "json",
|
||||
fetchOptions: {
|
||||
method: "GET",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Authorization: `Bearer ${POSTGREST_API_KEY}`,
|
||||
},
|
||||
},
|
||||
const data = await EleventyFetch(`${POSTGREST_URL}/optimized_all_activity`, {
|
||||
duration: '1h',
|
||||
type: 'json',
|
||||
fetchOptions: {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: `Bearer ${POSTGREST_API_KEY}`
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
return data?.[0] || [];
|
||||
} catch (error) {
|
||||
console.error("Error fetching activity:", error);
|
||||
console.error('Error fetching activity:', error);
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
import EleventyFetch from "@11ty/eleventy-fetch";
|
||||
import EleventyFetch from '@11ty/eleventy-fetch';
|
||||
|
||||
const { POSTGREST_URL, POSTGREST_API_KEY } = process.env;
|
||||
|
||||
const fetchBlogroll = async () => {
|
||||
try {
|
||||
return await EleventyFetch(`${POSTGREST_URL}/optimized_blogroll`, {
|
||||
duration: "1d",
|
||||
type: "json",
|
||||
duration: '1d',
|
||||
type: 'json',
|
||||
fetchOptions: {
|
||||
method: "GET",
|
||||
method: 'GET',
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Authorization: `Bearer ${POSTGREST_API_KEY}`,
|
||||
},
|
||||
},
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: `Bearer ${POSTGREST_API_KEY}`
|
||||
}
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
console.error("Error fetching and processing the blogroll:", error);
|
||||
console.error('Error fetching and processing the blogroll:', error);
|
||||
return [];
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,25 +1,22 @@
|
|||
import EleventyFetch from "@11ty/eleventy-fetch";
|
||||
import EleventyFetch from '@11ty/eleventy-fetch';
|
||||
|
||||
const { POSTGREST_URL, POSTGREST_API_KEY } = process.env;
|
||||
|
||||
const fetchAllBooks = async () => {
|
||||
try {
|
||||
return await EleventyFetch(
|
||||
`${POSTGREST_URL}/optimized_books?order=date_finished.desc`,
|
||||
{
|
||||
duration: "1h",
|
||||
type: "json",
|
||||
fetchOptions: {
|
||||
method: "GET",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Authorization: `Bearer ${POSTGREST_API_KEY}`,
|
||||
},
|
||||
},
|
||||
},
|
||||
);
|
||||
return await EleventyFetch(`${POSTGREST_URL}/optimized_books?order=date_finished.desc`, {
|
||||
duration: '1h',
|
||||
type: 'json',
|
||||
fetchOptions: {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: `Bearer ${POSTGREST_API_KEY}`
|
||||
}
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
console.error("Error fetching books:", error);
|
||||
console.error('Error fetching books:', error);
|
||||
return [];
|
||||
}
|
||||
};
|
||||
|
@ -45,7 +42,7 @@ export default async function () {
|
|||
const booksForCurrentYear =
|
||||
sortedByYear
|
||||
.find((yearGroup) => yearGroup.value === currentYear)
|
||||
?.data.filter((book) => book.status === "finished") || [];
|
||||
?.data.filter((book) => book.status === 'finished') || [];
|
||||
|
||||
return {
|
||||
all: books,
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
import EleventyFetch from "@11ty/eleventy-fetch";
|
||||
import EleventyFetch from '@11ty/eleventy-fetch';
|
||||
|
||||
const { POSTGREST_URL, POSTGREST_API_KEY } = process.env;
|
||||
|
||||
const fetchAllConcerts = async () => {
|
||||
try {
|
||||
return await EleventyFetch(`${POSTGREST_URL}/optimized_concerts`, {
|
||||
duration: "1h",
|
||||
type: "json",
|
||||
duration: '1h',
|
||||
type: 'json',
|
||||
fetchOptions: {
|
||||
method: "GET",
|
||||
method: 'GET',
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Authorization: `Bearer ${POSTGREST_API_KEY}`,
|
||||
},
|
||||
},
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: `Bearer ${POSTGREST_API_KEY}`
|
||||
}
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
console.error("Error fetching concerts:", error);
|
||||
console.error('Error fetching concerts:', error);
|
||||
return [];
|
||||
}
|
||||
};
|
||||
|
@ -24,7 +24,7 @@ const fetchAllConcerts = async () => {
|
|||
const processConcerts = (concerts) =>
|
||||
concerts.map((concert) => ({
|
||||
...concert,
|
||||
artist: concert.artist || { name: concert.artist_name_string, url: null },
|
||||
artist: concert.artist || { name: concert.artist_name_string, url: null }
|
||||
}));
|
||||
|
||||
export default async function () {
|
||||
|
@ -32,7 +32,7 @@ export default async function () {
|
|||
const concerts = await fetchAllConcerts();
|
||||
return processConcerts(concerts);
|
||||
} catch (error) {
|
||||
console.error("Error fetching and processing concerts data:", error);
|
||||
console.error('Error fetching and processing concerts data:', error);
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
import EleventyFetch from "@11ty/eleventy-fetch";
|
||||
import EleventyFetch from '@11ty/eleventy-fetch';
|
||||
|
||||
const { POSTGREST_URL, POSTGREST_API_KEY } = process.env;
|
||||
|
||||
const fetchFeeds = async () => {
|
||||
try {
|
||||
return await EleventyFetch(`${POSTGREST_URL}/optimized_feeds?select=*`, {
|
||||
duration: "1h",
|
||||
type: "json",
|
||||
duration: '1h',
|
||||
type: 'json',
|
||||
fetchOptions: {
|
||||
method: "GET",
|
||||
method: 'GET',
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Authorization: `Bearer ${POSTGREST_API_KEY}`,
|
||||
},
|
||||
},
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: `Bearer ${POSTGREST_API_KEY}`
|
||||
}
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
console.error("Error fetching feed metadata:", error);
|
||||
console.error('Error fetching feed metadata:', error);
|
||||
return [];
|
||||
}
|
||||
};
|
||||
|
@ -24,16 +24,16 @@ const fetchFeeds = async () => {
|
|||
const fetchFeedData = async (feedKey) => {
|
||||
try {
|
||||
return await EleventyFetch(`${POSTGREST_URL}/rpc/get_feed_data`, {
|
||||
duration: "1h",
|
||||
type: "json",
|
||||
duration: '1h',
|
||||
type: 'json',
|
||||
fetchOptions: {
|
||||
method: "POST",
|
||||
method: 'POST',
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Authorization: `Bearer ${POSTGREST_API_KEY}`,
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: `Bearer ${POSTGREST_API_KEY}`
|
||||
},
|
||||
body: JSON.stringify({ feed_key: feedKey }),
|
||||
},
|
||||
body: JSON.stringify({ feed_key: feedKey })
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
console.error(`Error fetching feed data for ${feedKey}:`, error);
|
||||
|
@ -48,9 +48,9 @@ export default async function () {
|
|||
for (const feed of feeds) {
|
||||
feedsWithData.push({
|
||||
...feed,
|
||||
entries: await fetchFeedData(feed.data),
|
||||
entries: await fetchFeedData(feed.data)
|
||||
});
|
||||
}
|
||||
|
||||
return feedsWithData;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,27 +1,24 @@
|
|||
import EleventyFetch from "@11ty/eleventy-fetch";
|
||||
import EleventyFetch from '@11ty/eleventy-fetch';
|
||||
|
||||
const { POSTGREST_URL, POSTGREST_API_KEY } = process.env;
|
||||
|
||||
const fetchGlobals = async () => {
|
||||
try {
|
||||
const data = await EleventyFetch(
|
||||
`${POSTGREST_URL}/optimized_globals?select=*`,
|
||||
{
|
||||
duration: "1d",
|
||||
type: "json",
|
||||
fetchOptions: {
|
||||
method: "GET",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Authorization: `Bearer ${POSTGREST_API_KEY}`,
|
||||
},
|
||||
},
|
||||
},
|
||||
);
|
||||
const data = await EleventyFetch(`${POSTGREST_URL}/optimized_globals?select=*`, {
|
||||
duration: '1d',
|
||||
type: 'json',
|
||||
fetchOptions: {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: `Bearer ${POSTGREST_API_KEY}`
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return data[0];
|
||||
} catch (error) {
|
||||
console.error("Error fetching globals:", error);
|
||||
console.error('Error fetching globals:', error);
|
||||
return {};
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,29 +1,31 @@
|
|||
import EleventyFetch from "@11ty/eleventy-fetch";
|
||||
import EleventyFetch from '@11ty/eleventy-fetch';
|
||||
|
||||
const { POSTGREST_URL, POSTGREST_API_KEY } = process.env;
|
||||
|
||||
export default async function () {
|
||||
const res = await EleventyFetch(`${POSTGREST_URL}/optimized_all_tags?order=tag.asc`, {
|
||||
duration: "1h",
|
||||
type: "json",
|
||||
duration: '1h',
|
||||
type: 'json',
|
||||
fetchOptions: {
|
||||
method: "GET",
|
||||
method: 'GET',
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Authorization: `Bearer ${POSTGREST_API_KEY}`,
|
||||
},
|
||||
},
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: `Bearer ${POSTGREST_API_KEY}`
|
||||
}
|
||||
}
|
||||
});
|
||||
const tags = await res;
|
||||
const groupedMap = new Map();
|
||||
|
||||
for (const tag of tags) {
|
||||
const letter = /^[a-zA-Z]/.test(tag.tag) ? tag.tag[0].toUpperCase() : "#";
|
||||
const letter = /^[a-zA-Z]/.test(tag.tag) ? tag.tag[0].toUpperCase() : '#';
|
||||
|
||||
if (!groupedMap.has(letter)) groupedMap.set(letter, []);
|
||||
|
||||
groupedMap.get(letter).push(tag);
|
||||
}
|
||||
|
||||
return [...groupedMap.entries()].sort(([a], [b]) => a.localeCompare(b)).map(([letter, tags]) => ({ letter, tags: tags.sort((a, b) => a.tag.localeCompare(b.tag)) }));
|
||||
return [...groupedMap.entries()]
|
||||
.sort(([a], [b]) => a.localeCompare(b))
|
||||
.map(([letter, tags]) => ({ letter, tags: tags.sort((a, b) => a.tag.localeCompare(b.tag)) }));
|
||||
}
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
import EleventyFetch from "@11ty/eleventy-fetch";
|
||||
import EleventyFetch from '@11ty/eleventy-fetch';
|
||||
|
||||
const { POSTGREST_URL, POSTGREST_API_KEY } = process.env;
|
||||
|
||||
const fetchHeaders = async () => {
|
||||
try {
|
||||
return await EleventyFetch(`${POSTGREST_URL}/optimized_headers?select=*`, {
|
||||
duration: "1h",
|
||||
type: "json",
|
||||
duration: '1h',
|
||||
type: 'json',
|
||||
fetchOptions: {
|
||||
method: "GET",
|
||||
method: 'GET',
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Authorization: `Bearer ${POSTGREST_API_KEY}`,
|
||||
},
|
||||
},
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: `Bearer ${POSTGREST_API_KEY}`
|
||||
}
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
console.error("Error fetching header data:", error);
|
||||
console.error('Error fetching header data:', error);
|
||||
return [];
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
import EleventyFetch from "@11ty/eleventy-fetch";
|
||||
import EleventyFetch from '@11ty/eleventy-fetch';
|
||||
|
||||
const { POSTGREST_URL, POSTGREST_API_KEY } = process.env;
|
||||
|
||||
const fetchAllLinks = async () => {
|
||||
try {
|
||||
return await EleventyFetch(`${POSTGREST_URL}/optimized_links?select=*`, {
|
||||
duration: "1h",
|
||||
type: "json",
|
||||
duration: '1h',
|
||||
type: 'json',
|
||||
fetchOptions: {
|
||||
method: "GET",
|
||||
method: 'GET',
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Authorization: `Bearer ${POSTGREST_API_KEY}`,
|
||||
},
|
||||
},
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: `Bearer ${POSTGREST_API_KEY}`
|
||||
}
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
console.error("Error fetching links:", error);
|
||||
console.error('Error fetching links:', error);
|
||||
return [];
|
||||
}
|
||||
};
|
||||
|
@ -26,6 +26,6 @@ export default async function () {
|
|||
|
||||
return {
|
||||
all: links,
|
||||
feed: links.filter((links) => links.feed),
|
||||
}
|
||||
feed: links.filter((links) => links.feed)
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
import EleventyFetch from "@11ty/eleventy-fetch";
|
||||
import EleventyFetch from '@11ty/eleventy-fetch';
|
||||
|
||||
const { POSTGREST_URL, POSTGREST_API_KEY } = process.env;
|
||||
|
||||
const fetchAllMovies = async () => {
|
||||
try {
|
||||
return await EleventyFetch(`${POSTGREST_URL}/optimized_movies?select=*`, {
|
||||
duration: "1h",
|
||||
type: "json",
|
||||
duration: '1h',
|
||||
type: 'json',
|
||||
fetchOptions: {
|
||||
method: "GET",
|
||||
method: 'GET',
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Authorization: `Bearer ${POSTGREST_API_KEY}`,
|
||||
},
|
||||
},
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: `Bearer ${POSTGREST_API_KEY}`
|
||||
}
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
console.error("Error fetching movies:", error);
|
||||
console.error('Error fetching movies:', error);
|
||||
return [];
|
||||
}
|
||||
};
|
||||
|
@ -44,19 +44,17 @@ export default async function () {
|
|||
movies,
|
||||
watchHistory: movies.filter((movie) => movie.last_watched),
|
||||
recentlyWatched: recentlyWatchedMovies,
|
||||
favorites: favoriteMovies.sort((a, b) =>
|
||||
a.title.localeCompare(b.title),
|
||||
),
|
||||
feed: movies.filter((movie) => movie.feed),
|
||||
favorites: favoriteMovies.sort((a, b) => a.title.localeCompare(b.title)),
|
||||
feed: movies.filter((movie) => movie.feed)
|
||||
};
|
||||
} catch (error) {
|
||||
console.error("Error fetching and processing movies data:", error);
|
||||
console.error('Error fetching and processing movies data:', error);
|
||||
return {
|
||||
movies: [],
|
||||
watchHistory: [],
|
||||
recentlyWatched: [],
|
||||
favorites: [],
|
||||
feed: [],
|
||||
feed: []
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
import EleventyFetch from "@11ty/eleventy-fetch";
|
||||
import EleventyFetch from '@11ty/eleventy-fetch';
|
||||
|
||||
const { POSTGREST_URL, POSTGREST_API_KEY } = process.env;
|
||||
|
||||
const fetchDataFromView = async (viewName) => {
|
||||
try {
|
||||
return await EleventyFetch(`${POSTGREST_URL}/${viewName}?select=*`, {
|
||||
duration: "1h",
|
||||
type: "json",
|
||||
duration: '1h',
|
||||
type: 'json',
|
||||
fetchOptions: {
|
||||
method: "GET",
|
||||
method: 'GET',
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Authorization: `Bearer ${POSTGREST_API_KEY}`,
|
||||
},
|
||||
},
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: `Bearer ${POSTGREST_API_KEY}`
|
||||
}
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
console.error(`Error fetching data from view ${viewName}:`, error);
|
||||
|
@ -32,17 +32,17 @@ export default async function fetchMusicData() {
|
|||
monthTracks,
|
||||
monthArtists,
|
||||
monthAlbums,
|
||||
monthGenres,
|
||||
monthGenres
|
||||
] = await Promise.all([
|
||||
fetchDataFromView("recent_tracks"),
|
||||
fetchDataFromView("week_tracks"),
|
||||
fetchDataFromView("week_artists"),
|
||||
fetchDataFromView("week_albums"),
|
||||
fetchDataFromView("week_genres"),
|
||||
fetchDataFromView("month_tracks"),
|
||||
fetchDataFromView("month_artists"),
|
||||
fetchDataFromView("month_albums"),
|
||||
fetchDataFromView("month_genres"),
|
||||
fetchDataFromView('recent_tracks'),
|
||||
fetchDataFromView('week_tracks'),
|
||||
fetchDataFromView('week_artists'),
|
||||
fetchDataFromView('week_albums'),
|
||||
fetchDataFromView('week_genres'),
|
||||
fetchDataFromView('month_tracks'),
|
||||
fetchDataFromView('month_artists'),
|
||||
fetchDataFromView('month_albums'),
|
||||
fetchDataFromView('month_genres')
|
||||
]);
|
||||
|
||||
return {
|
||||
|
@ -52,9 +52,7 @@ export default async function fetchMusicData() {
|
|||
artists: weekArtists,
|
||||
albums: weekAlbums,
|
||||
genres: weekGenres,
|
||||
totalTracks: weekTracks
|
||||
.reduce((acc, track) => acc + track.plays, 0)
|
||||
.toLocaleString("en-US"),
|
||||
totalTracks: weekTracks.reduce((acc, track) => acc + track.plays, 0).toLocaleString('en-US')
|
||||
},
|
||||
month: {
|
||||
tracks: monthTracks,
|
||||
|
@ -63,11 +61,11 @@ export default async function fetchMusicData() {
|
|||
genres: monthGenres,
|
||||
totalTracks: monthTracks
|
||||
.reduce((acc, track) => acc + track.plays, 0)
|
||||
.toLocaleString("en-US"),
|
||||
},
|
||||
.toLocaleString('en-US')
|
||||
}
|
||||
};
|
||||
} catch (error) {
|
||||
console.error("Error fetching and processing music data:", error);
|
||||
console.error('Error fetching and processing music data:', error);
|
||||
return {
|
||||
recent: [],
|
||||
week: {
|
||||
|
@ -75,15 +73,15 @@ export default async function fetchMusicData() {
|
|||
artists: [],
|
||||
albums: [],
|
||||
genres: [],
|
||||
totalTracks: "0",
|
||||
totalTracks: '0'
|
||||
},
|
||||
month: {
|
||||
tracks: [],
|
||||
artists: [],
|
||||
albums: [],
|
||||
genres: [],
|
||||
totalTracks: "0",
|
||||
},
|
||||
totalTracks: '0'
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,23 +1,20 @@
|
|||
import EleventyFetch from "@11ty/eleventy-fetch";
|
||||
import EleventyFetch from '@11ty/eleventy-fetch';
|
||||
|
||||
const { POSTGREST_URL, POSTGREST_API_KEY } = process.env;
|
||||
|
||||
const fetchAllNavigation = async () => {
|
||||
try {
|
||||
const data = await EleventyFetch(
|
||||
`${POSTGREST_URL}/optimized_navigation?select=*`,
|
||||
{
|
||||
duration: "1d",
|
||||
type: "json",
|
||||
fetchOptions: {
|
||||
method: "GET",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Authorization: `Bearer ${POSTGREST_API_KEY}`,
|
||||
},
|
||||
},
|
||||
},
|
||||
);
|
||||
const data = await EleventyFetch(`${POSTGREST_URL}/optimized_navigation?select=*`, {
|
||||
duration: '1d',
|
||||
type: 'json',
|
||||
fetchOptions: {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: `Bearer ${POSTGREST_API_KEY}`
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
const nav = data.reduce((acc, item) => {
|
||||
const navItem = {
|
||||
|
@ -25,7 +22,7 @@ const fetchAllNavigation = async () => {
|
|||
permalink: item.permalink || item.page_permalink,
|
||||
icon: item.icon,
|
||||
section: item.section,
|
||||
sort: item.sort,
|
||||
sort: item.sort
|
||||
};
|
||||
|
||||
if (!acc[item.menu_location]) {
|
||||
|
@ -43,7 +40,7 @@ const fetchAllNavigation = async () => {
|
|||
|
||||
return nav;
|
||||
} catch (error) {
|
||||
console.error("Error fetching navigation data:", error);
|
||||
console.error('Error fetching navigation data:', error);
|
||||
return {};
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
import EleventyFetch from "@11ty/eleventy-fetch";
|
||||
import EleventyFetch from '@11ty/eleventy-fetch';
|
||||
|
||||
const { POSTGREST_URL, POSTGREST_API_KEY } = process.env;
|
||||
|
||||
const fetchAllPages = async () => {
|
||||
try {
|
||||
return await EleventyFetch(`${POSTGREST_URL}/optimized_pages?select=*`, {
|
||||
duration: "1d",
|
||||
type: "json",
|
||||
duration: '1d',
|
||||
type: 'json',
|
||||
fetchOptions: {
|
||||
method: "GET",
|
||||
method: 'GET',
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Authorization: `Bearer ${POSTGREST_API_KEY}`,
|
||||
},
|
||||
},
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: `Bearer ${POSTGREST_API_KEY}`
|
||||
}
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
console.error("Error fetching pages:", error);
|
||||
console.error('Error fetching pages:', error);
|
||||
return [];
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,25 +1,22 @@
|
|||
import EleventyFetch from "@11ty/eleventy-fetch";
|
||||
import EleventyFetch from '@11ty/eleventy-fetch';
|
||||
|
||||
const { POSTGREST_URL, POSTGREST_API_KEY } = process.env;
|
||||
|
||||
const fetchAllPosts = async () => {
|
||||
try {
|
||||
return await EleventyFetch(
|
||||
`${POSTGREST_URL}/optimized_posts?select=*&order=date.desc`,
|
||||
{
|
||||
duration: "1d",
|
||||
type: "json",
|
||||
fetchOptions: {
|
||||
method: "GET",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Authorization: `Bearer ${POSTGREST_API_KEY}`,
|
||||
},
|
||||
},
|
||||
},
|
||||
);
|
||||
return await EleventyFetch(`${POSTGREST_URL}/optimized_posts?select=*&order=date.desc`, {
|
||||
duration: '1d',
|
||||
type: 'json',
|
||||
fetchOptions: {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: `Bearer ${POSTGREST_API_KEY}`
|
||||
}
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
console.error("Error fetching posts:", error);
|
||||
console.error('Error fetching posts:', error);
|
||||
return [];
|
||||
}
|
||||
};
|
||||
|
@ -29,6 +26,6 @@ export default async function () {
|
|||
|
||||
return {
|
||||
all: posts,
|
||||
feed: posts.filter((posts) => posts.feed),
|
||||
feed: posts.filter((posts) => posts.feed)
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,29 +1,26 @@
|
|||
import EleventyFetch from "@11ty/eleventy-fetch";
|
||||
import EleventyFetch from '@11ty/eleventy-fetch';
|
||||
|
||||
const { POSTGREST_URL, POSTGREST_API_KEY } = process.env;
|
||||
|
||||
export default async function () {
|
||||
try {
|
||||
const data = await EleventyFetch(
|
||||
`${POSTGREST_URL}/optimized_recent_activity`,
|
||||
{
|
||||
duration: "1h",
|
||||
type: "json",
|
||||
fetchOptions: {
|
||||
method: "GET",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Authorization: `Bearer ${POSTGREST_API_KEY}`,
|
||||
},
|
||||
},
|
||||
const data = await EleventyFetch(`${POSTGREST_URL}/optimized_recent_activity`, {
|
||||
duration: '1h',
|
||||
type: 'json',
|
||||
fetchOptions: {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: `Bearer ${POSTGREST_API_KEY}`
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
const feeds = data?.[0]?.feed || [];
|
||||
|
||||
return feeds.filter((item) => item !== null);
|
||||
} catch (error) {
|
||||
console.error("Error fetching recent activity:", error);
|
||||
console.error('Error fetching recent activity:', error);
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,25 +1,22 @@
|
|||
import EleventyFetch from "@11ty/eleventy-fetch";
|
||||
import EleventyFetch from '@11ty/eleventy-fetch';
|
||||
|
||||
const { POSTGREST_URL, POSTGREST_API_KEY } = process.env;
|
||||
|
||||
const fetchRedirects = async () => {
|
||||
try {
|
||||
return await EleventyFetch(
|
||||
`${POSTGREST_URL}/optimized_redirects?select=*`,
|
||||
{
|
||||
duration: "1h",
|
||||
type: "json",
|
||||
fetchOptions: {
|
||||
method: "GET",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Authorization: `Bearer ${POSTGREST_API_KEY}`,
|
||||
},
|
||||
},
|
||||
},
|
||||
);
|
||||
return await EleventyFetch(`${POSTGREST_URL}/optimized_redirects?select=*`, {
|
||||
duration: '1h',
|
||||
type: 'json',
|
||||
fetchOptions: {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: `Bearer ${POSTGREST_API_KEY}`
|
||||
}
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
console.error("Error fetching redirect data:", error);
|
||||
console.error('Error fetching redirect data:', error);
|
||||
return [];
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,33 +1,30 @@
|
|||
import EleventyFetch from "@11ty/eleventy-fetch";
|
||||
import EleventyFetch from '@11ty/eleventy-fetch';
|
||||
|
||||
const { POSTGREST_URL, POSTGREST_API_KEY } = process.env;
|
||||
|
||||
const fetchAllRobots = async () => {
|
||||
try {
|
||||
const data = await EleventyFetch(
|
||||
`${POSTGREST_URL}/optimized_robots?select=path,user_agents`,
|
||||
{
|
||||
duration: "1h",
|
||||
type: "json",
|
||||
fetchOptions: {
|
||||
method: "GET",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Authorization: `Bearer ${POSTGREST_API_KEY}`,
|
||||
},
|
||||
},
|
||||
},
|
||||
);
|
||||
const data = await EleventyFetch(`${POSTGREST_URL}/optimized_robots?select=path,user_agents`, {
|
||||
duration: '1h',
|
||||
type: 'json',
|
||||
fetchOptions: {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: `Bearer ${POSTGREST_API_KEY}`
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
const sortedData = data.sort((a, b) => {
|
||||
const aHasWildcard = a.user_agents.includes("*") ? 0 : 1;
|
||||
const bHasWildcard = b.user_agents.includes("*") ? 0 : 1;
|
||||
const aHasWildcard = a.user_agents.includes('*') ? 0 : 1;
|
||||
const bHasWildcard = b.user_agents.includes('*') ? 0 : 1;
|
||||
return aHasWildcard - bHasWildcard || a.path.localeCompare(b.path);
|
||||
});
|
||||
|
||||
return sortedData;
|
||||
} catch (error) {
|
||||
console.error("Error fetching robot data:", error);
|
||||
console.error('Error fetching robot data:', error);
|
||||
return [];
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
import EleventyFetch from "@11ty/eleventy-fetch";
|
||||
import EleventyFetch from '@11ty/eleventy-fetch';
|
||||
|
||||
const { POSTGREST_URL, POSTGREST_API_KEY } = process.env;
|
||||
|
||||
const fetchSitemap = async () => {
|
||||
try {
|
||||
return await EleventyFetch(`${POSTGREST_URL}/optimized_sitemap?select=*`, {
|
||||
duration: "1h",
|
||||
type: "json",
|
||||
duration: '1h',
|
||||
type: 'json',
|
||||
fetchOptions: {
|
||||
method: "GET",
|
||||
method: 'GET',
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Authorization: `Bearer ${POSTGREST_API_KEY}`,
|
||||
},
|
||||
},
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: `Bearer ${POSTGREST_API_KEY}`
|
||||
}
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
console.error("Error fetching sitemap entries:", error);
|
||||
console.error('Error fetching sitemap entries:', error);
|
||||
return [];
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
import EleventyFetch from "@11ty/eleventy-fetch";
|
||||
import EleventyFetch from '@11ty/eleventy-fetch';
|
||||
|
||||
const { POSTGREST_URL, POSTGREST_API_KEY } = process.env;
|
||||
|
||||
const fetchStats = async () => {
|
||||
try {
|
||||
return await EleventyFetch(`${POSTGREST_URL}/optimized_stats?select=*`, {
|
||||
duration: "1h",
|
||||
type: "json",
|
||||
duration: '1h',
|
||||
type: 'json',
|
||||
fetchOptions: {
|
||||
method: "GET",
|
||||
method: 'GET',
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Authorization: `Bearer ${POSTGREST_API_KEY}`,
|
||||
},
|
||||
},
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: `Bearer ${POSTGREST_API_KEY}`
|
||||
}
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
console.error("Error fetching stats data:", error);
|
||||
console.error('Error fetching stats data:', error);
|
||||
return [];
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import EleventyFetch from "@11ty/eleventy-fetch";
|
||||
import EleventyFetch from '@11ty/eleventy-fetch';
|
||||
|
||||
const { POSTGREST_URL, POSTGREST_API_KEY } = process.env;
|
||||
|
||||
|
@ -7,21 +7,21 @@ const fetchTopAlbums = async () => {
|
|||
const data = await EleventyFetch(
|
||||
`${POSTGREST_URL}/optimized_albums?select=table&order=total_plays_raw.desc&limit=8`,
|
||||
{
|
||||
duration: "1d",
|
||||
type: "json",
|
||||
duration: '1d',
|
||||
type: 'json',
|
||||
fetchOptions: {
|
||||
method: "GET",
|
||||
method: 'GET',
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Authorization: `Bearer ${POSTGREST_API_KEY}`,
|
||||
},
|
||||
},
|
||||
},
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: `Bearer ${POSTGREST_API_KEY}`
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
return data;
|
||||
} catch (error) {
|
||||
console.error("Error fetching top albums:", error);
|
||||
console.error('Error fetching top albums:', error);
|
||||
return {};
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import EleventyFetch from "@11ty/eleventy-fetch";
|
||||
import EleventyFetch from '@11ty/eleventy-fetch';
|
||||
|
||||
const { POSTGREST_URL, POSTGREST_API_KEY } = process.env;
|
||||
|
||||
|
@ -7,21 +7,21 @@ const fetchTopArtists = async () => {
|
|||
const data = await EleventyFetch(
|
||||
`${POSTGREST_URL}/optimized_artists?select=table&order=total_plays_raw.desc&limit=8`,
|
||||
{
|
||||
duration: "1d",
|
||||
type: "json",
|
||||
duration: '1d',
|
||||
type: 'json',
|
||||
fetchOptions: {
|
||||
method: "GET",
|
||||
method: 'GET',
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Authorization: `Bearer ${POSTGREST_API_KEY}`,
|
||||
},
|
||||
},
|
||||
},
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: `Bearer ${POSTGREST_API_KEY}`
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
return data;
|
||||
} catch (error) {
|
||||
console.error("Error fetching top artists:", error);
|
||||
console.error('Error fetching top artists:', error);
|
||||
return {};
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
import EleventyFetch from "@11ty/eleventy-fetch";
|
||||
import EleventyFetch from '@11ty/eleventy-fetch';
|
||||
|
||||
const { POSTGREST_URL, POSTGREST_API_KEY } = process.env;
|
||||
|
||||
const fetchTopTags = async () => {
|
||||
try {
|
||||
return await EleventyFetch(`${POSTGREST_URL}/rpc/get_top_tag_groups`, {
|
||||
duration: "1h",
|
||||
type: "json",
|
||||
duration: '1h',
|
||||
type: 'json',
|
||||
fetchOptions: {
|
||||
method: "POST",
|
||||
method: 'POST',
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Authorization: `Bearer ${POSTGREST_API_KEY}`,
|
||||
},
|
||||
},
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: `Bearer ${POSTGREST_API_KEY}`
|
||||
}
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
console.error("Error fetching top tag entries:", error);
|
||||
console.error('Error fetching top tag entries:', error);
|
||||
return [];
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
import EleventyFetch from "@11ty/eleventy-fetch";
|
||||
import EleventyFetch from '@11ty/eleventy-fetch';
|
||||
|
||||
const { POSTGREST_URL, POSTGREST_API_KEY } = process.env;
|
||||
|
||||
const fetchAllShows = async () => {
|
||||
try {
|
||||
return await EleventyFetch(`${POSTGREST_URL}/optimized_shows?select=*`, {
|
||||
duration: "1h",
|
||||
type: "json",
|
||||
duration: '1h',
|
||||
type: 'json',
|
||||
fetchOptions: {
|
||||
method: "GET",
|
||||
method: 'GET',
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Authorization: `Bearer ${POSTGREST_API_KEY}`,
|
||||
},
|
||||
},
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: `Bearer ${POSTGREST_API_KEY}`
|
||||
}
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
console.error("Error fetching shows:", error);
|
||||
console.error('Error fetching shows:', error);
|
||||
return [];
|
||||
}
|
||||
};
|
||||
|
@ -25,9 +25,7 @@ export default async function () {
|
|||
try {
|
||||
const shows = await fetchAllShows();
|
||||
|
||||
const watchedShows = shows.filter(
|
||||
(show) => show.last_watched_at !== null,
|
||||
);
|
||||
const watchedShows = shows.filter((show) => show.last_watched_at !== null);
|
||||
|
||||
const episodes = watchedShows.map((show) => ({
|
||||
title: show.episode.title,
|
||||
|
@ -37,7 +35,7 @@ export default async function () {
|
|||
image: show.episode.image,
|
||||
backdrop: show.episode.backdrop,
|
||||
last_watched_at: show.episode.last_watched_at,
|
||||
grid: show.grid,
|
||||
grid: show.grid
|
||||
}));
|
||||
|
||||
return {
|
||||
|
@ -45,15 +43,15 @@ export default async function () {
|
|||
recentlyWatched: episodes.slice(0, 125),
|
||||
favorites: shows
|
||||
.filter((show) => show.favorite)
|
||||
.sort((a, b) => a.title.localeCompare(b.title)),
|
||||
.sort((a, b) => a.title.localeCompare(b.title))
|
||||
};
|
||||
} catch (error) {
|
||||
console.error("Error fetching and processing shows data:", error);
|
||||
console.error('Error fetching and processing shows data:', error);
|
||||
|
||||
return {
|
||||
shows: [],
|
||||
recentlyWatched: [],
|
||||
favorites: [],
|
||||
favorites: []
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
import EleventyFetch from "@11ty/eleventy-fetch";
|
||||
import EleventyFetch from '@11ty/eleventy-fetch';
|
||||
|
||||
const { POSTGREST_URL, POSTGREST_API_KEY } = process.env;
|
||||
|
||||
const fetchUpcomingShows = async () => {
|
||||
try {
|
||||
return await EleventyFetch(`${POSTGREST_URL}/optimized_scheduled_shows?select=*`, {
|
||||
duration: "1h",
|
||||
type: "json",
|
||||
duration: '1h',
|
||||
type: 'json',
|
||||
fetchOptions: {
|
||||
method: "GET",
|
||||
method: 'GET',
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Authorization: `Bearer ${POSTGREST_API_KEY}`,
|
||||
},
|
||||
},
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: `Bearer ${POSTGREST_API_KEY}`
|
||||
}
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
console.error("Error fetching upcoming shows:", error);
|
||||
console.error('Error fetching upcoming shows:', error);
|
||||
return [];
|
||||
}
|
||||
};
|
||||
|
@ -25,5 +25,5 @@ export default async function () {
|
|||
const data = await fetchUpcomingShows();
|
||||
const upcomingShows = data?.[0]?.scheduled_shows;
|
||||
|
||||
return upcomingShows
|
||||
return upcomingShows;
|
||||
}
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
{
|
||||
"layout": "base.liquid"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue