Compare commits
8 Commits
feat/ci-te
...
60df317f78
| Author | SHA1 | Date | |
|---|---|---|---|
|
60df317f78
|
|||
|
4c1ea9fb12
|
|||
|
58ed636ce3
|
|||
|
e537c323c2
|
|||
|
812fc84d3e
|
|||
|
6d318a597b
|
|||
|
83bd6b9643
|
|||
|
c93b2652f5
|
@@ -1,10 +1,10 @@
|
|||||||
name: Test Python Compatibility
|
name: Tests and Linting
|
||||||
run-name: Test Python Compatibility
|
run-name: Python Compatibility and Linting tests
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
Python-Compatibility:
|
Tests-Linting:
|
||||||
runs-on: [ubuntu-latest, amd]
|
runs-on: [ubuntu-latest, amd]
|
||||||
container: catthehacker/ubuntu:act-latest
|
container: catthehacker/ubuntu:act-latest
|
||||||
strategy:
|
strategy:
|
||||||
@@ -29,7 +29,7 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
pip install pytest ruff
|
pip install pytest ruff
|
||||||
|
|
||||||
- name: Run tests
|
- name: Test with pytest
|
||||||
run: |
|
run: |
|
||||||
echo "Testing with Python ${{ matrix.python-version }}"
|
echo "Testing with Python ${{ matrix.python-version }}"
|
||||||
python -m pytest main.py
|
python -m pytest main.py
|
||||||
|
|||||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -17,6 +17,6 @@ cache/
|
|||||||
build/
|
build/
|
||||||
dist/
|
dist/
|
||||||
hsd/
|
hsd/
|
||||||
hsd-data/
|
hsd_data/
|
||||||
hsd.lock
|
hsd.lock
|
||||||
hsdconfig.json
|
hsdconfig.json
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ LABEL org.opencontainers.image.title="FireWallet (HSD)" \
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
VOLUME ["/app/hsd-data", "/app/user_data"]
|
VOLUME ["/app/hsd_data", "/app/user_data"]
|
||||||
|
|
||||||
|
|
||||||
ENTRYPOINT ["python3"]
|
ENTRYPOINT ["python3"]
|
||||||
|
|||||||
Binary file not shown.
@@ -13,6 +13,11 @@ cp example.env .env
|
|||||||
Edit .env to have your HSD api key.
|
Edit .env to have your HSD api key.
|
||||||
If you have HSD runnning on a separate computer also add the IP here
|
If you have HSD runnning on a separate computer also add the IP here
|
||||||
|
|
||||||
|
For a quick and easy installation on ubuntu/debian you can run the install.sh script
|
||||||
|
```bash
|
||||||
|
curl https://git.woodburn.au/nathanwoodburn/firewalletbrowser/src/branch/main/install.sh | bash
|
||||||
|
```
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
Make sure HSD is running then run the following commands:
|
Make sure HSD is running then run the following commands:
|
||||||
|
|||||||
@@ -1582,9 +1582,7 @@ def resendTXs():
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def zapTXs(account):
|
def zapTXs(account, age=1200):
|
||||||
age = 60 * 20 # 20 minutes
|
|
||||||
|
|
||||||
account_name = check_account(account)
|
account_name = check_account(account)
|
||||||
|
|
||||||
if not account_name:
|
if not account_name:
|
||||||
@@ -1806,7 +1804,7 @@ def checkPreRequisites() -> dict[str, bool]:
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
# Check if git is installed
|
# Check if git is installed
|
||||||
gitSubprocess = subprocess.run(["git", "-v"], capture_output=True, text=True,timeout=2)
|
gitSubprocess = subprocess.run(["git", "--version"], capture_output=True, text=True,timeout=2)
|
||||||
if gitSubprocess.returncode == 0:
|
if gitSubprocess.returncode == 0:
|
||||||
prerequisites["git"] = True
|
prerequisites["git"] = True
|
||||||
except Exception:
|
except Exception:
|
||||||
@@ -1902,7 +1900,7 @@ def hsdStart():
|
|||||||
chain_migrate = HSD_CONFIG.get("chainMigrate", False)
|
chain_migrate = HSD_CONFIG.get("chainMigrate", False)
|
||||||
wallet_migrate = HSD_CONFIG.get("walletMigrate", False)
|
wallet_migrate = HSD_CONFIG.get("walletMigrate", False)
|
||||||
spv = HSD_CONFIG.get("spv", False)
|
spv = HSD_CONFIG.get("spv", False)
|
||||||
prefix = HSD_CONFIG.get("prefix", os.path.join(os.getcwd(), "hsd-data"))
|
prefix = HSD_CONFIG.get("prefix", os.path.join(os.getcwd(), "hsd_data"))
|
||||||
|
|
||||||
|
|
||||||
# Base command
|
# Base command
|
||||||
@@ -1978,7 +1976,6 @@ def hsdRestart():
|
|||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
hsdStart()
|
hsdStart()
|
||||||
|
|
||||||
|
|
||||||
hsdInit()
|
hsdInit()
|
||||||
hsdStart()
|
hsdStart()
|
||||||
# endregion
|
# endregion
|
||||||
@@ -4,10 +4,8 @@ services:
|
|||||||
ports:
|
ports:
|
||||||
- "5000:5000"
|
- "5000:5000"
|
||||||
volumes:
|
volumes:
|
||||||
- hsd_data:/app/hsd-data
|
- hsd_data:/app/hsd_data
|
||||||
- user_data:/app/user_data
|
- user_data:/app/user_data
|
||||||
environment:
|
|
||||||
- INTERNAL_HSD=true
|
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
hsd_data:
|
hsd_data:
|
||||||
|
|||||||
81
install.sh
Executable file
81
install.sh
Executable file
@@ -0,0 +1,81 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
install_command=""
|
||||||
|
|
||||||
|
# Check if currently in the FireWalletBrowser directory
|
||||||
|
if [ -f "server.py" ]; then
|
||||||
|
echo "Please run this script from outside the FireWalletBrowser directory."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Starting installation of FireWalletBrowser..."
|
||||||
|
|
||||||
|
# Check if OS is using apt package manager (Debian/Ubuntu)
|
||||||
|
if command -v apt-get &> /dev/null; then
|
||||||
|
install_command="sudo apt-get install -y"
|
||||||
|
dependencies=(git curl wget python3 python3-pip python3-venv)
|
||||||
|
echo "Detected apt package manager."
|
||||||
|
# Check if OS is using pacman package manager (Arch Linux)
|
||||||
|
elif command -v pacman &> /dev/null; then
|
||||||
|
install_command="sudo pacman -S"
|
||||||
|
dependencies=(git curl wget python3 python-pip)
|
||||||
|
echo "Detected pacman package manager."
|
||||||
|
else
|
||||||
|
echo "Unsupported package manager. Please install dependencies manually."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# List of dependencies to install
|
||||||
|
# Install dependencies
|
||||||
|
for package in "${dependencies[@]}"; do
|
||||||
|
# Check if the package is already installed
|
||||||
|
if command -v $package &> /dev/null || dpkg -s $package &> /dev/null || pacman -Qi $package &> /dev/null; then
|
||||||
|
echo "$package is already installed."
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
echo "Installing $package..."
|
||||||
|
$install_command $package
|
||||||
|
# Check if the installation was successful
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo "Failed to install $package. Please check your package manager settings."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if ! command -v node &> /dev/null || ! command -v npm &> /dev/null; then
|
||||||
|
echo "Installing Node.js and npm..."
|
||||||
|
# Download and install nvm:
|
||||||
|
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash
|
||||||
|
# in lieu of restarting the shell
|
||||||
|
\. "$HOME/.nvm/nvm.sh"
|
||||||
|
nvm install 20
|
||||||
|
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo "Failed to install Node.js and npm. Please install them manually."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Node.js and npm are already installed."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Clone repo
|
||||||
|
git clone https://git.woodburn.au/nathanwoodburn/firewalletbrowser.git
|
||||||
|
|
||||||
|
# Setup venv
|
||||||
|
cd firewalletbrowser || exit 1
|
||||||
|
python3 -m venv .venv
|
||||||
|
source .venv/bin/activate
|
||||||
|
|
||||||
|
# Install python dependencies
|
||||||
|
python3 -m pip install -r requirements.txt
|
||||||
|
|
||||||
|
# Write .env file
|
||||||
|
if [ ! -f ".env" ]; then
|
||||||
|
echo "Creating .env file..."
|
||||||
|
echo "INTERNAL_HSD=true" > .env
|
||||||
|
echo "Created .env file with INTERNAL Node enabled."
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Installation complete. You can start the application by running ./start.sh"
|
||||||
22
main.py
22
main.py
@@ -1200,7 +1200,15 @@ def settings_action(action):
|
|||||||
|
|
||||||
|
|
||||||
if action == "zap":
|
if action == "zap":
|
||||||
resp = account_module.zapTXs(request.cookies.get("account"))
|
age = request.args.get("age", 1200)
|
||||||
|
try:
|
||||||
|
age = int(age)
|
||||||
|
except ValueError:
|
||||||
|
age = 1200
|
||||||
|
if age < 0:
|
||||||
|
age = 1200
|
||||||
|
|
||||||
|
resp = account_module.zapTXs(request.cookies.get("account"),age)
|
||||||
if type(resp) is dict and 'error' in resp:
|
if type(resp) is dict and 'error' in resp:
|
||||||
return redirect("/settings?error=" + str(resp['error']))
|
return redirect("/settings?error=" + str(resp['error']))
|
||||||
return redirect("/settings?success=Zapped transactions")
|
return redirect("/settings?success=Zapped transactions")
|
||||||
@@ -1222,6 +1230,18 @@ def settings_action(action):
|
|||||||
title="Restarting",
|
title="Restarting",
|
||||||
content="The node is restarting. This may take a minute or two. You can close this window.")
|
content="The node is restarting. This may take a minute or two. You can close this window.")
|
||||||
|
|
||||||
|
if action == "api-info":
|
||||||
|
content = f"API URL: <code>http://{account_module.HSD_IP}:{account_module.HSD_NODE_PORT}</code><br>"
|
||||||
|
content += f"Wallet URL: <code>http://{account_module.HSD_IP}:{account_module.HSD_WALLET_PORT}</code><br>"
|
||||||
|
content += f"API Key: <code>{account_module.HSD_API}</code><br><br>"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return render_template("message.html", account=account,
|
||||||
|
title="API Information",
|
||||||
|
content=content)
|
||||||
|
|
||||||
|
|
||||||
return redirect("/settings?error=Invalid action")
|
return redirect("/settings?error=Invalid action")
|
||||||
|
|
||||||
@app.route('/settings/upload', methods=['POST'])
|
@app.route('/settings/upload', methods=['POST'])
|
||||||
|
|||||||
9
start.sh
Executable file
9
start.sh
Executable file
@@ -0,0 +1,9 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Find if .venv exists
|
||||||
|
if [ -d ".venv" ]; then
|
||||||
|
echo "Virtual environment found. Activating..."
|
||||||
|
source .venv/bin/activate
|
||||||
|
fi
|
||||||
|
|
||||||
|
python3 server.py
|
||||||
@@ -85,6 +85,12 @@
|
|||||||
<h3>Delete unconfirmed transactions</h3><span>This will only remove pending tx from the wallet older than 20 minutes (~ 2 blocks)</span>
|
<h3>Delete unconfirmed transactions</h3><span>This will only remove pending tx from the wallet older than 20 minutes (~ 2 blocks)</span>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
<li class="list-group-item">
|
||||||
|
<div><a class="btn btn-primary stick-right" role="button" href="/settings/api-info">API Info</a>
|
||||||
|
<h3>View API Information</h3><span>View information about the connected HSD node's API</span>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
|
||||||
{% if internal %}
|
{% if internal %}
|
||||||
<li class="list-group-item">
|
<li class="list-group-item">
|
||||||
<div><a class="btn btn-primary stick-right" role="button" href="/settings/restart">Restart Node</a>
|
<div><a class="btn btn-primary stick-right" role="button" href="/settings/restart">Restart Node</a>
|
||||||
|
|||||||
Reference in New Issue
Block a user