From c9ec0aad8abb977a0be3750dd4efc456797cf1cb Mon Sep 17 00:00:00 2001 From: Ross Mountjoy Date: Thu, 19 Mar 2020 19:38:15 -0400 Subject: [PATCH 1/5] fixed critical bug with the tags --- dashmachine/sources.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dashmachine/sources.py b/dashmachine/sources.py index 4522931..9c8152e 100644 --- a/dashmachine/sources.py +++ b/dashmachine/sources.py @@ -86,8 +86,11 @@ def context_processor(): tags += app_db.tags.split(",") tags_form = TagsForm() + tags = [tag.strip() for tag in tags] + for tag in tags: + if tags.count(tag) > 1: + tags.remove(tag) tags_form.tags.choices += [(tag, tag) for tag in tags] - print(tags_form.tags.choices) settings = Settings.query.first() if settings.background == "random": if len(os.listdir(backgrounds_images_folder)) < 1: From fddd5f8e79b0230649ce31411630c78fac7d0563 Mon Sep 17 00:00:00 2001 From: Ross Mountjoy Date: Thu, 19 Mar 2020 19:53:53 -0400 Subject: [PATCH 2/5] fixed critical bug with the tags --- dashmachine/sources.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/dashmachine/sources.py b/dashmachine/sources.py index 9c8152e..1578772 100644 --- a/dashmachine/sources.py +++ b/dashmachine/sources.py @@ -87,9 +87,7 @@ def context_processor(): tags_form = TagsForm() tags = [tag.strip() for tag in tags] - for tag in tags: - if tags.count(tag) > 1: - tags.remove(tag) + tags = list(dict.fromkeys(tags)) tags_form.tags.choices += [(tag, tag) for tag in tags] settings = Settings.query.first() if settings.background == "random": From 3bd607a33d4b2b89430e8eb648e787813ddc345e Mon Sep 17 00:00:00 2001 From: Ross Mountjoy Date: Fri, 20 Mar 2020 09:09:25 -0400 Subject: [PATCH 3/5] fixed another critical bug with the tags --- dashmachine/sources.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/dashmachine/sources.py b/dashmachine/sources.py index 1578772..6055ccd 100644 --- a/dashmachine/sources.py +++ b/dashmachine/sources.py @@ -83,11 +83,13 @@ def context_processor(): app_db.groups = None if check_groups(app_db.groups, current_user): apps.append(app_db) - tags += app_db.tags.split(",") + if app_db.tags: + tags += app_db.tags.split(",") tags_form = TagsForm() - tags = [tag.strip() for tag in tags] - tags = list(dict.fromkeys(tags)) + if len(tags) > 0: + tags = [tag.strip() for tag in tags] + tags = list(dict.fromkeys(tags)) tags_form.tags.choices += [(tag, tag) for tag in tags] settings = Settings.query.first() if settings.background == "random": From 0d372762e2c6b2aef232aba1ee7e77c945d41ceb Mon Sep 17 00:00:00 2001 From: sportivaman <34513134+rmountjoy92@users.noreply.github.com> Date: Fri, 20 Mar 2020 09:18:49 -0400 Subject: [PATCH 4/5] Update README.md fixes #44 --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 159f5cd..3907417 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,9 @@ # DashMachine ### Another web application bookmark dashboard, with fun features. +## Before Installing +Please read the latest update post: https://redd.it/flubzn + ![screenshot](https://raw.githubusercontent.com/rmountjoy92/DashMachine/master/screenshot1.png) ![screenshot](https://raw.githubusercontent.com/rmountjoy92/DashMachine/master/screenshot2.png) @@ -46,7 +49,7 @@ Instructions are for linux. ``` virtualenv --python=python3 DashMachineEnv cd DashMachineEnv && source bin/activate -git clone https://git.wolf-house.net/ross/DashMachine.git +git clone https://github.com/rmountjoy92/DashMachine.git cd DashMachine && pip install -r requirements.txt python3 run.py ``` From ab412f6bb958e00431ada73adfa9a9fe0e9a303e Mon Sep 17 00:00:00 2001 From: Kevin Custer Date: Sat, 21 Mar 2020 08:26:42 -0400 Subject: [PATCH 5/5] Add documentation for PiHole and Transmission Platforms. Fix typo in curl documentation. --- dashmachine/platform/curl.py | 2 +- dashmachine/platform/pihole.py | 55 ++++++++++++++++++++++++++++ dashmachine/platform/transmission.py | 54 +++++++++++++++++++++++++++ 3 files changed, 110 insertions(+), 1 deletion(-) diff --git a/dashmachine/platform/curl.py b/dashmachine/platform/curl.py index 5fea062..360d9d6 100644 --- a/dashmachine/platform/curl.py +++ b/dashmachine/platform/curl.py @@ -14,7 +14,7 @@ response_type = json | Variable | Required | Description | Options | |-----------------|----------|-----------------------------------------------------------------|-------------------| | [variable_name] | Yes | Name for the data source. | [variable_name] | -| plaform | Yes | Name of the platform. | curl | +| platform | Yes | Name of the platform. | curl | | resource | Yes | Url to curl | url | | value_template | Yes | Jinja template for how the returned data from api is displayed. | jinja template | | response_type | No | Response type. Use json if response is a JSON. Default is plain.| plain,json | diff --git a/dashmachine/platform/pihole.py b/dashmachine/platform/pihole.py index b4d24e0..4108553 100644 --- a/dashmachine/platform/pihole.py +++ b/dashmachine/platform/pihole.py @@ -1,3 +1,58 @@ +""" + +##### PiHole +Display information from the PiHole API +```ini +[variable_name] +platform = pihole +host = 192.168.1.101 +password = {{ PiHole password }} +value_template = {{ value_template }} +``` +> **Returns:** `value_template` as rendered string + +| Variable | Required | Description | Options | +|-----------------|----------|-----------------------------------------------------------------|-------------------| +| [variable_name] | Yes | Name for the data source. | [variable_name] | +| platform | Yes | Name of the platform. | pihole | +| host | Yes | Host of the PiHole | host | +| password | Yes | Password for the PiHole | password | +| value_template | Yes | Jinja template for how the returned data from API is displayed. | jinja template | + + +
+###### **Available fields for value_template** + +* domain_count +* queries +* blocked +* ads_percentage +* unique_domains +* forwarded +* cached +* total_clients +* unique_clients +* total_queries +* gravity_last_updated + +> **Working example:** +>```ini +> [pihole-data] +> platform = pihole +> host = 192.168.1.101 +> password = password123 +> value_template = Ads Blocked Today: {{ blocked }}
Status: {{ status }}
Queries today: {{ queries }} +> +> [PiHole] +> prefix = http:// +> url = 192.168.1.101 +> icon = static/images/apps/pihole.png +> description = A black hole for Internet advertisements +> open_in = new_tab +> data_sources = pihole-data +>``` +""" + from flask import render_template_string diff --git a/dashmachine/platform/transmission.py b/dashmachine/platform/transmission.py index 0fef512..00dc05d 100644 --- a/dashmachine/platform/transmission.py +++ b/dashmachine/platform/transmission.py @@ -1,3 +1,57 @@ +""" + +##### Transmission +Display information from the Trasnmission API +```ini +[variable_name] +platform = transmission +host = localhost +port = 9091 +user = {{ transmission Web UI username }} +password = {{ Transmission Web UI password }} +value_template = {{ value_template }} +``` +> **Returns:** `value_template` as rendered string + +| Variable | Required | Description | Options | +|-----------------|----------|-----------------------------------------------------------------|-------------------| +| [variable_name] | Yes | Name for the data source. | [variable_name] | +| platform | Yes | Name of the platform. | transmission | +| host | Yes | Host of Transmission Web UI | host | +| port | Yes | Port of Transmission Web UI | port | +| user | No | Username for Transmission Web UI | username | +| password | No | Password for Transmission Web UI | password | +| value_template | Yes | Jinja template for how the returned data from API is displayed. | jinja template | + +
+###### **Available fields for value_template** + +* downloadSpeed +* uploadSpeed +* activeTorrentCount +* pausedTorrentCount +* torrentCount + +> **Working example:** +>```ini +> [transmission-data] +> platform = transmission +> host = 192.168.1.30 +> port = 9091 +> user = admin +> password = password123 +> value_template = 🔽 {{(downloadSpeed/1024/1024)|round(2)}} MB/s
🔼 {{(uploadSpeed/1024/1024)|round(2)}} MB/s
Active: {{activeTorrentCount}}
+> +> [Transmission] +> prefix = http:// +> url = 192.168.1.30:9091 +> icon = static/images/apps/transmission.png +> description = A Fast, Easy, and Free BitTorrent Client +> open_in = new_tab +> data_sources = transmission-data +>``` +""" + import json from flask import render_template_string import transmissionrpc