mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-27 11:50:00 +00:00
commit
8a101f9e9a
@ -1,72 +0,0 @@
|
||||
# Various Node ignoramuses.
|
||||
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
pids
|
||||
*.pid
|
||||
*.seed
|
||||
lib-cov
|
||||
coverage
|
||||
.grunt
|
||||
.lock-wscript
|
||||
build/Release
|
||||
node_modules
|
||||
jspm_modules
|
||||
.npm
|
||||
.node_repl_history
|
||||
|
||||
# Various Windows ignoramuses.
|
||||
Thumbs.db
|
||||
ehthumbs.db
|
||||
Desktop.ini
|
||||
$RECYCLE.BIN/
|
||||
*.cab
|
||||
*.msi
|
||||
*.msm
|
||||
*.msp
|
||||
*.lnk
|
||||
|
||||
# Various OSX ignoramuses.
|
||||
.DS_Store
|
||||
.AppleDouble
|
||||
.LSOverride
|
||||
Icon
|
||||
._*
|
||||
.DocumentRevisions-V100
|
||||
.fseventsd
|
||||
.Spotlight-V100
|
||||
.TemporaryItems
|
||||
.Trashes
|
||||
.VolumeIcon.icns
|
||||
.AppleDB
|
||||
.AppleDesktop
|
||||
Network Trash Folder
|
||||
Temporary Items
|
||||
.apdisk
|
||||
|
||||
# Various Linux ignoramuses.
|
||||
|
||||
.fuse_hidden*
|
||||
.directory
|
||||
.Trash-*
|
||||
|
||||
# Various Magic Mirror ignoramuses and anti-ignoramuses.
|
||||
|
||||
# Don't ignore the node_helper core module.
|
||||
!/modules/node_helper
|
||||
!/modules/node_helper/**
|
||||
|
||||
# Ignore all modules except the default modules.
|
||||
/modules/**
|
||||
!/modules/default/**
|
||||
|
||||
# Ignore changes to the custom css files.
|
||||
/css/custom.css
|
||||
|
||||
# Ignore unnecessary files for docker
|
||||
CHANGELOG.md
|
||||
LICENSE.md
|
||||
README.md
|
||||
Gruntfile.js
|
||||
.*
|
10
.gitignore
vendored
10
.gitignore
vendored
@ -65,3 +65,13 @@ Temporary Items
|
||||
|
||||
# Ignore changes to the custom css files.
|
||||
/css/custom.css
|
||||
|
||||
# Vim
|
||||
## swap
|
||||
[._]*.s[a-w][a-z]
|
||||
[._]s[a-w][a-z]
|
||||
|
||||
## diff patch
|
||||
*.orig
|
||||
*.rej
|
||||
*.bak
|
||||
|
@ -10,7 +10,7 @@ before_script:
|
||||
- sleep 5
|
||||
script:
|
||||
- grunt
|
||||
- npm test
|
||||
- npm run test:unit
|
||||
cache:
|
||||
directories:
|
||||
- node_modules
|
||||
|
38
CHANGELOG.md
38
CHANGELOG.md
@ -2,6 +2,44 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
This project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
## [2.1.2] - 2017-07-01
|
||||
|
||||
### Changed
|
||||
- Revert Docker related changes in favor of [docker-MagicMirror](https://github.com/bastilimbach/docker-MagicMirror). All Docker images are outsourced. ([#856](https://github.com/MichMich/MagicMirror/pull/856))
|
||||
- Change Docker base image (Debian + Node) to an arm based distro (AlpineARM + Node) ([#846](https://github.com/MichMich/MagicMirror/pull/846))
|
||||
- Fix the dockerfile to have it running from the first time.
|
||||
|
||||
### Added
|
||||
- Add in option to wrap long calendar events to multiple lines using `wrapEvents` configuration option.
|
||||
- Add test e2e `show title newsfeed` for newsfeed module.
|
||||
- Add task to check configuration file.
|
||||
- Add test check URLs of vendors.
|
||||
- Add test of match current week number on clock module with showWeek configuration.
|
||||
- Add test default modules present modules/default/defaultmodules.js.
|
||||
- Add unit test calendar_modules function capFirst.
|
||||
- Add test for check if exists the directories present in defaults modules.
|
||||
- Add support for showing wind direction as an arrow instead of abbreviation in currentWeather module.
|
||||
- Add support for writing translation fucntions to support flexible word order
|
||||
- Add test for check if exits the directories present in defaults modules.
|
||||
- Add calendar option to set a separate date format for full day events.
|
||||
- Add ability for `currentweather` module to display indoor temperature via INDOOR_TEMPERATURE notification
|
||||
- Add ability to change the path of the `custom.css`.
|
||||
- Add translation Dutch to Alert module.
|
||||
- Added Romanian translation.
|
||||
|
||||
### Updated
|
||||
- Added missing keys to Polish translation.
|
||||
- Added missing key to German translation.
|
||||
- Added better translation with flexible word order to Finnish translation
|
||||
|
||||
### Fixed
|
||||
- Fix instruction in README for using automatically installer script.
|
||||
- Bug of duplicated compliments as described in [here](https://forum.magicmirror.builders/topic/2381/compliments-module-stops-cycling-compliments).
|
||||
- Fix double message about port when server is starting
|
||||
- Corrected Swedish translations for TODAY/TOMORROW/DAYAFTERTOMORROW.
|
||||
- Removed unused import from js/electron.js
|
||||
- Made calendar.js respect config.timeFormat irrespecive of locale setting
|
||||
- Fixed alignment of analog clock when a large calendar is displayed in the same side bar
|
||||
|
||||
## [2.1.1] - 2017-04-01
|
||||
|
||||
|
19
Dockerfile
19
Dockerfile
@ -1,19 +0,0 @@
|
||||
FROM node:latest
|
||||
|
||||
RUN apt-get update && apt-get -y install dos2unix
|
||||
|
||||
WORKDIR /opt/magic_mirror
|
||||
COPY . .
|
||||
COPY /modules unmount_modules
|
||||
COPY /config unmount_config
|
||||
|
||||
ENV NODE_ENV production
|
||||
ENV MM_PORT 8080
|
||||
|
||||
RUN npm install
|
||||
|
||||
RUN ["dos2unix", "docker-entrypoint.sh"]
|
||||
RUN ["chmod", "+x", "docker-entrypoint.sh"]
|
||||
|
||||
EXPOSE $MM_PORT
|
||||
ENTRYPOINT ["/opt/magic_mirror/docker-entrypoint.sh"]
|
51
Gruntfile.js
51
Gruntfile.js
@ -6,12 +6,20 @@ module.exports = function(grunt) {
|
||||
options: {
|
||||
configFile: ".eslintrc.json"
|
||||
},
|
||||
target: ["js/*.js", "modules/default/*.js", "modules/default/*/*.js",
|
||||
"serveronly/*.js", "*.js", "tests/*/*.js", "!modules/default/alert/notificationFx.js",
|
||||
"!modules/default/alert/modernizr.custom.js", "!modules/default/alert/classie.js",
|
||||
target: [
|
||||
"js/*.js",
|
||||
"modules/default/*.js",
|
||||
"modules/default/*/*.js",
|
||||
"serveronly/*.js",
|
||||
"*.js",
|
||||
"tests/**/*.js",
|
||||
"!modules/default/alert/notificationFx.js",
|
||||
"!modules/default/alert/modernizr.custom.js",
|
||||
"!modules/default/alert/classie.js",
|
||||
"config/*",
|
||||
"translations/translations.js", "vendor/vendor.js"
|
||||
|
||||
"translations/translations.js",
|
||||
"vendor/vendor.js",
|
||||
"modules/node_modules/node_helper/index.js"
|
||||
]
|
||||
},
|
||||
stylelint: {
|
||||
@ -19,14 +27,26 @@ module.exports = function(grunt) {
|
||||
options: {
|
||||
configFile: ".stylelintrc"
|
||||
},
|
||||
src: ["css/main.css", "modules/default/calendar/calendar.css", "modules/default/clock/clock_styles.css", "modules/default/currentweather/currentweather.css", "modules/default/weatherforcast/weatherforcast.css"]
|
||||
src: [
|
||||
"css/main.css",
|
||||
"modules/default/calendar/calendar.css",
|
||||
"modules/default/clock/clock_styles.css",
|
||||
"modules/default/currentweather/currentweather.css",
|
||||
"modules/default/weatherforcast/weatherforcast.css"
|
||||
]
|
||||
}
|
||||
},
|
||||
jsonlint: {
|
||||
main: {
|
||||
src: ["package.json", ".eslintrc.json", ".stylelintrc", "translations/*.json",
|
||||
"modules/default/*/translations/*.json", "installers/pm2_MagicMirror.json",
|
||||
"vendor/package.js"],
|
||||
src: [
|
||||
"package.json",
|
||||
".eslintrc.json",
|
||||
".stylelintrc",
|
||||
"translations/*.json",
|
||||
"modules/default/*/translations/*.json",
|
||||
"installers/pm2_MagicMirror.json",
|
||||
"vendor/package.js"
|
||||
],
|
||||
options: {
|
||||
reporter: "jshint"
|
||||
}
|
||||
@ -58,11 +78,20 @@ module.exports = function(grunt) {
|
||||
"MD038": false
|
||||
}
|
||||
},
|
||||
src: ["README.md", "CHANGELOG.md", "LICENSE.md", "modules/README.md", "modules/default/**/*.md", "!modules/default/calendar/vendor/ical.js/readme.md"]
|
||||
src: [
|
||||
"README.md",
|
||||
"CHANGELOG.md",
|
||||
"LICENSE.md",
|
||||
"modules/README.md",
|
||||
"modules/default/**/*.md",
|
||||
"!modules/default/calendar/vendor/ical.js/readme.md"
|
||||
]
|
||||
}
|
||||
},
|
||||
yamllint: {
|
||||
all: [".travis.yml"]
|
||||
all: [
|
||||
".travis.yml"
|
||||
]
|
||||
}
|
||||
});
|
||||
grunt.loadNpmTasks("grunt-eslint");
|
||||
|
11
README.md
11
README.md
@ -59,7 +59,7 @@ docker run -d \
|
||||
--volume ~/magic_mirror/config:/opt/magic_mirror/config \
|
||||
--volume ~/magic_mirror/modules:/opt/magic_mirror/modules \
|
||||
--name magic_mirror \
|
||||
MichMich/MagicMirror
|
||||
bastilimbach/docker-magicmirror
|
||||
```
|
||||
|
||||
| **Volumes** | **Description** |
|
||||
@ -75,6 +75,8 @@ var config = {
|
||||
};
|
||||
```
|
||||
|
||||
If you want to run the server on a raspberry pi, use the `raspberry` tag. (bastilimbach/docker-magicmirror:raspberry)
|
||||
|
||||
#### Manual
|
||||
|
||||
1. Download and install the latest Node.js version.
|
||||
@ -104,6 +106,11 @@ Type `git status` to see your changes, if there are any, you can reset them with
|
||||
1. Duplicate `config/config.js.sample` to `config/config.js`. **Note:** If you used the installer script. This step is already done for you.
|
||||
2. Modify your required settings.
|
||||
|
||||
Note: You'll can check your configuration running the follow command:
|
||||
```bash
|
||||
npm run config:check
|
||||
```
|
||||
|
||||
The following properties can be configured:
|
||||
|
||||
| **Option** | **Description** |
|
||||
@ -117,7 +124,7 @@ The following properties can be configured:
|
||||
| `units` | The units that will be used in the default weather modules. Possible values are `metric` or `imperial`. The default is `metric`. |
|
||||
| `modules` | An array of active modules. **The array must contain objects. See the next table below for more information.** |
|
||||
| `electronOptions` | An optional array of Electron (browser) options. This allows configuration of e.g. the browser screen size and position (example: `electronOptions: { fullscreen: false, width: 800, height: 600 }`). Kiosk mode can be enabled by setting `kiosk = true`, `autoHideMenuBar = false` and `fullscreen = false`. More options can be found [here](https://github.com/electron/electron/blob/master/docs/api/browser-window.md). |
|
||||
|
||||
| `customCss` | The path of the `custom.css` stylesheet. The default is `css/custom.css`. |
|
||||
|
||||
Module configuration:
|
||||
|
||||
|
@ -2,11 +2,19 @@
|
||||
*
|
||||
* By Michael Teeuw http://michaelteeuw.nl
|
||||
* MIT Licensed.
|
||||
*
|
||||
* For more information how you can configurate this file
|
||||
* See https://github.com/MichMich/MagicMirror#configuration
|
||||
*
|
||||
*/
|
||||
|
||||
var config = {
|
||||
port: 8080,
|
||||
ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"], // Set [] to allow all IP addresses.
|
||||
ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"], // Set [] to allow all IP addresses
|
||||
// or add a specific IPv4 of 192.168.1.5 :
|
||||
// ["127.0.0.1", "::ffff:127.0.0.1", "::1", "::ffff:192.168.1.5"],
|
||||
// or IPv4 range of 192.168.3.0 --> 192.168.3.15 use CIDR format :
|
||||
// ["127.0.0.1", "::ffff:127.0.0.1", "::1", "::ffff:192.168.3.0/28"],
|
||||
|
||||
language: "en",
|
||||
timeFormat: 24,
|
||||
|
@ -1,11 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ ! -f /opt/magic_mirror/modules ]; then
|
||||
cp -R /opt/magic_mirror/unmount_modules/. /opt/magic_mirror/modules
|
||||
fi
|
||||
|
||||
if [ ! -f /opt/magic_mirror/config ]; then
|
||||
cp -R /opt/magic_mirror/unmount_config/. /opt/magic_mirror/config
|
||||
fi
|
||||
|
||||
node serveronly
|
@ -65,7 +65,7 @@ if command_exists node; then
|
||||
fi
|
||||
|
||||
else
|
||||
echo -e "\e[92mNo Node.js upgrade nessecery.\e[0m"
|
||||
echo -e "\e[92mNo Node.js upgrade necessary.\e[0m"
|
||||
fi
|
||||
|
||||
else
|
||||
@ -150,8 +150,7 @@ fi
|
||||
|
||||
# Use pm2 control like a service MagicMirror
|
||||
read -p "Do you want use pm2 for auto starting of your MagicMirror (y/n)?" choice
|
||||
if [[ $choice =~ ^[Yy]$ ]]
|
||||
then
|
||||
if [[ $choice =~ ^[Yy]$ ]]; then
|
||||
sudo npm install -g pm2
|
||||
sudo su -c "env PATH=$PATH:/usr/bin pm2 startup linux -u pi --hp /home/pi"
|
||||
pm2 start ~/MagicMirror/installers/pm2_MagicMirror.json
|
||||
|
@ -21,6 +21,7 @@ var defaults = {
|
||||
timeFormat: 24,
|
||||
units: "metric",
|
||||
zoom: 1,
|
||||
customCss: "css/custom.css",
|
||||
|
||||
modules: [
|
||||
{
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
"use strict";
|
||||
|
||||
const Server = require(__dirname + "/server.js");
|
||||
const electron = require("electron");
|
||||
const core = require(__dirname + "/app.js");
|
||||
|
||||
@ -30,7 +29,7 @@ function createWindow() {
|
||||
zoomFactor: config.zoom
|
||||
},
|
||||
backgroundColor: "#000000"
|
||||
}
|
||||
};
|
||||
|
||||
// DEPRECATED: "kioskmode" backwards compatibility, to be removed
|
||||
// settings these options directly instead provides cleaner interface
|
||||
@ -51,7 +50,7 @@ function createWindow() {
|
||||
mainWindow.loadURL("http://localhost:" + config.port);
|
||||
|
||||
// Open the DevTools if run with "npm start dev"
|
||||
if(process.argv[2] == "dev") {
|
||||
if (process.argv.includes("dev")) {
|
||||
mainWindow.webContents.openDevTools();
|
||||
}
|
||||
|
||||
|
@ -32,10 +32,10 @@ var Loader = (function() {
|
||||
});
|
||||
} else {
|
||||
// All modules loaded. Load custom.css
|
||||
// This is done after all the moduels so we can
|
||||
// overwrite all the defined styls.
|
||||
// This is done after all the modules so we can
|
||||
// overwrite all the defined styles.
|
||||
|
||||
loadFile("css/custom.css", function() {
|
||||
loadFile(config.customCss, function() {
|
||||
// custom.css loaded. Start all modules.
|
||||
startModules();
|
||||
});
|
||||
|
@ -165,8 +165,6 @@ var MM = (function() {
|
||||
if( headerWrapper.length > 0 && newHeader) {
|
||||
headerWrapper[0].innerHTML = newHeader;
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
/* hideModule(module, speed, callback)
|
||||
@ -219,7 +217,7 @@ var MM = (function() {
|
||||
|
||||
// remove lockString if set in options.
|
||||
if (options.lockString) {
|
||||
var index = module.lockStrings.indexOf(options.lockString)
|
||||
var index = module.lockStrings.indexOf(options.lockString);
|
||||
if ( index !== -1) {
|
||||
module.lockStrings.splice(index, 1);
|
||||
}
|
||||
|
16
js/module.js
16
js/module.js
@ -272,14 +272,18 @@ var Module = Class.extend({
|
||||
}
|
||||
},
|
||||
|
||||
/* translate(key, defaultValue)
|
||||
* Request the translation for a given key.
|
||||
/* translate(key, defaultValueOrVariables, defaultValue)
|
||||
* Request the translation for a given key with optional variables and default value.
|
||||
*
|
||||
* argument key string - The key of the string to translage
|
||||
* argument defaultValue string - The default value if no translation was found. (Optional)
|
||||
* argument key string - The key of the string to translate
|
||||
* argument defaultValueOrVariables string/object - The default value or variables for translating. (Optional)
|
||||
* argument defaultValue string - The default value with variables. (Optional)
|
||||
*/
|
||||
translate: function (key, defaultValue) {
|
||||
return Translator.translate(this, key) || defaultValue || "";
|
||||
translate: function (key, defaultValueOrVariables, defaultValue) {
|
||||
if(typeof defaultValueOrVariables === "object") {
|
||||
return Translator.translate(this, key, defaultValueOrVariables) || defaultValue || "";
|
||||
}
|
||||
return Translator.translate(this, key) || defaultValueOrVariables || "";
|
||||
},
|
||||
|
||||
/* updateDom(speed)
|
||||
|
@ -15,14 +15,13 @@ var fs = require("fs");
|
||||
var helmet = require("helmet");
|
||||
|
||||
var Server = function(config, callback) {
|
||||
console.log("Starting server on port " + config.port + " ... ");
|
||||
|
||||
var port = config.port;
|
||||
if (process.env.MM_PORT) {
|
||||
port = process.env.MM_PORT;
|
||||
}
|
||||
|
||||
console.log("Starting server op port " + port + " ... ");
|
||||
console.log("Starting server on port " + port + " ... ");
|
||||
|
||||
server.listen(port, config.address ? config.address : null);
|
||||
|
||||
@ -44,7 +43,7 @@ var Server = function(config, callback) {
|
||||
app.use("/js", express.static(__dirname));
|
||||
var directories = ["/config", "/css", "/fonts", "/modules", "/vendor", "/translations", "/tests/configs"];
|
||||
var directory;
|
||||
for (i in directories) {
|
||||
for (var i in directories) {
|
||||
directory = directories[i];
|
||||
app.use(directory, express.static(path.resolve(global.root_path + directory)));
|
||||
}
|
||||
|
@ -22,7 +22,6 @@ var MMSocket = function(moduleName) {
|
||||
// register catch all.
|
||||
self.socket.on("*", function(notification, payload) {
|
||||
if (notification !== "*") {
|
||||
//console.log('Received notification: ' + notification +', payload: ' + payload);
|
||||
notificationCallback(notification, payload);
|
||||
}
|
||||
});
|
||||
|
@ -111,32 +111,47 @@ var Translator = (function() {
|
||||
translations: {},
|
||||
translationsFallback: {},
|
||||
|
||||
/* translate(module, key)
|
||||
/* translate(module, key, variables)
|
||||
* Load a translation for a given key for a given module.
|
||||
*
|
||||
* argument module Module - The module to load the translation for.
|
||||
* argument key string - The key of the text to translate.
|
||||
* argument variables - The variables to use within the translation template (optional)
|
||||
*/
|
||||
translate: function(module, key) {
|
||||
translate: function(module, key, variables) {
|
||||
variables = variables || {}; //Empty object by default
|
||||
|
||||
// Combines template and variables like:
|
||||
// template: "Please wait for {timeToWait} before continuing with {work}."
|
||||
// variables: {timeToWait: "2 hours", work: "painting"}
|
||||
// to: "Please wait for 2 hours before continuing with painting."
|
||||
function createStringFromTemplate(template, variables) {
|
||||
if(variables.fallback && !template.match(new RegExp("\{.+\}"))) {
|
||||
template = variables.fallback;
|
||||
}
|
||||
return template.replace(new RegExp("\{([^\}]+)\}", "g"), function(_unused, varName){
|
||||
return variables[varName] || "{"+varName+"}";
|
||||
});
|
||||
}
|
||||
|
||||
if(this.translations[module.name] && key in this.translations[module.name]) {
|
||||
// Log.log("Got translation for " + key + " from module translation: ");
|
||||
return this.translations[module.name][key];
|
||||
return createStringFromTemplate(this.translations[module.name][key], variables);
|
||||
}
|
||||
|
||||
if (key in this.coreTranslations) {
|
||||
// Log.log("Got translation for " + key + " from core translation.");
|
||||
return this.coreTranslations[key];
|
||||
return createStringFromTemplate(this.coreTranslations[key], variables);
|
||||
}
|
||||
|
||||
if (this.translationsFallback[module.name] && key in this.translationsFallback[module.name]) {
|
||||
// Log.log("Got translation for " + key + " from module translation fallback.");
|
||||
return this.translationsFallback[module.name][key];
|
||||
return createStringFromTemplate(this.translationsFallback[module.name][key], variables);
|
||||
}
|
||||
|
||||
if (key in this.coreTranslationsFallback) {
|
||||
// Log.log("Got translation for " + key + " from core translation fallback.");
|
||||
return this.coreTranslationsFallback[key];
|
||||
return createStringFromTemplate(this.coreTranslationsFallback[key], variables);
|
||||
}
|
||||
|
||||
return key;
|
||||
|
@ -11,7 +11,8 @@ var colors = require("colors/safe");
|
||||
var Utils = {
|
||||
colors: {
|
||||
warn: colors.yellow,
|
||||
error: colors.red
|
||||
error: colors.red,
|
||||
info: colors.blue
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -44,27 +44,27 @@ As you can see, the `Module.register()` method takes two arguments: the name of
|
||||
### Available module instance properties
|
||||
After the module is initialized, the module instance has a few available module properties:
|
||||
|
||||
####`this.name`
|
||||
#### `this.name`
|
||||
**String**
|
||||
|
||||
The name of the module.
|
||||
|
||||
####`this.identifier`
|
||||
#### `this.identifier`
|
||||
**String**
|
||||
|
||||
This is a unique identifier for the module instance.
|
||||
|
||||
####`this.hidden`
|
||||
#### `this.hidden`
|
||||
**Boolean**
|
||||
|
||||
This represents if the module is currently hidden (faded away).
|
||||
|
||||
####`this.config`
|
||||
#### `this.config`
|
||||
**Boolean**
|
||||
|
||||
The configuration of the module instance as set in the user's config.js file. This config will also contain the module's defaults if these properties are not over written by the user config.
|
||||
|
||||
####`this.data`
|
||||
#### `this.data`
|
||||
**Object**
|
||||
|
||||
The data object contains additional metadata about the module instance:
|
||||
@ -75,10 +75,10 @@ The data object contains additional metadata about the module instance:
|
||||
- `data.position` - The position in which the instance will be shown.
|
||||
|
||||
|
||||
####`defaults: {}`
|
||||
#### `defaults: {}`
|
||||
Any properties defined in the defaults object, will be merged with the module config as defined in the user's config.js file. This is the best place to set your modules's configuration defaults. Any of the module configuration properties can be accessed using `this.config.propertyName`, but more about that later.
|
||||
|
||||
####'requiresVersion:'
|
||||
#### `requiresVersion:`
|
||||
|
||||
*Introduced in version: 2.1.0.*
|
||||
|
||||
@ -93,10 +93,10 @@ requiresVersion: "2.1.0",
|
||||
|
||||
### Subclassable module methods
|
||||
|
||||
####`init()`
|
||||
#### `init()`
|
||||
This method is called when a module gets instantiated. In most cases you do not need to subclass this method.
|
||||
|
||||
####`loaded(callback)`
|
||||
#### `loaded(callback)`
|
||||
|
||||
*Introduced in version: 2.1.1.*
|
||||
|
||||
@ -111,7 +111,7 @@ loaded: function(callback) {
|
||||
}
|
||||
````
|
||||
|
||||
####`start()`
|
||||
#### `start()`
|
||||
This method is called when all modules are loaded an the system is ready to boot up. Keep in mind that the dom object for the module is not yet created. The start method is a perfect place to define any additional module properties:
|
||||
|
||||
**Example:**
|
||||
@ -122,7 +122,7 @@ start: function() {
|
||||
}
|
||||
````
|
||||
|
||||
####`getScripts()`
|
||||
#### `getScripts()`
|
||||
**Should return: Array**
|
||||
|
||||
The getScripts method is called to request any additional scripts that need to be loaded. This method should therefore return an array with strings. If you want to return a full path to a file in the module folder, use the `this.file('filename.js')` method. In all cases the loader will only load a file once. It even checks if the file is available in the default vendor folder.
|
||||
@ -142,7 +142,7 @@ getScripts: function() {
|
||||
**Note:** If a file can not be loaded, the boot up of the mirror will stall. Therefore it's advised not to use any external urls.
|
||||
|
||||
|
||||
####`getStyles()`
|
||||
#### `getStyles()`
|
||||
**Should return: Array**
|
||||
|
||||
The getStyles method is called to request any additional stylesheets that need to be loaded. This method should therefore return an array with strings. If you want to return a full path to a file in the module folder, use the `this.file('filename.css')` method. In all cases the loader will only load a file once. It even checks if the file is available in the default vendor folder.
|
||||
@ -161,7 +161,7 @@ getStyles: function() {
|
||||
````
|
||||
**Note:** If a file can not be loaded, the boot up of the mirror will stall. Therefore it's advised not to use any external urls.
|
||||
|
||||
####`getTranslations()`
|
||||
#### `getTranslations()`
|
||||
**Should return: Dictionary**
|
||||
|
||||
The getTranslations method is called to request translation files that need to be loaded. This method should therefore return a dictionary with the files to load, identified by the country's short name.
|
||||
@ -179,7 +179,7 @@ getTranslations: function() {
|
||||
|
||||
````
|
||||
|
||||
####`getDom()`
|
||||
#### `getDom()`
|
||||
**Should return:** Dom Object
|
||||
|
||||
Whenever the MagicMirror needs to update the information on screen (because it starts, or because your module asked a refresh using `this.updateDom()`), the system calls the getDom method. This method should therefore return a dom object.
|
||||
@ -194,7 +194,7 @@ getDom: function() {
|
||||
|
||||
````
|
||||
|
||||
####`getHeader()`
|
||||
#### `getHeader()`
|
||||
**Should return:** String
|
||||
|
||||
Whenever the MagicMirror needs to update the information on screen (because it starts, or because your module asked a refresh using `this.updateDom()`), the system calls the getHeader method to retrieve the module's header. This method should therefor return a string. If this method is not subclassed, this function will return the user's configured header.
|
||||
@ -211,7 +211,7 @@ getHeader: function() {
|
||||
|
||||
````
|
||||
|
||||
####`notificationReceived(notification, payload, sender)`
|
||||
#### `notificationReceived(notification, payload, sender)`
|
||||
|
||||
That MagicMirror core has the ability to send notifications to modules. Or even better: the modules have the possibility to send notifications to other modules. When this module is called, it has 3 arguments:
|
||||
|
||||
@ -237,7 +237,7 @@ notificationReceived: function(notification, payload, sender) {
|
||||
- `DOM_OBJECTS_CREATED` - All dom objects are created. The system is now ready to perform visual changes.
|
||||
|
||||
|
||||
####`socketNotificationReceived: function(notification, payload)`
|
||||
#### `socketNotificationReceived: function(notification, payload)`
|
||||
When using a node_helper, the node helper can send your module notifications. When this module is called, it has 2 arguments:
|
||||
|
||||
- `notification` - String - The notification identifier.
|
||||
@ -253,11 +253,11 @@ socketNotificationReceived: function(notification, payload) {
|
||||
},
|
||||
````
|
||||
|
||||
####`suspend()`
|
||||
#### `suspend()`
|
||||
When a module is hidden (using the `module.hide()` method), the `suspend()` method will be called. By subclassing this method you can perform tasks like halting the update timers.
|
||||
|
||||
####`resume()`
|
||||
When a module will be shown after it was previously hidden (using the `module.show()` method), the `resume()` method will be called. By subclassing this method you can perform tasks restarting the update timers.
|
||||
#### `resume()`
|
||||
When a module is requested to be shown (using the `module.show()` method), the `resume()` method will be called. By subclassing this method you can perform tasks restarting the update timers.
|
||||
|
||||
|
||||
### Module instance methods
|
||||
@ -265,13 +265,13 @@ When a module will be shown after it was previously hidden (using the `module.sh
|
||||
Each module instance has some handy methods which can be helpful building your module.
|
||||
|
||||
|
||||
####`this.file(filename)`
|
||||
#### `this.file(filename)`
|
||||
***filename* String** - The name of the file you want to create the path for.<br>
|
||||
**Returns String**
|
||||
|
||||
If you want to create a path to a file in your module folder, use the `file()` method. It returns the path to the filename given as the attribute. Is method comes in handy when configuring the [getScripts](#getscripts) and [getStyles](#getstyles) methods.
|
||||
|
||||
####`this.updateDom(speed)`
|
||||
#### `this.updateDom(speed)`
|
||||
***speed* Number** - Optional. Animation speed in milliseconds.<br>
|
||||
|
||||
Whenever your module need to be updated, call the `updateDom(speed)` method. It requests the MagicMirror core to update its dom object. If you define the speed, the content update will be animated, but only if the content will really change.
|
||||
@ -289,7 +289,7 @@ start: function() {
|
||||
...
|
||||
````
|
||||
|
||||
####`this.sendNotification(notification, payload)`
|
||||
#### `this.sendNotification(notification, payload)`
|
||||
***notification* String** - The notification identifier.<br>
|
||||
***payload* AnyType** - Optional. A notification payload.<br>
|
||||
|
||||
@ -300,7 +300,7 @@ If you want to send a notification to all other modules, use the `sendNotificati
|
||||
this.sendNotification('MYMODULE_READY_FOR_ACTION', {foo:bar});
|
||||
````
|
||||
|
||||
####`this.sendSocketNotification(notification, payload)`
|
||||
#### `this.sendSocketNotification(notification, payload)`
|
||||
***notification* String** - The notification identifier.<br>
|
||||
***payload* AnyType** - Optional. A notification payload.<br>
|
||||
|
||||
@ -311,7 +311,7 @@ If you want to send a notification to the node_helper, use the `sendSocketNotifi
|
||||
this.sendSocketNotification('SET_CONFIG', this.config);
|
||||
````
|
||||
|
||||
####`this.hide(speed, callback, options)`
|
||||
#### `this.hide(speed, callback, options)`
|
||||
***speed* Number** - Optional (Required when setting callback or options), The speed of the hide animation in milliseconds.
|
||||
***callback* Function** - Optional, The callback after the hide animation is finished.
|
||||
***options* Function** - Optional, Object with additional options for the hide action (see below). (*Introduced in version: 2.1.0.*)
|
||||
@ -328,7 +328,7 @@ Possible configurable options:
|
||||
**Note 3:** If the dom is not yet created, the hide method won't work. Wait for the `DOM_OBJECTS_CREATED` [notification](#notificationreceivednotification-payload-sender).
|
||||
|
||||
|
||||
####`this.show(speed, callback, options)`
|
||||
#### `this.show(speed, callback, options)`
|
||||
***speed* Number** - Optional (Required when setting callback or options), The speed of the show animation in milliseconds.
|
||||
***callback* Function** - Optional, The callback after the show animation is finished.
|
||||
***options* Function** - Optional, Object with additional options for the show action (see below). (*Introduced in version: 2.1.0.*)
|
||||
@ -344,7 +344,7 @@ Possible configurable options:
|
||||
**Note 2:** If the show animation is hijacked (an other method calls show on the same module), the callback will not be called.<br>
|
||||
**Note 3:** If the dom is not yet created, the show method won't work. Wait for the `DOM_OBJECTS_CREATED` [notification](#notificationreceivednotification-payload-sender).
|
||||
|
||||
####Visibility locking
|
||||
#### Visibility locking
|
||||
|
||||
(*Introduced in version: 2.1.0.*)
|
||||
|
||||
@ -401,7 +401,7 @@ Use this `force` method with caution. See `show()` method for more information.
|
||||
|
||||
|
||||
|
||||
####`this.translate(identifier)`
|
||||
#### `this.translate(identifier)`
|
||||
***identifier* String** - Identifier of the string that should be translated.
|
||||
|
||||
The Magic Mirror contains a convenience wrapper for `l18n`. You can use this to automatically serve different translations for your modules based on the user's `language` configuration.
|
||||
@ -429,6 +429,51 @@ this.translate("INFO") //Will return a translated string for the identifier INFO
|
||||
|
||||
**Note:** although comments are officially not supported in JSON files, MagicMirror allows it by stripping the comments before parsing the JSON file. Comments in translation files could help other translators.
|
||||
|
||||
##### `this.translate(identifier, variables)`
|
||||
***identifier* String** - Identifier of the string that should be translated.
|
||||
***variables* Object** - Object of variables to be used in translation.
|
||||
|
||||
This improved and backwards compatible way to handle translations behaves like the normal translation function and follows the rules described above. It's recommended to use this new format for translating everywhere. It allows translator to change the word order in the sentence to be translated.
|
||||
|
||||
|
||||
**Example:**
|
||||
````javascript
|
||||
var timeUntilEnd = moment(event.endDate, "x").fromNow(true);
|
||||
this.translate("RUNNING", { "timeUntilEnd": timeUntilEnd) }); // Will return a translated string for the identifier RUNNING, replacing `{timeUntilEnd}` with the contents of the variable `timeUntilEnd` in the order that translator intended.
|
||||
````
|
||||
|
||||
**Example English .json file:**
|
||||
````javascript
|
||||
{
|
||||
"RUNNING": "Ends in {timeUntilEnd}",
|
||||
}
|
||||
````
|
||||
|
||||
**Example Finnish .json file:**
|
||||
````javascript
|
||||
{
|
||||
"RUNNING": "Päättyy {timeUntilEnd} päästä",
|
||||
}
|
||||
````
|
||||
|
||||
**Note:** The *variables* Object has an special case called `fallback`. It's used to support old translations in translation files that do not have the variables in them. If you are upgrading an old module that had translations that did not support the word order, it is recommended to have the fallback layout.
|
||||
|
||||
**Example:**
|
||||
````javascript
|
||||
var timeUntilEnd = moment(event.endDate, "x").fromNow(true);
|
||||
this.translate("RUNNING", {
|
||||
"fallback": this.translate("RUNNING") + " {timeUntilEnd}"
|
||||
"timeUntilEnd": timeUntilEnd
|
||||
)}); // Will return a translated string for the identifier RUNNING, replacing `{timeUntilEnd}` with the contents of the variable `timeUntilEnd` in the order that translator intended. (has a fallback)
|
||||
````
|
||||
|
||||
**Example swedish .json file that does not have the variable in it:**
|
||||
````javascript
|
||||
{
|
||||
"RUNNING": "Slutar",
|
||||
}
|
||||
|
||||
In this case the `translate`-function will not find any variables in the translation, will look for `fallback` variable and use that if possible to create the translation.
|
||||
|
||||
## The Node Helper: node_helper.js
|
||||
|
||||
@ -447,17 +492,17 @@ Of course, the above helper would not do anything useful. So with the informatio
|
||||
|
||||
### Available module instance properties
|
||||
|
||||
####`this.name`
|
||||
#### `this.name`
|
||||
**String**
|
||||
|
||||
The name of the module
|
||||
|
||||
####`this.path`
|
||||
#### `this.path`
|
||||
**String**
|
||||
|
||||
The path of the module
|
||||
|
||||
####`this.expressApp`
|
||||
#### `this.expressApp`
|
||||
**Express App Instance**
|
||||
|
||||
This is a link to the express instance. It will allow you to define extra routes.
|
||||
@ -476,13 +521,13 @@ start: function() {
|
||||
this.expressApp.use("/" + this.name, express.static(this.path + "/public"));
|
||||
````
|
||||
|
||||
####`this.io`
|
||||
#### `this.io`
|
||||
**Socket IO Instance**
|
||||
|
||||
This is a link to the IO instance. It will allow you to do some Socket.IO magic. In most cases you won't need this, since the Node Helper has a few convenience methods to make this simple.
|
||||
|
||||
|
||||
####'requiresVersion:'
|
||||
#### `requiresVersion:`
|
||||
*Introduced in version: 2.1.0.*
|
||||
|
||||
A string that defines the minimum version of the MagicMirror framework. If it is set, the system compares the required version with the users version. If the version of the user is out of date, it won't run the module.
|
||||
@ -496,10 +541,10 @@ requiresVersion: "2.1.0",
|
||||
|
||||
### Subclassable module methods
|
||||
|
||||
####`init()`
|
||||
#### `init()`
|
||||
This method is called when a node helper gets instantiated. In most cases you do not need to subclass this method.
|
||||
|
||||
####`start()`
|
||||
#### `start()`
|
||||
This method is called when all node helpers are loaded and the system is ready to boot up. The start method is a perfect place to define any additional module properties:
|
||||
|
||||
**Example:**
|
||||
@ -510,7 +555,7 @@ start: function() {
|
||||
}
|
||||
````
|
||||
|
||||
####`socketNotificationReceived: function(notification, payload)`
|
||||
#### `socketNotificationReceived: function(notification, payload)`
|
||||
With this method, your node helper can receive notifications from your modules. When this method is called, it has 2 arguments:
|
||||
|
||||
- `notification` - String - The notification identifier.
|
||||
@ -529,7 +574,7 @@ socketNotificationReceived: function(notification, payload) {
|
||||
|
||||
Each node helper has some handy methods which can be helpful building your module.
|
||||
|
||||
####`this.sendSocketNotification(notification, payload)`
|
||||
#### `this.sendSocketNotification(notification, payload)`
|
||||
***notification* String** - The notification identifier.<br>
|
||||
***payload* AnyType** - Optional. A notification payload.<br>
|
||||
|
||||
@ -549,7 +594,7 @@ The core Magic Mirror object: `MM` has some handy method that will help you in c
|
||||
### Module selection
|
||||
The only additional method available for your module, is the feature to retrieve references to other modules. This can be used to hide and show other modules.
|
||||
|
||||
####`MM.getModules()`
|
||||
#### `MM.getModules()`
|
||||
**Returns Array** - An array with module instances.<br>
|
||||
|
||||
To make a selection of all currently loaded module instances, run the `MM.getModules()` method. It will return an array with all currently loaded module instances. The returned array has a lot of filtering methods. See below for more info.
|
||||
@ -557,7 +602,7 @@ To make a selection of all currently loaded module instances, run the `MM.getMod
|
||||
**Note:** This method returns an empty array if not all modules are started yet. Wait for the `ALL_MODULES_STARTED` [notification](#notificationreceivednotification-payload-sender).
|
||||
|
||||
|
||||
#####`.withClass(classnames)`
|
||||
##### `.withClass(classnames)`
|
||||
***classnames* String or Array** - The class names on which you want to filter.
|
||||
**Returns Array** - An array with module instances.<br>
|
||||
|
||||
@ -570,7 +615,7 @@ var modules = MM.getModules().withClass('classname1 classname2');
|
||||
var modules = MM.getModules().withClass(['classname1','classname2']);
|
||||
````
|
||||
|
||||
#####`.exceptWithClass(classnames)`
|
||||
##### `.exceptWithClass(classnames)`
|
||||
***classnames* String or Array** - The class names of the modules you want to remove from the results.
|
||||
**Returns Array** - An array with module instances.<br>
|
||||
|
||||
@ -583,7 +628,7 @@ var modules = MM.getModules().exceptWithClass('classname1 classname2');
|
||||
var modules = MM.getModules().exceptWithClass(['classname1','classname2']);
|
||||
````
|
||||
|
||||
#####`.exceptModule(module)`
|
||||
##### `.exceptModule(module)`
|
||||
***module* Module Object** - The reference to a module you want to remove from the results.
|
||||
**Returns Array** - An array with module instances.<br>
|
||||
|
||||
@ -601,7 +646,7 @@ Of course, you can combine all of the above filters:
|
||||
var modules = MM.getModules().withClass('classname1').exceptwithClass('classname2').exceptModule(aModule);
|
||||
````
|
||||
|
||||
#####`.enumerate(callback)`
|
||||
##### `.enumerate(callback)`
|
||||
***callback* Function(module)** - The callback run on every instance.
|
||||
|
||||
If you want to perform an action on all selected modules, you can use the `enumerate` function:
|
||||
|
@ -30,7 +30,8 @@ Module.register("alert",{
|
||||
getTranslations: function() {
|
||||
return {
|
||||
en: "translations/en.json",
|
||||
de: "translations/de.json"
|
||||
de: "translations/de.json",
|
||||
nl: "translations/nl.json",
|
||||
};
|
||||
},
|
||||
show_notification: function(message) {
|
||||
|
4
modules/default/alert/translations/nl.json
Normal file
4
modules/default/alert/translations/nl.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"sysTitle": "MagicMirror Notificatie",
|
||||
"welcome": "Welkom, Succesvol gestart!"
|
||||
}
|
@ -31,6 +31,7 @@ The following properties can be configured:
|
||||
| `displaySymbol` | Display a symbol in front of an entry. <br><br> **Possible values:** `true` or `false` <br> **Default value:** `true`
|
||||
| `defaultSymbol` | The default symbol. <br><br> **Possible values:** See [Font Awsome](http://fontawesome.io/icons/) website. <br> **Default value:** `calendar`
|
||||
| `maxTitleLength` | The maximum title length. <br><br> **Possible values:** `10` - `50` <br> **Default value:** `25`
|
||||
| `wrapEvents` | Wrap event titles to multiple lines. Breaks lines at the length defined by `maxTitleLength`. <br><br> **Possible values:** `true` or `false` <br> **Default value:** `false`
|
||||
| `fetchInterval` | How often does the content needs to be fetched? (Milliseconds) <br><br> **Possible values:** `1000` - `86400000` <br> **Default value:** `300000` (5 minutes)
|
||||
| `animationSpeed` | Speed of the update animation. (Milliseconds) <br><br> **Possible values:**`0` - `5000` <br> **Default value:** `2000` (2 seconds)
|
||||
| `fade` | Fade the future events to black. (Gradient) <br><br> **Possible values:** `true` or `false` <br> **Default value:** `true`
|
||||
@ -39,6 +40,7 @@ The following properties can be configured:
|
||||
| `titleReplace` | An object of textual replacements applied to the tile of the event. This allow to remove or replace certains words in the title. <br><br> **Example:** `{'Birthday of ' : '', 'foo':'bar'}` <br> **Default value:** `{ "De verjaardag van ": "", "'s birthday": "" }`
|
||||
| `displayRepeatingCountTitle` | Show count title for yearly repeating events (e.g. "X. Birthday", "X. Anniversary") <br><br> **Possible values:** `true` or `false` <br> **Default value:** `false`
|
||||
| `dateFormat` | Format to use for the date of events (when using absolute dates) <br><br> **Possible values:** See [Moment.js formats](http://momentjs.com/docs/#/parsing/string-format/) <br> **Default value:** `MMM Do` (e.g. Jan 18th)
|
||||
| `fullDayEventDateFormat` | Format to use for the date of full day events (when using absolute dates) <br><br> **Possible values:** See [Moment.js formats](http://momentjs.com/docs/#/parsing/string-format/) <br> **Default value:** `MMM Do` (e.g. Jan 18th)
|
||||
| `timeFormat` | Display event times as absolute dates, or relative time <br><br> **Possible values:** `absolute` or `relative` <br> **Default value:** `relative`
|
||||
| `getRelative` | How much time (in hours) should be left until calendar events start getting relative? <br><br> **Possible values:** `0` (events stay absolute) - `48` (48 hours before the event starts) <br> **Default value:** `6`
|
||||
| `urgency` | When using a timeFormat of `absolute`, the `urgency` setting allows you to display events within a specific time frame as `relative`. This allows events within a certain time frame to be displayed as relative (in xx days) while others are displayed as absolute dates <br><br> **Possible values:** a positive integer representing the number of days for which you want a relative date, for example `7` (for 7 days) <br><br> **Default value:** `7`
|
||||
|
@ -2,6 +2,7 @@
|
||||
padding-left: 0;
|
||||
padding-right: 10px;
|
||||
font-size: 80%;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.calendar .symbol span {
|
||||
@ -19,4 +20,5 @@
|
||||
.calendar .time {
|
||||
padding-left: 30px;
|
||||
text-align: right;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
@ -18,12 +18,14 @@ Module.register("calendar", {
|
||||
displayRepeatingCountTitle: false,
|
||||
defaultRepeatingCountTitle: "",
|
||||
maxTitleLength: 25,
|
||||
wrapEvents: false, // wrap events to multiple lines breaking at maxTitleLength
|
||||
fetchInterval: 5 * 60 * 1000, // Update every 5 minutes.
|
||||
animationSpeed: 2000,
|
||||
fade: true,
|
||||
urgency: 7,
|
||||
timeFormat: "relative",
|
||||
dateFormat: "MMM Do",
|
||||
fullDayEventDateFormat: "MMM Do",
|
||||
getRelative: 6,
|
||||
fadePoint: 0.25, // Start on 1/4th of the list.
|
||||
hidePrivate: false,
|
||||
@ -67,6 +69,29 @@ Module.register("calendar", {
|
||||
// Set locale.
|
||||
moment.locale(config.language);
|
||||
|
||||
switch (config.timeFormat) {
|
||||
case 12: {
|
||||
moment.updateLocale(config.language, {
|
||||
longDateFormat: {
|
||||
LT: "h:mm A"
|
||||
}
|
||||
});
|
||||
break;
|
||||
}
|
||||
case 24: {
|
||||
moment.updateLocale(config.language, {
|
||||
longDateFormat: {
|
||||
LT: "hh:mm"
|
||||
}
|
||||
});
|
||||
break;
|
||||
}
|
||||
// If config.timeFormat was not given (or has invalid format) default to locale default
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (var c in this.config.calendars) {
|
||||
var calendar = this.config.calendars[c];
|
||||
calendar.url = calendar.url.replace("webcal://", "http://");
|
||||
@ -172,7 +197,6 @@ Module.register("calendar", {
|
||||
var titleWrapper = document.createElement("td"),
|
||||
repeatingCountTitle = "";
|
||||
|
||||
|
||||
if (this.config.displayRepeatingCountTitle) {
|
||||
|
||||
repeatingCountTitle = this.countTitleForUrl(event.url);
|
||||
@ -227,7 +251,7 @@ Module.register("calendar", {
|
||||
// This event falls within the config.urgency period that the user has set
|
||||
timeWrapper.innerHTML = this.capFirst(moment(event.startDate, "x").fromNow());
|
||||
} else {
|
||||
timeWrapper.innerHTML = this.capFirst(moment(event.startDate, "x").format(this.config.dateFormat));
|
||||
timeWrapper.innerHTML = this.capFirst(moment(event.startDate, "x").format(this.config.fullDayEventDateFormat));
|
||||
}
|
||||
} else {
|
||||
timeWrapper.innerHTML = this.capFirst(moment(event.startDate, "x").fromNow());
|
||||
@ -264,7 +288,12 @@ Module.register("calendar", {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
timeWrapper.innerHTML = this.capFirst(this.translate("RUNNING")) + " " + moment(event.endDate, "x").fromNow(true);
|
||||
timeWrapper.innerHTML = this.capFirst(
|
||||
this.translate("RUNNING", {
|
||||
fallback: this.translate("RUNNING") + " {timeUntilEnd}",
|
||||
timeUntilEnd: moment(event.endDate, "x").fromNow(true)
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
//timeWrapper.innerHTML += ' - '+ moment(event.startDate,'x').format('lll');
|
||||
@ -414,15 +443,38 @@ Module.register("calendar", {
|
||||
*
|
||||
* argument string string - The string to shorten.
|
||||
* argument maxLength number - The max length of the string.
|
||||
* argument wrapEvents - Wrap the text after the line has reached maxLength
|
||||
*
|
||||
* return string - The shortened string.
|
||||
*/
|
||||
shorten: function (string, maxLength) {
|
||||
if (string.length > maxLength) {
|
||||
return string.slice(0, maxLength) + "…";
|
||||
}
|
||||
shorten: function (string, maxLength, wrapEvents) {
|
||||
if (wrapEvents) {
|
||||
var temp = "";
|
||||
var currentLine = "";
|
||||
var words = string.split(" ");
|
||||
|
||||
return string;
|
||||
for (var i = 0; i < words.length; i++) {
|
||||
var word = words[i];
|
||||
if (currentLine.length + word.length < 25 - 1) { // max - 1 to account for a space
|
||||
currentLine += (word + " ");
|
||||
} else {
|
||||
if (currentLine.length > 0) {
|
||||
temp += (currentLine + "<br>" + word + " ");
|
||||
} else {
|
||||
temp += (word + "<br>");
|
||||
}
|
||||
currentLine = "";
|
||||
}
|
||||
}
|
||||
|
||||
return temp + currentLine;
|
||||
} else {
|
||||
if (string.length > maxLength) {
|
||||
return string.slice(0, maxLength) + "…";
|
||||
} else {
|
||||
return string;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/* capFirst(string)
|
||||
@ -437,7 +489,7 @@ Module.register("calendar", {
|
||||
/* titleTransform(title)
|
||||
* Transforms the title of an event for usage.
|
||||
* Replaces parts of the text as defined in config.titleReplace.
|
||||
* Shortens title based on config.maxTitleLength
|
||||
* Shortens title based on config.maxTitleLength and config.wrapEvents
|
||||
*
|
||||
* argument title string - The title to transform.
|
||||
*
|
||||
@ -456,7 +508,7 @@ Module.register("calendar", {
|
||||
title = title.replace(needle, replacement);
|
||||
}
|
||||
|
||||
title = this.shorten(title, this.config.maxTitleLength);
|
||||
title = this.shorten(title, this.config.maxTitleLength, this.config.wrapEvents);
|
||||
return title;
|
||||
},
|
||||
|
||||
@ -466,9 +518,9 @@ Module.register("calendar", {
|
||||
*/
|
||||
broadcastEvents: function () {
|
||||
var eventList = [];
|
||||
for (url in this.calendarData) {
|
||||
for (var url in this.calendarData) {
|
||||
var calendar = this.calendarData[url];
|
||||
for (e in calendar) {
|
||||
for (var e in calendar) {
|
||||
var event = cloneObject(calendar[e]);
|
||||
delete event.url;
|
||||
eventList.push(event);
|
||||
|
@ -127,7 +127,6 @@ Module.register("clock",{
|
||||
hour = ((now.hours() % 12) / 12) * 360 + 90 + minute / 12;
|
||||
|
||||
// Create wrappers
|
||||
var wrapper = document.createElement("div");
|
||||
var clockCircle = document.createElement("div");
|
||||
clockCircle.className = "clockCircle";
|
||||
clockCircle.style.width = this.config.analogSize;
|
||||
@ -181,7 +180,6 @@ Module.register("clock",{
|
||||
wrapper.appendChild(weekWrapper);
|
||||
} else if (this.config.displayType === "analog") {
|
||||
// Display only an analog clock
|
||||
dateWrapper.style.textAlign = "center";
|
||||
|
||||
if (this.config.showWeek) {
|
||||
weekWrapper.style.paddingBottom = "15px";
|
||||
|
@ -1,5 +1,5 @@
|
||||
.clockCircle {
|
||||
margin: 0 auto;
|
||||
margin: 0;
|
||||
position: relative;
|
||||
border-radius: 50%;
|
||||
background-size: 100%;
|
||||
|
@ -13,7 +13,7 @@ modules: [
|
||||
// Best results in one of the middle regions like: lower_third
|
||||
config: {
|
||||
// The config property is optional.
|
||||
// If no config is set, an example calendar is shown.
|
||||
// If no config is set, the default compliments are shown.
|
||||
// See 'Configuration options' for more information.
|
||||
}
|
||||
}
|
||||
@ -31,6 +31,7 @@ The following properties can be configured:
|
||||
| `fadeSpeed` | Speed of the update animation. (Milliseconds) <br><br> **Possible values:**`0` - `5000` <br> **Default value:** `4000` (4 seconds)
|
||||
| `compliments` | The list of compliments. <br><br> **Possible values:** An object with four arrays: `morning`, `afternoon`, `evening` and `anytime`. See _compliment configuration_ below. <br> **Default value:** See _compliment configuration_ below.
|
||||
| `remoteFile` | External file from which to load the compliments <br><br> **Possible values:** Path to a JSON file containing compliments, configured as per the value of the _compliments configuration_ (see below). An object with four arrays: `morning`, `afternoon`, `evening` and `anytime`. - `compliments.json` <br> **Default value:** `null` (Do not load from file)
|
||||
| `classes` | Override the CSS classes of the div showing the compliments <br><br> **Default value:** `thin xlarge bright`
|
||||
|
||||
### Compliment configuration
|
||||
|
||||
@ -88,7 +89,7 @@ config: {
|
||||
],
|
||||
afternoon: [
|
||||
"Hello, beauty!",
|
||||
'You look sexy!',
|
||||
"You look sexy!",
|
||||
"Looking good today!"
|
||||
],
|
||||
evening: [
|
||||
@ -110,9 +111,9 @@ around them ("morning", "afternoon", "evening", "snow", "rain", etc.).
|
||||
#### Example compliments.json file:
|
||||
````json
|
||||
{
|
||||
"anytime" : [
|
||||
"Hey there sexy!"
|
||||
],
|
||||
"anytime" : [
|
||||
"Hey there sexy!"
|
||||
],
|
||||
"morning" : [
|
||||
"Good morning, sunshine!",
|
||||
"Who needs coffee when you have your smile?",
|
||||
|
@ -96,14 +96,14 @@ Module.register("compliments", {
|
||||
*/
|
||||
complimentArray: function() {
|
||||
var hour = moment().hour();
|
||||
var compliments = null;
|
||||
var compliments;
|
||||
|
||||
if (hour >= 3 && hour < 12) {
|
||||
compliments = this.config.compliments.morning;
|
||||
} else if (hour >= 12 && hour < 17) {
|
||||
compliments = this.config.compliments.afternoon;
|
||||
} else {
|
||||
compliments = this.config.compliments.evening;
|
||||
if (hour >= 3 && hour < 12 && this.config.compliments.hasOwnProperty("morning")) {
|
||||
compliments = this.config.compliments.morning.slice(0);
|
||||
} else if (hour >= 12 && hour < 17 && this.config.compliments.hasOwnProperty("afternoon")) {
|
||||
compliments = this.config.compliments.afternoon.slice(0);
|
||||
} else if(this.config.compliments.hasOwnProperty("evening")) {
|
||||
compliments = this.config.compliments.evening.slice(0);
|
||||
}
|
||||
|
||||
if (typeof compliments === "undefined") {
|
||||
@ -117,7 +117,6 @@ Module.register("compliments", {
|
||||
compliments.push.apply(compliments, this.config.compliments.anytime);
|
||||
|
||||
return compliments;
|
||||
|
||||
},
|
||||
|
||||
/* complimentFile(callback)
|
||||
|
@ -40,7 +40,9 @@ The following properties can be configured:
|
||||
| `showPeriod` | Show the period (am/pm) with 12 hour format <br><br> **Possible values:** `true` or `false` <br> **Default value:** `true`
|
||||
| `showPeriodUpper` | Show the period (AM/PM) with 12 hour format as uppercase <br><br> **Possible values:** `true` or `false` <br> **Default value:** `false`
|
||||
| `showWindDirection` | Show the wind direction next to the wind speed. <br><br> **Possible values:** `true` or `false` <br> **Default value:** `true`
|
||||
| `showWindDirectionAsArrow` | Show the wind direction as an arrow instead of abbreviation <br><br> **Possible values:** `true` or `false` <br> **Default value:** `false`
|
||||
| `showHumidity` | Show the current humidity <br><br> **Possible values:** `true` or `false` <br> **Default value:** `false`
|
||||
| `showIndoorTemperature` | If you have another module that emits the INDOOR_TEMPERATURE notification, the indoor temperature will be displayed <br> **Default value:** `false`
|
||||
| `onlyTemp` | Show only current Temperature and weather icon. <br><br> **Possible values:** `true` or `false` <br> **Default value:** `false`
|
||||
| `useBeaufort` | Pick between using the Beaufort scale for wind speed or using the default units. <br><br> **Possible values:** `true` or `false` <br> **Default value:** `true`
|
||||
| `lang` | The language of the days. <br><br> **Possible values:** `en`, `nl`, `ru`, etc ... <br> **Default value:** uses value of _config.language_
|
||||
|
@ -1,4 +1,5 @@
|
||||
.currentweather .weathericon {
|
||||
.currentweather .weathericon,
|
||||
.currentweather .fa-home {
|
||||
font-size: 75%;
|
||||
line-height: 65px;
|
||||
display: inline-block;
|
||||
|
@ -21,10 +21,12 @@ Module.register("currentweather",{
|
||||
showPeriod: true,
|
||||
showPeriodUpper: false,
|
||||
showWindDirection: true,
|
||||
showWindDirectionAsArrow: false,
|
||||
useBeaufort: true,
|
||||
lang: config.language,
|
||||
showHumidity: false,
|
||||
degreeLabel: false,
|
||||
showIndoorTemperature: false,
|
||||
|
||||
initialLoadDelay: 0, // 0 seconds delay
|
||||
retryDelay: 2500,
|
||||
@ -94,9 +96,11 @@ Module.register("currentweather",{
|
||||
|
||||
this.windSpeed = null;
|
||||
this.windDirection = null;
|
||||
this.windDeg = null;
|
||||
this.sunriseSunsetTime = null;
|
||||
this.sunriseSunsetIcon = null;
|
||||
this.temperature = null;
|
||||
this.indoorTemperature = null;
|
||||
this.weatherType = null;
|
||||
|
||||
this.loaded = false;
|
||||
@ -111,7 +115,6 @@ Module.register("currentweather",{
|
||||
var small = document.createElement("div");
|
||||
small.className = "normal medium";
|
||||
|
||||
|
||||
var windIcon = document.createElement("span");
|
||||
windIcon.className = "wi wi-strong-wind dimmed";
|
||||
small.appendChild(windIcon);
|
||||
@ -122,7 +125,13 @@ Module.register("currentweather",{
|
||||
|
||||
if (this.config.showWindDirection) {
|
||||
var windDirection = document.createElement("sup");
|
||||
windDirection.innerHTML = " " + this.translate(this.windDirection);
|
||||
if (this.config.showWindDirectionAsArrow) {
|
||||
if(this.windDeg !== null) {
|
||||
windDirection.innerHTML = " <i class=\"fa fa-long-arrow-down\" style=\"transform:rotate("+this.windDeg+"deg);\"></i> ";
|
||||
}
|
||||
} else {
|
||||
windDirection.innerHTML = " " + this.translate(this.windDirection);
|
||||
}
|
||||
small.appendChild(windDirection);
|
||||
}
|
||||
var spacer = document.createElement("span");
|
||||
@ -203,6 +212,17 @@ Module.register("currentweather",{
|
||||
temperature.innerHTML = " " + this.temperature + "°" + degreeLabel;
|
||||
large.appendChild(temperature);
|
||||
|
||||
if (this.config.showIndoorTemperature && this.indoorTemperature) {
|
||||
var indoorIcon = document.createElement("span");
|
||||
indoorIcon.className = "fa fa-home";
|
||||
large.appendChild(indoorIcon);
|
||||
|
||||
var indoorTemperatureElem = document.createElement("span");
|
||||
indoorTemperatureElem.className = "bright";
|
||||
indoorTemperatureElem.innerHTML = " " + this.indoorTemperature + "°" + degreeLabel;
|
||||
large.appendChild(indoorTemperatureElem);
|
||||
}
|
||||
|
||||
wrapper.appendChild(large);
|
||||
return wrapper;
|
||||
},
|
||||
@ -226,10 +246,9 @@ Module.register("currentweather",{
|
||||
if (notification === "CALENDAR_EVENTS") {
|
||||
var senderClasses = sender.data.classes.toLowerCase().split(" ");
|
||||
if (senderClasses.indexOf(this.config.calendarClass.toLowerCase()) !== -1) {
|
||||
var lastEvent = this.firstEvent;
|
||||
this.firstEvent = false;
|
||||
|
||||
for (e in payload) {
|
||||
for (var e in payload) {
|
||||
var event = payload[e];
|
||||
if (event.location || event.geo) {
|
||||
this.firstEvent = event;
|
||||
@ -239,6 +258,10 @@ Module.register("currentweather",{
|
||||
}
|
||||
}
|
||||
}
|
||||
if (notification === "INDOOR_TEMPERATURE") {
|
||||
this.indoorTemperature = this.roundValue(payload);
|
||||
this.updateDom(self.config.animationSpeed);
|
||||
}
|
||||
},
|
||||
|
||||
/* updateWeather(compliments)
|
||||
@ -323,12 +346,12 @@ Module.register("currentweather",{
|
||||
|
||||
if (this.config.useBeaufort){
|
||||
this.windSpeed = this.ms2Beaufort(this.roundValue(data.wind.speed));
|
||||
}else {
|
||||
} else {
|
||||
this.windSpeed = parseFloat(data.wind.speed).toFixed(0);
|
||||
}
|
||||
|
||||
|
||||
this.windDirection = this.deg2Cardinal(data.wind.deg);
|
||||
this.windDeg = data.wind.deg;
|
||||
this.weatherType = this.config.iconTable[data.weather[0].icon];
|
||||
|
||||
var now = new Date();
|
||||
@ -359,7 +382,6 @@ Module.register("currentweather",{
|
||||
this.sunriseSunsetTime = timeString;
|
||||
this.sunriseSunsetIcon = (sunrise < now && sunset > now) ? "wi-sunset" : "wi-sunrise";
|
||||
|
||||
|
||||
this.show(this.config.animationSpeed, {lockString:this.identifier});
|
||||
this.loaded = true;
|
||||
this.updateDom(this.config.animationSpeed);
|
||||
@ -386,6 +408,10 @@ Module.register("currentweather",{
|
||||
/* ms2Beaufort(ms)
|
||||
* Converts m2 to beaufort (windspeed).
|
||||
*
|
||||
* see:
|
||||
* http://www.spc.noaa.gov/faq/tornado/beaufort.html
|
||||
* https://en.wikipedia.org/wiki/Beaufort_scale#Modern_scale
|
||||
*
|
||||
* argument ms number - Windspeed in m/s.
|
||||
*
|
||||
* return number - Windspeed in beaufort.
|
||||
|
@ -63,7 +63,7 @@ Module.register("weatherforecast",{
|
||||
firstEvent: false,
|
||||
|
||||
// create a variable to hold the location name based on the API result.
|
||||
fetchedLocatioName: "",
|
||||
fetchedLocationName: "",
|
||||
|
||||
// Define required scripts.
|
||||
getScripts: function() {
|
||||
@ -175,7 +175,6 @@ Module.register("weatherforecast",{
|
||||
row.style.opacity = 1 - (1 / steps * currentStep);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return table;
|
||||
@ -184,7 +183,7 @@ Module.register("weatherforecast",{
|
||||
// Override getHeader method.
|
||||
getHeader: function() {
|
||||
if (this.config.appendLocationNameToHeader) {
|
||||
return this.data.header + " " + this.fetchedLocatioName;
|
||||
return this.data.header + " " + this.fetchedLocationName;
|
||||
}
|
||||
|
||||
return this.data.header;
|
||||
@ -200,10 +199,9 @@ Module.register("weatherforecast",{
|
||||
if (notification === "CALENDAR_EVENTS") {
|
||||
var senderClasses = sender.data.classes.toLowerCase().split(" ");
|
||||
if (senderClasses.indexOf(this.config.calendarClass.toLowerCase()) !== -1) {
|
||||
var lastEvent = this.firstEvent;
|
||||
this.firstEvent = false;
|
||||
|
||||
for (e in payload) {
|
||||
for (var e in payload) {
|
||||
var event = payload[e];
|
||||
if (event.location || event.geo) {
|
||||
this.firstEvent = event;
|
||||
@ -291,7 +289,7 @@ Module.register("weatherforecast",{
|
||||
* argument data object - Weather information received form openweather.org.
|
||||
*/
|
||||
processWeather: function(data) {
|
||||
this.fetchedLocatioName = data.city.name + ", " + data.city.country;
|
||||
this.fetchedLocationName = data.city.name + ", " + data.city.country;
|
||||
|
||||
this.forecast = [];
|
||||
for (var i = 0, count = data.list.length; i < count; i++) {
|
||||
@ -335,6 +333,10 @@ Module.register("weatherforecast",{
|
||||
/* ms2Beaufort(ms)
|
||||
* Converts m2 to beaufort (windspeed).
|
||||
*
|
||||
* see:
|
||||
* http://www.spc.noaa.gov/faq/tornado/beaufort.html
|
||||
* https://en.wikipedia.org/wiki/Beaufort_scale#Modern_scale
|
||||
*
|
||||
* argument ms number - Windspeed in m/s.
|
||||
*
|
||||
* return number - Windspeed in beaufort.
|
||||
|
11
modules/node_modules/node_helper/index.js
generated
vendored
11
modules/node_modules/node_helper/index.js
generated
vendored
@ -20,7 +20,7 @@ NodeHelper = Class.extend({
|
||||
},
|
||||
|
||||
start: function() {
|
||||
console.log("Staring module helper: " + this.name);
|
||||
console.log("Starting module helper: " + this.name);
|
||||
},
|
||||
|
||||
/* socketNotificationReceived(notification, payload)
|
||||
@ -45,7 +45,7 @@ NodeHelper = Class.extend({
|
||||
/* setPath(path)
|
||||
* Set the module path.
|
||||
*
|
||||
* argument name string - Module name.
|
||||
* argument path string - Module path.
|
||||
*/
|
||||
setPath: function(path) {
|
||||
this.path = path;
|
||||
@ -98,9 +98,10 @@ NodeHelper = Class.extend({
|
||||
|
||||
// register catch all.
|
||||
socket.on("*", function(notification, payload) {
|
||||
if (notification !== "*")
|
||||
//console.log('received message in namespace: ' + namespace);
|
||||
self.socketNotificationReceived(notification, payload);
|
||||
if (notification !== "*") {
|
||||
//console.log('received message in namespace: ' + namespace);
|
||||
self.socketNotificationReceived(notification, payload);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
36
package.json
36
package.json
@ -1,15 +1,16 @@
|
||||
{
|
||||
"name": "magicmirror",
|
||||
"version": "2.1.1",
|
||||
"version": "2.1.2",
|
||||
"description": "The open source modular smart mirror platform.",
|
||||
"main": "js/electron.js",
|
||||
"scripts": {
|
||||
"start": "sh run-start.sh",
|
||||
"install": "cd vendor && npm install",
|
||||
"postinstall": "sh installers/postinstall/postinstall.sh",
|
||||
"test": "./node_modules/mocha/bin/mocha tests --recursive",
|
||||
"test:unit": "./node_modules/mocha/bin/mocha tests/unit --recursive",
|
||||
"test:e2e": "./node_modules/mocha/bin/mocha tests/e2e --recursive"
|
||||
"test": "NODE_ENV=test ./node_modules/mocha/bin/mocha tests --recursive",
|
||||
"test:unit": "NODE_ENV=test ./node_modules/mocha/bin/mocha tests/unit --recursive",
|
||||
"test:e2e": "NODE_ENV=test ./node_modules/mocha/bin/mocha tests/e2e --recursive",
|
||||
"config:check": "node tests/configs/check_config.js"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@ -29,36 +30,39 @@
|
||||
"bugs": {
|
||||
"url": "https://github.com/MichMich/MagicMirror/issues"
|
||||
},
|
||||
"homepage": "https://github.com/MichMich/MagicMirror#readme",
|
||||
"homepage": "https://magicmirror.builders",
|
||||
"devDependencies": {
|
||||
"chai": "^3.5.0",
|
||||
"chai-as-promised": "^6.0.0",
|
||||
"current-week-number": "^1.0.7",
|
||||
"grunt": "latest",
|
||||
"grunt-eslint": "latest",
|
||||
"grunt-jsonlint": "latest",
|
||||
"grunt-markdownlint": "^1.0.13",
|
||||
"grunt-markdownlint": "^1.0.39",
|
||||
"grunt-stylelint": "latest",
|
||||
"grunt-yamllint": "latest",
|
||||
"http-auth": "^3.1.3",
|
||||
"mocha": "^3.2.0",
|
||||
"spectron": "^3.4.1",
|
||||
"jshint": "^2.9.4",
|
||||
"mocha": "^3.4.2",
|
||||
"spectron": "^3.6.4",
|
||||
"stylelint": "^7.11.0",
|
||||
"stylelint-config-standard": "latest",
|
||||
"time-grunt": "latest"
|
||||
},
|
||||
"dependencies": {
|
||||
"body-parser": "^1.17.1",
|
||||
"body-parser": "^1.17.2",
|
||||
"colors": "^1.1.2",
|
||||
"electron": "^1.4.7",
|
||||
"express": "^4.14.0",
|
||||
"electron": "^1.6.10",
|
||||
"express": "^4.15.3",
|
||||
"express-ipfilter": "latest",
|
||||
"feedme": "latest",
|
||||
"helmet": "^3.1.0",
|
||||
"helmet": "^3.6.1",
|
||||
"iconv-lite": "latest",
|
||||
"moment": "latest",
|
||||
"request": "^2.78.0",
|
||||
"rrule-alt": "^2.2.3",
|
||||
"simple-git": "^1.62.0",
|
||||
"socket.io": "^1.7.3",
|
||||
"request": "^2.81.0",
|
||||
"rrule-alt": "^2.2.5",
|
||||
"simple-git": "^1.73.0",
|
||||
"socket.io": "^2.0.2",
|
||||
"valid-url": "latest",
|
||||
"walk": "latest"
|
||||
}
|
||||
|
66
tests/configs/check_config.js
Normal file
66
tests/configs/check_config.js
Normal file
@ -0,0 +1,66 @@
|
||||
/* Magic Mirror
|
||||
*
|
||||
* Checker configuration file
|
||||
*
|
||||
* By Rodrigo Ramírez Norambuena
|
||||
* https://rodrigoramirez.com
|
||||
*
|
||||
* MIT Licensed.
|
||||
*
|
||||
*/
|
||||
|
||||
var v = require("jshint");
|
||||
var path = require("path");
|
||||
var fs = require("fs");
|
||||
var Utils = require(__dirname + "/../../js/utils.js");
|
||||
|
||||
if (process.env.NODE_ENV == "test") {return 0};
|
||||
|
||||
/* getConfigFile()
|
||||
* Return string with path of configuration file
|
||||
* Check if set by enviroment variable MM_CONFIG_FILE
|
||||
*/
|
||||
function getConfigFile() {
|
||||
// FIXME: This function should be in core. Do you want refactor me ;) ?, be good!
|
||||
rootPath = path.resolve(__dirname + "/../../");
|
||||
var configFileName = path.resolve(rootPath + "/config/config.js");
|
||||
if (process.env.MM_CONFIG_FILE) {
|
||||
configFileName = path.resolve(process.env.MM_CONFIG_FILE);
|
||||
}
|
||||
return configFileName;
|
||||
}
|
||||
|
||||
var configFileName = getConfigFile();
|
||||
// Check if file is present
|
||||
if (fs.existsSync(configFileName) === false) {
|
||||
console.error(Utils.colors.error("File not found: "), configFileName);
|
||||
return;
|
||||
}
|
||||
// check permision
|
||||
try {
|
||||
fs.accessSync(configFileName, fs.F_OK);
|
||||
} catch (e) {
|
||||
console.log(Utils.colors.error(e));
|
||||
return;
|
||||
}
|
||||
|
||||
// Validate syntax of the configuration file.
|
||||
// In case the there errors show messages and
|
||||
// return
|
||||
console.info(Utils.colors.info("Checking file... ", configFileName));
|
||||
// I'm not sure if all ever is utf-8
|
||||
fs.readFile(configFileName, "utf-8", function(err, data) {
|
||||
if (err) {throw err;}
|
||||
v.JSHINT(data); // Parser by jshint
|
||||
|
||||
if (v.JSHINT.errors.length == 0) {
|
||||
console.log("Your configuration file don't containt syntax error :)");
|
||||
return true;
|
||||
} else {
|
||||
errors = v.JSHINT.data().errors;
|
||||
for (idx in errors) {
|
||||
error = errors[idx];
|
||||
console.log("Line", error.line, "col", error.character, error.reason);
|
||||
}
|
||||
}
|
||||
});
|
410
tests/configs/data/feed_test_rodrigoramirez.xml
Normal file
410
tests/configs/data/feed_test_rodrigoramirez.xml
Normal file
@ -0,0 +1,410 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
|
||||
xmlns:content="http://purl.org/rss/1.0/modules/content/"
|
||||
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:atom="http://www.w3.org/2005/Atom"
|
||||
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
|
||||
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
|
||||
>
|
||||
|
||||
<channel>
|
||||
<title>Rodrigo Ramírez Norambuena</title>
|
||||
<atom:link href="https://rodrigoramirez.com/feed/" rel="self" type="application/rss+xml" />
|
||||
<link>https://rodrigoramirez.com</link>
|
||||
<description>Temas sobre Linux, VoIP, Open Source, tecnología y lo relacionado.</description>
|
||||
<lastBuildDate>Fri, 21 Oct 2016 21:30:22 +0000</lastBuildDate>
|
||||
<language>es-ES</language>
|
||||
<sy:updatePeriod>hourly</sy:updatePeriod>
|
||||
<sy:updateFrequency>1</sy:updateFrequency>
|
||||
<generator>https://wordpress.org/?v=4.7.3</generator>
|
||||
<item>
|
||||
<title>QPanel 0.13.0</title>
|
||||
<link>https://rodrigoramirez.com/qpanel-0-13-0/</link>
|
||||
<comments>https://rodrigoramirez.com/qpanel-0-13-0/#comments</comments>
|
||||
<pubDate>Tue, 20 Sep 2016 11:16:08 +0000</pubDate>
|
||||
<dc:creator><![CDATA[decipher]]></dc:creator>
|
||||
<category><![CDATA[Software]]></category>
|
||||
<category><![CDATA[app_queue]]></category>
|
||||
<category><![CDATA[asterisk]]></category>
|
||||
<category><![CDATA[FreeSWITCH]]></category>
|
||||
<category><![CDATA[qpanel]]></category>
|
||||
<category><![CDATA[queue]]></category>
|
||||
<category><![CDATA[spy]]></category>
|
||||
<category><![CDATA[supervision]]></category>
|
||||
<category><![CDATA[templates]]></category>
|
||||
<category><![CDATA[whisper]]></category>
|
||||
|
||||
<guid isPermaLink="false">https://rodrigoramirez.com/?p=1299</guid>
|
||||
<description><![CDATA[<p>Ya está disponible la versión 0.13.0 de QPanel Para instalar esta nueva versión, la debes descargar de https://github.com/roramirez/qpanel/tree/0.13.0 En al README.md puedes encontrar las instrucciones para hacer que funcione en tu sistema. En esta nueva versión cuenta con los siguientes cambios: Se establece un limite para el reciclado del tiempo de conexión a la base […]</p>
|
||||
<p>La entrada <a rel="nofollow" href="https://rodrigoramirez.com/qpanel-0-13-0/">QPanel 0.13.0</a> aparece primero en <a rel="nofollow" href="https://rodrigoramirez.com">Rodrigo Ramírez Norambuena</a>.</p>
|
||||
]]></description>
|
||||
<content:encoded><![CDATA[<p><img class="aligncenter" src="https://raw.githubusercontent.com/roramirez/qpanel/e55aa16bbd85b579ee82e56469526270c5afa462/samples/animation.gif" alt="Panel monitor callcenter | Qpanel Monitor Colas" width="685" height="385" />Ya está disponible la versión 0.13.0 de QPanel</p>
|
||||
<p>Para instalar esta nueva versión, la debes descargar de</p>
|
||||
<ul>
|
||||
<li><a href="https://github.com/roramirez/qpanel/tree/0.13.0">https://github.com/roramirez/qpanel/tree/0.13.0</a></li>
|
||||
</ul>
|
||||
<p>En al README.md puedes encontrar las instrucciones para hacer que funcione en tu sistema.</p>
|
||||
<p>En esta nueva versión cuenta con los siguientes cambios:</p>
|
||||
<ul>
|
||||
<li>Se establece un limite para el reciclado del tiempo de conexión a la base de datos que contenga QueueLog. Esto evita problemas en bases de datos como MySQL que finaliza o da timeout a las conexiones.</li>
|
||||
<li>Ahora la py-asterisk va dentro del archivo requirements.txt y no como submodulo del proyecto.</li>
|
||||
<li>Se remueven la mayoría de las libs externas para Javascript y CSS para manejarlos desde ahora con <a href="https://bower.io/">Bower</a>.</li>
|
||||
<li>Se incluye un script para WSGI que permite su utilización con Apache.</li>
|
||||
<li>Actualización para los idiomas Ruso y Portugues.</li>
|
||||
</ul>
|
||||
<p>Si deseas colaborar con el proyecto puedes agregar nuevas sugerencias mediante un <a href="https://github.com/roramirez/qpanel/issues/new?title=[Feature]">issue</a> ó colaborar mediante <a href="https://github.com/roramirez/qpanel/blob/dd42cf0f534408505f57b0d387dffee2f3688711/README.md#how-to-contribute">mediante un Pull Request.</a></p>
|
||||
<p>Ahora si necesitas <a href="https://boxtub.com/qpanel/">soporte comercial para instalaciones, personalizaciones o nuevas características lo puedes solicitar en https://boxtub.com/qpanel/</a></p>
|
||||
<p> </p>
|
||||
<p>La entrada <a rel="nofollow" href="https://rodrigoramirez.com/qpanel-0-13-0/">QPanel 0.13.0</a> aparece primero en <a rel="nofollow" href="https://rodrigoramirez.com">Rodrigo Ramírez Norambuena</a>.</p>
|
||||
]]></content:encoded>
|
||||
<wfw:commentRss>https://rodrigoramirez.com/qpanel-0-13-0/feed/</wfw:commentRss>
|
||||
<slash:comments>3</slash:comments>
|
||||
</item>
|
||||
<item>
|
||||
<title>Problema VirtualBox “starting virtual machine” …</title>
|
||||
<link>https://rodrigoramirez.com/problema-virtualbox-starting-virtual-machine/</link>
|
||||
<comments>https://rodrigoramirez.com/problema-virtualbox-starting-virtual-machine/#respond</comments>
|
||||
<pubDate>Sat, 10 Sep 2016 22:50:13 +0000</pubDate>
|
||||
<dc:creator><![CDATA[decipher]]></dc:creator>
|
||||
<category><![CDATA[Linux]]></category>
|
||||
<category><![CDATA[no arranca]]></category>
|
||||
<category><![CDATA[Problema]]></category>
|
||||
<category><![CDATA[VirtualBox]]></category>
|
||||
|
||||
<guid isPermaLink="false">https://rodrigoramirez.com/?p=1284</guid>
|
||||
<description><![CDATA[<p>Después de una actualización de Debian, de la rama stretch/sid, tuve un problema con VirtualBox. La versión que se actualizó fue a la virtualbox 5.1.4-dfsg-1+b1. El gran problema era que ninguna maquina virtual quería arrancar, se quedaba en un largo limbo con el mensaje “starting virtual machine”, como el de la imagen de a continuación. […]</p>
|
||||
<p>La entrada <a rel="nofollow" href="https://rodrigoramirez.com/problema-virtualbox-starting-virtual-machine/">Problema VirtualBox “starting virtual machine” …</a> aparece primero en <a rel="nofollow" href="https://rodrigoramirez.com">Rodrigo Ramírez Norambuena</a>.</p>
|
||||
]]></description>
|
||||
<content:encoded><![CDATA[<p>Después de una actualización de Debian, de la rama stretch/sid, tuve un problema con VirtualBox. La versión que se actualizó fue a la virtualbox 5.1.4-dfsg-1+b1. El gran problema era que ninguna maquina virtual quería arrancar, se quedaba en un largo limbo con el mensaje “starting virtual machine”, como el de la imagen de a continuación.</p>
|
||||
<p><a href="https://rodrigoramirez.com/wp-content/uploads/Screenshot-at-2016-09-10-19-25-09.png"><img class="aligncenter wp-image-1290 size-full" src="https://rodrigoramirez.com/wp-content/uploads/Screenshot-at-2016-09-10-19-25-09.png" alt="Starting virtual machine ... VirtualBox" width="648" height="554" srcset="https://rodrigoramirez.com/wp-content/uploads/Screenshot-at-2016-09-10-19-25-09.png 648w, https://rodrigoramirez.com/wp-content/uploads/Screenshot-at-2016-09-10-19-25-09-300x256.png 300w" sizes="(max-width: 648px) 100vw, 648px" /></a></p>
|
||||
<p>Ninguna, pero ninguna maquina arrancó, se quedaban en ese mensaje. Fue de esos instantes en que sudas helado … <img src="https://s.w.org/images/core/emoji/2.2.1/72x72/1f609.png" alt="😉" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
|
||||
<p>Con un poco de investigación fue a parar al archivo<em> ~/.VirtualBox/VBoxSVC.log </em>que indicaba</p>
|
||||
<pre>$ tail -f ~/.VirtualBox/VBoxSVC.log
|
||||
00:08:32.932717 nspr-7 Failed to open "/dev/vboxdrvu", errno=13, rc=VERR_VM_DRIVER_NOT_ACCESSIBLE
|
||||
00:08:33.555836 nspr-6 Failed to open "/dev/vboxdrvu", errno=13, rc=VERR_VM_DRIVER_NOT_ACCESSIBLE</pre>
|
||||
<p> </p>
|
||||
<p>Fui… algo de donde agarrarse. Mirando un poco mas se trataba de problemas con los permisos al vboxdrvu, mirando indicaba que tenía 0600.</p>
|
||||
<p> </p>
|
||||
<pre>$ ls -lh /dev/vboxdrvu
|
||||
crw------- 1 root root 10, 56 Sep 10 12:47 /dev/vboxdrvu</pre>
|
||||
<p> </p>
|
||||
<p>El tema es que deben estar en 0666, le cambias los permisos y eso soluciona el problema <img src="https://s.w.org/images/core/emoji/2.2.1/72x72/1f642.png" alt="🙂" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
|
||||
<pre>
|
||||
$ sudo chmod 0666 /dev/vboxdrvu
|
||||
$ ls -lh /dev/vboxdrvu
|
||||
crw-rw-rw- 1 root root 10, 56 Sep 10 12:47 /dev/vboxdrvu</pre>
|
||||
<p>La entrada <a rel="nofollow" href="https://rodrigoramirez.com/problema-virtualbox-starting-virtual-machine/">Problema VirtualBox “starting virtual machine” …</a> aparece primero en <a rel="nofollow" href="https://rodrigoramirez.com">Rodrigo Ramírez Norambuena</a>.</p>
|
||||
]]></content:encoded>
|
||||
<wfw:commentRss>https://rodrigoramirez.com/problema-virtualbox-starting-virtual-machine/feed/</wfw:commentRss>
|
||||
<slash:comments>0</slash:comments>
|
||||
</item>
|
||||
<item>
|
||||
<title>Mejorando la consola interactiva de Python</title>
|
||||
<link>https://rodrigoramirez.com/mejorando-la-consola-interactiva-python/</link>
|
||||
<comments>https://rodrigoramirez.com/mejorando-la-consola-interactiva-python/#comments</comments>
|
||||
<pubDate>Tue, 06 Sep 2016 04:24:43 +0000</pubDate>
|
||||
<dc:creator><![CDATA[decipher]]></dc:creator>
|
||||
<category><![CDATA[desarrollo]]></category>
|
||||
<category><![CDATA[Desarrollo]]></category>
|
||||
<category><![CDATA[Python]]></category>
|
||||
|
||||
<guid isPermaLink="false">https://rodrigoramirez.com/?p=1247</guid>
|
||||
<description><![CDATA[<p>Cuando estás desarrollando en Python es muy cool estar utilizando la consola interactiva para ir probando cosas antes de ponerlas dentro del archivo de código fuente. La consola de Python funciona y cumple su cometido. Solo al tipear python te permite entrar en modo interactivo e ir probando cosas. El punto es que a veces […]</p>
|
||||
<p>La entrada <a rel="nofollow" href="https://rodrigoramirez.com/mejorando-la-consola-interactiva-python/">Mejorando la consola interactiva de Python</a> aparece primero en <a rel="nofollow" href="https://rodrigoramirez.com">Rodrigo Ramírez Norambuena</a>.</p>
|
||||
]]></description>
|
||||
<content:encoded><![CDATA[<p>Cuando estás desarrollando en Python es muy <em>cool</em> estar utilizando la consola interactiva para ir probando cosas antes de ponerlas dentro del archivo de código fuente.</p>
|
||||
<p>La consola de Python funciona y cumple su cometido. Solo al tipear <em>python </em>te permite entrar en modo interactivo e ir probando cosas.</p>
|
||||
<p>El punto es que a veces uno necesita ir un poco más allá. Como autocomentado de código o resaltado de sintaxis, para eso tengo dos truco que utilizo generalmente.</p>
|
||||
<h2>Truco a)</h2>
|
||||
<p>Este permite añadirle algunos esteriodes a la consolta, en realidad uno, el autocompletado. Esto es de gran ayuda para ir conociendo los metodo que puede tener un objecto, funciones u operaciones.</p>
|
||||
<p>Para esto se ocupo <em>rlcompleter</em> y <em>readline. </em></p>
|
||||
<p> </p>
|
||||
<p>Lo que hace que hacer luego de tipear python es agregar lo siguiente dentro de la consola interativa</p>
|
||||
<p><em>import rlcompleter, readline</em><br />
|
||||
<em>readline.parse_and_bind(‘tab:complete’)</em></p>
|
||||
<p>Ya con esto te permite autocomentar código <img src="https://s.w.org/images/core/emoji/2.2.1/72x72/1f642.png" alt="🙂" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
|
||||
<p><a href="https://rodrigoramirez.com/wp-content/uploads/Screenshot-at-2016-09-03-01-14-32.png"><img class="aligncenter wp-image-1279 size-full" src="https://rodrigoramirez.com/wp-content/uploads/Screenshot-at-2016-09-03-01-14-32.png" width="689" height="421" srcset="https://rodrigoramirez.com/wp-content/uploads/Screenshot-at-2016-09-03-01-14-32.png 689w, https://rodrigoramirez.com/wp-content/uploads/Screenshot-at-2016-09-03-01-14-32-300x183.png 300w" sizes="(max-width: 689px) 100vw, 689px" /></a></p>
|
||||
<p> </p>
|
||||
<h2>Truco b)</h2>
|
||||
<p>Esto es mejorar un poco más. Es utilizar embed de <a href="https://ipython.org/">IPython,</a> ya en la consola digita (copias o pegas) lo siguiente</p>
|
||||
<p><em>from IPython import embed</em><br />
|
||||
<em>embed()</em></p>
|
||||
<p>Y el resultado será lo que se ve a continuación… bueno, no?</p>
|
||||
<p> </p>
|
||||
<p><a href="https://rodrigoramirez.com/wp-content/uploads/Screenshot-at-2016-07-25-15-48-39.png"><img class="aligncenter wp-image-1262 size-full" src="https://rodrigoramirez.com/wp-content/uploads/Screenshot-at-2016-07-25-15-48-39.png" width="743" height="293" srcset="https://rodrigoramirez.com/wp-content/uploads/Screenshot-at-2016-07-25-15-48-39.png 743w, https://rodrigoramirez.com/wp-content/uploads/Screenshot-at-2016-07-25-15-48-39-300x118.png 300w" sizes="(max-width: 743px) 100vw, 743px" /></a></p>
|
||||
<p> </p>
|
||||
<p>Si no quieres estar escribiendo cada vez que entras, agregas estas instrucciones en tu archivo <em>~/.pythonrc.py </em> y lo hará cada vez que entras en el modo interactivo de la consola de Python. Lo que si, tu archivo pythonrc.py debe estar seteado en variable de entorno PYTHONSTARTUP</p>
|
||||
<p>ejemplo</p>
|
||||
<p><em>export PYTHONSTARTUP=~/.pythonrc.py</em></p>
|
||||
<p>O lo agregas a un bashrc, zshrc o la shell que ocupes.</p>
|
||||
<p>La entrada <a rel="nofollow" href="https://rodrigoramirez.com/mejorando-la-consola-interactiva-python/">Mejorando la consola interactiva de Python</a> aparece primero en <a rel="nofollow" href="https://rodrigoramirez.com">Rodrigo Ramírez Norambuena</a>.</p>
|
||||
]]></content:encoded>
|
||||
<wfw:commentRss>https://rodrigoramirez.com/mejorando-la-consola-interactiva-python/feed/</wfw:commentRss>
|
||||
<slash:comments>4</slash:comments>
|
||||
</item>
|
||||
<item>
|
||||
<title>QPanel 0.12.0 con estadísticas</title>
|
||||
<link>https://rodrigoramirez.com/qpanel-0-12-0-estadisticas/</link>
|
||||
<comments>https://rodrigoramirez.com/qpanel-0-12-0-estadisticas/#respond</comments>
|
||||
<pubDate>Mon, 22 Aug 2016 04:19:03 +0000</pubDate>
|
||||
<dc:creator><![CDATA[decipher]]></dc:creator>
|
||||
<category><![CDATA[Software]]></category>
|
||||
<category><![CDATA[app_queue]]></category>
|
||||
<category><![CDATA[asterisk]]></category>
|
||||
<category><![CDATA[FreeSWITCH]]></category>
|
||||
<category><![CDATA[qpanel]]></category>
|
||||
<category><![CDATA[queue]]></category>
|
||||
<category><![CDATA[spy]]></category>
|
||||
<category><![CDATA[supervision]]></category>
|
||||
<category><![CDATA[templates]]></category>
|
||||
<category><![CDATA[whisper]]></category>
|
||||
|
||||
<guid isPermaLink="false">https://rodrigoramirez.com/?p=1268</guid>
|
||||
<description><![CDATA[<p>Ya está disponible una nueva versión de QPanel, esta es la 0.12.0 Para instalar esta nueva versión, debes visitar la siguiente URL https://github.com/roramirez/qpanel/tree/0.12.0 En esta nueva versión las funcionalidades agregadas son: Permite remover los agentes de las cola Posibilidad de cancelar llamadas que están en espera de atención Estadísticas por rango de fecha obtenidas desde […]</p>
|
||||
<p>La entrada <a rel="nofollow" href="https://rodrigoramirez.com/qpanel-0-12-0-estadisticas/">QPanel 0.12.0 con estadísticas</a> aparece primero en <a rel="nofollow" href="https://rodrigoramirez.com">Rodrigo Ramírez Norambuena</a>.</p>
|
||||
]]></description>
|
||||
<content:encoded><![CDATA[<p><img class="aligncenter" src="https://raw.githubusercontent.com/roramirez/qpanel/e55aa16bbd85b579ee82e56469526270c5afa462/samples/animation.gif" alt="Panel monitor callcenter | Qpanel Monitor Colas" width="685" height="385" />Ya está disponible una nueva versión de QPanel, esta es la 0.12.0</p>
|
||||
<p>Para instalar esta nueva versión, debes visitar la siguiente URL</p>
|
||||
<ul>
|
||||
<li><a href="https://github.com/roramirez/qpanel/tree/0.12.0">https://github.com/roramirez/qpanel/tree/0.12.0</a></li>
|
||||
</ul>
|
||||
<p>En esta nueva versión las funcionalidades agregadas son:</p>
|
||||
<ul>
|
||||
<li>Permite remover los agentes de las cola</li>
|
||||
<li>Posibilidad de cancelar llamadas que están en espera de atención</li>
|
||||
<li>Estadísticas por rango de fecha obtenidas desde el queue_log de Asterisk</li>
|
||||
<li>Se actualiza a Flask 0.11</li>
|
||||
</ul>
|
||||
<p>Si deseas colaborar con el proyecto puedes agregar nuevas sugerencias mediante un <a href="https://github.com/roramirez/qpanel/issues/new?title=[Feature]">issue</a> ó colaborar mediante <a href="https://github.com/roramirez/qpanel/blob/dd42cf0f534408505f57b0d387dffee2f3688711/README.md#how-to-contribute">mediante un Pull Request</a></p>
|
||||
<p>La entrada <a rel="nofollow" href="https://rodrigoramirez.com/qpanel-0-12-0-estadisticas/">QPanel 0.12.0 con estadísticas</a> aparece primero en <a rel="nofollow" href="https://rodrigoramirez.com">Rodrigo Ramírez Norambuena</a>.</p>
|
||||
]]></content:encoded>
|
||||
<wfw:commentRss>https://rodrigoramirez.com/qpanel-0-12-0-estadisticas/feed/</wfw:commentRss>
|
||||
<slash:comments>0</slash:comments>
|
||||
</item>
|
||||
<item>
|
||||
<title>QPanel 0.11.0 con Spy, Whisper y mas</title>
|
||||
<link>https://rodrigoramirez.com/qpanel-spy-supervisor/</link>
|
||||
<comments>https://rodrigoramirez.com/qpanel-spy-supervisor/#comments</comments>
|
||||
<pubDate>Thu, 21 Jul 2016 01:53:21 +0000</pubDate>
|
||||
<dc:creator><![CDATA[decipher]]></dc:creator>
|
||||
<category><![CDATA[Software]]></category>
|
||||
<category><![CDATA[app_queue]]></category>
|
||||
<category><![CDATA[asterisk]]></category>
|
||||
<category><![CDATA[FreeSWITCH]]></category>
|
||||
<category><![CDATA[qpanel]]></category>
|
||||
<category><![CDATA[queue]]></category>
|
||||
<category><![CDATA[spy]]></category>
|
||||
<category><![CDATA[supervision]]></category>
|
||||
<category><![CDATA[templates]]></category>
|
||||
<category><![CDATA[whisper]]></category>
|
||||
|
||||
<guid isPermaLink="false">https://rodrigoramirez.com/?p=1245</guid>
|
||||
<description><![CDATA[<p>Ya está disponible una nueva versión de QPanel, esta es la 0.11.0 Para instalar esta nueva versión, debes visitar la siguiente URL https://github.com/roramirez/qpanel/tree/0.11.0 Esta versión hemos agregado algunas funcionalidades que los usuarios han ido solicitando. Para esta versión es posible realizar Spy, Whisper o Barge a un canal para la supervisión de los miembros que […]</p>
|
||||
<p>La entrada <a rel="nofollow" href="https://rodrigoramirez.com/qpanel-spy-supervisor/">QPanel 0.11.0 con Spy, Whisper y mas</a> aparece primero en <a rel="nofollow" href="https://rodrigoramirez.com">Rodrigo Ramírez Norambuena</a>.</p>
|
||||
]]></description>
|
||||
<content:encoded><![CDATA[<p><img class="aligncenter" src="https://raw.githubusercontent.com/roramirez/qpanel/e55aa16bbd85b579ee82e56469526270c5afa462/samples/animation.gif" alt="Panel monitor callcenter | Qpanel Monitor Colas" width="685" height="385" />Ya está disponible una nueva versión de QPanel, esta es la 0.11.0</p>
|
||||
<p>Para instalar esta nueva versión, debes visitar la siguiente URL</p>
|
||||
<ul>
|
||||
<li><a href="https://github.com/roramirez/qpanel/tree/0.11.0">https://github.com/roramirez/qpanel/tree/0.11.0</a></li>
|
||||
</ul>
|
||||
<p>Esta versión hemos agregado algunas funcionalidades que los usuarios han ido solicitando.</p>
|
||||
<p>Para esta versión es posible realizar Spy, Whisper o Barge a un canal para la supervisión de los miembros que están en una cola.</p>
|
||||
<p>También el sistema de plantillas se hecho una refactorización para eliminar exceso de codigo HTML usando uno de base.</p>
|
||||
<p>Se han agregado una suite de tests unitarios que al contar del avance del proyecto deberían ir incrementando.</p>
|
||||
<p>Se ha solucionado un bug con la actualización del color del estado del agente cuando es uno nuevo agregado a la cola.</p>
|
||||
<p> </p>
|
||||
<p>El proyecto siempre está abierto a nuevas sugerencias las cuales puedes agregar mediante un <a href="https://github.com/roramirez/qpanel/issues/new?title=[Feature]">issue</a>.</p>
|
||||
<p>La entrada <a rel="nofollow" href="https://rodrigoramirez.com/qpanel-spy-supervisor/">QPanel 0.11.0 con Spy, Whisper y mas</a> aparece primero en <a rel="nofollow" href="https://rodrigoramirez.com">Rodrigo Ramírez Norambuena</a>.</p>
|
||||
]]></content:encoded>
|
||||
<wfw:commentRss>https://rodrigoramirez.com/qpanel-spy-supervisor/feed/</wfw:commentRss>
|
||||
<slash:comments>4</slash:comments>
|
||||
</item>
|
||||
<item>
|
||||
<title>Añadir Swap a un sistema</title>
|
||||
<link>https://rodrigoramirez.com/crear-swap/</link>
|
||||
<comments>https://rodrigoramirez.com/crear-swap/#respond</comments>
|
||||
<pubDate>Fri, 15 Jul 2016 05:07:43 +0000</pubDate>
|
||||
<dc:creator><![CDATA[decipher]]></dc:creator>
|
||||
<category><![CDATA[Linux]]></category>
|
||||
|
||||
<guid isPermaLink="false">https://rodrigoramirez.com/?p=1234</guid>
|
||||
<description><![CDATA[<p>Algo que me toma generalmente hacer es cuando trabajo con maquina virtuales es asignar una cantidad determinada de Swap. La memoria swap es un espacio de intercambio en disco para cuando el sistema ya no puede utilizar más memoria RAM. El problema para mi es que algunos sistemas de maquinas virtuales no asignan por defecto […]</p>
|
||||
<p>La entrada <a rel="nofollow" href="https://rodrigoramirez.com/crear-swap/">Añadir Swap a un sistema</a> aparece primero en <a rel="nofollow" href="https://rodrigoramirez.com">Rodrigo Ramírez Norambuena</a>.</p>
|
||||
]]></description>
|
||||
<content:encoded><![CDATA[<p>Algo que me toma generalmente hacer es cuando trabajo con maquina virtuales es asignar una cantidad determinada de Swap.</p>
|
||||
<p>La memoria swap es un espacio de intercambio en disco para cuando el sistema ya no puede utilizar más memoria RAM.</p>
|
||||
<p>El problema para mi es que algunos sistemas de maquinas virtuales no asignan por defecto un espacio para la Swap, lo que te lleva a que el sistema pueda tener crash durante la ejecución.</p>
|
||||
<p>Para comprobar la asignación de memoria, al ejecutar el comando <em>free</em> nos debería mostrar como algo similar a lo siguiente</p>
|
||||
<p> </p>
|
||||
<pre>$ free -m
|
||||
total used free shared buffers cached
|
||||
Mem: 494 488 6 1 54 75
|
||||
-/+ buffers/cache: 357 136
|
||||
Swap: 0 0 0</pre>
|
||||
<p>En la zona de swap indica que no asignada, valor 0.</p>
|
||||
<p>Para asignar swap al sistema se debe un archivo en disco para que sea utilizado como espacio de intercambio, en este caso lo vamos crear uno de 3GB en la raíz del sistema</p>
|
||||
<pre class="code-pre "><code>fallocate -l 3G /swapfile</code></pre>
|
||||
<p>Comprobamos que ha sido creado</p>
|
||||
<pre>$ ls -lh /swapfile
|
||||
-rw-r--r-- 1 root root 3.0G Jul 11 13:10 /swapfile
|
||||
</pre>
|
||||
<h3>Habilitación del archivo Swap</h3>
|
||||
<p>Ahora nos toca habilitar el archivo creado. Para eso le asignaremos los permisos</p>
|
||||
<pre>chmod 600 /swapfile</pre>
|
||||
<p>Lo siguiente es para convertir el archivo para swap</p>
|
||||
<pre>mkswap /swapfile</pre>
|
||||
<p>Para habilitar y asignarla eso como memoria swap al sistema usamos</p>
|
||||
<pre>swapon /swapfile</pre>
|
||||
<p>Ya con esto podrémos ver en nuestro sistema la memoria asignada para swap</p>
|
||||
<pre>$ free -m
|
||||
total used free shared buffers cached
|
||||
Mem: 494 486 7 1 51 77
|
||||
-/+ buffers/cache: 358 136
|
||||
Swap: 3071 0 3071</pre>
|
||||
<p> </p>
|
||||
<p>Para que al reiniciar el sistema esto se mantenga, debemos agregar la siguiente línea al archivo /etc/fstab</p>
|
||||
<pre><span class="pl-s">/swapfile none swap sw 0 0</span></pre>
|
||||
<p> </p>
|
||||
<p>Podemos editar /etc/fstab con algún editor como vim, nano o podemos agregar la linea directamente en la desde la cli de la siguiente manera</p>
|
||||
<pre><span class="pl-c1">echo</span> <span class="pl-s"><span class="pl-pds">"</span>/swapfile none swap sw 0 0<span class="pl-pds">"</span></span> <span class="pl-k">>></span> /etc/fstab</pre>
|
||||
<p> </p>
|
||||
<p> </p>
|
||||
<p>La entrada <a rel="nofollow" href="https://rodrigoramirez.com/crear-swap/">Añadir Swap a un sistema</a> aparece primero en <a rel="nofollow" href="https://rodrigoramirez.com">Rodrigo Ramírez Norambuena</a>.</p>
|
||||
]]></content:encoded>
|
||||
<wfw:commentRss>https://rodrigoramirez.com/crear-swap/feed/</wfw:commentRss>
|
||||
<slash:comments>0</slash:comments>
|
||||
</item>
|
||||
<item>
|
||||
<title>QPanel 0.10.0 con vista consolidada</title>
|
||||
<link>https://rodrigoramirez.com/qpanel-0-10-0-vista-consolidada/</link>
|
||||
<comments>https://rodrigoramirez.com/qpanel-0-10-0-vista-consolidada/#respond</comments>
|
||||
<pubDate>Mon, 20 Jun 2016 19:32:55 +0000</pubDate>
|
||||
<dc:creator><![CDATA[decipher]]></dc:creator>
|
||||
<category><![CDATA[Linux]]></category>
|
||||
<category><![CDATA[app_queue]]></category>
|
||||
<category><![CDATA[asterisk]]></category>
|
||||
<category><![CDATA[FreeSWITCH]]></category>
|
||||
<category><![CDATA[qpanel]]></category>
|
||||
<category><![CDATA[queue]]></category>
|
||||
|
||||
<guid isPermaLink="false">https://rodrigoramirez.com/?p=1227</guid>
|
||||
<description><![CDATA[<p>Ya con la release numero 28 la nueva versión 0.10.0 de QPanel ya está disponible. Para instalar esta nueva versión, debes visitar la siguiente URL https://github.com/roramirez/qpanel/tree/0.10.0 Esta versión versión nos preocupamos de realizar mejoras, refactorizaciones y agregamos una nueva funcionalidad. La nueva funcionalidad incluida es que ahora es posible contar con una vista consolidada para […]</p>
|
||||
<p>La entrada <a rel="nofollow" href="https://rodrigoramirez.com/qpanel-0-10-0-vista-consolidada/">QPanel 0.10.0 con vista consolidada</a> aparece primero en <a rel="nofollow" href="https://rodrigoramirez.com">Rodrigo Ramírez Norambuena</a>.</p>
|
||||
]]></description>
|
||||
<content:encoded><![CDATA[<p><img class="alignleft" src="https://raw.githubusercontent.com/roramirez/qpanel/0.10.0/samples/animation.gif" alt="Panel monitor callcenter | Qpanel Monitor Colas" width="403" height="227" />Ya con la release numero 28 la nueva versión 0.10.0 de QPanel ya está disponible.</p>
|
||||
<p>Para instalar esta nueva versión, debes visitar la siguiente URL</p>
|
||||
<ul>
|
||||
<li><a href="https://github.com/roramirez/qpanel/tree/0.10.0">https://github.com/roramirez/qpanel/tree/0.10.0</a></li>
|
||||
</ul>
|
||||
<p>Esta versión versión nos preocupamos de realizar mejoras, refactorizaciones y agregamos una nueva funcionalidad.</p>
|
||||
<p>La nueva funcionalidad incluida es que ahora es posible contar con una vista consolidada para la información de todas las colas. Que hace tener un mejor control y visualización de lo que está pasando en las colas.</p>
|
||||
<p>El proyecto siempre está abierto a nuevas sugerencias las cuales puedes agregar mediante un <a href="https://github.com/roramirez/qpanel/issues/new?title=[Feature]">issue</a>.</p>
|
||||
<p>La entrada <a rel="nofollow" href="https://rodrigoramirez.com/qpanel-0-10-0-vista-consolidada/">QPanel 0.10.0 con vista consolidada</a> aparece primero en <a rel="nofollow" href="https://rodrigoramirez.com">Rodrigo Ramírez Norambuena</a>.</p>
|
||||
]]></content:encoded>
|
||||
<wfw:commentRss>https://rodrigoramirez.com/qpanel-0-10-0-vista-consolidada/feed/</wfw:commentRss>
|
||||
<slash:comments>0</slash:comments>
|
||||
</item>
|
||||
<item>
|
||||
<title>Nerdearla 2016, WebRTC Glue</title>
|
||||
<link>https://rodrigoramirez.com/nerdearla-2016/</link>
|
||||
<comments>https://rodrigoramirez.com/nerdearla-2016/#respond</comments>
|
||||
<pubDate>Wed, 15 Jun 2016 17:55:41 +0000</pubDate>
|
||||
<dc:creator><![CDATA[decipher]]></dc:creator>
|
||||
<category><![CDATA[Linux]]></category>
|
||||
<category><![CDATA[baires]]></category>
|
||||
<category><![CDATA[charla]]></category>
|
||||
<category><![CDATA[Computación]]></category>
|
||||
<category><![CDATA[informatica]]></category>
|
||||
<category><![CDATA[tech]]></category>
|
||||
<category><![CDATA[ti]]></category>
|
||||
<category><![CDATA[webrtc]]></category>
|
||||
|
||||
<guid isPermaLink="false">https://rodrigoramirez.com/?p=1218</guid>
|
||||
<description><![CDATA[<p>Días atrás estuve participando en el evento llamado Nerdearla en Buenos Aires. El ambiente era genial si eres de esas personas que desde niño sintio curiosidad por ver como funcionan las cosas, donde desarmabas para volver armar lo juguetes. Habían muchas cosas interesantes tanto en las presentaciones, co-working y workshop que se hubieron. Si te […]</p>
|
||||
<p>La entrada <a rel="nofollow" href="https://rodrigoramirez.com/nerdearla-2016/">Nerdearla 2016, WebRTC Glue</a> aparece primero en <a rel="nofollow" href="https://rodrigoramirez.com">Rodrigo Ramírez Norambuena</a>.</p>
|
||||
]]></description>
|
||||
<content:encoded><![CDATA[<p>Días atrás estuve participando en el evento llamado <a href="http://nerdear.la/">Nerdearla</a> en Buenos Aires. El ambiente era genial si eres de esas personas que desde niño sintio curiosidad por ver como funcionan las cosas, donde desarmabas para volver armar lo juguetes.</p>
|
||||
<p>Habían muchas cosas interesantes tanto en las presentaciones, co-working y workshop que se hubieron. Si te lo perdiste te recomiendo que estés pendiente para el proximo año.</p>
|
||||
<p> </p>
|
||||
<p>Te podias encontrar con una nuestra como esta<a href="https://rodrigoramirez.com/wp-content/uploads/CkhnO83XAAAfaxS.jpg"><img class="aligncenter size-medium wp-image-1221" src="https://rodrigoramirez.com/wp-content/uploads/CkhnO83XAAAfaxS-300x169.jpg" alt="Kaypro II" width="300" height="169" srcset="https://rodrigoramirez.com/wp-content/uploads/CkhnO83XAAAfaxS-300x169.jpg 300w, https://rodrigoramirez.com/wp-content/uploads/CkhnO83XAAAfaxS-768x432.jpg 768w, https://rodrigoramirez.com/wp-content/uploads/CkhnO83XAAAfaxS-1024x576.jpg 1024w, https://rodrigoramirez.com/wp-content/uploads/CkhnO83XAAAfaxS.jpg 1200w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
|
||||
<p>Puedes dar un vistaso a lo registrado por algunos <a href="https://twitter.com/hashtag/nerdearla?f=tweets&vertical=default&src=hash">usuarios en Twitter</a></p>
|
||||
<p>El primer día hice un workshop denominado WebRTC Glue, donde muestra como hacer como unificar la experiencia de atención del centro de contacto directamente en la web. Es una presentación práctica donde puedes ver los ejemplos y usarlos como gustes. Están en <a href="https://gitlab.com/roramirez/webrtc-glue">el repositorio en Gitlab</a>. La presentación <a href="/charlas/webrtc-glue/index.html">la puedes ver aquí</a></p>
|
||||
<p> </p>
|
||||
<p><a href="https://rodrigoramirez.com/wp-content/uploads/CkhxulgWYAAp7fW.jpg"><img class="aligncenter size-medium wp-image-1222" src="https://rodrigoramirez.com/wp-content/uploads/CkhxulgWYAAp7fW-300x169.jpg" alt="WebRTC Glue" width="300" height="169" srcset="https://rodrigoramirez.com/wp-content/uploads/CkhxulgWYAAp7fW-300x169.jpg 300w, https://rodrigoramirez.com/wp-content/uploads/CkhxulgWYAAp7fW-768x432.jpg 768w, https://rodrigoramirez.com/wp-content/uploads/CkhxulgWYAAp7fW-1024x576.jpg 1024w, https://rodrigoramirez.com/wp-content/uploads/CkhxulgWYAAp7fW.jpg 1200w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
|
||||
<p>Haber si nos vemos el próximo año.</p>
|
||||
<p> </p>
|
||||
<p><strong>Update</strong>: Puedes ver una parte sin la demostración del workshop</p>
|
||||
<p><iframe src="https://www.youtube.com/embed/qDreeYk-UK4?list=PLTTdzfRyGY1vQukK8L4QeAfYdbURSzFq5" width="560" height="315" frameborder="0" allowfullscreen="allowfullscreen"></iframe><br />
|
||||
</p>
|
||||
<p>La entrada <a rel="nofollow" href="https://rodrigoramirez.com/nerdearla-2016/">Nerdearla 2016, WebRTC Glue</a> aparece primero en <a rel="nofollow" href="https://rodrigoramirez.com">Rodrigo Ramírez Norambuena</a>.</p>
|
||||
]]></content:encoded>
|
||||
<wfw:commentRss>https://rodrigoramirez.com/nerdearla-2016/feed/</wfw:commentRss>
|
||||
<slash:comments>0</slash:comments>
|
||||
</item>
|
||||
<item>
|
||||
<title>QPanel 0.9.0</title>
|
||||
<link>https://rodrigoramirez.com/qpanel-0-9-0/</link>
|
||||
<comments>https://rodrigoramirez.com/qpanel-0-9-0/#respond</comments>
|
||||
<pubDate>Mon, 09 May 2016 18:40:23 +0000</pubDate>
|
||||
<dc:creator><![CDATA[decipher]]></dc:creator>
|
||||
<category><![CDATA[Software]]></category>
|
||||
<category><![CDATA[asterisk]]></category>
|
||||
<category><![CDATA[callcenter]]></category>
|
||||
<category><![CDATA[colas]]></category>
|
||||
<category><![CDATA[monitor]]></category>
|
||||
<category><![CDATA[monitoreo]]></category>
|
||||
<category><![CDATA[panel]]></category>
|
||||
<category><![CDATA[qpanel]]></category>
|
||||
<category><![CDATA[queues]]></category>
|
||||
|
||||
<guid isPermaLink="false">http://rodrigoramirez.com/?p=1206</guid>
|
||||
<description><![CDATA[<p>El Panel monitor callcenter para colas de Asterisk ya cuenta con una nueva versión, la 0.9.0 Para instalar esta nueva versión, debes visitar la siguiente URL https://github.com/roramirez/qpanel/tree/0.9.0 Esta versión versión nos preocupamos de realizar mejoras y refactorizaciones en el codigo para dar un mejor rendimiento, como también de la compatibilidad con la versión 11 de […]</p>
|
||||
<p>La entrada <a rel="nofollow" href="https://rodrigoramirez.com/qpanel-0-9-0/">QPanel 0.9.0</a> aparece primero en <a rel="nofollow" href="https://rodrigoramirez.com">Rodrigo Ramírez Norambuena</a>.</p>
|
||||
]]></description>
|
||||
<content:encoded><![CDATA[<p><img class="alignleft" src="https://raw.githubusercontent.com/roramirez/qpanel/0.9.0/samples/animation.gif" alt="Panel monitor callcenter | Qpanel Monitor Colas" width="403" height="227" />El Panel monitor callcenter para colas de Asterisk ya cuenta con una nueva versión, la 0.9.0</p>
|
||||
<p>Para instalar esta nueva versión, debes visitar la siguiente URL</p>
|
||||
<ul>
|
||||
<li><a href="https://github.com/roramirez/qpanel/tree/0.9.0">https://github.com/roramirez/qpanel/tree/0.9.0</a></li>
|
||||
</ul>
|
||||
<p>Esta versión versión nos preocupamos de realizar mejoras y refactorizaciones en el codigo para dar un mejor rendimiento, como también de la compatibilidad con la versión 11 de Asterisk.</p>
|
||||
<p>Dentro de las cosas que podamos mencionar:</p>
|
||||
<ul>
|
||||
<li> Actualización del repositorio y versión de py-asterisk, biblioteca para trabajar con Asterisk. Acá la ocupamos principalmente para uso del Manager.</li>
|
||||
<li>Portación de parche de funcionalidades como pausa, tiempo, razón de una pausa para Asterisk 11.</li>
|
||||
<li>Cambio del comportamiento en el conteo cuando el participante en una cola está ocupado (busy)</li>
|
||||
</ul>
|
||||
<p>El proyecto siempre está abierto a nuevas sugerencias las cuales puedes agregar mediante un <a href="https://github.com/roramirez/qpanel/issues/new?title=[Feature]">issue</a>.</p>
|
||||
<p>La entrada <a rel="nofollow" href="https://rodrigoramirez.com/qpanel-0-9-0/">QPanel 0.9.0</a> aparece primero en <a rel="nofollow" href="https://rodrigoramirez.com">Rodrigo Ramírez Norambuena</a>.</p>
|
||||
]]></content:encoded>
|
||||
<wfw:commentRss>https://rodrigoramirez.com/qpanel-0-9-0/feed/</wfw:commentRss>
|
||||
<slash:comments>0</slash:comments>
|
||||
</item>
|
||||
<item>
|
||||
<title>Mandar un email desde la shell</title>
|
||||
<link>https://rodrigoramirez.com/mandar-un-email-desde-la-shell/</link>
|
||||
<comments>https://rodrigoramirez.com/mandar-un-email-desde-la-shell/#comments</comments>
|
||||
<pubDate>Wed, 13 Apr 2016 13:05:13 +0000</pubDate>
|
||||
<dc:creator><![CDATA[decipher]]></dc:creator>
|
||||
<category><![CDATA[Linux]]></category>
|
||||
<category><![CDATA[mini-tips]]></category>
|
||||
<category><![CDATA[bash]]></category>
|
||||
<category><![CDATA[cli]]></category>
|
||||
<category><![CDATA[Email]]></category>
|
||||
<category><![CDATA[mail]]></category>
|
||||
<category><![CDATA[sh]]></category>
|
||||
<category><![CDATA[shell]]></category>
|
||||
|
||||
<guid isPermaLink="false">http://rodrigoramirez.com/?p=1172</guid>
|
||||
<description><![CDATA[<p>Dejo esto por acá ya que es algo que siempre me olvido como es. El tema es enviar un email mediante el comando mail en un servidor con Linux. Si usas mail a secas te va pidiendo los datos para crear el correo, principalmente el body del correo. Para automatizar esto a través de un […]</p>
|
||||
<p>La entrada <a rel="nofollow" href="https://rodrigoramirez.com/mandar-un-email-desde-la-shell/">Mandar un email desde la shell</a> aparece primero en <a rel="nofollow" href="https://rodrigoramirez.com">Rodrigo Ramírez Norambuena</a>.</p>
|
||||
]]></description>
|
||||
<content:encoded><![CDATA[<p>Dejo esto por acá ya que es algo que siempre me olvido como es. El tema es enviar un email mediante el comando <em>mail</em> en un servidor con Linux.</p>
|
||||
<p>Si usas mail a secas te va pidiendo los datos para crear el correo, principalmente el body del correo. Para automatizar esto a través de un <em>echo</em> le pasas por pipe a <em>mail</em></p>
|
||||
<pre>echo "Cuerpo del mensaje" | mail -s Asunto a@rodrigoramirez.com</pre>
|
||||
<p>La entrada <a rel="nofollow" href="https://rodrigoramirez.com/mandar-un-email-desde-la-shell/">Mandar un email desde la shell</a> aparece primero en <a rel="nofollow" href="https://rodrigoramirez.com">Rodrigo Ramírez Norambuena</a>.</p>
|
||||
]]></content:encoded>
|
||||
<wfw:commentRss>https://rodrigoramirez.com/mandar-un-email-desde-la-shell/feed/</wfw:commentRss>
|
||||
<slash:comments>4</slash:comments>
|
||||
</item>
|
||||
</channel>
|
||||
</rss>
|
@ -1,4 +1,4 @@
|
||||
/* Magic Mirror Test config for default compliments
|
||||
/* Magic Mirror Test config for default compliments
|
||||
*
|
||||
* By Rodrigo Ramírez Norambuena https://rodrigoramirez.com
|
||||
* MIT Licensed.
|
||||
|
38
tests/configs/modules/newsfeed/default.js
Normal file
38
tests/configs/modules/newsfeed/default.js
Normal file
@ -0,0 +1,38 @@
|
||||
/* Magic Mirror Test config newsfeed module
|
||||
*
|
||||
* By Rodrigo Ramírez Norambuena https://rodrigoramirez.com
|
||||
* MIT Licensed.
|
||||
*/
|
||||
|
||||
var config = {
|
||||
port: 8080,
|
||||
ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"],
|
||||
|
||||
language: "en",
|
||||
timeFormat: 12,
|
||||
units: "metric",
|
||||
electronOptions: {
|
||||
webPreferences: {
|
||||
nodeIntegration: true,
|
||||
},
|
||||
},
|
||||
|
||||
modules: [
|
||||
{
|
||||
|
||||
module: "newsfeed",
|
||||
position: "bottom_bar",
|
||||
config: {
|
||||
feeds: [
|
||||
{
|
||||
title: "Rodrigo Ramirez Blog",
|
||||
url: "http://localhost:8080/tests/configs/data/feed_test_rodrigoramirez.xml"
|
||||
},
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
/*************** DO NOT EDIT THE LINE BELOW ***************/
|
||||
if (typeof module !== "undefined") {module.exports = config;}
|
@ -24,8 +24,8 @@ var config = {
|
||||
// Using exotic content. This is why dont accept go to JSON configuration file
|
||||
(function() {
|
||||
var positions = ["top_bar", "top_left", "top_center", "top_right", "upper_third",
|
||||
"middle_center", "lower_third", "bottom_left", "bottom_center", "bottom_right",
|
||||
"bottom_bar", "fullscreen_above", "fullscreen_below"];
|
||||
"middle_center", "lower_third", "bottom_left", "bottom_center", "bottom_right",
|
||||
"bottom_bar", "fullscreen_above", "fullscreen_below"];
|
||||
var modules = Array();
|
||||
for (idx in positions) {
|
||||
modules.push({
|
||||
|
@ -119,6 +119,16 @@ describe("Clock module", function () {
|
||||
return app.client.waitUntilWindowLoaded()
|
||||
.getText(".clock .week").should.eventually.match(weekRegex);
|
||||
});
|
||||
|
||||
it("shows week with correct number of week of year", function() {
|
||||
|
||||
it("FIXME: if the day is a sunday this not match");
|
||||
// const currentWeekNumber = require("current-week-number")();
|
||||
// const weekToShow = "Week " + currentWeekNumber;
|
||||
// return app.client.waitUntilWindowLoaded()
|
||||
// .getText(".clock .week").should.eventually.equal(weekToShow);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
28
tests/e2e/modules/newsfeed_spec.js
Normal file
28
tests/e2e/modules/newsfeed_spec.js
Normal file
@ -0,0 +1,28 @@
|
||||
const globalSetup = require("../global-setup");
|
||||
const app = globalSetup.app;
|
||||
const chai = require("chai");
|
||||
const expect = chai.expect;
|
||||
|
||||
describe("Newsfeed module", function () {
|
||||
|
||||
this.timeout(20000);
|
||||
|
||||
beforeEach(function (done) {
|
||||
app.start().then(function() { done(); } );
|
||||
});
|
||||
|
||||
afterEach(function (done) {
|
||||
app.stop().then(function() { done(); });
|
||||
});
|
||||
|
||||
describe("Default configuration", function() {
|
||||
|
||||
before(function() {
|
||||
process.env.MM_CONFIG_FILE = "tests/configs/modules/newsfeed/default.js";
|
||||
});
|
||||
|
||||
it("show title newsfeed", function () {
|
||||
return app.client.waitUntilTextExists(".newsfeed .small", "Rodrigo Ramirez Blog", 10000).should.be.fulfilled;
|
||||
});
|
||||
});
|
||||
});
|
36
tests/e2e/vendor_spec.js
Normal file
36
tests/e2e/vendor_spec.js
Normal file
@ -0,0 +1,36 @@
|
||||
const globalSetup = require("./global-setup");
|
||||
const app = globalSetup.app;
|
||||
const request = require("request");
|
||||
const chai = require("chai");
|
||||
const expect = chai.expect;
|
||||
|
||||
|
||||
describe("Vendors", function () {
|
||||
|
||||
this.timeout(20000);
|
||||
|
||||
beforeEach(function (done) {
|
||||
app.start().then(function() { done(); } );
|
||||
});
|
||||
|
||||
afterEach(function (done) {
|
||||
app.stop().then(function() { done(); });
|
||||
});
|
||||
|
||||
describe("Get list vendors", function () {
|
||||
|
||||
before(function() {
|
||||
process.env.MM_CONFIG_FILE = "tests/configs/env.js";
|
||||
});
|
||||
|
||||
var vendors = require(__dirname + "/../../vendor/vendor.js");
|
||||
Object.keys(vendors).forEach(vendor => {
|
||||
it(`should return 200 HTTP code for vendor "${vendor}"`, function() {
|
||||
urlVendor = "http://localhost:8080/vendor/" + vendors[vendor];
|
||||
request.get(urlVendor, function (err, res, body) {
|
||||
expect(res.statusCode).to.equal(200);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
36
tests/unit/functions/calendar_spec.js
Normal file
36
tests/unit/functions/calendar_spec.js
Normal file
@ -0,0 +1,36 @@
|
||||
var fs = require("fs");
|
||||
var path = require("path");
|
||||
var chai = require("chai");
|
||||
var expect = chai.expect;
|
||||
var vm = require("vm");
|
||||
|
||||
|
||||
describe("Functions into modules/default/calendar/calendar.js", function() {
|
||||
|
||||
// Fake for use by calendar.js
|
||||
Module = {}
|
||||
Module.definitions = {};
|
||||
Module.register = function (name, moduleDefinition) {
|
||||
Module.definitions[name] = moduleDefinition;
|
||||
};
|
||||
|
||||
// load calendar.js
|
||||
require("../../../modules/default/calendar/calendar.js");
|
||||
|
||||
describe("capFirst", function() {
|
||||
words = {
|
||||
"rodrigo": "Rodrigo",
|
||||
"123m": "123m",
|
||||
"magic mirror": "Magic mirror",
|
||||
",a": ",a",
|
||||
"ñandú": "Ñandú"
|
||||
};
|
||||
|
||||
Object.keys(words).forEach(word => {
|
||||
it(`for ${word} should return ${words[word]}`, function() {
|
||||
expect(Module.definitions.calendar.capFirst(word)).to.equal(words[word]);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
66
tests/unit/global_vars/defaults_modules_spec.js
Normal file
66
tests/unit/global_vars/defaults_modules_spec.js
Normal file
@ -0,0 +1,66 @@
|
||||
var fs = require("fs");
|
||||
var path = require("path");
|
||||
var chai = require("chai");
|
||||
var expect = chai.expect;
|
||||
var vm = require("vm");
|
||||
|
||||
before(function() {
|
||||
var basedir = path.join(__dirname, "../../..");
|
||||
|
||||
var fileName = "js/app.js";
|
||||
var filePath = path.join(basedir, fileName);
|
||||
var code = fs.readFileSync(filePath);
|
||||
|
||||
this.sandbox = {
|
||||
module: {},
|
||||
__dirname: path.dirname(filePath),
|
||||
global: {},
|
||||
console: {
|
||||
log: function() { /*console.log("console.log(", arguments, ")");*/ }
|
||||
},
|
||||
process: {
|
||||
on: function() { /*console.log("process.on called with: ", arguments);*/ },
|
||||
env: {}
|
||||
}
|
||||
};
|
||||
|
||||
this.sandbox.require = function(filename) {
|
||||
// This modifies the global slightly,
|
||||
// but supplies vm with essential code
|
||||
return require(filename);
|
||||
};
|
||||
|
||||
vm.runInNewContext(code, this.sandbox, fileName);
|
||||
});
|
||||
|
||||
after(function() {
|
||||
//console.log(global);
|
||||
});
|
||||
|
||||
describe("Default modules set in modules/default/defaultmodules.js", function() {
|
||||
|
||||
var expectedDefaultModules = [
|
||||
"alert",
|
||||
"calendar",
|
||||
"clock",
|
||||
"compliments",
|
||||
"currentweather",
|
||||
"helloworld",
|
||||
"newsfeed",
|
||||
"weatherforecast",
|
||||
"updatenotification"
|
||||
];
|
||||
|
||||
expectedDefaultModules.forEach(defaultModule => {
|
||||
it(`contains default module "${defaultModule}"`, function() {
|
||||
expect(this.sandbox.defaultModules).to.include(defaultModule);
|
||||
});
|
||||
});
|
||||
|
||||
expectedDefaultModules.forEach(defaultModule => {
|
||||
it(`contains a folder for modules/default/${defaultModule}"`, function() {
|
||||
expect(fs.existsSync(path.join(this.sandbox.global.root_path, "modules/default", defaultModule))).to.equal(true);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
@ -63,8 +63,8 @@ describe("'global.root_path' set in js/app.js", function() {
|
||||
});
|
||||
|
||||
it("should expect the global.version equals package.json file", function() {
|
||||
version_package = JSON.parse(fs.readFileSync("package.json", "utf8")).version;
|
||||
expect(this.sandbox.global.version).to.equal(version_package);
|
||||
versionPackage = JSON.parse(fs.readFileSync("package.json", "utf8")).version;
|
||||
expect(this.sandbox.global.version).to.equal(versionPackage);
|
||||
});
|
||||
|
||||
});
|
||||
|
@ -7,6 +7,8 @@
|
||||
"RUNNING": "noch",
|
||||
"EMPTY": "Keine Termine.",
|
||||
|
||||
"WEEK": "Woche",
|
||||
|
||||
"N": "N",
|
||||
"NNE": "NNO",
|
||||
"NE": "NO",
|
||||
|
@ -4,7 +4,7 @@
|
||||
"TODAY": "Tänään",
|
||||
"TOMORROW": "Huomenna",
|
||||
"DAYAFTERTOMORROW": "Ylihuomenna",
|
||||
"RUNNING": "Meneillään",
|
||||
"RUNNING": "Päättyy {timeUntilEnd} päästä",
|
||||
"EMPTY": "Ei tulevia tapahtumia.",
|
||||
|
||||
"N": "P",
|
||||
|
@ -7,6 +7,8 @@
|
||||
"RUNNING": "Slutter om",
|
||||
"EMPTY": "Ingen kommende arrangementer.",
|
||||
|
||||
"WEEK": "Uke",
|
||||
|
||||
"N": "N",
|
||||
"NNE": "NNØ",
|
||||
"NE": "NØ",
|
||||
@ -24,7 +26,7 @@
|
||||
"NW": "NV",
|
||||
"NNW": "NNV",
|
||||
|
||||
"UPDATE_NOTIFICATION": "MagicMirror² oppdatering er tilgjengelig.",
|
||||
"UPDATE_NOTIFICATION": "MagicMirror²-oppdatering er tilgjengelig.",
|
||||
"UPDATE_NOTIFICATION_MODULE": "Oppdatering tilgjengelig for modulen MODULE_NAME.",
|
||||
"UPDATE_INFO": "Nåværende installasjon er COMMIT_COUNT bak BRANCH_NAME grenen."
|
||||
}
|
||||
|
@ -3,9 +3,12 @@
|
||||
|
||||
"TODAY": "Dziś",
|
||||
"TOMORROW": "Jutro",
|
||||
"DAYAFTERTOMORROW": "Pojutrze",
|
||||
"RUNNING": "Koniec za",
|
||||
"EMPTY": "Brak wydarzeń.",
|
||||
|
||||
"WEEK": "Tydzień",
|
||||
|
||||
"N": "N",
|
||||
"NNE": "NNE",
|
||||
"NE": "NE",
|
||||
|
32
translations/ro.json
Normal file
32
translations/ro.json
Normal file
@ -0,0 +1,32 @@
|
||||
{
|
||||
"LOADING": "Se încarcă …",
|
||||
|
||||
"TODAY": "Astăzi",
|
||||
"TOMORROW": "Mâine",
|
||||
"DAYAFTERTOMORROW": "Poimâine",
|
||||
"RUNNING": "Se termină în",
|
||||
"EMPTY": "Nici un eveniment.",
|
||||
|
||||
"WEEK": "Săptămâna",
|
||||
|
||||
"N": "N",
|
||||
"NNE": "NNE",
|
||||
"NE": "NE",
|
||||
"ENE": "ENE",
|
||||
"E": "E",
|
||||
"ESE": "ESE",
|
||||
"SE": "SE",
|
||||
"SSE": "SSE",
|
||||
"S": "S",
|
||||
"SSW": "SSW",
|
||||
"SW": "SW",
|
||||
"WSW": "WSW",
|
||||
"W": "W",
|
||||
"WNW": "WNW",
|
||||
"NW": "NW",
|
||||
"NNW": "NNW",
|
||||
|
||||
"UPDATE_NOTIFICATION": "Un update este disponibil pentru MagicMirror².",
|
||||
"UPDATE_NOTIFICATION_MODULE": "Un update este disponibil pentru modulul MODULE_NAME.",
|
||||
"UPDATE_INFO": "Există COMMIT_COUNT commit-uri noi pe branch-ul BRANCH_NAME."
|
||||
}
|
@ -7,6 +7,8 @@
|
||||
"RUNNING": "Заканчивается через",
|
||||
"EMPTY": "Нет предстоящих событий",
|
||||
|
||||
"WEEK": "Неделя",
|
||||
|
||||
"N": "С",
|
||||
"NNE": "ССВ",
|
||||
"NE": "СВ",
|
||||
|
@ -1,9 +1,9 @@
|
||||
{
|
||||
"LOADING": "Laddar …",
|
||||
|
||||
"TODAY": "Idag",
|
||||
"TOMORROW": "Imorgon",
|
||||
"DAYAFTERTOMORROW": "Iövermorgon",
|
||||
"TODAY": "I dag",
|
||||
"TOMORROW": "I morgon",
|
||||
"DAYAFTERTOMORROW": "I övermorgon",
|
||||
"RUNNING": "Slutar",
|
||||
"EMPTY": "Inga kommande händelser.",
|
||||
|
||||
|
@ -33,6 +33,7 @@ var translations = {
|
||||
"is" : "translations/is.json", // Icelandic
|
||||
"et" : "translations/et.json", // Estonian
|
||||
"kr" : "translations/kr.json", // Korean
|
||||
"ro" : "translations/ro.json", // Romanian
|
||||
};
|
||||
|
||||
if (typeof module !== "undefined") {module.exports = translations;}
|
||||
|
2
vendor/vendor.js
vendored
2
vendor/vendor.js
vendored
@ -14,3 +14,5 @@ var vendor = {
|
||||
"weather-icons-wind.css": "node_modules/weathericons/css/weather-icons-wind.css",
|
||||
"font-awesome.css": "node_modules/font-awesome/css/font-awesome.min.css"
|
||||
};
|
||||
|
||||
if (typeof module !== "undefined"){module.exports = vendor;}
|
||||
|
Loading…
x
Reference in New Issue
Block a user