mirror of
https://github.com/mynodebtc/mynode.git
synced 2024-11-11 16:09:16 +00:00
Add Nostr RS Relay v0.7.15
This commit is contained in:
parent
825409f883
commit
39fbe5bae3
|
@ -0,0 +1,141 @@
|
|||
# Nostr-rs-relay configuration
|
||||
|
||||
[info]
|
||||
# The advertised URL for the Nostr websocket.
|
||||
relay_url = "wss://mynode.local/"
|
||||
|
||||
# Relay information for clients. Put your unique server name here.
|
||||
name = "nostr-rs-relay"
|
||||
|
||||
# Description
|
||||
description = "A newly created nostr-rs-relay.\n\nCustomize this with your own info."
|
||||
|
||||
# Administrative contact pubkey
|
||||
#pubkey = "0c2d168a4ae8ca58c9f1ab237b5df682599c6c7ab74307ea8b05684b60405d41"
|
||||
|
||||
# Administrative contact URI
|
||||
#contact = "mailto:contact@example.com"
|
||||
|
||||
[diagnostics]
|
||||
# Enable tokio tracing (for use with tokio-console)
|
||||
#tracing = true
|
||||
|
||||
[database]
|
||||
# Directory for SQLite files. Defaults to the current directory. Can
|
||||
# also be specified (and overriden) with the "--db dirname" command
|
||||
# line option.
|
||||
data_directory = "/mnt/hdd/mynode/nostrrsrelay/db"
|
||||
|
||||
|
||||
# Use an in-memory database instead of 'nostr.db'.
|
||||
# Caution; this will not survive a process restart!
|
||||
#in_memory = false
|
||||
|
||||
# Database connection pool settings for subscribers:
|
||||
|
||||
# Minimum number of SQLite reader connections
|
||||
#min_conn = 4
|
||||
|
||||
# Maximum number of SQLite reader connections. Recommend setting this
|
||||
# to approx the number of cores.
|
||||
#max_conn = 8
|
||||
|
||||
[network]
|
||||
# Bind to this network address
|
||||
address = "0.0.0.0"
|
||||
|
||||
# Listen on this port
|
||||
port = 8080
|
||||
|
||||
# If present, read this HTTP header for logging client IP addresses.
|
||||
# Examples for common proxies, cloudflare:
|
||||
#remote_ip_header = "x-forwarded-for"
|
||||
#remote_ip_header = "cf-connecting-ip"
|
||||
|
||||
# Websocket ping interval in seconds, defaults to 5 minutes
|
||||
#ping_interval = 300
|
||||
|
||||
[options]
|
||||
# Reject events that have timestamps greater than this many seconds in
|
||||
# the future. Recommended to reject anything greater than 30 minutes
|
||||
# from the current time, but the default is to allow any date.
|
||||
reject_future_seconds = 1800
|
||||
|
||||
[limits]
|
||||
# Limit events created per second, averaged over one minute. Must be
|
||||
# an integer. If not set (or set to 0), defaults to unlimited. Note:
|
||||
# this is for the server as a whole, not per-connection.
|
||||
# messages_per_sec = 0
|
||||
|
||||
# Limit client subscriptions created per second, averaged over one
|
||||
# minute. Must be an integer. If not set (or set to 0), defaults to
|
||||
# unlimited.
|
||||
#subscriptions_per_min = 0
|
||||
|
||||
# UNIMPLEMENTED...
|
||||
# Limit how many concurrent database connections a client can have.
|
||||
# This prevents a single client from starting too many expensive
|
||||
# database queries. Must be an integer. If not set (or set to 0),
|
||||
# defaults to unlimited (subject to subscription limits).
|
||||
#db_conns_per_client = 0
|
||||
|
||||
# Limit blocking threads used for database connections. Defaults to 16.
|
||||
#max_blocking_threads = 16
|
||||
|
||||
# Limit the maximum size of an EVENT message. Defaults to 128 KB.
|
||||
# Set to 0 for unlimited.
|
||||
#max_event_bytes = 131072
|
||||
|
||||
# Maximum WebSocket message in bytes. Defaults to 128 KB.
|
||||
#max_ws_message_bytes = 131072
|
||||
|
||||
# Maximum WebSocket frame size in bytes. Defaults to 128 KB.
|
||||
#max_ws_frame_bytes = 131072
|
||||
|
||||
# Broadcast buffer size, in number of events. This prevents slow
|
||||
# readers from consuming memory.
|
||||
#broadcast_buffer = 16384
|
||||
|
||||
# Event persistence buffer size, in number of events. This provides
|
||||
# backpressure to senders if writes are slow.
|
||||
#event_persist_buffer = 4096
|
||||
|
||||
# Event kind blacklist. Events with these kinds will be discarded.
|
||||
#event_kind_blacklist = [
|
||||
# 70202,
|
||||
#]
|
||||
|
||||
[authorization]
|
||||
# Pubkey addresses in this array are whitelisted for event publishing.
|
||||
# Only valid events by these authors will be accepted, if the variable
|
||||
# is set.
|
||||
#pubkey_whitelist = [
|
||||
# "35d26e4690cbe1a898af61cc3515661eb5fa763b57bd0b42e45099c8b32fd50f",
|
||||
# "887645fef0ce0c3c1218d2f5d8e6132a19304cdc57cd20281d082f38cfea0072",
|
||||
#]
|
||||
|
||||
[verified_users]
|
||||
# NIP-05 verification of users. Can be "enabled" to require NIP-05
|
||||
# metadata for event authors, "passive" to perform validation but
|
||||
# never block publishing, or "disabled" to do nothing.
|
||||
#mode = "disabled"
|
||||
|
||||
# Domain names that will be prevented from publishing events.
|
||||
#domain_blacklist = ["wellorder.net"]
|
||||
|
||||
# Domain names that are allowed to publish events. If defined, only
|
||||
# events NIP-05 verified authors at these domains are persisted.
|
||||
#domain_whitelist = ["example.com"]
|
||||
|
||||
# Consider an pubkey "verified" if we have a successful validation
|
||||
# from the NIP-05 domain within this amount of time. Note, if the
|
||||
# domain provides a successful response that omits the account,
|
||||
# verification is immediately revoked.
|
||||
#verify_expiration = "1 week"
|
||||
|
||||
# How long to wait between verification attempts for a specific author.
|
||||
#verify_update_frequency = "24 hours"
|
||||
|
||||
# How many consecutive failed checks before we give up on verifying
|
||||
# this author.
|
||||
#max_consecutive_failures = 20
|
|
@ -0,0 +1,65 @@
|
|||
{
|
||||
"name": "Nostr RS Relay",
|
||||
"short_name": "nostrrsrelay",
|
||||
"author": {
|
||||
"name": "scsibug",
|
||||
"link": "https://github.com/scsibug"
|
||||
},
|
||||
"website": {
|
||||
"name": "GitHub",
|
||||
"link": "https://github.com/scsibug/nostr-rs-relay"
|
||||
},
|
||||
"category": "communication",
|
||||
"short_description": "Nostr Relay",
|
||||
"description": [
|
||||
"This is a nostr relay, written in Rust. It currently supports the entire relay protocol, and persists data with SQLite.",
|
||||
"This application is intended for advanced users and running a relay is not required to use nostr clients."
|
||||
],
|
||||
"latest_version": "0.7.15",
|
||||
"linux_user": "nostrrsrelay",
|
||||
"supported_archs": null,
|
||||
"download_skip": false,
|
||||
"download_type": "source",
|
||||
"download_source_url": "https://github.com/scsibug/nostr-rs-relay/archive/refs/tags/{VERSION}.tar.gz",
|
||||
"download_binary_url": {
|
||||
"aarch64": "download_url",
|
||||
"x86_64": "download_url"
|
||||
},
|
||||
"install_env_vars": {},
|
||||
"supports_app_page": true,
|
||||
"supports_testnet": false,
|
||||
"http_port": null,
|
||||
"https_port": null,
|
||||
"extra_ports": [5050],
|
||||
"requires_bitcoin": false,
|
||||
"requires_docker_image_installation": true,
|
||||
"requires_electrs": false,
|
||||
"requires_lightning": false,
|
||||
"show_on_application_page": true,
|
||||
"show_on_homepage": true,
|
||||
"show_on_status_page": true,
|
||||
"hide_status_icon": false,
|
||||
"app_tile_name": "Nostr RS Relay",
|
||||
"app_tile_running_status_text": "Running",
|
||||
"app_tile_button_text": "Info",
|
||||
"app_tile_button_href": "/app/nostrrsrelay/info",
|
||||
"app_page_show_open_button": false,
|
||||
"app_page_content": [
|
||||
{
|
||||
"heading": "Instructions",
|
||||
"content": [
|
||||
"Once the nostr relay is running, you can use nostr clients to connect to it using the local IP address of the device or via the tor service.",
|
||||
"Enjoy!"
|
||||
]
|
||||
}
|
||||
],
|
||||
"can_uninstall": true,
|
||||
"can_reinstall": true,
|
||||
"can_enable_disable": true,
|
||||
"is_beta": true,
|
||||
"is_premium": true,
|
||||
"homepage_section": "apps",
|
||||
"homepage_order": 91,
|
||||
"app_type": "custom",
|
||||
"sdk_version": 2
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 13 KiB |
|
@ -0,0 +1,36 @@
|
|||
# nostrrsrelay service
|
||||
# /etc/systemd/system/nostrrsrelay.service
|
||||
|
||||
[Unit]
|
||||
Description=nostrrsrelay
|
||||
Wants=www.service docker_images.service
|
||||
After=www.service docker_images.service
|
||||
|
||||
[Service]
|
||||
WorkingDirectory=/opt/mynode/nostrrsrelay
|
||||
|
||||
EnvironmentFile=-/mnt/hdd/mynode/nostrrsrelay/env
|
||||
ExecStartPre=/usr/bin/is_not_shutting_down.sh
|
||||
ExecStartPre=/bin/bash -c 'if [ -f /usr/bin/service_scripts/pre_nostrrsrelay.sh ]; then /bin/bash /usr/bin/service_scripts/pre_nostrrsrelay.sh; fi'
|
||||
ExecStart=/usr/bin/docker run --rm \
|
||||
--name nostrrsrelay \
|
||||
--publish 5050:8080 \
|
||||
--user ${UID}:${GID} \
|
||||
--mount src=/mnt/hdd/mynode/nostrrsrelay/config.toml,target=/usr/src/app/config.toml,type=bind \
|
||||
--mount src=/mnt/hdd/mynode/nostrrsrelay/data,target=/usr/src/app/db,type=bind \
|
||||
nostrrsrelay
|
||||
ExecStartPost=/bin/bash -c 'if [ -f /usr/bin/service_scripts/post_nostrrsrelay.sh ]; then /bin/bash /usr/bin/service_scripts/post_nostrrsrelay.sh; fi'
|
||||
ExecStop=/usr/bin/docker stop -t 2 nostrrsrelay
|
||||
|
||||
User=nostrrsrelay
|
||||
Group=nostrrsrelay
|
||||
Type=simple
|
||||
TimeoutSec=120
|
||||
Restart=always
|
||||
RestartSec=60
|
||||
StandardOutput=syslog
|
||||
StandardError=syslog
|
||||
SyslogIdentifier=nostrrsrelay
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
|
@ -0,0 +1,27 @@
|
|||
#!/bin/bash
|
||||
|
||||
source /usr/share/mynode/mynode_device_info.sh
|
||||
source /usr/share/mynode/mynode_app_versions.sh
|
||||
|
||||
set -x
|
||||
set -e
|
||||
|
||||
echo "==================== INSTALLING APP ===================="
|
||||
|
||||
# The current directory is the app install folder and the app tarball from GitHub
|
||||
# has already been downloaded and extracted. Any additional env variables specified
|
||||
# in the JSON file are also present.
|
||||
|
||||
# Setup folders and config
|
||||
mkdir -p /mnt/hdd/mynode/nostrrsrelay/data
|
||||
if [ ! -f /mnt/hdd/mynode/nostrrsrelay/app_data/config.toml ]; then
|
||||
cp -f /usr/share/mynode_apps/nostrrsrelay/app_data/config.toml /mnt/hdd/mynode/nostrrsrelay/config.toml
|
||||
fi
|
||||
|
||||
# Remove old containers
|
||||
docker rmi $(docker images --format '{{.Repository}}:{{.Tag}}' | grep 'nostrrsrelay') || true
|
||||
|
||||
# Build docker container
|
||||
docker build -t nostrrsrelay .
|
||||
|
||||
echo "================== DONE INSTALLING APP ================="
|
|
@ -0,0 +1,3 @@
|
|||
#!/bin/bash
|
||||
|
||||
# This will run after launching the application
|
|
@ -0,0 +1,9 @@
|
|||
#!/bin/bash
|
||||
|
||||
# This will run prior to launching the application
|
||||
|
||||
MY_UID=$(id -u)
|
||||
MY_GID=$(id -g)
|
||||
|
||||
echo "UID=$MY_UID" > /mnt/hdd/mynode/nostrrsrelay/env
|
||||
echo "GID=$MY_GID" >> /mnt/hdd/mynode/nostrrsrelay/env
|
|
@ -0,0 +1,13 @@
|
|||
#!/bin/bash
|
||||
|
||||
source /usr/share/mynode/mynode_device_info.sh
|
||||
source /usr/share/mynode/mynode_app_versions.sh
|
||||
|
||||
echo "==================== UNINSTALLING APP ===================="
|
||||
|
||||
# The app folder will be removed automatically after this script runs. You may not need to do anything here.
|
||||
|
||||
# Remove old containers
|
||||
docker rmi $(docker images --format '{{.Repository}}:{{.Tag}}' | grep 'nostrrsrelay') || true
|
||||
|
||||
echo "================== DONE UNINSTALLING APP ================="
|
|
@ -0,0 +1,32 @@
|
|||
from flask import Blueprint, render_template, redirect
|
||||
from user_management import check_logged_in
|
||||
from enable_disable_functions import *
|
||||
from device_info import *
|
||||
from application_info import *
|
||||
from systemctl_info import *
|
||||
import subprocess
|
||||
import os
|
||||
|
||||
|
||||
mynode_nostrrsrelay = Blueprint('mynode_nostrrsrelay',__name__)
|
||||
|
||||
|
||||
### Page functions (have prefix /app/<app name/)
|
||||
@mynode_nostrrsrelay.route("/info")
|
||||
def nostrrsrelay_page():
|
||||
check_logged_in()
|
||||
|
||||
app = get_application("nostrrsrelay")
|
||||
app_status = get_application_status("nostrrsrelay")
|
||||
app_status_color = get_application_status_color("nostrrsrelay")
|
||||
|
||||
# Load page
|
||||
templateData = {
|
||||
"title": "myNode - " + app["name"],
|
||||
"ui_settings": read_ui_settings(),
|
||||
"app_status": app_status,
|
||||
"app_status_color": app_status_color,
|
||||
"app": app
|
||||
}
|
||||
return render_template('/app/generic_app.html', **templateData)
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
Custom Jinja templates (HTML files) can be added here for unique application pages
|
||||
|
||||
Templates will be available under applications/<short_name>/xyz.html
|
|
@ -0,0 +1,54 @@
|
|||
<!DOCTYPE html lang="en">
|
||||
<head>
|
||||
<title>{{ title }}</title>
|
||||
{% include 'includes/head.html' %}
|
||||
</head>
|
||||
<body>
|
||||
{% include 'includes/logo_header.html' %}
|
||||
<div class="mynode_top_left_div">
|
||||
<a href="/"><img class="mynode_nav_icon" src="{{ url_for('static', filename="images/home.png")}}"/></a>
|
||||
</div>
|
||||
|
||||
<div class="main_header">{{app.name}} (custom page - remove)</div>
|
||||
<br/>
|
||||
|
||||
<div class="app_tile_row">
|
||||
<div class="info_tile">
|
||||
<div class="info_tile_header">Status</div>
|
||||
<div class="info_tile_contents">
|
||||
<table class="info_table">
|
||||
<tr>
|
||||
<th>Status</th>
|
||||
<td>{{app_status}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Actions</th>
|
||||
<td>
|
||||
<a class="ui-button ui-widget ui-corner-all mynode_button_small" style="width: 100px;" href="#">Open</a>
|
||||
<a class="ui-button ui-widget ui-corner-all mynode_button_small" style="width: 100px;" href="#">Button A</a>
|
||||
<a class="ui-button ui-widget ui-corner-all mynode_button_small" style="width: 100px;" href="#">Button B</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="instructions">
|
||||
<div class="instructions-header">Instructions</div>
|
||||
<ol class="instructions-steps">
|
||||
<li>Custom instructions?</li>
|
||||
</ol>
|
||||
</div>
|
||||
|
||||
<div id="confirm-dialog"></div>
|
||||
|
||||
<div id="loading_spinner_overlay" class="loading_spinner_overlay" style="display:none;">
|
||||
<img id="loading_spinner" class="loading_image" src="{{ url_for('static', filename="images/loading.gif")}}"/>
|
||||
<br/>
|
||||
<span id="loading_spinner_message">Loading...</span>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user