Fix calendar fetch on homepage
This commit is contained in:
parent
1a2c873658
commit
7101d583cc
18
.editorconfig
Normal file
18
.editorconfig
Normal file
@ -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
|
@ -2,7 +2,7 @@
|
|||||||
# Since that normally requires the API key, which you normally don't want to expose to the public.
|
# Since that normally requires the API key, which you normally don't want to expose to the public.
|
||||||
|
|
||||||
location /sonarr-ics {
|
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-Real-IP $remote_addr;
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
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-Real-IP $remote_addr;
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
proxy_set_header X-Forwarded-Proto $scheme;
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
}
|
}
|
||||||
|
@ -123,7 +123,7 @@ function keyHandlers(calendar)
|
|||||||
case 'ArrowLeft':
|
case 'ArrowLeft':
|
||||||
calendar.prev();
|
calendar.prev();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'ArrowRight':
|
case 'ArrowRight':
|
||||||
calendar.next();
|
calendar.next();
|
||||||
break;
|
break;
|
||||||
@ -181,20 +181,17 @@ async function loadSonarrCalendar(shouldForce = false)
|
|||||||
const calendarElement = document.querySelector('#sonarr-calendar');
|
const calendarElement = document.querySelector('#sonarr-calendar');
|
||||||
let events = [];
|
let events = [];
|
||||||
|
|
||||||
|
let promises = [];
|
||||||
for (const list of icsUrls)
|
for (const list of icsUrls)
|
||||||
{
|
{
|
||||||
try {
|
const { url, name } = list;
|
||||||
const { url, name } = list;
|
promises.push(fetchIcs(url, name, shouldForce));
|
||||||
let fetched = await fetchIcs(url, name, shouldForce);
|
|
||||||
fetched = fetched.filter(x => x !== null);
|
|
||||||
|
|
||||||
events = [...events, ...fetched];
|
|
||||||
}
|
|
||||||
catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
events = await Promise.all(promises);
|
||||||
|
events = events.flat();
|
||||||
|
events = events.filter(x => x !== null);
|
||||||
|
|
||||||
const calendar = new FullCalendar.Calendar(calendarElement, {
|
const calendar = new FullCalendar.Calendar(calendarElement, {
|
||||||
// initialView: 'dayGridMonth',
|
// initialView: 'dayGridMonth',
|
||||||
customButtons: {
|
customButtons: {
|
||||||
@ -220,7 +217,7 @@ async function loadSonarrCalendar(shouldForce = false)
|
|||||||
const message = document.querySelector('#status-message');
|
const message = document.querySelector('#status-message');
|
||||||
try {
|
try {
|
||||||
calendar.render();
|
calendar.render();
|
||||||
|
|
||||||
if (message) {
|
if (message) {
|
||||||
message.textContent = '';
|
message.textContent = '';
|
||||||
}
|
}
|
||||||
@ -244,4 +241,4 @@ window.addEventListener('DOMContentLoaded', function() {
|
|||||||
},
|
},
|
||||||
60 * 1000
|
60 * 1000
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user