Updated relayer whitelisted for custom nip11 info.
authorLuke Hoersten <luke@hoersten.org>
Sun, 23 Jul 2023 11:08:34 -0500
changeset 219 0faea2a7570f
parent 218 1db4800bc4f5
child 220 16226c249f6f
Updated relayer whitelisted for custom nip11 info.
nostr/build/defaults/main.yaml
nostr/build/tasks/main.yaml
--- a/nostr/build/defaults/main.yaml	Sat Jul 22 23:27:09 2023 -0500
+++ b/nostr/build/defaults/main.yaml	Sun Jul 23 11:08:34 2023 -0500
@@ -4,3 +4,10 @@
 # https://github.com/fiatjaf/relayer/releases
 relayer_tar: "https://github.com/fiatjaf/relayer/archive/refs/tags/v{{relayer_version}}.tar.gz"
 relayer_build_dir: "/tmp/relayer-{{relayer_version}}"
+
+relayer_main_src: "main.go"
+relayer_handler_src: "handlers.go"
+relayer_name: "Relayer"
+relayer_description: ""
+relayer_admin_pubkey: ""
+relayer_admin_contact: ""
--- a/nostr/build/tasks/main.yaml	Sat Jul 22 23:27:09 2023 -0500
+++ b/nostr/build/tasks/main.yaml	Sun Jul 23 11:08:34 2023 -0500
@@ -11,6 +11,27 @@
     dest: "/tmp/"
     creates: "{{relayer_build_dir}}"
 
+# update name
+- name: update relayer nip11 info
+  lineinfile:
+    path: "{{relayer_main_src}}"
+    regexp: "^(\\s*)return \"WhitelistedRelay\"$"
+    line: "\\1return \"{{relayer_name}}\""
+    backrefs: yes
+
+# update nip11 relay info
+- name: update relayer nip11 info
+  lineinfile:
+    path: "{{relayer_handler_src}}"
+    regexp: "^(\\s*){{item.k}}(\\s*)(.*)$"
+    line: "\\1{{item.k}}\\2\"{{item.v}}\","
+    backrefs: yes
+  loop:
+    - {"k": "Description:", "v": "{{relayer_description}}"}
+    - {"k": "PubKey:", "v": "{{relayer_admin_pubkey}}"}
+    - {"k": "Contact:", "v": "{{relayer_admin_contact}}"}
+    - {"k": "Version:", "v": "{{relayer_version}}"}
+
 - name: check if relayer build exists
   stat:
     path: "{{relayer_build_dir}}/whitelisted/whitelisted"