diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..8f0de65 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,18 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +indent_size = 4 +indent_style = space +insert_final_newline = true +trim_trailing_whitespace = true + +[*.md] +trim_trailing_whitespace = false + +[*.{yml,yaml}] +indent_size = 2 + +[docker-compose.yml] +indent_size = 4 diff --git a/nginx-location.conf b/nginx-location.conf index 00d7560..68e2e3b 100644 --- a/nginx-location.conf +++ b/nginx-location.conf @@ -2,7 +2,7 @@ # Since that normally requires the API key, which you normally don't want to expose to the public. location /sonarr-ics { - proxy_pass "https://sonarr.example.com/feed/calendar/Sonarr.ics?apikey=YOUR_API_KEY_HERE"; + proxy_pass "https://sonarr.example.com/feed/v3/calendar/Sonarr.ics?apikey=YOUR_API_KEY_HERE"; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; @@ -15,4 +15,4 @@ location /sonarr-series { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; -} \ No newline at end of file +} diff --git a/public/calendar.js b/public/calendar.js index d7c339b..fb80da1 100644 --- a/public/calendar.js +++ b/public/calendar.js @@ -123,7 +123,7 @@ function keyHandlers(calendar) case 'ArrowLeft': calendar.prev(); break; - + case 'ArrowRight': calendar.next(); break; @@ -181,20 +181,17 @@ async function loadSonarrCalendar(shouldForce = false) const calendarElement = document.querySelector('#sonarr-calendar'); let events = []; + let promises = []; for (const list of icsUrls) { - try { - const { url, name } = list; - let fetched = await fetchIcs(url, name, shouldForce); - fetched = fetched.filter(x => x !== null); - - events = [...events, ...fetched]; - } - catch (err) { - console.error(err); - } + const { url, name } = list; + promises.push(fetchIcs(url, name, shouldForce)); } + events = await Promise.all(promises); + events = events.flat(); + events = events.filter(x => x !== null); + const calendar = new FullCalendar.Calendar(calendarElement, { // initialView: 'dayGridMonth', customButtons: { @@ -220,7 +217,7 @@ async function loadSonarrCalendar(shouldForce = false) const message = document.querySelector('#status-message'); try { calendar.render(); - + if (message) { message.textContent = ''; } @@ -244,4 +241,4 @@ window.addEventListener('DOMContentLoaded', function() { }, 60 * 1000 ); -}); \ No newline at end of file +});