chore: normalize formatting

This commit is contained in:
Cory Dransfeldt 2024-10-19 19:50:10 -07:00
parent 01ed2ac3b3
commit 2f6cfbe7ae
No known key found for this signature in database
61 changed files with 921 additions and 743 deletions

View file

@ -1,37 +1,45 @@
import { DateTime } from 'luxon'
import ics from 'ics'
import { DateTime } from "luxon";
import ics from "ics";
export const albumReleasesCalendar = (collection) => {
const collectionData = collection.getAll()[0]
const { data } = collectionData
const { albumReleases: { all } } = data
if (!all || all.length === 0) return ''
const collectionData = collection.getAll()[0];
const { data } = collectionData;
const {
albumReleases: { all },
} = data;
if (!all || all.length === 0) return "";
const events = all.map(album => {
const date = DateTime.fromISO(album['release_date'])
if (!date.isValid) return null
const events = all
.map((album) => {
const date = DateTime.fromISO(album["release_date"]);
if (!date.isValid) return null;
return {
start: [date.year, date.month, date.day],
startInputType: 'local',
startOutputType: 'local',
title: `Release: ${album['artist']['name']} - ${album['title']}`,
description: `Check out this new album release: ${album['url']}. Read more about ${album['artist']['name']} at https://coryd.dev${album['artist']['url']}`,
url: album['url'],
uid: `${date.toFormat('yyyyMMdd')}-${album['artist']['name']}-${album['title']}@coryd.dev`,
timestamp: DateTime.now().toUTC().toFormat("yyyyMMdd'T'HHmmss'Z'")
}
}).filter(event => event !== null)
return {
start: [date.year, date.month, date.day],
startInputType: "local",
startOutputType: "local",
title: `Release: ${album["artist"]["name"]} - ${album["title"]}`,
description: `Check out this new album release: ${album["url"]}. Read more about ${album["artist"]["name"]} at https://coryd.dev${album["artist"]["url"]}`,
url: album["url"],
uid: `${date.toFormat("yyyyMMdd")}-${album["artist"]["name"]}-${
album["title"]
}@coryd.dev`,
timestamp: DateTime.now().toUTC().toFormat("yyyyMMdd'T'HHmmss'Z'"),
};
})
.filter((event) => event !== null);
const { error, value } = ics.createEvents(events, { calName: 'Album releases calendar / coryd.dev' })
const { error, value } = ics.createEvents(events, {
calName: "Album releases calendar / coryd.dev",
});
if (error) {
console.error('Error creating events: ', error)
console.error("Error creating events: ", error);
events.forEach((event, index) => {
console.error(`Event ${index}:`, event)
})
return ''
console.error(`Event ${index}:`, event);
});
return "";
}
return value
}
return value;
};

View file

@ -1,59 +1,75 @@
import fs from 'fs'
import path from 'path'
import { minify } from 'terser'
import fs from "fs";
import path from "path";
import { minify } from "terser";
const errorPages = ['404', '500', '1000', 'broken', 'error', 'js-challenge', 'not-allowed', 'rate-limit']
const errorPages = [
"404",
"500",
"1000",
"broken",
"error",
"js-challenge",
"not-allowed",
"rate-limit",
];
export const copyErrorPages = () => {
errorPages.forEach((errorPage) => {
const sourcePath = path.join('_site', errorPage, 'index.html')
const destinationPath = path.join('_site', `${errorPage}.html`)
const directoryPath = path.join('_site', errorPage)
const sourcePath = path.join("_site", errorPage, "index.html");
const destinationPath = path.join("_site", `${errorPage}.html`);
const directoryPath = path.join("_site", errorPage);
fs.copyFile(sourcePath, destinationPath, (err) => {
if (err) {
console.error(`Error copying ${errorPage} page:`, err)
return
console.error(`Error copying ${errorPage} page:`, err);
return;
}
fs.unlink(sourcePath, (unlinkErr) => {
if (unlinkErr) {
console.error(`Error deleting source file for ${errorPage} page:`, unlinkErr)
return
console.error(
`Error deleting source file for ${errorPage} page:`,
unlinkErr
);
return;
}
fs.rmdir(directoryPath, (rmdirErr) => {
if (rmdirErr) console.error(`Error removing directory for ${errorPage} page:`, rmdirErr)
})
})
})
})
}
if (rmdirErr)
console.error(
`Error removing directory for ${errorPage} page:`,
rmdirErr
);
});
});
});
});
};
export const minifyJsComponents = async () => {
const scriptsDir = '_site/assets/scripts'
const scriptsDir = "_site/assets/scripts";
const minifyJsFilesInDir = async (dir) => {
const files = fs.readdirSync(dir)
const files = fs.readdirSync(dir);
for (const fileName of files) {
const filePath = path.join(dir, fileName)
const stat = fs.statSync(filePath)
const filePath = path.join(dir, fileName);
const stat = fs.statSync(filePath);
if (stat.isDirectory()) {
await minifyJsFilesInDir(filePath)
} else if (fileName.endsWith('.js')) {
const fileContent = fs.readFileSync(filePath, 'utf8')
const minified = await minify(fileContent)
await minifyJsFilesInDir(filePath);
} else if (fileName.endsWith(".js")) {
const fileContent = fs.readFileSync(filePath, "utf8");
const minified = await minify(fileContent);
if (minified.error) {
console.error(`Error minifying ${filePath}:`, minified.error)
console.error(`Error minifying ${filePath}:`, minified.error);
} else {
fs.writeFileSync(filePath, minified.code)
fs.writeFileSync(filePath, minified.code);
}
} else {
console.log(`No .js files to minify in ${filePath}`)
console.log(`No .js files to minify in ${filePath}`);
}
}
}
};
await minifyJsFilesInDir(scriptsDir)
}
await minifyJsFilesInDir(scriptsDir);
};

View file

@ -1,26 +1,26 @@
export default {
stringToRFC822Date: (dateString) => {
const date = new Date(dateString)
const date = new Date(dateString);
if (isNaN(date)) return ''
if (isNaN(date)) return "";
const options = {
weekday: 'short',
day: '2-digit',
month: 'short',
year: 'numeric',
hour: '2-digit',
minute: '2-digit',
second: '2-digit',
timeZoneName: 'short'
}
const formatter = new Intl.DateTimeFormat('en-GB', options)
weekday: "short",
day: "2-digit",
month: "short",
year: "numeric",
hour: "2-digit",
minute: "2-digit",
second: "2-digit",
timeZoneName: "short",
};
const formatter = new Intl.DateTimeFormat("en-GB", options);
return formatter.format(date).replace(',', '')
return formatter.format(date).replace(",", "");
},
stringToRFC3339: (dateString) => {
const date = new Date(dateString)
const date = new Date(dateString);
return isNaN(date) ? '' : date.toISOString()
}
}
return isNaN(date) ? "" : date.toISOString();
},
};

View file

@ -1,18 +1,19 @@
import truncateHtml from 'truncate-html'
import { shuffleArray } from '../utilities/index.js'
import truncateHtml from "truncate-html";
import { shuffleArray } from "../utilities/index.js";
export default {
encodeAmp: (string) => {
if (!string) return
const pattern = /&(?!(?:[a-zA-Z]+|#[0-9]+|#x[0-9a-fA-F]+);)/g
const replacement = '&'
return string.replace(pattern, replacement)
if (!string) return;
const pattern = /&(?!(?:[a-zA-Z]+|#[0-9]+|#x[0-9a-fA-F]+);)/g;
const replacement = "&";
return string.replace(pattern, replacement);
},
replaceQuotes: (string) => string.replace(/"/g, '"'),
formatNumber: (number) => number.toLocaleString('en-US'),
htmlTruncate: (content, limit = 50) => truncateHtml(content, limit, {
byWords: true,
ellipsis: '...'
}),
replaceQuotes: (string) => string.replace(/"/g, """),
formatNumber: (number) => number.toLocaleString("en-US"),
htmlTruncate: (content, limit = 50) =>
truncateHtml(content, limit, {
byWords: true,
ellipsis: "...",
}),
shuffleArray,
}
};

View file

@ -1,11 +1,11 @@
import dates from './dates.js'
import general from './general.js'
import media from './media.js'
import navigation from './navigation.js'
import dates from "./dates.js";
import general from "./general.js";
import media from "./media.js";
import navigation from "./navigation.js";
export default {
...dates,
...general,
...media,
...navigation,
}
};

View file

@ -1,35 +1,43 @@
export default {
filterBooksByStatus: (books, status) => books.filter(book => book['status'] === status),
findFavoriteBooks: (books) => books.filter(book => book['favorite'] === true),
bookYearLinks: (years) => years
.sort((a, b) => b['value'] - a['value'])
.map((year, index) => `<a href="/books/years/${year['value']}">${year['value']}</a>${index < years.length - 1 ? ' / ' : ''}`)
.join(''),
filterBooksByStatus: (books, status) =>
books.filter((book) => book["status"] === status),
findFavoriteBooks: (books) =>
books.filter((book) => book["favorite"] === true),
bookYearLinks: (years) =>
years
.sort((a, b) => b["value"] - a["value"])
.map(
(year, index) =>
`<a href="/books/years/${year["value"]}">${year["value"]}</a>${
index < years.length - 1 ? " / " : ""
}`
)
.join(""),
mediaLinks: (data, type, count = 10) => {
if (!data || !type) return ''
if (!data || !type) return "";
const dataSlice = data.slice(0, count)
if (dataSlice.length === 0) return null
const dataSlice = data.slice(0, count);
if (dataSlice.length === 0) return null;
const buildLink = (item) => {
switch (type) {
case 'genre':
return `<a href="${item['genre_url']}">${item['genre_name']}</a>`
case 'artist':
return `<a href="${item['url']}">${item['name']}</a>`
case 'book':
return `<a href="${item['url']}">${item['title']}</a>`
case "genre":
return `<a href="${item["genre_url"]}">${item["genre_name"]}</a>`;
case "artist":
return `<a href="${item["url"]}">${item["name"]}</a>`;
case "book":
return `<a href="${item["url"]}">${item["title"]}</a>`;
default:
return ''
return "";
}
}
};
if (dataSlice.length === 1) return buildLink(dataSlice[0])
if (dataSlice.length === 1) return buildLink(dataSlice[0]);
const links = dataSlice.map(buildLink)
const allButLast = links.slice(0, -1).join(', ')
const last = links[links.length - 1]
const links = dataSlice.map(buildLink);
const allButLast = links.slice(0, -1).join(", ");
const last = links[links.length - 1];
return `${allButLast} and ${last}`
}
}
return `${allButLast} and ${last}`;
},
};

View file

@ -1,3 +1,5 @@
export default {
isLinkActive: (category, page) => page.includes(category) && page.split('/').filter(a => a !== '').length <= 1
}
isLinkActive: (category, page) =>
page.includes(category) &&
page.split("/").filter((a) => a !== "").length <= 1,
};

View file

@ -1,33 +1,33 @@
import fs from 'node:fs/promises'
import path from 'node:path'
import postcss from 'postcss'
import postcssImport from 'postcss-import'
import postcssImportExtGlob from 'postcss-import-ext-glob'
import autoprefixer from 'autoprefixer'
import cssnano from 'cssnano'
import fs from "node:fs/promises";
import path from "node:path";
import postcss from "postcss";
import postcssImport from "postcss-import";
import postcssImportExtGlob from "postcss-import-ext-glob";
import autoprefixer from "autoprefixer";
import cssnano from "cssnano";
export const cssConfig = (eleventyConfig) => {
eleventyConfig.addTemplateFormats('css')
eleventyConfig.addExtension('css', {
outputFileExtension: 'css',
eleventyConfig.addTemplateFormats("css");
eleventyConfig.addExtension("css", {
outputFileExtension: "css",
compile: async (inputContent, inputPath) => {
const outputPath = '_site/assets/css/index.css'
const outputPath = "_site/assets/css/index.css";
if (inputPath.endsWith('index.css')) {
if (inputPath.endsWith("index.css")) {
return async () => {
let result = await postcss([
postcssImportExtGlob,
postcssImport,
autoprefixer,
cssnano,
]).process(inputContent, { from: inputPath })
]).process(inputContent, { from: inputPath });
await fs.mkdir(path.dirname(outputPath), { recursive: true })
await fs.writeFile(outputPath, result.css)
await fs.mkdir(path.dirname(outputPath), { recursive: true });
await fs.writeFile(outputPath, result.css);
return result.css
}
return result.css;
};
}
},
})
}
});
};

View file

@ -1,27 +1,28 @@
export const shuffleArray = array => {
const shuffled = [...array]
export const shuffleArray = (array) => {
const shuffled = [...array];
for (let i = shuffled.length - 1; i > 0; i--) {
let j = Math.floor(Math.random() * (i + 1))
let temp = shuffled[i]
shuffled[i] = shuffled[j]
shuffled[j] = temp
let j = Math.floor(Math.random() * (i + 1));
let temp = shuffled[i];
shuffled[i] = shuffled[j];
shuffled[j] = temp;
}
return shuffled
}
return shuffled;
};
export const regionNames = new Intl.DisplayNames(['en'], { type: 'region' })
export const regionNames = new Intl.DisplayNames(["en"], { type: "region" });
export const getCountryName = (countryCode) => regionNames.of(countryCode.trim()) || countryCode.trim()
export const getCountryName = (countryCode) =>
regionNames.of(countryCode.trim()) || countryCode.trim();
export const parseCountryField = (countryField) => {
if (!countryField) return null
if (!countryField) return null;
const delimiters = [',', '/', '&', 'and']
let countries = [countryField]
const delimiters = [",", "/", "&", "and"];
let countries = [countryField];
delimiters.forEach(delimiter => {
countries = countries.flatMap(country => country.split(delimiter))
})
delimiters.forEach((delimiter) => {
countries = countries.flatMap((country) => country.split(delimiter));
});
return countries.map(getCountryName).join(', ')
}
return countries.map(getCountryName).join(", ");
};

View file

@ -1,33 +1,36 @@
import fs from 'fs/promises'
import dotenv from 'dotenv-flow'
import fs from "fs/promises";
import dotenv from "dotenv-flow";
dotenv.config()
dotenv.config();
const workerName = process.argv[2]
const workerName = process.argv[2];
if (!workerName) {
console.error('Please specify a worker name.')
process.exit(1)
console.error("Please specify a worker name.");
process.exit(1);
}
const templatePath = `workers/${workerName}/wrangler.template.toml`
const outputPath = `workers/${workerName}/wrangler.toml`
const templatePath = `workers/${workerName}/wrangler.template.toml`;
const outputPath = `workers/${workerName}/wrangler.toml`;
async function generateToml() {
try {
const template = await fs.readFile(templatePath, 'utf8')
const template = await fs.readFile(templatePath, "utf8");
const output = template
.replace(/\${CF_ACCOUNT_ID}/g, process.env.CF_ACCOUNT_ID)
.replace(/\${CF_ZONE_ID}/g, process.env.CF_ZONE_ID)
.replace(/\${RSS_TO_MASTODON_KV_NAMESPACE_ID}/g, process.env.RSS_TO_MASTODON_KV_NAMESPACE_ID)
.replace(
/\${RSS_TO_MASTODON_KV_NAMESPACE_ID}/g,
process.env.RSS_TO_MASTODON_KV_NAMESPACE_ID
);
await fs.writeFile(outputPath, output)
await fs.writeFile(outputPath, output);
console.log(`Generated wrangler.toml for ${workerName}`)
console.log(`Generated wrangler.toml for ${workerName}`);
} catch (error) {
console.error('Error generating wrangler.toml:', error)
process.exit(1)
console.error("Error generating wrangler.toml:", error);
process.exit(1);
}
}
generateToml()
generateToml();

View file

@ -297,4 +297,4 @@ window.addEventListener("load", () => {
updateSearchResults(nextResults);
});
})();
});
});

View file

@ -1,5 +1,4 @@
html
body {
html body {
color: var(--text-color);
background: var(--background-color);
font-family: var(--font-mono);
@ -13,8 +12,8 @@ html {
body {
font-size: var(--font-size-base);
line-height: var(--line-height-base);
letter-spacing: -.025rem;
word-spacing: -.05rem;
letter-spacing: -0.025rem;
word-spacing: -0.05rem;
}
::-webkit-scrollbar {
@ -81,7 +80,7 @@ p:not(.banner p) > svg {
:is(h1, h2, h3, h4, h5, h6):has(svg) {
display: flex;
align-items: center;
gap: var(--spacing-sm)
gap: var(--spacing-sm);
}
strong,
@ -125,29 +124,76 @@ svg {
.search,
.tattoo,
.tv {
&.article { --section-color: var(--article); }
&.books { --section-color: var(--books); }
&.brand-github { --section-color: var(--brand-github); }
&.brand-mastodon { --section-color: var(--brand-mastodon); }
&.brand-npm { --section-color: var(--brand-npm); }
&.coffee { --section-color: var(--brand-buy-me-a-coffee); }
&.collected { --section-color: var(--collected); }
&.concerts { --section-color: var(--concerts); }
&.country { --section-color: var(--country); }
&.device-tv-old { --section-color: var(--tv); }
&.device-watch { --section-color: var(--now); }
&.favorite { --section-color: var(--favorite); }
&.headphones { --section-color: var(--music); }
&.heart-handshake { --section-color: var(--webrings); }
&.info-circle { --section-color: var(--about); }
&.link { --section-color: var(--link); }
&.mail { --section-color: var(--brand-gmail); }
&.mail-plus { --section-color: var(--newsletter); }
&.movies, &.tv { --section-color: var(--tv); }
&.music { --section-color: var(--music); }
&.rss { --section-color: var(--brand-rss); }
&.search { --section-color: var(--search); }
&.tattoo { --section-color: var(--tattoo); }
&.article {
--section-color: var(--article);
}
&.books {
--section-color: var(--books);
}
&.brand-github {
--section-color: var(--brand-github);
}
&.brand-mastodon {
--section-color: var(--brand-mastodon);
}
&.brand-npm {
--section-color: var(--brand-npm);
}
&.coffee {
--section-color: var(--brand-buy-me-a-coffee);
}
&.collected {
--section-color: var(--collected);
}
&.concerts {
--section-color: var(--concerts);
}
&.country {
--section-color: var(--country);
}
&.device-tv-old {
--section-color: var(--tv);
}
&.device-watch {
--section-color: var(--now);
}
&.favorite {
--section-color: var(--favorite);
}
&.headphones {
--section-color: var(--music);
}
&.heart-handshake {
--section-color: var(--webrings);
}
&.info-circle {
--section-color: var(--about);
}
&.link {
--section-color: var(--link);
}
&.mail {
--section-color: var(--brand-gmail);
}
&.mail-plus {
--section-color: var(--newsletter);
}
&.movies,
&.tv {
--section-color: var(--tv);
}
&.music {
--section-color: var(--music);
}
&.rss {
--section-color: var(--brand-rss);
}
&.search {
--section-color: var(--search);
}
&.tattoo {
--section-color: var(--tattoo);
}
color: var(--section-color);
@ -173,14 +219,11 @@ a:active,
:is(.main-title, footer nav.sub-pages) a:focus,
:is(.main-title, footer nav.sub-pages) a:active {
color: var(--accent-color-hover);
transition: color var(--transition-duration-default) var(--transition-ease-in-out);
transition: color var(--transition-duration-default)
var(--transition-ease-in-out);
}
:is(
a:has(svg):hover,
a:has(svg):active,
a:has(svg):focus
) svg {
:is(a:has(svg):hover, a:has(svg):active, a:has(svg):focus) svg {
stroke: var(--accent-color-hover);
}
@ -201,26 +244,55 @@ a:active,
}
/* headers */
h1, h2, h3, h4, h5, h6 {
h1,
h2,
h3,
h4,
h5,
h6 {
font-weight: var(--font-weight-bold);
line-height: var(--line-height-md);
margin: var(--margin-vertical-base-horizontal-zero);
}
h1 { font-size: var(--font-size-2xl); }
h2 { font-size: var(--font-size-xl); }
h3 { font-size: var(--font-size-lg); }
h4 { font-size: var(--font-size-base); }
h5 { font-size: var(--font-size-md); }
h6 { font-size: var(--font-size-sm); }
h1 {
font-size: var(--font-size-2xl);
}
h2 {
font-size: var(--font-size-xl);
}
h3 {
font-size: var(--font-size-lg);
}
h4 {
font-size: var(--font-size-base);
}
h5 {
font-size: var(--font-size-md);
}
h6 {
font-size: var(--font-size-sm);
}
@media screen and (min-width: 768px) {
h1 { font-size: var(--font-size-3xl); }
h2 { font-size: var(--font-size-2xl); }
h3 { font-size: var(--font-size-xl); }
h4 { font-size: var(--font-size-lg); }
h5 { font-size: var(--font-size-base); }
h6 { font-size: var(--font-size-md); }
h1 {
font-size: var(--font-size-3xl);
}
h2 {
font-size: var(--font-size-2xl);
}
h3 {
font-size: var(--font-size-xl);
}
h4 {
font-size: var(--font-size-lg);
}
h5 {
font-size: var(--font-size-base);
}
h6 {
font-size: var(--font-size-md);
}
}
/* dividers */
@ -272,7 +344,7 @@ td {
text-overflow: ellipsis;
&::after {
content: '';
content: "";
position: absolute;
inset-block-start: 0;
inset-inline-end: 0;
@ -410,9 +482,9 @@ footer {
color: var(--text-color);
}
/* lists */
ul, ol {
ul,
ol {
list-style-position: inside;
margin: var(--margin-vertical-base-horizontal-zero);
padding-left: var(--spacing-base);
@ -428,4 +500,4 @@ ul, ol {
border-radius: var(--border-radius-slight);
height: auto;
width: 100%;
}
}

View file

@ -15,4 +15,4 @@
& img {
image-rendering: pixelated;
}
}
}

View file

@ -37,12 +37,24 @@
&.old-post,
&.rss,
&.warning {
&.error { --banner-accent-color: var(--error); }
&.github { --banner-accent-color: var(--brand-github); }
&.npm { --banner-accent-color: var(--brand-npm); }
&.old-post { --banner-accent-color: var(--gray-dark); }
&.rss { --banner-accent-color: var(--brand-rss); }
&.warning { --banner-accent-color: var(--warning); }
&.error {
--banner-accent-color: var(--error);
}
&.github {
--banner-accent-color: var(--brand-github);
}
&.npm {
--banner-accent-color: var(--brand-npm);
}
&.old-post {
--banner-accent-color: var(--gray-dark);
}
&.rss {
--banner-accent-color: var(--brand-rss);
}
&.warning {
--banner-accent-color: var(--warning);
}
border-color: var(--banner-accent-color);
@ -56,4 +68,4 @@
stroke: var(--banner-accent-color);
}
}
}
}

View file

@ -1,5 +1,5 @@
@import url('./tab-buttons.css');
@import url('./text-toggle.css');
@import url("./tab-buttons.css");
@import url("./text-toggle.css");
button,
.button {
@ -22,7 +22,8 @@ button,
color: var(--text-color-inverted);
background-color: var(--accent-color);
appearance: none;
transition: color var(--transition-duration-default) var(--transition-ease-in-out);
transition: color var(--transition-duration-default)
var(--transition-ease-in-out);
}
&:not(.theme-toggle, .active):hover,
@ -32,4 +33,4 @@ button,
background-color: var(--accent-color-hover);
border-color: var(--accent-color-hover);
}
}
}

View file

@ -1,6 +1,6 @@
::placeholder {
color: var(--text-color);
opacity: .5;
opacity: 0.5;
}
input[type="text"],
@ -90,4 +90,4 @@ fieldset {
text-decoration: none;
}
}
}
}

View file

@ -1,5 +1,6 @@
.mastodon-post-wrapper {
& dl, dt {
& dl,
dt {
display: flex;
}
@ -7,11 +8,11 @@
align-items: center;
& dd {
margin-left: var(--spacing-xs);;
margin-left: var(--spacing-xs);
&:not(:last-child) {
margin-right: var(--spacing-lg);
}
}
}
}
}

View file

@ -56,7 +56,7 @@
&::after {
position: absolute;
z-index: 1;
content: '';
content: "";
top: 0;
left: 0;
box-shadow: var(--box-shadow-media);
@ -64,7 +64,8 @@
height: 100%;
border: var(--border-default);
border-radius: var(--border-radius-slight);
transition: border-color var(--transition-duration-default) var(--transition-ease-in-out);
transition: border-color var(--transition-duration-default)
var(--transition-ease-in-out);
}
}
@ -98,4 +99,4 @@
overflow: hidden;
}
}
}
}

View file

@ -144,4 +144,4 @@ menu {
display: none;
}
}
}
}

View file

@ -64,4 +64,4 @@
stroke: var(--accent-color-hover);
}
}
}
}

View file

@ -138,4 +138,4 @@
}
}
}
}
}

View file

@ -22,4 +22,4 @@
cursor: not-allowed;
stroke: var(--gray-medium);
stroke-width: var(--stroke-width-default);
}
}

View file

@ -10,4 +10,4 @@
background-color: var(--accent-color);
border-radius: var(--border-radius-full);
}
}
}

View file

@ -37,4 +37,4 @@ input[id="tracks-recent"] ~ [for="tracks-recent"]:has(+ [for="tracks-chart"]) {
#tracks-chart:not(:checked) ~ [for="tracks-chart"]:hover,
#tracks-chart:not(:checked) ~ [for="tracks-chart"]:active {
color: var(--accent-color-hover);
}
}

View file

@ -12,7 +12,7 @@
&::after {
position: absolute;
z-index: 1;
content: '';
content: "";
box-shadow: var(--box-shadow-text-toggle);
width: 100%;
height: 20%;
@ -24,4 +24,4 @@
& + button[data-toggle-button]:has(+ *) {
margin: 0 0 var(--spacing-base);
}
}
}

View file

@ -20,10 +20,14 @@ theme-toggle {
stroke: var(--accent-color-hover);
}
& > .light svg { stroke: var(--sun); }
& > .dark svg { stroke: var(--moon); }
& > .light svg {
stroke: var(--sun);
}
& > .dark svg {
stroke: var(--moon);
}
& > .light ,
& > .light,
& > .dark {
display: none;
}
@ -47,4 +51,4 @@ theme-toggle {
& .theme-toggle > .dark {
display: inline;
}
}
}

View file

@ -1,6 +1,6 @@
@font-face {
font-family: MonoLisa;
src: url('/assets/fonts/ml.woff2') format('woff2');
src: url("/assets/fonts/ml.woff2") format("woff2");
font-weight: 400;
font-style: normal;
font-display: swap;
@ -8,7 +8,7 @@
@font-face {
font-family: MonoLisa;
src: url('/assets/fonts/mlb.woff2') format('woff2');
src: url("/assets/fonts/mlb.woff2") format("woff2");
font-weight: 700;
font-style: normal;
font-display: swap;
@ -16,7 +16,7 @@
@font-face {
font-family: MonoLisa;
src: url('/assets/fonts/mli.woff2') format('woff2');
src: url("/assets/fonts/mli.woff2") format("woff2");
font-weight: 400;
font-style: italic;
font-display: swap;
@ -24,8 +24,8 @@
@font-face {
font-family: MonoLisa;
src: url('/assets/fonts/mlbi.woff2') format('woff2');
src: url("/assets/fonts/mlbi.woff2") format("woff2");
font-weight: 700;
font-style: italic;
font-display: swap;
}
}

View file

@ -108,11 +108,12 @@
--border-gray: 1px solid var(--gray-light);
/* fonts */
--font-mono: MonoLisa, Menlo, Consolas, Monaco, Liberation Mono, Lucida Console, ui-monospace, monospace;
--font-mono: MonoLisa, Menlo, Consolas, Monaco, Liberation Mono,
Lucida Console, ui-monospace, monospace;
/* text */
--font-size-xs: .7rem;
--font-size-sm: .85rem;
--font-size-xs: 0.7rem;
--font-size-sm: 0.85rem;
--font-size-base: 1rem;
--font-size-lg: 1.15rem;
--font-size-xl: 1.3rem;
@ -127,9 +128,9 @@
--line-height-base: 2;
/* sizing */
--sizing-xs: .25rem;
--sizing-sm: .5rem;
--sizing-md: .75rem;
--sizing-xs: 0.25rem;
--sizing-sm: 0.5rem;
--sizing-md: 0.75rem;
--sizing-lg: 1rem;
--sizing-base: 1.5rem;
--sizing-xl: 1.75rem;

View file

@ -1,43 +1,57 @@
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="3.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:atom="http://www.w3.org/2005/Atom">
<xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:stylesheet version="3.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:atom="http://www.w3.org/2005/Atom">
<xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes" />
<xsl:template match="/">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<title><xsl:value-of select="/rss/channel/title"/></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
<title>
<xsl:value-of select="/rss/channel/title" />
</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
<link rel="stylesheet" href="/assets/styles/index.css" type="text/css" />
</head>
<body class="feed">
<div class="main-wrapper">
<main>
<section class="main-title">
<h1><a href="/feeds" tabindex="0"><xsl:value-of select="/rss/channel/title"/></a></h1>
<h1>
<a href="/feeds" tabindex="0">
<xsl:value-of select="/rss/channel/title" />
</a>
</h1>
</section>
<div class="default-wrapper">
<p><xsl:value-of select="/rss/channel/description"/></p>
<p><strong class="highlight-text">Subscribe by adding the URL below to your feed reader of choice.</strong></p>
<p>
<xsl:value-of select="/rss/channel/description" />
</p>
<p>
<strong class="highlight-text">Subscribe by adding the URL below to your feed reader
of choice.</strong>
</p>
<p>
<pre class="small">
<code><xsl:value-of select="rss/channel/atom:link/@href"/></code>
</pre>
</p>
<p><a href="/feeds">View more of the feeds from my site.</a></p>
<p>
<a href="/feeds">View more of the feeds from my site.</a>
</p>
<hr />
<section>
<xsl:for-each select="/rss/channel/item">
<div class="item">
<p class="date">Published: <xsl:value-of select="pubDate"/></p>
<p class="date">Published: <xsl:value-of select="pubDate" /></p>
<h3>
<a>
<xsl:attribute name="href">
<xsl:value-of select="link"/>
<xsl:value-of select="link" />
</xsl:attribute>
<xsl:value-of select="title"/>
<xsl:value-of select="title" />
</a>
</h3>
<xsl:value-of select="description" disable-output-escaping="yes"/>
<xsl:value-of select="description" disable-output-escaping="yes" />
<xsl:if test="enclosure">
<img src="{enclosure/@url}" alt="{title}" />
</xsl:if>
@ -48,7 +62,10 @@
</main>
<footer>
<hr />
<p>Subscribe by adding <code><xsl:value-of select="rss/channel/atom:link/@href"/></code> to your feed reader of choice.</p>
<p>Subscribe by adding <code>
<xsl:value-of select="rss/channel/atom:link/@href" />
</code> to your
feed reader of choice.</p>
</footer>
</div>
</body>

View file

@ -1,40 +1,40 @@
@layer reset, defaults, base, page, components, plugins;
/* style resets */
@import url('./reset.css') layer(reset);
@import url("./reset.css") layer(reset);
/* core defaults */
@import url('./defaults/fonts.css') layer(defaults);
@import url('./defaults/vars.css') layer(defaults);
@import url("./defaults/fonts.css") layer(defaults);
@import url("./defaults/vars.css") layer(defaults);
/* base styles */
@import url('./base/index.css') layer(base);
/* base styles */
@import url("./base/index.css") layer(base);
/* plugins */
@import url('./plugins/prism.css') layer(plugins);
@import url("./plugins/prism.css") layer(plugins);
/* page styles */
@import url('./pages/about.css') layer(page);
@import url('./pages/books.css') layer(page);
@import url('./pages/blogroll.css') layer(page);
@import url('./pages/contact.css') layer(page);
@import url('./pages/feeds.css') layer(page);
@import url('./pages/links.css') layer(page);
@import url('./pages/music.css') layer(page);
@import url('./pages/articles.css') layer(page);
@import url('./pages/watching.css') layer(page);
@import url('./pages/webrings.css') layer(page);
@import url("./pages/about.css") layer(page);
@import url("./pages/books.css") layer(page);
@import url("./pages/blogroll.css") layer(page);
@import url("./pages/contact.css") layer(page);
@import url("./pages/feeds.css") layer(page);
@import url("./pages/links.css") layer(page);
@import url("./pages/music.css") layer(page);
@import url("./pages/articles.css") layer(page);
@import url("./pages/watching.css") layer(page);
@import url("./pages/webrings.css") layer(page);
/* component styles */
@import url('./components/badge-grid.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/mastodon-post.css') layer(components);
@import url('./components/media-grid.css') layer(components);
@import url('./components/menu.css') layer(components);
@import url('./components/modal.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/theme-toggle.css') layer(components);
@import url("./components/badge-grid.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/mastodon-post.css") layer(components);
@import url("./components/media-grid.css") layer(components);
@import url("./components/menu.css") layer(components);
@import url("./components/modal.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/theme-toggle.css") layer(components);

View file

@ -26,4 +26,4 @@
.about-title {
text-align: center;
}
}

View file

@ -77,4 +77,4 @@ sup.footnote-ref {
sup.footnote-ref a,
.footnote-backref {
text-decoration: none;
}
}

View file

@ -1,3 +1,3 @@
.blog-roll-icons {
display: flex;
}
}

View file

@ -27,7 +27,8 @@
max-width: calc(var(--sizing-3xl) * 4);
height: auto;
aspect-ratio: var(--aspect-ratio-vertical);
transition: border-color var(--transition-duration-default) var(--transition-ease-in-out);
transition: border-color var(--transition-duration-default)
var(--transition-ease-in-out);
}
& a:focus img,
@ -136,4 +137,4 @@
}
}
}
}
}

View file

@ -43,4 +43,4 @@
& h2 {
margin: 0;
}
}
}

View file

@ -44,4 +44,4 @@
& footer {
padding-bottom: var(--spacing-3xl);
}
}
}

View file

@ -13,4 +13,4 @@
border-radius: var(--border-radius-slight);
padding: var(--spacing-xs) var(--spacing-sm);
}
}
}

View file

@ -81,4 +81,4 @@
p.concerts + ul + hr {
display: none;
}
}

View file

@ -45,7 +45,7 @@ a:active > .watching.hero::after {
&::after {
position: absolute;
z-index: 1;
content: '';
content: "";
top: 0;
left: 0;
box-shadow: var(--box-shadow-media);
@ -53,7 +53,8 @@ a:active > .watching.hero::after {
height: 100%;
border: var(--border-default);
border-radius: var(--border-radius-slight);
transition: border-color var(--transition-duration-default) var(--transition-ease-in-out);
transition: border-color var(--transition-duration-default)
var(--transition-ease-in-out);
}
}
@ -98,4 +99,4 @@ a:active > .watching.hero::after {
.icon-link + .poster.grid {
margin-top: var(--spacing-base);
}
}

View file

@ -20,4 +20,4 @@
display: flex;
}
}
}
}

View file

@ -20,7 +20,7 @@ pre {
margin: var(--sizing-xl) 0;
overflow: auto;
& > code {
& > code {
padding: 0;
}
}
@ -108,4 +108,4 @@ pre,
&.bold {
font-weight: var(--font-weight-bold);
}
}
}

View file

@ -1,4 +1,6 @@
*, *::before, *::after {
*,
*::before,
*::after {
box-sizing: border-box;
margin: 0;
}
@ -9,10 +11,19 @@ body {
-webkit-text-size-adjust: none;
}
input, button, textarea, select {
input,
button,
textarea,
select {
font: inherit;
}
p, h1, h2, h3, h4, h5, h6 {
p,
h1,
h2,
h3,
h4,
h5,
h6 {
overflow-wrap: break-word;
}
}

View file

@ -1,3 +1,3 @@
{
"eleventyExcludeFromCollections": true
}
}

View file

@ -1,20 +1,20 @@
import { createClient } from '@supabase/supabase-js'
import { createClient } from "@supabase/supabase-js";
const SUPABASE_URL = process.env.SUPABASE_URL
const SUPABASE_KEY = process.env.SUPABASE_KEY
const supabase = createClient(SUPABASE_URL, SUPABASE_KEY)
const SUPABASE_URL = process.env.SUPABASE_URL;
const SUPABASE_KEY = process.env.SUPABASE_KEY;
const supabase = createClient(SUPABASE_URL, SUPABASE_KEY);
export default async function fetchActivity() {
const { data, error } = await supabase
.from('optimized_all_activity')
.select('feed')
.from("optimized_all_activity")
.select("feed");
if (error) {
console.error('Error fetching activity data:', error)
return []
console.error("Error fetching activity data:", error);
return [];
}
const [{ feed } = {}] = data
const [{ feed } = {}] = data;
return feed?.filter(item => item['feed'] !== null) || []
}
return feed?.filter((item) => item["feed"] !== null) || [];
}

View file

@ -1,43 +1,47 @@
import { createClient } from '@supabase/supabase-js'
import { DateTime } from 'luxon'
import { createClient } from "@supabase/supabase-js";
import { DateTime } from "luxon";
const SUPABASE_URL = process.env.SUPABASE_URL
const SUPABASE_KEY = process.env.SUPABASE_KEY
const supabase = createClient(SUPABASE_URL, SUPABASE_KEY)
const SUPABASE_URL = process.env.SUPABASE_URL;
const SUPABASE_KEY = process.env.SUPABASE_KEY;
const supabase = createClient(SUPABASE_URL, SUPABASE_KEY);
const fetchAlbumReleases = async () => {
const today = DateTime.utc().startOf('day').toSeconds()
const today = DateTime.utc().startOf("day").toSeconds();
const { data, error } = await supabase
.from('optimized_album_releases')
.select('*')
.from("optimized_album_releases")
.select("*");
if (error) {
console.error('Error fetching data:', error)
return []
console.error("Error fetching data:", error);
return [];
}
const all = data.map(album => {
const releaseDate = DateTime.fromSeconds(album['release_timestamp']).toUTC().startOf('day')
const all = data
.map((album) => {
const releaseDate = DateTime.fromSeconds(album["release_timestamp"])
.toUTC()
.startOf("day");
return {
...album,
description: album['artist']['description'],
date: releaseDate.toLocaleString(DateTime.DATE_FULL),
timestamp: releaseDate.toSeconds()
}
}).sort((a, b) => a['timestamp'] - b['timestamp'])
return {
...album,
description: album["artist"]["description"],
date: releaseDate.toLocaleString(DateTime.DATE_FULL),
timestamp: releaseDate.toSeconds(),
};
})
.sort((a, b) => a["timestamp"] - b["timestamp"]);
const upcoming = all.filter(album => album['release_timestamp'] > today)
const upcoming = all.filter((album) => album["release_timestamp"] > today);
return { all, upcoming }
}
return { all, upcoming };
};
export default async function () {
try {
return await fetchAlbumReleases()
return await fetchAlbumReleases();
} catch (error) {
console.error('Error fetching and processing album releases:', error)
return []
console.error("Error fetching and processing album releases:", error);
return [];
}
}
}

View file

@ -1,47 +1,47 @@
import { createClient } from '@supabase/supabase-js'
import { parseCountryField } from '../../config/utilities/index.js'
import { createClient } from "@supabase/supabase-js";
import { parseCountryField } from "../../config/utilities/index.js";
const SUPABASE_URL = process.env.SUPABASE_URL
const SUPABASE_KEY = process.env.SUPABASE_KEY
const supabase = createClient(SUPABASE_URL, SUPABASE_KEY)
const PAGE_SIZE = 1000
const SUPABASE_URL = process.env.SUPABASE_URL;
const SUPABASE_KEY = process.env.SUPABASE_KEY;
const supabase = createClient(SUPABASE_URL, SUPABASE_KEY);
const PAGE_SIZE = 1000;
const fetchAllArtists = async () => {
let artists = []
let rangeStart = 0
let artists = [];
let rangeStart = 0;
while (true) {
const { data, error } = await supabase
.from('optimized_artists')
.select('*')
.range(rangeStart, rangeStart + PAGE_SIZE - 1)
.from("optimized_artists")
.select("*")
.range(rangeStart, rangeStart + PAGE_SIZE - 1);
if (error) {
console.error('Error fetching artists:', error)
break
console.error("Error fetching artists:", error);
break;
}
artists = artists.concat(data)
if (data.length < PAGE_SIZE) break
rangeStart += PAGE_SIZE
artists = artists.concat(data);
if (data.length < PAGE_SIZE) break;
rangeStart += PAGE_SIZE;
}
return artists
}
return artists;
};
const processArtists = (artists) => {
return artists.map(artist => ({
return artists.map((artist) => ({
...artist,
country: parseCountryField(artist['country']),
}))
}
country: parseCountryField(artist["country"]),
}));
};
export default async function () {
try {
const artists = await fetchAllArtists()
return processArtists(artists)
const artists = await fetchAllArtists();
return processArtists(artists);
} catch (error) {
console.error('Error fetching and processing artists data:', error)
return []
console.error("Error fetching and processing artists data:", error);
return [];
}
}
}

View file

@ -1,29 +1,31 @@
import { createClient } from '@supabase/supabase-js'
import { createClient } from "@supabase/supabase-js";
const SUPABASE_URL = process.env.SUPABASE_URL
const SUPABASE_KEY = process.env.SUPABASE_KEY
const supabase = createClient(SUPABASE_URL, SUPABASE_KEY)
const SUPABASE_URL = process.env.SUPABASE_URL;
const SUPABASE_KEY = process.env.SUPABASE_KEY;
const supabase = createClient(SUPABASE_URL, SUPABASE_KEY);
const fetchBlogroll = async () => {
const { data, error } = await supabase
.from('authors')
.select('*')
.eq('blogroll', true)
.order('name', { ascending: true })
.from("authors")
.select("*")
.eq("blogroll", true)
.order("name", { ascending: true });
if (error) {
console.error('Error fetching authors for the blogroll:', error)
return []
console.error("Error fetching authors for the blogroll:", error);
return [];
}
return data.sort((a, b) => a['name'].toLowerCase().localeCompare(b['name'].toLowerCase()))
}
return data.sort((a, b) =>
a["name"].toLowerCase().localeCompare(b["name"].toLowerCase())
);
};
export default async function () {
try {
return await fetchBlogroll()
return await fetchBlogroll();
} catch (error) {
console.error('Error fetching and processing the blogroll:', error)
return []
console.error("Error fetching and processing the blogroll:", error);
return [];
}
}
}

View file

@ -1,60 +1,60 @@
import { createClient } from '@supabase/supabase-js'
import { createClient } from "@supabase/supabase-js";
const SUPABASE_URL = process.env.SUPABASE_URL
const SUPABASE_KEY = process.env.SUPABASE_KEY
const supabase = createClient(SUPABASE_URL, SUPABASE_KEY)
const PAGE_SIZE = 1000
const SUPABASE_URL = process.env.SUPABASE_URL;
const SUPABASE_KEY = process.env.SUPABASE_KEY;
const supabase = createClient(SUPABASE_URL, SUPABASE_KEY);
const PAGE_SIZE = 1000;
const fetchAllBooks = async () => {
let books = []
let rangeStart = 0
let books = [];
let rangeStart = 0;
while (true) {
const { data, error } = await supabase
.from('optimized_books')
.select('*')
.order('date_finished', { ascending: false })
.range(rangeStart, rangeStart + PAGE_SIZE - 1)
.from("optimized_books")
.select("*")
.order("date_finished", { ascending: false })
.range(rangeStart, rangeStart + PAGE_SIZE - 1);
if (error) {
console.error('Error fetching books:', error)
break
console.error("Error fetching books:", error);
break;
}
books = books.concat(data)
if (data.length < PAGE_SIZE) break
rangeStart += PAGE_SIZE
books = books.concat(data);
if (data.length < PAGE_SIZE) break;
rangeStart += PAGE_SIZE;
}
return books
}
return books;
};
const sortBooksByYear = (books) => {
const years = {}
books.forEach(book => {
const year = book['year']
const years = {};
books.forEach((book) => {
const year = book["year"];
if (!years[year]) {
years[year] = { value: year, data: [book] }
years[year] = { value: year, data: [book] };
} else {
years[year]['data'].push(book)
years[year]["data"].push(book);
}
})
return Object.values(years).filter(year => year['value'] > 2017)
}
});
return Object.values(years).filter((year) => year["value"] > 2017);
};
const currentYear = new Date().getFullYear()
const currentYear = new Date().getFullYear();
export default async function () {
const books = await fetchAllBooks()
const sortedByYear = sortBooksByYear(books)
const booksForCurrentYear = sortedByYear.find(
yearGroup => yearGroup.value === currentYear
)?.data || []
const books = await fetchAllBooks();
const sortedByYear = sortBooksByYear(books);
const booksForCurrentYear =
sortedByYear.find((yearGroup) => yearGroup.value === currentYear)?.data ||
[];
return {
all: books,
years: sortedByYear,
currentYear: booksForCurrentYear,
feed: books.filter(book => book['feed'])
}
}
feed: books.filter((book) => book["feed"]),
};
}

View file

@ -1,46 +1,46 @@
import { createClient } from '@supabase/supabase-js'
import { createClient } from "@supabase/supabase-js";
const SUPABASE_URL = process.env.SUPABASE_URL
const SUPABASE_KEY = process.env.SUPABASE_KEY
const supabase = createClient(SUPABASE_URL, SUPABASE_KEY)
const PAGE_SIZE = 1000
const SUPABASE_URL = process.env.SUPABASE_URL;
const SUPABASE_KEY = process.env.SUPABASE_KEY;
const supabase = createClient(SUPABASE_URL, SUPABASE_KEY);
const PAGE_SIZE = 1000;
const fetchAllConcerts = async () => {
let concerts = []
let rangeStart = 0
let concerts = [];
let rangeStart = 0;
while (true) {
const { data, error } = await supabase
.from('optimized_concerts')
.select('*')
.range(rangeStart, rangeStart + PAGE_SIZE - 1)
.from("optimized_concerts")
.select("*")
.range(rangeStart, rangeStart + PAGE_SIZE - 1);
if (error) {
console.error('Error fetching concerts:', error)
break
console.error("Error fetching concerts:", error);
break;
}
concerts = concerts.concat(data)
if (data.length < PAGE_SIZE) break
rangeStart += PAGE_SIZE
concerts = concerts.concat(data);
if (data.length < PAGE_SIZE) break;
rangeStart += PAGE_SIZE;
}
return concerts
}
return concerts;
};
const processConcerts = (concerts) => {
return concerts.map(concert => ({
return concerts.map((concert) => ({
...concert,
artist: concert.artist || { name: concert.artist_name_string, url: null },
}))
}
}));
};
export default async function () {
try {
const concerts = await fetchAllConcerts()
return processConcerts(concerts)
const concerts = await fetchAllConcerts();
return processConcerts(concerts);
} catch (error) {
console.error('Error fetching and processing concerts data:', error)
return []
console.error("Error fetching and processing concerts data:", error);
return [];
}
}
}

View file

@ -1,27 +1,25 @@
import { createClient } from '@supabase/supabase-js'
import { createClient } from "@supabase/supabase-js";
const SUPABASE_URL = process.env.SUPABASE_URL
const SUPABASE_KEY = process.env.SUPABASE_KEY
const supabase = createClient(SUPABASE_URL, SUPABASE_KEY)
const SUPABASE_URL = process.env.SUPABASE_URL;
const SUPABASE_KEY = process.env.SUPABASE_KEY;
const supabase = createClient(SUPABASE_URL, SUPABASE_KEY);
const fetchGenres = async () => {
const { data, error } = await supabase
.from('optimized_genres')
.select('*')
const { data, error } = await supabase.from("optimized_genres").select("*");
if (error) {
console.error('Error fetching genres with artists:', error)
return []
console.error("Error fetching genres with artists:", error);
return [];
}
return data
}
return data;
};
export default async function () {
try {
return await fetchGenres()
return await fetchGenres();
} catch (error) {
console.error('Error fetching and processing genres:', error)
return []
console.error("Error fetching and processing genres:", error);
return [];
}
}
}

View file

@ -1,28 +1,28 @@
import { createClient } from '@supabase/supabase-js'
import { createClient } from "@supabase/supabase-js";
const SUPABASE_URL = process.env.SUPABASE_URL
const SUPABASE_KEY = process.env.SUPABASE_KEY
const supabase = createClient(SUPABASE_URL, SUPABASE_KEY)
const SUPABASE_URL = process.env.SUPABASE_URL;
const SUPABASE_KEY = process.env.SUPABASE_KEY;
const supabase = createClient(SUPABASE_URL, SUPABASE_KEY);
const fetchGlobals = async () => {
const { data, error } = await supabase
.from('optimized_globals')
.select('*')
.single()
.from("optimized_globals")
.select("*")
.single();
if (error) {
console.error('Error fetching globals:', error)
return {}
console.error("Error fetching globals:", error);
return {};
}
return data
}
return data;
};
export default async function () {
try {
return await fetchGlobals()
return await fetchGlobals();
} catch (error) {
console.error('Error fetching and processing globals:', error)
return {}
console.error("Error fetching and processing globals:", error);
return {};
}
}
}

View file

@ -1,40 +1,40 @@
import { createClient } from '@supabase/supabase-js'
import { createClient } from "@supabase/supabase-js";
const SUPABASE_URL = process.env.SUPABASE_URL
const SUPABASE_KEY = process.env.SUPABASE_KEY
const supabase = createClient(SUPABASE_URL, SUPABASE_KEY)
const PAGE_SIZE = 1000
const SUPABASE_URL = process.env.SUPABASE_URL;
const SUPABASE_KEY = process.env.SUPABASE_KEY;
const supabase = createClient(SUPABASE_URL, SUPABASE_KEY);
const PAGE_SIZE = 1000;
const fetchAllLinks = async () => {
let links = []
let page = 0
let fetchMore = true
let links = [];
let page = 0;
let fetchMore = true;
while (fetchMore) {
const { data, error } = await supabase
.from('optimized_links')
.select('*')
.range(page * PAGE_SIZE, (page + 1) * PAGE_SIZE - 1)
.from("optimized_links")
.select("*")
.range(page * PAGE_SIZE, (page + 1) * PAGE_SIZE - 1);
if (error) {
console.error('Error fetching links:', error)
return links
console.error("Error fetching links:", error);
return links;
}
if (data.length < PAGE_SIZE) fetchMore = false
if (data.length < PAGE_SIZE) fetchMore = false;
links = links.concat(data)
page++
links = links.concat(data);
page++;
}
return links
}
return links;
};
export default async function () {
try {
return await fetchAllLinks()
return await fetchAllLinks();
} catch (error) {
console.error('Error fetching and processing links:', error)
return []
console.error("Error fetching and processing links:", error);
return [];
}
}
}

View file

@ -1,62 +1,67 @@
import { createClient } from '@supabase/supabase-js'
import { DateTime } from 'luxon'
import { createClient } from "@supabase/supabase-js";
import { DateTime } from "luxon";
const SUPABASE_URL = process.env.SUPABASE_URL
const SUPABASE_KEY = process.env.SUPABASE_KEY
const supabase = createClient(SUPABASE_URL, SUPABASE_KEY)
const PAGE_SIZE = 1000
const SUPABASE_URL = process.env.SUPABASE_URL;
const SUPABASE_KEY = process.env.SUPABASE_KEY;
const supabase = createClient(SUPABASE_URL, SUPABASE_KEY);
const PAGE_SIZE = 1000;
const fetchAllMovies = async () => {
let movies = []
let rangeStart = 0
let movies = [];
let rangeStart = 0;
while (true) {
const { data, error } = await supabase
.from('optimized_movies')
.select('*')
.range(rangeStart, rangeStart + PAGE_SIZE - 1)
.from("optimized_movies")
.select("*")
.range(rangeStart, rangeStart + PAGE_SIZE - 1);
if (error) {
console.error('Error fetching movies:', error)
break
console.error("Error fetching movies:", error);
break;
}
movies = movies.concat(data)
movies = movies.concat(data);
if (data.length < PAGE_SIZE) break
rangeStart += PAGE_SIZE
if (data.length < PAGE_SIZE) break;
rangeStart += PAGE_SIZE;
}
return movies
}
return movies;
};
export default async function () {
const year = DateTime.now().year
const year = DateTime.now().year;
try {
const movies = await fetchAllMovies()
const favoriteMovies = movies.filter(movie => movie['favorite'])
const movies = await fetchAllMovies();
const favoriteMovies = movies.filter((movie) => movie["favorite"]);
const now = DateTime.now();
const recentlyWatchedMovies = movies.filter(movie => {
const lastWatched = movie['last_watched']
return (lastWatched && now.diff(DateTime.fromISO(lastWatched), 'months').months <= 6)
})
const recentlyWatchedMovies = movies.filter((movie) => {
const lastWatched = movie["last_watched"];
return (
lastWatched &&
now.diff(DateTime.fromISO(lastWatched), "months").months <= 6
);
});
return {
movies,
watchHistory: movies.filter(movie => movie['last_watched']),
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: [],
};
}
}
}

View file

@ -1,35 +1,35 @@
import { createClient } from '@supabase/supabase-js'
import { createClient } from "@supabase/supabase-js";
const SUPABASE_URL = process.env.SUPABASE_URL
const SUPABASE_KEY = process.env.SUPABASE_KEY
const supabase = createClient(SUPABASE_URL, SUPABASE_KEY)
const PAGE_SIZE = 1000
const SUPABASE_URL = process.env.SUPABASE_URL;
const SUPABASE_KEY = process.env.SUPABASE_KEY;
const supabase = createClient(SUPABASE_URL, SUPABASE_KEY);
const PAGE_SIZE = 1000;
const fetchDataFromView = async (viewName) => {
let rows = []
let rangeStart = 0
let rows = [];
let rangeStart = 0;
while (true) {
const { data, error } = await supabase
.from(viewName)
.select('*')
.range(rangeStart, rangeStart + PAGE_SIZE - 1)
.select("*")
.range(rangeStart, rangeStart + PAGE_SIZE - 1);
if (error) {
console.error(`Error fetching data from view ${viewName}:`, error)
break
console.error(`Error fetching data from view ${viewName}:`, error);
break;
}
if (data.length === 0) break
if (data.length === 0) break;
rows = [...rows, ...data]
rows = [...rows, ...data];
if (data.length < PAGE_SIZE) break
rangeStart += PAGE_SIZE
if (data.length < PAGE_SIZE) break;
rangeStart += PAGE_SIZE;
}
return rows
}
return rows;
};
export default async function fetchMusicData() {
try {
@ -44,16 +44,16 @@ export default async function fetchMusicData() {
monthAlbums,
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 {
recent: recentTracks,
@ -64,7 +64,7 @@ export default async function fetchMusicData() {
genres: weekGenres,
totalTracks: weekTracks
.reduce((acc, track) => acc + track.plays, 0)
.toLocaleString('en-US'),
.toLocaleString("en-US"),
},
month: {
tracks: monthTracks,
@ -73,11 +73,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)
return {}
console.error("Error fetching and processing music data:", error);
return {};
}
}
}

View file

@ -1,48 +1,48 @@
import { createClient } from '@supabase/supabase-js'
import { createClient } from "@supabase/supabase-js";
const SUPABASE_URL = process.env.SUPABASE_URL
const SUPABASE_KEY = process.env.SUPABASE_KEY
const supabase = createClient(SUPABASE_URL, SUPABASE_KEY)
const SUPABASE_URL = process.env.SUPABASE_URL;
const SUPABASE_KEY = process.env.SUPABASE_KEY;
const supabase = createClient(SUPABASE_URL, SUPABASE_KEY);
const fetchAllNavigation = async () => {
const { data, error } = await supabase
.from('optimized_navigation')
.select('*')
.from("optimized_navigation")
.select("*");
if (error) {
console.error('Error fetching navigation data:', error)
return {}
console.error("Error fetching navigation data:", error);
return {};
}
const menu = data.reduce((acc, item) => {
const menuItem = {
title: item['title'] || item['page_title'],
permalink: item['permalink'] || item ['page_permalink'],
icon: item['icon'],
sort: item['sort']
}
title: item["title"] || item["page_title"],
permalink: item["permalink"] || item["page_permalink"],
icon: item["icon"],
sort: item["sort"],
};
if (!acc[item['menu_location']]) {
acc[item['menu_location']] = [menuItem]
if (!acc[item["menu_location"]]) {
acc[item["menu_location"]] = [menuItem];
} else {
acc[item['menu_location']].push(menuItem)
acc[item["menu_location"]].push(menuItem);
}
return acc
}, {})
return acc;
}, {});
Object.keys(menu).forEach(location => {
menu[location].sort((a, b) => a['sort'] - b['sort'])
})
Object.keys(menu).forEach((location) => {
menu[location].sort((a, b) => a["sort"] - b["sort"]);
});
return menu
}
return menu;
};
export default async function () {
try {
return await fetchAllNavigation()
return await fetchAllNavigation();
} catch (error) {
console.error('Error fetching and processing navigation data:', error)
return {}
console.error("Error fetching and processing navigation data:", error);
return {};
}
}
}

View file

@ -1,33 +1,35 @@
import { createClient } from '@supabase/supabase-js'
import { createClient } from "@supabase/supabase-js";
const SUPABASE_URL = process.env.SUPABASE_URL
const SUPABASE_KEY = process.env.SUPABASE_KEY
const supabase = createClient(SUPABASE_URL, SUPABASE_KEY)
const SUPABASE_URL = process.env.SUPABASE_URL;
const SUPABASE_KEY = process.env.SUPABASE_KEY;
const supabase = createClient(SUPABASE_URL, SUPABASE_KEY);
const fetchNowPlaying = async () => {
const { data, error } = await supabase
.from('optimized_latest_listen')
.select('*')
.single()
.from("optimized_latest_listen")
.select("*")
.single();
if (error) {
console.error('Error fetching the latest track:', error)
return {}
console.error("Error fetching the latest track:", error);
return {};
}
const genreEmoji = data.genre_emoji
const emoji = data.artist_emoji || genreEmoji
const genreEmoji = data.genre_emoji;
const emoji = data.artist_emoji || genreEmoji;
return {
content: `${emoji || '🎧'} ${data.track_name} by <a href="https://coryd.dev${data.url}">${data.artist_name}</a>`,
}
}
content: `${emoji || "🎧"} ${
data.track_name
} by <a href="https://coryd.dev${data.url}">${data.artist_name}</a>`,
};
};
export default async function () {
try {
return await fetchNowPlaying()
return await fetchNowPlaying();
} catch (error) {
console.error('Error fetching and processing now-playing data:', error)
return {}
console.error("Error fetching and processing now-playing data:", error);
return {};
}
}
}

View file

@ -1,40 +1,40 @@
import { createClient } from '@supabase/supabase-js'
import { createClient } from "@supabase/supabase-js";
const SUPABASE_URL = process.env['SUPABASE_URL']
const SUPABASE_KEY = process.env['SUPABASE_KEY']
const supabase = createClient(SUPABASE_URL, SUPABASE_KEY)
const PAGE_SIZE = 250
const SUPABASE_URL = process.env["SUPABASE_URL"];
const SUPABASE_KEY = process.env["SUPABASE_KEY"];
const supabase = createClient(SUPABASE_URL, SUPABASE_KEY);
const PAGE_SIZE = 250;
const fetchAllPages = async () => {
let pages = []
let page = 0
let fetchMore = true
let pages = [];
let page = 0;
let fetchMore = true;
while (fetchMore) {
const { data, error } = await supabase
.from('optimized_pages')
.select('*')
.range(page * PAGE_SIZE, (page + 1) * PAGE_SIZE - 1)
.from("optimized_pages")
.select("*")
.range(page * PAGE_SIZE, (page + 1) * PAGE_SIZE - 1);
if (error) {
console.error('Error fetching pages:', error)
return pages
console.error("Error fetching pages:", error);
return pages;
}
if (data.length < PAGE_SIZE) fetchMore = false
if (data.length < PAGE_SIZE) fetchMore = false;
pages = pages.concat(data)
page++
pages = pages.concat(data);
page++;
}
return pages
}
return pages;
};
export default async function () {
try {
return await fetchAllPages()
return await fetchAllPages();
} catch (error) {
console.error('Error fetching and processing pages:', error)
return []
console.error("Error fetching and processing pages:", error);
return [];
}
}
}

View file

@ -1,41 +1,41 @@
import { createClient } from '@supabase/supabase-js'
import { createClient } from "@supabase/supabase-js";
const SUPABASE_URL = process.env['SUPABASE_URL']
const SUPABASE_KEY = process.env['SUPABASE_KEY']
const supabase = createClient(SUPABASE_URL, SUPABASE_KEY)
const PAGE_SIZE = 1000
const SUPABASE_URL = process.env["SUPABASE_URL"];
const SUPABASE_KEY = process.env["SUPABASE_KEY"];
const supabase = createClient(SUPABASE_URL, SUPABASE_KEY);
const PAGE_SIZE = 1000;
const fetchAllPosts = async () => {
let posts = []
let page = 0
let fetchMore = true
let posts = [];
let page = 0;
let fetchMore = true;
while (fetchMore) {
const { data, error } = await supabase
.from('optimized_posts')
.select('*')
.order('date', { ascending: false })
.range(page * PAGE_SIZE, (page + 1) * PAGE_SIZE - 1)
.from("optimized_posts")
.select("*")
.order("date", { ascending: false })
.range(page * PAGE_SIZE, (page + 1) * PAGE_SIZE - 1);
if (error) {
console.error('Error fetching posts:', error)
return posts
console.error("Error fetching posts:", error);
return posts;
}
if (data.length < PAGE_SIZE) fetchMore = false
if (data.length < PAGE_SIZE) fetchMore = false;
posts = posts.concat(data)
page++
posts = posts.concat(data);
page++;
}
return posts
}
return posts;
};
export default async function () {
try {
return await fetchAllPosts()
return await fetchAllPosts();
} catch (error) {
console.error('Error fetching and processing posts:', error)
return []
console.error("Error fetching and processing posts:", error);
return [];
}
}
}

View file

@ -1,38 +1,40 @@
import { createClient } from '@supabase/supabase-js'
import { createClient } from "@supabase/supabase-js";
const SUPABASE_URL = process.env.SUPABASE_URL
const SUPABASE_KEY = process.env.SUPABASE_KEY
const supabase = createClient(SUPABASE_URL, SUPABASE_KEY)
const PAGE_SIZE = 500
const SUPABASE_URL = process.env.SUPABASE_URL;
const SUPABASE_KEY = process.env.SUPABASE_KEY;
const supabase = createClient(SUPABASE_URL, SUPABASE_KEY);
const PAGE_SIZE = 500;
const fetchAllRobots = async () => {
let robots = []
let from = 0
let robots = [];
let from = 0;
while (true) {
const { data, error } = await supabase
.from('robots')
.select('user_agent')
.range(from, from + PAGE_SIZE - 1)
.from("robots")
.select("user_agent")
.range(from, from + PAGE_SIZE - 1);
if (error) {
console.error('Error fetching robot data:', error)
return []
console.error("Error fetching robot data:", error);
return [];
}
robots = robots.concat(data)
if (data.length < PAGE_SIZE) break
from += PAGE_SIZE
robots = robots.concat(data);
if (data.length < PAGE_SIZE) break;
from += PAGE_SIZE;
}
return robots.map(robot => robot['user_agent']).sort((a, b) => a.toLowerCase().localeCompare(b.toLowerCase()))
}
return robots
.map((robot) => robot["user_agent"])
.sort((a, b) => a.toLowerCase().localeCompare(b.toLowerCase()));
};
export default async function () {
try {
return await fetchAllRobots()
return await fetchAllRobots();
} catch (error) {
console.error('Error fetching and processing robot data:', error)
return []
console.error("Error fetching and processing robot data:", error);
return [];
}
}
}

View file

@ -1,20 +1,20 @@
import { createClient } from '@supabase/supabase-js'
import { createClient } from "@supabase/supabase-js";
const SUPABASE_URL = process.env.SUPABASE_URL
const SUPABASE_KEY = process.env.SUPABASE_KEY
const supabase = createClient(SUPABASE_URL, SUPABASE_KEY)
const SUPABASE_URL = process.env.SUPABASE_URL;
const SUPABASE_KEY = process.env.SUPABASE_KEY;
const supabase = createClient(SUPABASE_URL, SUPABASE_KEY);
export default async function fetchSyndication() {
const { data, error } = await supabase
.from('optimized_syndication')
.select('syndication')
.from("optimized_syndication")
.select("syndication");
if (error) {
console.error('Error fetching search index data:', error)
return []
console.error("Error fetching search index data:", error);
return [];
}
const [{ syndication } = {}] = data
const [{ syndication } = {}] = data;
return syndication?.filter(item => item['syndication'] !== null) || []
}
return syndication?.filter((item) => item["syndication"] !== null) || [];
}

View file

@ -1,61 +1,65 @@
import { createClient } from '@supabase/supabase-js'
import { createClient } from "@supabase/supabase-js";
const SUPABASE_URL = process.env.SUPABASE_URL
const SUPABASE_KEY = process.env.SUPABASE_KEY
const supabase = createClient(SUPABASE_URL, SUPABASE_KEY)
const PAGE_SIZE = 1000
const SUPABASE_URL = process.env.SUPABASE_URL;
const SUPABASE_KEY = process.env.SUPABASE_KEY;
const supabase = createClient(SUPABASE_URL, SUPABASE_KEY);
const PAGE_SIZE = 1000;
const fetchAllShows = async () => {
let shows = []
let rangeStart = 0
let shows = [];
let rangeStart = 0;
while (true) {
const { data, error } = await supabase
.from('optimized_shows')
.select('*')
.range(rangeStart, rangeStart + PAGE_SIZE - 1)
.from("optimized_shows")
.select("*")
.range(rangeStart, rangeStart + PAGE_SIZE - 1);
if (error) {
console.error('Error fetching shows:', error)
break
console.error("Error fetching shows:", error);
break;
}
shows = shows.concat(data)
if (data.length < PAGE_SIZE) break
rangeStart += PAGE_SIZE
shows = shows.concat(data);
if (data.length < PAGE_SIZE) break;
rangeStart += PAGE_SIZE;
}
return shows
}
return shows;
};
export default async function () {
try {
const shows = await fetchAllShows()
const watchedShows = shows.filter(show => show['last_watched_at'] !== null)
const episodes = watchedShows.map(show => ({
title: show['episode']['title'],
year: show['year'],
formatted_episode: show['episode']['formatted_episode'],
url: show['episode']['url'],
image: show['episode']['image'],
backdrop: show['episode']['backdrop'],
last_watched_at: show['episode']['last_watched_at'],
grid: show['grid'],
type: 'tv'
}))
const shows = await fetchAllShows();
const watchedShows = shows.filter(
(show) => show["last_watched_at"] !== null
);
const episodes = watchedShows.map((show) => ({
title: show["episode"]["title"],
year: show["year"],
formatted_episode: show["episode"]["formatted_episode"],
url: show["episode"]["url"],
image: show["episode"]["image"],
backdrop: show["episode"]["backdrop"],
last_watched_at: show["episode"]["last_watched_at"],
grid: show["grid"],
type: "tv",
}));
return {
shows,
recentlyWatched: episodes.slice(0, 125),
favorites: shows.filter(show => show.favorite).sort((a, b) => a.title.localeCompare(b.title)),
}
favorites: shows
.filter((show) => show.favorite)
.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: [],
}
};
}
}
}