fix(profile) zaimki.pl/@:username throwing "500 Error Cannot access uninitialized variable." on safari

also, clean up old "namedays" PoC, we haven't implemented it for ages, and if we do, it's better to configure in the db (`names` table)
This commit is contained in:
Andrea Vos 2025-08-12 09:18:44 +02:00
parent e7be07fae6
commit e54eb9bb51
35 changed files with 12 additions and 45 deletions

View File

@ -1 +0,0 @@
{}

View File

@ -1 +0,0 @@
{}

View File

@ -1 +0,0 @@
{}

View File

@ -1 +0,0 @@
{}

View File

@ -1 +0,0 @@
{}

View File

@ -1 +0,0 @@
{}

View File

@ -1 +0,0 @@
{}

View File

@ -1 +0,0 @@
{}

View File

@ -1 +0,0 @@
{}

View File

@ -1 +0,0 @@
{}

View File

@ -1 +0,0 @@
{}

View File

@ -1 +0,0 @@
{}

View File

@ -1 +0,0 @@
{}

View File

@ -1 +0,0 @@
{}

View File

@ -1 +0,0 @@
{}

View File

@ -1 +0,0 @@
{}

View File

@ -1 +0,0 @@
{}

View File

@ -1 +0,0 @@
{}

View File

@ -1 +0,0 @@
{}

View File

@ -1 +0,0 @@
{}

View File

@ -1 +0,0 @@
{}

View File

@ -1 +0,0 @@
{}

View File

@ -1 +0,0 @@
{ "Andrea": ["04-30"] }

View File

@ -1 +0,0 @@
{}

View File

@ -1 +0,0 @@
{}

View File

@ -1 +0,0 @@
{}

View File

@ -1 +0,0 @@
{}

View File

@ -1 +0,0 @@
{}

View File

@ -1 +0,0 @@
{}

View File

@ -1 +0,0 @@
{}

View File

@ -1 +0,0 @@
{}

View File

@ -1 +0,0 @@
{}

View File

@ -1 +0,0 @@
{}

View File

@ -4,7 +4,7 @@ import type { Event } from '~/src/calendar/helpers.ts';
export const buildCalendar = (localEvents: Event[], baseUrl: string) => {
return new Calendar(
[...internationalEvents, ...localEvents], // TODO , ...namedays
[...internationalEvents, ...localEvents],
baseUrl,
2021,
2025,

View File

@ -121,14 +121,14 @@ export const loadNameCount = async () => {
export const loadCalendar = async () => {
const locale = getLocale();
const baseUrl = getUrlForLocale(locale);
const localEvents = (await import(`~/locale/${locale}/calendar/events.ts`)).default;
/* const rawNamedays = (await import(`~/locale/${config.locale}/names/namedays.json`)).default;
const namedays = Object.entries(rawNamedays as Record<string, string[]>)
.flatMap(([name, namedays]) => {
return namedays.map((nameday) => {
const [m, d] = nameday.split('-');
return new Event(`nameday$${name}`, null, parseInt(m), day(parseInt(d)), EventLevel.Nameday);
});
}); */
return buildCalendar(localEvents, baseUrl);
};
try {
const localEvents = (await import(`~/locale/${locale}/calendar/events.ts`)).default;
return buildCalendar(localEvents, baseUrl);
} catch (error) {
// quickfix: not sure why that would happen (events.ts always exists, with at least `export default []`),
// but apparently on Safari on Polish version (only?) we can get "500 Error Cannot access uninitialized variable."
// returning [] still loads events correctly (via a separate request?)
return buildCalendar([], baseUrl);
}
};