diff --git a/packages/app/config/default.json b/packages/app/config/default.json
index 9c97a1b4..cd02a553 100644
--- a/packages/app/config/default.json
+++ b/packages/app/config/default.json
@@ -8,6 +8,7 @@
"appleTouchIconUrl": "/nostrich_512.png",
"httpCache": "",
"animalNamePlaceholders": false,
+ "defaultZapPoolFee": 0.5,
"features": {
"analytics": true,
"subscriptions": true,
diff --git a/packages/app/src/Tasks/NoticeZapPool.tsx b/packages/app/src/Tasks/NoticeZapPool.tsx
new file mode 100644
index 00000000..a57d0f2c
--- /dev/null
+++ b/packages/app/src/Tasks/NoticeZapPool.tsx
@@ -0,0 +1,38 @@
+import { FormattedMessage, FormattedNumber } from "react-intl";
+import { Link } from "react-router-dom";
+import { BaseUITask } from "Tasks";
+
+export class NoticeZapPoolDefault extends BaseUITask {
+ id = "zap-pool-default";
+
+ check(): boolean {
+ return !this.state.muted && CONFIG.defaultZapPoolFee !== undefined;
+ }
+
+ render() {
+ return (
+ <>
+
+
+ ),
+ link: (
+
+
+
+ ),
+ }}
+ />
+
+ >
+ );
+ }
+}
diff --git a/packages/app/src/Tasks/TaskList.css b/packages/app/src/Tasks/TaskList.css
new file mode 100644
index 00000000..9b853747
--- /dev/null
+++ b/packages/app/src/Tasks/TaskList.css
@@ -0,0 +1,3 @@
+.task-list a {
+ text-decoration: underline;
+}
diff --git a/packages/app/src/Tasks/TaskList.tsx b/packages/app/src/Tasks/TaskList.tsx
index 35b1d6e3..ad86ac16 100644
--- a/packages/app/src/Tasks/TaskList.tsx
+++ b/packages/app/src/Tasks/TaskList.tsx
@@ -1,3 +1,4 @@
+import "./TaskList.css";
import { useState } from "react";
import { useUserProfile } from "@snort/system-react";
@@ -7,8 +8,9 @@ import { UITask } from "Tasks";
import { DonateTask } from "./DonateTask";
import { Nip5Task } from "./Nip5Task";
import { RenewSubTask } from "./RenewSubscription";
+import { NoticeZapPoolDefault } from "./NoticeZapPool";
-const AllTasks: Array = [new Nip5Task(), new DonateTask()];
+const AllTasks: Array = [new Nip5Task(), new DonateTask(), new NoticeZapPoolDefault()];
if (CONFIG.features.subscriptions) {
AllTasks.push(new RenewSubTask());
}
@@ -25,7 +27,7 @@ export const TaskList = () => {
}
return (
- <>
+
{AllTasks.filter(a => (user ? a.check(user, session) : false)).map(a => {
return (
@@ -39,6 +41,6 @@ export const TaskList = () => {
);
})}
- >
+
);
};
diff --git a/packages/app/src/ZapPoolController.ts b/packages/app/src/ZapPoolController.ts
index ab274c99..a61f6761 100644
--- a/packages/app/src/ZapPoolController.ts
+++ b/packages/app/src/ZapPoolController.ts
@@ -2,7 +2,8 @@ import { UserCache } from "Cache";
import { LNURL, ExternalStore, unixNow } from "@snort/shared";
import { Toastore } from "Toaster";
import { LNWallet, WalletInvoiceState, Wallets } from "Wallet";
-import { getDisplayName } from "SnortUtils";
+import { bech32ToHex, getDisplayName } from "SnortUtils";
+import { SnortPubKey } from "Const";
export enum ZapPoolRecipientType {
Generic = 0,
@@ -103,10 +104,11 @@ class ZapPool extends ExternalStore> {
this.notifyChange();
}
- getOrDefault(rcpt: ZapPoolRecipient) {
+ getOrDefault(rcpt: ZapPoolRecipient): ZapPoolRecipient {
const k = this.#key(rcpt);
- if (this.#store.has(k)) {
- return { ...this.#store.get(k) };
+ const existing = this.#store.get(k);
+ if (existing) {
+ return { ...existing };
}
return rcpt;
}
@@ -137,6 +139,18 @@ class ZapPool extends ExternalStore> {
if (existing) {
const arr = JSON.parse(existing) as Array;
this.#store = new Map(arr.map(a => [`${a.pubkey}-${a.type}`, a]));
+ } else if (CONFIG.defaultZapPoolFee) {
+ this.#store = new Map([
+ [
+ `${bech32ToHex(SnortPubKey)}-${ZapPoolRecipientType.Generic}`,
+ {
+ type: ZapPoolRecipientType.Generic,
+ split: CONFIG.defaultZapPoolFee,
+ pubkey: bech32ToHex(SnortPubKey),
+ sum: 0,
+ },
+ ],
+ ]);
}
const lastPayout = self.localStorage.getItem("zap-pool-last-payout");
diff --git a/packages/app/src/lang.json b/packages/app/src/lang.json
index d9e9ceb6..b561f40c 100644
--- a/packages/app/src/lang.json
+++ b/packages/app/src/lang.json
@@ -1068,6 +1068,9 @@
"deEeEI": {
"defaultMessage": "Register"
},
+ "dmsiLv": {
+ "defaultMessage": "A default Zap Pool split of {n} has been configured for {site} developers, you can disable it at any time in {link}"
+ },
"e61Jf3": {
"defaultMessage": "Coming soon"
},
diff --git a/packages/app/src/translations/en.json b/packages/app/src/translations/en.json
index b8918a67..fe98536a 100644
--- a/packages/app/src/translations/en.json
+++ b/packages/app/src/translations/en.json
@@ -349,6 +349,7 @@
"d7d0/x": "LN Address",
"dOQCL8": "Display name",
"deEeEI": "Register",
+ "dmsiLv": "A default Zap Pool split of {n} has been configured for {site} developers, you can disable it at any time in {link}",
"e61Jf3": "Coming soon",
"e7VmYP": "Enter pin to unlock your private key",
"e7qqly": "Mark All Read",