Skip to content
This repository has been archived by the owner on Jan 2, 2025. It is now read-only.

2.0.0 #3

Merged
merged 59 commits into from
Aug 12, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
71e4dca
Add babel-cli to dependencies.
lesander Jan 18, 2017
cda7ee9
Add Babel presets and plugins.
lesander Jan 18, 2017
53e3f9d
Ignore correct directories.
lesander Jan 18, 2017
989337b
Add more babel dependencies.
lesander Jan 18, 2017
1037e41
Update dependencies and babelrc
lesander Feb 16, 2017
1e1ba41
Update tests.
lesander Apr 1, 2017
7a7aa98
Update source comment headers.
lesander Apr 1, 2017
0fa843b
Use xml2json promise package.
lesander Apr 1, 2017
fa80210
Add unhandled rejection handler.
lesander Apr 1, 2017
b8d9f9e
Use specific directory.
lesander Apr 1, 2017
f4875a4
Improve getting started section.
lesander Apr 1, 2017
eb5138f
Add callmonitor prototype
lesander Apr 1, 2017
3dec4cc
Update test files to use await/async methods.
lesander Apr 2, 2017
561e4ed
Add call monitor port to default configuration
lesander Apr 2, 2017
9bc6f65
Rewrite src to async/await
lesander Apr 2, 2017
b0e1698
Update completion badge.
lesander Apr 2, 2017
ad50d3f
Update package versions and add local test command.
lesander Apr 2, 2017
501da7a
Merge branch 'master' into 2.0.0
lesander Apr 4, 2017
4f56f39
Update readme files.
lesander Apr 4, 2017
2754195
Standard --fix
lesander Apr 5, 2017
8e02b0b
Comply with StandardJS style
lesander Apr 5, 2017
eb1c676
Remove build and publish scripts for now.
lesander Apr 5, 2017
169d21d
Forget about babel for now.
lesander Apr 5, 2017
165235b
Add command example.
lesander Apr 5, 2017
9a0fe4d
Update basic example in documentation.
lesander Apr 5, 2017
990dd94
Fix typo.
lesander Apr 5, 2017
bae8b64
Add working CallMonitor.
lesander Apr 13, 2017
daea1f8
Add test for dialNumber.
lesander Apr 13, 2017
345f684
Apply StandardJS fixes.
lesander Apr 13, 2017
627ca69
Correctly exit test if encountered error.
lesander Apr 14, 2017
a722f9b
Moved version getters to fritzSystem module.
lesander Apr 14, 2017
1668d43
Improve handling of unhandled Promise rejections.
lesander Apr 14, 2017
75ddf57
Move callMonitor to fritzFon module.
lesander Apr 14, 2017
1fe8b09
Fix calls to version functions.
lesander Apr 14, 2017
9834694
Actually remove version functions from fritzLogin
lesander Apr 14, 2017
bc768c2
Make codebase compatible with JSDoc
lesander Apr 14, 2017
0f1b65c
Check for phoneNumber parameter.
lesander Apr 14, 2017
6fa9531
Return correct error object.
lesander Apr 14, 2017
57fa6d7
Remove old lib reference.
lesander Apr 14, 2017
49261ea
Add StandardJS and JSDoc tests.
lesander Apr 14, 2017
b26354d
Standard --fix
lesander Apr 14, 2017
d268511
Add build-docs nom command.
lesander Apr 14, 2017
1210942
Add API documentation website
lesander Apr 14, 2017
527eeee
2.0.0
lesander Apr 14, 2017
2102516
Ignore docs for StandardJS
lesander Apr 14, 2017
8139897
Set completion status to 70%
lesander Apr 14, 2017
caa6b8f
Ignore Jekyll site build folder.
lesander Apr 24, 2017
a0685a2
Add documentation watch command to package.json
lesander Apr 24, 2017
0cbf6c1
Fix legal sentence
lesander Apr 24, 2017
629fe6f
Update docs.
lesander Apr 24, 2017
6e9a110
Add link to docs.
lesander Apr 24, 2017
601ce8b
Update text on version requirements of NodeJS.
lesander Aug 1, 2017
b39c5d4
Fix #4
lesander Aug 12, 2017
1daf405
Standard --fix
lesander Aug 12, 2017
1de0826
Migrate to Buffer.from
lesander Aug 12, 2017
926729d
Add a simple landing page for the project.
lesander Aug 12, 2017
798c61b
Add Migrating section to readme.
lesander Aug 12, 2017
5f56767
re-arrange some readme parts.
lesander Aug 12, 2017
edc2539
Add note about storage of the SID.
lesander Aug 12, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"presets": ["es2015", "stage-0"],
"plugins": [
["transform-runtime", {
"polyfill": false,
"regenerator": true
}]
]
}
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,9 @@ calls.json

# Ignore research files.
research/

# Ignore lib file.
lib/

# Ignore Jekyll site folder.
_site/
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
src/
24 changes: 16 additions & 8 deletions DOCS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Documentation

**Documentation is outdated and still a work in progress. This is expected to be finished by release v2.1.0**

Every call to any `fritz` function should include the `options` object. The domain (or IP address) can differ with your local network setup. If your Fritz!Box does not require a username while logging in, you can simply leave that field blank.
```js
{
Expand All @@ -10,15 +12,21 @@ Every call to any `fritz` function should include the `options` object. The doma
}
```

All functions of the FritzBox.js API are [Promise](http://www.datchley.name/es6-promises)-based.
All functions of the FritzBox.js API are ES7 [async/await](https://davidwalsh.name/async-generators#es7-async) Promise-based.

```js
fritz.functionName(parameter1, parameter2, ...)
.then((result) => {
// do something with the result.
})
.catch((error) => {
// do something with the error.
})
async function main() {
const result = await fritz.functionName(parameter1, parameter2, ...)

if (result.error) {
// deal with the error object.
return console.log(result.error.message)
}

// deal with the result object.
// ...
}
main()
```

## Available functions
Expand Down
27 changes: 27 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
FritzBox.js

MIT License

Copyright (c) 2017 Sander Laarhoven
Expand All @@ -19,3 +21,28 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

--------------------------------------------------------------------------------

fritzbox-callmonitor

The MIT License (MIT)

Copyright (c) 2013 Thorsten Basse

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
78 changes: 59 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,30 @@
# FritzBox.js
[![GitHub release](https://img.shields.io/github/release/lesander/fritzbox.js.svg?maxAge=1)]()
[![Completion Status](https://img.shields.io/badge/completion-45%25-yellowgreen.svg)]()
[![Completion Status](https://img.shields.io/badge/completion-70%25-green.svg)]()
[![Build Status](https://travis-ci.org/lesander/fritzbox.js.svg?branch=master&cache=pls)](https://travis-ci.org/lesander/fritzbox.js)

[![npm](https://img.shields.io/npm/dt/fritzbox.js.svg?maxAge=1)]()

[![Code Climate](https://codeclimate.com/github/lesander/fritzbox.js/badges/gpa.svg)](https://codeclimate.com/github/lesander/fritzbox.js)
[![BCH compliance](https://bettercodehub.com/edge/badge/lesander/fritzbox.js?maxAge=-1)](https://bettercodehub.com)

The most powerful, simple and complete [AVM](https://avm.de) Fritz!Box [API](https://avm.de/Schnittstellen).


The most powerful, simple and complete AVM Fritz!Box API. **This project is still a work in progress.** Written in Node.js
**This project is still a work in progress. [See issue #1 for the current status.](https://github.com/lesander/fritzbox.js/issues/1)**

## Getting Started
This module is written in ECMAscript 2015 [ES6](https://github.com/mjavascript/practical-es6) and is promise-based. You should use the latest version (`^7.0.0`) of NodeJS.
This module is future-proof and uses async/await promises.

This means that you need to run NodeJS version `7.6.0` or newer. If your NodeJS version is between `7.0.0` and `7.5.0` you can use the harmony flag `--harmony-async-await` to make use of the async/await promises.

This package was tested on Fritz!Box 7390 and 7490, with firmware versions `6.53`, `6.51` and `6.83`.

## Installing

This package was tested on Fritz!Box 7390 and 7490 with firmware versions `6.53` and `6.51`.
```
npm install fritzbox.js
```

## Usage

A simple example showing how to get the history of calls made with a [Fritz!Fon](https://en.avm.de/products/fritzfon) can be seen below.

```js
Expand All @@ -30,31 +35,66 @@ const options = {
server: 'fritz.box',
protocol: 'https' }

;(async () => {

const calls = await fritz.getCalls(options)
if (calls.error) return console.log('Error: ' + calls.error.message)
console.log('Got ' + calls.length + 'calls.')

})()
```

To minimize overhead and limit login requests made to the Fritz!Box it is recommended to store the SID once one has been obtained using [`fritz.getSessionId`](http://localhost:9000/api/#fritzLogin.getSessionId).

## Documentation
Want to get started with FritzBox.js? Cool! The API is
[documented and available here](https://lesander.github.io/fritzbox.js/api), and you can
[see some examples](/test) in the `test/` folder.

## Contributing
If you'd like to contribute to FritzBox.js, or file a bug or feature request,
please head over to [the issue tracker](/issues) or [open a pull request](/pulls).

## Migrating from 1.x.x to 2.x.x
FritzBox.js v2.x is not backwards compatible with v1.x.
One of the mayor changes includes the switch to `async/await` Promises.
In v1.x, Promises were implemented with a `then`, `catch`:

```js
fritz.getCalls(options)
.then((callHistory) => {
console.log(callHistory)
})
.catch((error) => {
console.log(error)
})
```

With v2.x, the `catch` will no longer catch any errors, since the module is now
built to provide support for `await`. Any errors will be passed along like this:

```js
fritz.getCalls(options)
.then((callHistory) => {
if (callHistory.error) return console.log(error)
console.log(callHistory)
})
```

## Documentation
Want to get started with FritzBox.js? Cool! The API is
[documented and available here](/DOCS.md), and you can
[see some examples](/test) in the `test/` folder.
Of course, this can be simplified using `await`:

## Contributing
If you'd like to contribute to FritzBox.js, or file a bug or feature request,
please head over to [the issue tracker](/issues) or [open a pull request](/pulls).
```js
let callHistory = await fritz.getCalls(options)
if (callHistory.error) return console.log(error)
console.log(callHistory)
```

Note that any Promise waiting to be fulfilled using `await` should be put inside an `async` function.

For more changes, please see the [roadmap](https://github.com/lesander/fritzbox.js/issues/1).

## License
This software is open-sourced under the MIT License ([see the LICENSE file for
the full license](/LICENSE)). So within some limits, you can do with the code whatever
you want. However, if you like and/or want to re-use it, I'd really appreciate
a reference to this project page.
the full license](/LICENSE)).

The software is provided as is. It might work as expected - or not.
Just don't blame me.
You are required to include a copy of this project's license and copyright notice in your modified or distributed version of FritzBox.js
4 changes: 4 additions & 0 deletions docs/_config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
version: '2.0.0'
collections:
- examples
highlighter: pygments
9 changes: 9 additions & 0 deletions docs/_includes/head.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">

<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,700">
<link rel="stylesheet" href="assets/css/prism.css">
<link rel="stylesheet" href="assets/css/toolkit.css">
<link rel="stylesheet" href="assets/css/stars.css">
<link rel="stylesheet" href="assets/css/theme.css">
2 changes: 2 additions & 0 deletions docs/_includes/scripts.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
<script src="/assets/js/toolkit.min.js"></script>
11 changes: 11 additions & 0 deletions docs/_layouts/default.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>{{ page.title }}</title>
{% include head.html %}
</head>
<body>
{{ content }}
</body>
{% include scripts.html %}
</html>
Loading