From f34fab1c0f945f701b3b1a0370086413381a2132 Mon Sep 17 00:00:00 2001
From: Paulus Schoutsen
Date: Mon, 11 Apr 2022 23:24:52 -0700
Subject: [PATCH] Add funding URL (#213)
---
README.md | 1 +
index.html | 8 ++++++++
src/const.ts | 1 +
src/install-dialog.ts | 13 +++++++++++++
src/styles.ts | 4 ++++
static/firmware_build/manifest.json | 1 +
6 files changed, 28 insertions(+)
diff --git a/README.md b/README.md
index 2499057..ab99ad3 100644
--- a/README.md
+++ b/README.md
@@ -15,6 +15,7 @@ Manifest definition:
"name": "ESPHome",
"version": "2021.10.3",
"home_assistant_domain": "esphome",
+ "funding_url": "https://esphome.io/guides/supporters.html",
"builds": [
{
"chipFamily": "ESP32",
diff --git a/index.html b/index.html
index 1011509..53e791b 100644
--- a/index.html
+++ b/index.html
@@ -346,6 +346,7 @@
"name": "ESPHome",
"version": "2021.11.0",
"home_assistant_domain": "esphome",
+ "funding_url": "https://esphome.io/guides/supporters.html",
"new_install_prompt_erase": false,
"builds": [
{
@@ -395,6 +396,13 @@
new_install_improv_wait_time
to the number of seconds to
wait. Set to 0
to disable Improv Serial detection.
+
+ If your product accepts donations you can add
+ funding_url
to your manifest. This allows you to link to
+ your page explaining the user how they can fund development. This link
+ is visible in the ESP Web Tools menu when connected to a device running
+ your firmware (as detected via Improv).
+
Customizing the look and feel
diff --git a/src/const.ts b/src/const.ts
index 271a279..60177a8 100644
--- a/src/const.ts
+++ b/src/const.ts
@@ -16,6 +16,7 @@ export interface Manifest {
name: string;
version: string;
home_assistant_domain?: string;
+ funding_url?: string;
/** @deprecated use `new_install_prompt_erase` instead */
new_install_skip_erase?: boolean;
new_install_prompt_erase?: boolean;
diff --git a/src/install-dialog.ts b/src/install-dialog.ts
index 98828d2..9c894b4 100644
--- a/src/install-dialog.ts
+++ b/src/install-dialog.ts
@@ -245,6 +245,19 @@ class EwtInstallDialog extends LitElement {
}}
>
+ ${this._isSameFirmware && this._manifest.funding_url
+ ? html`
+
+ `
+ : ""}
${this._isSameVersion
? html`
diff --git a/src/styles.ts b/src/styles.ts
index 716fddd..8e12100 100644
--- a/src/styles.ts
+++ b/src/styles.ts
@@ -14,4 +14,8 @@ export const dialogStyles = css`
a {
color: var(--improv-primary-color, #03a9f4);
}
+
+ a.button {
+ text-decoration: none;
+ }
`;
diff --git a/static/firmware_build/manifest.json b/static/firmware_build/manifest.json
index 95b57e0..0b2ce7b 100644
--- a/static/firmware_build/manifest.json
+++ b/static/firmware_build/manifest.json
@@ -2,6 +2,7 @@
"name": "ESPHome",
"version": "2022.3.0",
"home_assistant_domain": "esphome",
+ "funding_url": "https://esphome.io/guides/supporters.html",
"builds": [
{
"chipFamily": "ESP32",