Scripts used for the Lightning Goats project.
Contributions are welcome. Please open an issue or submit a pull request.
Lightning Goats Middleware
Home Page: https://lightning-goats.com
Send feeder override status to nostril_command.py and modify nostr messages accordingly.
Refactor and split the fast_api app into multiple files for better readability and maintainability; organize the code into several modules based on their functionality.
Suggested structure:
Main Application File (main.py): Contains the FastAPI app creation and route definitions.
Configuration and Environment Variables (config.py): Handles loading environment variables and configuration settings.
Models and Schemas (models.py): Contains Pydantic models for request and response schemas.
Utility Functions (utils.py): Includes various utility functions like convert_to_sats, create_invoice, etc.
Database Operations (database.py): Manages database operations, like storing and retrieving data.
External API Integrations (external_apis.py): Functions that interact with external APIs like YouTube API, payment API, etc.
Async Tasks (tasks.py): Asynchronous tasks such as triggering the feeder, handling payments, etc.
Logging (logging.py): Setup and configurations for logging.
The webhook appears to be being called twice for each incoming transaction causing Nostr notifications to happen twice. The fast_api app needs to store a few previous checking_ids or an other identifier and check incoming transactions against them to insure this doesn't happen. This way it doesn't matter if the same transaction comes in more than once.
Use websockets / flask to create an ap to run on the Openhab server which offers a route to get weather data for display on the overlay and lightning-goats.com
Missed one crucial step. Function should include separate invoicing for zaps. Something like:
# construct zap request if needed
if lnurl_data.get("allowsNostr") and lnurl_data.get("nostrPubkey"):
event_details = {
"kind": 9734,
"content": description or "CyberHerd Treats",
"tags": [
["p", lnurl_data["nostrPubkey"]]
],
"pubkey": "669ebbcccf409ee0467a33660ae88fd17e5379e646e41d7c236ff4963f3c36b6",
"created_at": round(datetime.now().timestamp()),
}
signed_zap_event = await sign_event(event_details, nos_sec)
zap_event_encoded = quote(json.dumps(signed_zap_event))
zap_url = f"{lnurl_data['callback']}?amount={amount}&nostr={zap_event_encoded}"
zap_response = await client.get(zap_url, headers=headers)
zap_response.raise_for_status()
invoice = zap_response.json().get('payment_request', None)
if invoice:
logger.info(f"Received invoice: {invoice}")
return await pay_invoice(client, invoice) # pay_invoice should handle the payment and return a structured response
else:
logger.error("No invoice received from zap request")
return {"success": False, "message": "No invoice received from zap request"}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.