Skip to content

Commit

Permalink
'convert html entities appearing in probe response'
Browse files Browse the repository at this point in the history
  • Loading branch information
faithoflifedev committed May 7, 2023
1 parent f371467 commit 67c9db0
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 30 deletions.
26 changes: 7 additions & 19 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,50 +1,38 @@
# Changelog

## 2.1.2+8
## 2.1.2+9

strings aren't integers
convert html entities appearing in probe response

## 2.1.2+7
## 2.1.2+8

it's never easy
strings aren't integers

## 2.1.2+5

annotated_shelf was a big mistake

## 2.1.2+5

missed some changes

## 2.1.2+4

simple ws-proxy support

## 2.1.2+3

real meta fix

## 2.1.2+2

meta fix

## 2.1.2

The following helper methods have been added to the package:
* `Search` request suppot has been added (experimental)
* `Search` request support has been added (experimental)
* FindRecordings
* GetRecordingSearchResults
* GetRecordingInformation
* GetRecordingSummary
* `Imaging` request suppot has been added (experimental)
* `Imaging` request support has been added (experimental)
* GetCurrentPreset
* GetPresets
* GetServiceCapabilities
* GetStatus
* `Media` ver20
* GetVideoSourceConfigurationOptions
* Multicast Probe
* genral improvements
* general improvements

## 2.1.1-dev.1

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ To use this package in your code, first add the dependency to your project:
```yml
dependencies:
...
easy_onvif: ^2.1.2+8
easy_onvif: ^2.1.2+9
```
If you need additional help getting started with dart, check out these [guides](https://dart.dev/guides).
Expand Down
2 changes: 1 addition & 1 deletion lib/meta.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
import 'dart:convert' show json;

final pubSpec = json.decode(
'{"name":"easy_onvif","version":"2.1.2+8","homepage":"https://github.com/faithoflifedev/easy_onvif","environment":{"sdk":">=2.19.2 <4.0.0"},"description":"A pure Dart library designed primarily for command line automation of Onvif compatible devices, but can be used anywhere Dart is used.","dependencies":{"args":"^2.3.1","crypto":"^3.0.2","dio":"^5.1.1","html_unescape":"^2.0.0","intl":"^0.18.1","json_annotation":"^4.8.0","loggy":"^2.0.3","shelf":"^1.4.1","shelf_router":"^1.1.4","sprintf":"^7.0.0","universal_io":"^2.2.0","uuid":"^3.0.7","xml":"^6.3.0","xml2json":"^5.3.6","yaml":"^3.1.1"},"dev_dependencies":{"build_runner":"^2.3.3","grinder":"^0.9.2","json_serializable":"^6.6.1","lints":"^2.0.1","mustache_template":"^2.0.0","process_run":"^0.12.3+2","pub_semver":"^2.1.3","publish_tools":"^0.1.0+10","pubspec":"^2.3.0","test":"^1.24.2"},"executables":{"onvif":""},"repository":"https://github.com/faithoflifedev/easy_onvif"}');
'{"name":"easy_onvif","version":"2.1.2+9","homepage":"https://github.com/faithoflifedev/easy_onvif","environment":{"sdk":">=2.19.2 <4.0.0"},"description":"A pure Dart library designed primarily for command line automation of Onvif compatible devices, but can be used anywhere Dart is used.","dependencies":{"args":"^2.3.1","crypto":"^3.0.2","dio":"^5.1.1","html_unescape":"^2.0.0","intl":"^0.18.1","json_annotation":"^4.8.0","loggy":"^2.0.3","shelf":"^1.4.1","shelf_router":"^1.1.4","sprintf":"^7.0.0","universal_io":"^2.2.0","uuid":"^3.0.7","xml":"^6.3.0","xml2json":"^5.3.6","yaml":"^3.1.1"},"dev_dependencies":{"build_runner":"^2.3.3","grinder":"^0.9.2","json_serializable":"^6.6.1","lints":"^2.0.1","mustache_template":"^2.0.0","process_run":"^0.12.3+2","pub_semver":"^2.1.3","publish_tools":"^0.1.0+10","pubspec":"^2.3.0","test":"^1.24.2"},"executables":{"onvif":""},"repository":"https://github.com/faithoflifedev/easy_onvif"}');
11 changes: 3 additions & 8 deletions lib/src/model/probe/probe_match.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import 'dart:convert';

import 'package:easy_onvif/util.dart';
import 'package:html_unescape/html_unescape.dart';
import 'package:json_annotation/json_annotation.dart';
import 'package:loggy/loggy.dart';

Expand Down Expand Up @@ -108,13 +107,9 @@ class ProbeMatch with UiLoggy {
@override
String toString() => json.encode(toJson());

static List<String> _listFromXmlJson(Map<String, dynamic> value) {
final unescape = HtmlUnescape();

return unescape
.convert(OnvifUtil.mappedToString(value))
.split(RegExp('[ |,]'));
}
static List<String> _listFromXmlJson(Map<String, dynamic> value) =>
OnvifUtil.parseHtmlString(OnvifUtil.mappedToString(value))
.split(RegExp('[ |,|\n]'));

static List<String> _listFromJson(dynamic json) {
if (json is Map) {
Expand Down
4 changes: 4 additions & 0 deletions lib/src/util/util.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'dart:convert';
import 'dart:html' as html;
import 'dart:typed_data';

import 'package:dio/dio.dart';
Expand Down Expand Up @@ -198,6 +199,9 @@ class OnvifUtil {

static List<String>? nullableStringToList(String? value) =>
value != null ? stringToList(value) : null;

static String parseHtmlString(String htmlString) =>
(html.Element.span()..appendHtml(htmlString)).innerText;
}

class NotSupportedException implements Exception {}
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: easy_onvif
version: 2.1.2+8
version: 2.1.2+9
homepage: https://github.com/faithoflifedev/easy_onvif
description: A pure Dart library designed primarily for command line automation of Onvif compatible devices, but can be used anywhere Dart is used.
repository: https://github.com/faithoflifedev/easy_onvif
Expand Down

0 comments on commit 67c9db0

Please sign in to comment.