mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-10-11 07:06:19 +00:00
- removes the external unmaintained `module-alias` dependency -> reducing complexity and risk - introduces a small internal alias mechanism for `logger` and `node_helper` - preserves backward compatibility for existing 3rd‑party modules - should simplify a future ESM migration of MagicMirror I'm confident that it shouldn't cause any problems, but we could also consider including it in the release after next. What do you think? This PR is inspired by PR #2934 - so thanks to @thesebas! 🙇 😃
43 lines
1.3 KiB
JavaScript
43 lines
1.3 KiB
JavaScript
/*
|
|
* CalendarFetcher Tester
|
|
* use this script with `node debug.js` to test the fetcher without the need
|
|
* of starting the MagicMirror² core. Adjust the values below to your desire.
|
|
*/
|
|
// Load internal alias resolver
|
|
require("../../../js/alias-resolver");
|
|
const Log = require("logger");
|
|
|
|
const CalendarFetcher = require("./calendarfetcher");
|
|
|
|
const url = "https://calendar.google.com/calendar/ical/pkm1t2uedjbp0uvq1o7oj1jouo%40group.calendar.google.com/private-08ba559f89eec70dd74bbd887d0a3598/basic.ics"; // Standard test URL
|
|
//const url = "https://www.googleapis.com/calendar/v3/calendars/primary/events/"; // URL for Bearer auth (must be configured in Google OAuth2 first)
|
|
const fetchInterval = 60 * 60 * 1000;
|
|
const maximumEntries = 10;
|
|
const maximumNumberOfDays = 365;
|
|
const user = "magicmirror";
|
|
const pass = "MyStrongPass";
|
|
const auth = {
|
|
user: user,
|
|
pass: pass
|
|
};
|
|
|
|
Log.log("Create fetcher ...");
|
|
|
|
const fetcher = new CalendarFetcher(url, fetchInterval, [], maximumEntries, maximumNumberOfDays, auth);
|
|
|
|
fetcher.onReceive(function (fetcher) {
|
|
Log.log(fetcher.events());
|
|
Log.log("------------------------------------------------------------");
|
|
process.exit(0);
|
|
});
|
|
|
|
fetcher.onError(function (fetcher, error) {
|
|
Log.log("Fetcher error:");
|
|
Log.log(error);
|
|
process.exit(1);
|
|
});
|
|
|
|
fetcher.startFetch();
|
|
|
|
Log.log("Create fetcher done! ");
|