mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-07-15 21:03:47 +00:00
Compare commits
22 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a6d0658e41 | |||
| 1aea3603a7 | |||
| 972e27eb64 | |||
| 38e128bd16 | |||
| 0712fdd731 | |||
| bb5559c696 | |||
| b2ff35e106 | |||
| 19a2cb8eed | |||
| 078e6d5de0 | |||
| 794714368a | |||
| 4fbaf50e08 | |||
| 4ec4cfcdb7 | |||
| a46f2f1343 | |||
| 72e5ff5a64 | |||
| 63cfdfda9e | |||
| 3a3b51d1ae | |||
| 3f4280c2ff | |||
| 97124bc3b6 | |||
| 253be0077e | |||
| fe96e68872 | |||
| 30acbed1a7 | |||
| 7416734f68 |
@@ -1,126 +0,0 @@
|
||||
name: Donation Goal Badge
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: "0 */6 * * *"
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
update:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Generate donation goal SVG
|
||||
run: |
|
||||
set -e
|
||||
|
||||
EVM_ADDRESS="0x83eA1Db55cc6E34fCD11Da2b7849621af67b6E34"
|
||||
BTC_ADDRESS="bc1qrxc3vpnl6qhh9p8akjmjukcgmgmq852ua64h05"
|
||||
SOL_ADDRESS="T4BF5ioySVUjwaPNw4Sdu7oK8SXLxgQRcMaTQ6YJ2UJ"
|
||||
DOCS_SNAPSHOT_URL="https://raw.githubusercontent.com/Termix-SSH/Termix-Docs/main/static/donation-snapshot.json"
|
||||
MONTHLY_GOAL=750
|
||||
|
||||
# Fetch crypto prices
|
||||
PRICES=$(curl -sf "https://api.coingecko.com/api/v3/simple/price?ids=ethereum,bitcoin,solana&vs_currencies=usd" || echo '{}')
|
||||
ETH_PRICE=$(echo "$PRICES" | python3 -c "import sys,json; d=json.load(sys.stdin); print(d.get('ethereum',{}).get('usd',0))" 2>/dev/null || echo 0)
|
||||
BTC_PRICE=$(echo "$PRICES" | python3 -c "import sys,json; d=json.load(sys.stdin); print(d.get('bitcoin',{}).get('usd',0))" 2>/dev/null || echo 0)
|
||||
SOL_PRICE=$(echo "$PRICES" | python3 -c "import sys,json; d=json.load(sys.stdin); print(d.get('solana',{}).get('usd',0))" 2>/dev/null || echo 0)
|
||||
|
||||
# Fetch live balances
|
||||
ETH_RAW=$(curl -sf "https://eth.blockscout.com/api/v2/addresses/${EVM_ADDRESS}" || echo '{"coin_balance":"0"}')
|
||||
ETH_BAL=$(echo "$ETH_RAW" | python3 -c "import sys,json; d=json.load(sys.stdin); print(int(d.get('coin_balance','0')) / 1e18)" 2>/dev/null || echo 0)
|
||||
|
||||
BASE_RAW=$(curl -sf "https://base.blockscout.com/api/v2/addresses/${EVM_ADDRESS}" || echo '{"coin_balance":"0"}')
|
||||
BASE_BAL=$(echo "$BASE_RAW" | python3 -c "import sys,json; d=json.load(sys.stdin); print(int(d.get('coin_balance','0')) / 1e18)" 2>/dev/null || echo 0)
|
||||
|
||||
BTC_RAW=$(curl -sf "https://blockstream.info/api/address/${BTC_ADDRESS}" || echo '{"chain_stats":{"funded_txo_sum":0,"spent_txo_sum":0}}')
|
||||
BTC_BAL=$(echo "$BTC_RAW" | python3 -c "import sys,json; d=json.load(sys.stdin); s=d.get('chain_stats',{}); print((s.get('funded_txo_sum',0)-s.get('spent_txo_sum',0))/1e8)" 2>/dev/null || echo 0)
|
||||
|
||||
SOL_RAW=$(curl -sf -X POST "https://api.mainnet-beta.solana.com" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"getBalance\",\"params\":[\"${SOL_ADDRESS}\"]}" || echo '{"result":{"value":0}}')
|
||||
SOL_BAL=$(echo "$SOL_RAW" | python3 -c "import sys,json; d=json.load(sys.stdin); print(d.get('result',{}).get('value',0)/1e9)" 2>/dev/null || echo 0)
|
||||
|
||||
# Fetch snapshot baseline from docs repo
|
||||
SNAPSHOT=$(curl -sf "$DOCS_SNAPSHOT_URL" || echo '{"ethBal":0,"baseBal":0,"btcBal":0,"solBal":0}')
|
||||
SNAP_ETH=$(echo "$SNAPSHOT" | python3 -c "import sys,json; d=json.load(sys.stdin); print(d.get('ethBal',0))" 2>/dev/null || echo 0)
|
||||
SNAP_BASE=$(echo "$SNAPSHOT" | python3 -c "import sys,json; d=json.load(sys.stdin); print(d.get('baseBal',0))" 2>/dev/null || echo 0)
|
||||
SNAP_BTC=$(echo "$SNAPSHOT" | python3 -c "import sys,json; d=json.load(sys.stdin); print(d.get('btcBal',0))" 2>/dev/null || echo 0)
|
||||
SNAP_SOL=$(echo "$SNAPSHOT" | python3 -c "import sys,json; d=json.load(sys.stdin); print(d.get('solBal',0))" 2>/dev/null || echo 0)
|
||||
|
||||
export ETH_BAL BASE_BAL BTC_BAL SOL_BAL SNAP_ETH SNAP_BASE SNAP_BTC SNAP_SOL ETH_PRICE BTC_PRICE SOL_PRICE MONTHLY_GOAL
|
||||
|
||||
python3 - <<'PYEOF'
|
||||
import os, math
|
||||
|
||||
eth_bal = float(os.environ.get('ETH_BAL', 0))
|
||||
base_bal = float(os.environ.get('BASE_BAL', 0))
|
||||
btc_bal = float(os.environ.get('BTC_BAL', 0))
|
||||
sol_bal = float(os.environ.get('SOL_BAL', 0))
|
||||
snap_eth = float(os.environ.get('SNAP_ETH', 0))
|
||||
snap_base = float(os.environ.get('SNAP_BASE', 0))
|
||||
snap_btc = float(os.environ.get('SNAP_BTC', 0))
|
||||
snap_sol = float(os.environ.get('SNAP_SOL', 0))
|
||||
eth_price = float(os.environ.get('ETH_PRICE', 0))
|
||||
btc_price = float(os.environ.get('BTC_PRICE', 0))
|
||||
sol_price = float(os.environ.get('SOL_PRICE', 0))
|
||||
goal = float(os.environ.get('MONTHLY_GOAL', 750))
|
||||
|
||||
delta_eth = max(0, eth_bal - snap_eth)
|
||||
delta_base = max(0, base_bal - snap_base)
|
||||
delta_btc = max(0, btc_bal - snap_btc)
|
||||
delta_sol = max(0, sol_bal - snap_sol)
|
||||
|
||||
total = delta_eth * eth_price + delta_base * eth_price + delta_btc * btc_price + delta_sol * sol_price
|
||||
pct = min(total / goal * 100, 100) if goal > 0 else 0
|
||||
|
||||
if total < 1:
|
||||
display = '< $1'
|
||||
else:
|
||||
display = f'${math.floor(total):,}'
|
||||
|
||||
goal_display = f'${int(goal):,}'
|
||||
|
||||
# SVG dimensions
|
||||
W = 400
|
||||
BAR_W = 360
|
||||
BAR_X = 20
|
||||
BAR_H = 8
|
||||
FILL_W = round(BAR_W * pct / 100)
|
||||
|
||||
label = f'Monthly Donation Goal {display} / {goal_display}'
|
||||
pct_label = f'{round(pct)}% of monthly goal' if pct < 100 else 'Goal reached this month. Thank you!'
|
||||
|
||||
svg = f'''<svg xmlns="http://www.w3.org/2000/svg" width="{W}" height="52" role="img" aria-label="Monthly donation goal">
|
||||
<title>Monthly donation goal</title>
|
||||
<rect width="{W}" height="52" rx="6" fill="#0c0d0b"/>
|
||||
<text x="{W//2}" y="13" font-family="sans-serif" font-size="11" fill="#F39044" text-anchor="middle">{label}</text>
|
||||
<rect x="{BAR_X}" y="20" width="{BAR_W}" height="{BAR_H}" rx="4" fill="#F3904433"/>
|
||||
<rect x="{BAR_X}" y="20" width="{FILL_W}" height="{BAR_H}" rx="4" fill="#F39044"/>
|
||||
<text x="{W//2}" y="44" font-family="sans-serif" font-size="10" fill="#F3904499" text-anchor="middle">{pct_label}</text>
|
||||
</svg>'''
|
||||
|
||||
with open('repo-images/donation-goal.svg', 'w') as f:
|
||||
f.write(svg)
|
||||
print(f'SVG written: {display} / {goal_display} ({round(pct)}%)')
|
||||
PYEOF
|
||||
- name: Commit SVG
|
||||
run: |
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||
git add repo-images/donation-goal.svg
|
||||
if git diff --cached --quiet; then
|
||||
exit 0
|
||||
fi
|
||||
# Amend the previous bot commit if it exists, otherwise create a new one
|
||||
LAST_AUTHOR=$(git log -1 --format='%ae')
|
||||
if [ "$LAST_AUTHOR" = "github-actions[bot]@users.noreply.github.com" ]; then
|
||||
git commit --amend --no-edit
|
||||
git push --force-with-lease
|
||||
else
|
||||
git commit -m "chore: update donation goal badge"
|
||||
git push
|
||||
fi
|
||||
@@ -483,11 +483,16 @@ jobs:
|
||||
|
||||
PR_NUMBER=$(gh pr list --repo Termix-SSH/Docs --head "$BRANCH" --base main --state open --json number -q '.[0].number' || true)
|
||||
if [ -z "$PR_NUMBER" ]; then
|
||||
PR_NUMBER=$(gh pr create --repo Termix-SSH/Docs \
|
||||
PR_URL=$(gh pr create --repo Termix-SSH/Docs \
|
||||
--base main --head "$BRANCH" \
|
||||
--title "release-${{ needs.prep.outputs.version }}" \
|
||||
--body "API docs for ${{ needs.prep.outputs.version }}" \
|
||||
| grep -oE '[0-9]+$')
|
||||
--body "API docs for ${{ needs.prep.outputs.version }}")
|
||||
PR_NUMBER=$(echo "$PR_URL" | grep -oE '[0-9]+$')
|
||||
fi
|
||||
|
||||
if [ -z "$PR_NUMBER" ]; then
|
||||
echo "Failed to find or create a PR for $BRANCH."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
gh pr merge "$PR_NUMBER" --repo Termix-SSH/Docs --squash --admin
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
cask "termix" do
|
||||
version "2.4.1"
|
||||
sha256 "c71209bf0bde9eefa5aeefbfc2b1db3af4ca3546e5f2ef09d233a6d3d1719150"
|
||||
version "2.5.0"
|
||||
sha256 "0662380b3cc986e5ddab263122e87b03a581bc18dbff1ad13e11dc973c84984b"
|
||||
|
||||
url "https://github.com/Termix-SSH/Termix/releases/download/release-#{version}-tag/termix_macos_universal_dmg.dmg"
|
||||
name "Termix"
|
||||
|
||||
@@ -31,12 +31,14 @@
|
||||
<a href="https://donate.termix.site/"><img alt="Donate" src="https://img.shields.io/badge/Donate-Support%20Termix-F39044?style=flat&labelColor=1a1a1a" /></a>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<a href="https://donate.termix.site/"><img alt="Donations this month" src="https://img.shields.io/badge/dynamic/json?style=for-the-badge&label=Donations%20this%20month&query=%24.fiatTotal&prefix=%24&url=https%3A%2F%2Ftermix.site%2Fdonation-snapshot.json&color=F39044&labelColor=1a1a1a" /></a>
|
||||
</p>
|
||||
|
||||
<br />
|
||||
|
||||
Termix is free and open source. If you find it useful, consider [donating](https://donate.termix.site/) to help cover server costs and development time.
|
||||
|
||||
<a href="https://donate.termix.site/"><img src="./repo-images/donation-goal.svg" alt="Monthly donation goal" /></a>
|
||||
|
||||
<br />
|
||||
|
||||
<img src="./repo-images/Termix Header.png" alt="Termix Banner" width="900" />
|
||||
@@ -392,6 +394,10 @@ See [Projects](https://github.com/orgs/Termix-SSH/projects/5) for all planned fe
|
||||
<a href="https://aws.amazon.com/">
|
||||
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/9/93/Amazon_Web_Services_Logo.svg/960px-Amazon_Web_Services_Logo.svg.png" height="40" alt="AWS" />
|
||||
</a>
|
||||
|
||||
<a href="https://rackgenius.com/">
|
||||
<img src="https://rackgenius.com/rackgenius-logo.png" height="40" alt="AWS" />
|
||||
</a>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="400" height="52" role="img" aria-label="Monthly donation goal">
|
||||
<title>Monthly donation goal</title>
|
||||
<rect width="400" height="52" rx="6" fill="#0c0d0b"/>
|
||||
<text x="200" y="13" font-family="sans-serif" font-size="11" fill="#F39044" text-anchor="middle">Monthly Donation Goal ... / $750</text>
|
||||
<rect x="20" y="20" width="360" height="8" rx="4" fill="#F3904433"/>
|
||||
<rect x="20" y="20" width="0" height="8" rx="4" fill="#F39044"/>
|
||||
<text x="200" y="44" font-family="sans-serif" font-size="10" fill="#F3904499" text-anchor="middle">Loading...</text>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 610 B |
Reference in New Issue
Block a user