mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-27 11:50:00 +00:00
Added proper User-Agent string to Facebook calendar call, and various fixed spelling of 'exist'.
This commit is contained in:
parent
8d1ef5291f
commit
486956b762
@ -152,7 +152,7 @@ var Module = Class.extend({
|
||||
},
|
||||
|
||||
/* socket()
|
||||
* Returns a socket object. If it doesn"t exsist, it"s created.
|
||||
* Returns a socket object. If it doesn"t exist, it"s created.
|
||||
* It also registers the notification callback.
|
||||
*/
|
||||
socket: function() {
|
||||
|
@ -298,7 +298,7 @@ If no translation is found, a fallback will be used. The fallback sequence is as
|
||||
- 4. Translation as defined in core translation file of the fallback language (the first defined core translation file).
|
||||
- 5. The key (identifier) of the translation.
|
||||
|
||||
When adding translations to your module, it's a good idea to see if an apropriate translation is already available in the [core translation files](https://github.com/MichMich/MagicMirror/tree/master/translations). This way, your module can benefit from the exsisting translations.
|
||||
When adding translations to your module, it's a good idea to see if an apropriate translation is already available in the [core translation files](https://github.com/MichMich/MagicMirror/tree/master/translations). This way, your module can benefit from the existing translations.
|
||||
|
||||
**Example:**
|
||||
````javascript
|
||||
|
@ -49,7 +49,7 @@ Module.register("calendar",{
|
||||
getTranslations: function() {
|
||||
// The translations for the defaut modules are defined in the core translation files.
|
||||
// Therefor we can just return false. Otherwise we should have returned a dictionairy.
|
||||
// If you're trying to build yiur own module including translations, check out the documentation.
|
||||
// If you're trying to build your own module including translations, check out the documentation.
|
||||
return false;
|
||||
},
|
||||
|
||||
|
@ -25,7 +25,12 @@ var CalendarFetcher = function(url, reloadInterval, maximumEntries, maximumNumbe
|
||||
clearTimeout(reloadTimer);
|
||||
reloadTimer = null;
|
||||
|
||||
ical.fromURL(url, {}, function(err, data) {
|
||||
var opts = {
|
||||
headers: {
|
||||
'User-Agent': 'Mozilla/5.0 (Node.js 6.0.0) MagicMirror/v2 (https://github.com/MichMich/MagicMirror/)'
|
||||
}
|
||||
}
|
||||
ical.fromURL(url, opts, function(err, data) {
|
||||
if (err) {
|
||||
fetchFailedCallback(self, err);
|
||||
scheduleTimer();
|
||||
@ -188,7 +193,7 @@ var CalendarFetcher = function(url, reloadInterval, maximumEntries, maximumNumbe
|
||||
};
|
||||
|
||||
/* broadcastItems()
|
||||
* Broadcast the exsisting events.
|
||||
* Broadcast the existing events.
|
||||
*/
|
||||
this.broadcastEvents = function() {
|
||||
//console.log('Broadcasting ' + events.length + ' events.');
|
||||
|
@ -30,8 +30,8 @@ module.exports = NodeHelper.create({
|
||||
},
|
||||
|
||||
/* createFetcher(url, reloadInterval)
|
||||
* Creates a fetcher for a new url if it doesn't exsist yet.
|
||||
* Otherwise it reuses the exsisting one.
|
||||
* Creates a fetcher for a new url if it doesn't exist yet.
|
||||
* Otherwise it reuses the existing one.
|
||||
*
|
||||
* attribute url string - URL of the news feed.
|
||||
* attribute reloadInterval number - Reload interval in milliseconds.
|
||||
@ -69,7 +69,7 @@ module.exports = NodeHelper.create({
|
||||
|
||||
self.fetchers[url] = fetcher;
|
||||
} else {
|
||||
//console.log('Use exsisting news fetcher for url: ' + url);
|
||||
//console.log('Use existing news fetcher for url: ' + url);
|
||||
fetcher = self.fetchers[url];
|
||||
fetcher.broadcastEvents();
|
||||
}
|
||||
|
@ -117,7 +117,7 @@ var Fetcher = function(url, reloadInterval, encoding) {
|
||||
};
|
||||
|
||||
/* broadcastItems()
|
||||
* Broadcast the exsisting items.
|
||||
* Broadcast the existing items.
|
||||
*/
|
||||
this.broadcastItems = function() {
|
||||
if (items.length <= 0) {
|
||||
|
@ -25,8 +25,8 @@ module.exports = NodeHelper.create({
|
||||
},
|
||||
|
||||
/* createFetcher(url, reloadInterval)
|
||||
* Creates a fetcher for a new url if it doesn't exsist yet.
|
||||
* Otherwise it reoses the exsisting one.
|
||||
* Creates a fetcher for a new url if it doesn't exist yet.
|
||||
* Otherwise it reoses the existing one.
|
||||
*
|
||||
* attribute url string - URL of the news feed.
|
||||
* attribute reloadInterval number - Reload interval in milliseconds.
|
||||
@ -62,7 +62,7 @@ module.exports = NodeHelper.create({
|
||||
|
||||
self.fetchers[url] = fetcher;
|
||||
} else {
|
||||
console.log("Use exsisting news fetcher for url: " + url);
|
||||
console.log("Use existing news fetcher for url: " + url);
|
||||
fetcher = self.fetchers[url];
|
||||
fetcher.setReloadInterval(reloadInterval);
|
||||
fetcher.broadcastItems();
|
||||
|
Loading…
x
Reference in New Issue
Block a user