Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SERVER_DOMAIN = "nostr.hu"
RELAY = "ws://127.0.0.1:8080"
BLOSSOM = "http://127.0.0.1:3000"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.venv
__pycache__
.env
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ Nostr event kind `34128` is used for mapping from the file path (that comes afte
Install
=======

`pip install -r requirements.txt`
```
cp .env.example .env
pip install -r requirements.txt
```

Upload
======
Expand Down
1 change: 1 addition & 0 deletions blossom.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ async def store(sk, data, blossom_server, sha256, path):
tags=[
["t", "upload"],
["x", sha256],
["size", len(data)],
["expiration", "1777777777"]
]
)
Expand Down
14 changes: 10 additions & 4 deletions hostr.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
import os
import sys
import logging
from aiohttp import web, ClientSession
from dotenv import load_dotenv

from monstr.client.client import Client, ClientPool
from monstr.encrypt import Keys

SERVER_DOMAIN = "nostr.hu"
RELAY = "ws://127.0.0.1:8080"
BLOSSOM = "http://127.0.0.1:3000"
load_dotenv()

SERVER_DOMAIN = os.getenv('SERVER_DOMAIN')
RELAY = os.getenv('RELAY')
BLOSSOM = os.getenv('BLOSSOM')
FILEMAP_KIND = "34128"

logging.basicConfig(level=logging.INFO)
Expand Down Expand Up @@ -68,4 +72,6 @@ async def serve_file(request):
web.get("/", serve_file),
web.get("/{path:.*}", serve_file)
])
web.run_app(app, host='0.0.0.0', port=8000)

if __name__ == "__main__":
web.run_app(app, host='0.0.0.0', port=8000)
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
aiohttp
monstr
python-dotenv
7 changes: 5 additions & 2 deletions uploadr.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,16 @@
import hashlib
import time
from datetime import datetime
from dotenv import load_dotenv

from monstr.encrypt import Keys
from monstr.client.client import Client
from monstr.event.event import Event

RELAY = "wss://relay.magnifiq.tech" # Right now it's hardcoded
BLOSSOM = "https://blossom.nostr.hu" # Same here.
load_dotenv()

RELAY = os.getenv('RELAY')
BLOSSOM = os.getenv('BLOSSOM')

parser = argparse.ArgumentParser()
parser.add_argument(
Expand Down