Skip to content

Commit 4d5f57f

Browse files
authored
feat: new hardware installer (#17)
1 parent 359b459 commit 4d5f57f

File tree

1,472 files changed

+236
-215640
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,472 files changed

+236
-215640
lines changed

.github/workflows/arduino-report.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
on:
2+
schedule:
3+
- cron: '*/5 * * * *'
4+
jobs:
5+
build:
6+
runs-on: ubuntu-latest
7+
steps:
8+
- uses: arduino/report-size-deltas@v1

.github/workflows/arduino.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: arduino
2+
on: [ push, pull_request ]
3+
4+
jobs:
5+
build-for-esp32:
6+
runs-on: ubuntu-latest
7+
strategy:
8+
matrix:
9+
fqbn:
10+
- esp32:esp32:esp32
11+
12+
steps:
13+
- uses: actions/checkout@v3
14+
- uses: arduino/compile-sketches@v1
15+
with:
16+
enable-deltas-report: true
17+
github-token: ${{ secrets.GITHUB_TOKEN }}
18+
fqbn: ${{ matrix.fqbn }}
19+
platforms: |
20+
- name: esp32:esp32
21+
source-url: https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
22+
sketch-paths: |
23+
- lnpos
24+
libraries: |
25+
- name: WebSockets
26+
- name: ArduinoJson
27+
- name: AutoConnect
28+
- name: Base64
29+
- name: Keypad
30+
- name: PageBuilder
31+
- name: uBitcoin
32+
- source-path: ./libraries/TFT_eSPI
33+
- source-path: ./libraries/QRCode
34+
35+
cli-compile-flags: |
36+
- --warnings="none"
37+
- --build-property
38+
- build.partitions=min_spiffs
39+
- --build-property
40+
- upload.maximum_size=1966080
41+
42+
- uses: actions/upload-artifact@v2
43+
with:
44+
name: sketches-reports
45+
path: sketches-reports
46+
47+
48+
report:
49+
needs: build-for-esp32
50+
if: github.event_name == 'pull_request'
51+
runs-on: ubuntu-latest
52+
steps:
53+
# This step is needed to get the size data produced by the compile jobs
54+
- name: Download sketches reports artifact
55+
uses: actions/download-artifact@v2
56+
with:
57+
name: sketches-reports
58+
path: sketches-reports
59+
60+
- uses: arduino/report-size-deltas@v1
61+
with:
62+
sketches-reports-source: sketches-reports

.github/workflows/release.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v[0-9]+.[0-9]+.[0-9]+"
7+
8+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
9+
permissions:
10+
contents: write
11+
pages: write
12+
id-token: write
13+
14+
jobs:
15+
release:
16+
runs-on: ubuntu-latest
17+
steps:
18+
19+
- uses: actions/checkout@v3
20+
with:
21+
ref: main
22+
23+
- name: update version in repo
24+
env:
25+
tag: ${{ github.ref_name }}
26+
run: |
27+
tmp=$(mktemp)
28+
jq --arg version $tag '.versions |= [$version] + .' versions.json > "$tmp" && mv "$tmp" versions.json
29+
git config --global user.name 'Alan Bits'
30+
git config --global user.email '[email protected]'
31+
git commit -am "[CHORE] update version to $tag"
32+
git push
33+
git push --delete origin $tag
34+
git tag -fa $tag -m "update via workflow"
35+
git push --tags
36+
37+
- name: Install Arduino CLI
38+
uses: arduino/setup-arduino-cli@v1
39+
40+
- name: build sketch with arduino cli
41+
env:
42+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
43+
tag: ${{ github.ref_name }}
44+
run: |
45+
sh build.sh
46+
47+
- name: Create github release
48+
env:
49+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
50+
tag: ${{ github.ref_name }}
51+
run: |
52+
gh release create "$tag" --generate-notes ./build/lnpos.ino.bootloader.bin \
53+
./build/lnpos.ino.bin ./build/lnpos.ino.partitions.bin

.github/workflows/static.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Simple workflow for deploying static content to GitHub Pages
2+
name: Deploy static content to Pages
3+
4+
on:
5+
# Runs on pushes targeting the default branch
6+
push:
7+
branches: ["main"]
8+
9+
# Allows you to run this workflow manually from the Actions tab
10+
workflow_dispatch:
11+
12+
# Allows you to run this workflow from other workflows
13+
workflow_call:
14+
15+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
16+
permissions:
17+
contents: read
18+
pages: write
19+
id-token: write
20+
21+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
22+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
23+
concurrency:
24+
group: "pages"
25+
cancel-in-progress: false
26+
27+
jobs:
28+
deploy:
29+
environment:
30+
name: github-pages
31+
url: ${{ steps.deployment.outputs.page_url }}
32+
runs-on: ubuntu-latest
33+
steps:
34+
- name: Checkout
35+
uses: actions/checkout@v3
36+
- name: Use Node.js
37+
uses: actions/setup-node@v3
38+
with:
39+
node-version: '16.x'
40+
- name: build webinstaller
41+
run: |
42+
sh build-webinstaller.sh
43+
cd hardware-installer
44+
npm install
45+
npx vite build
46+
- name: Setup Pages
47+
uses: actions/configure-pages@v3
48+
- name: Upload artifact
49+
uses: actions/upload-pages-artifact@v1
50+
with:
51+
path: "hardware-installer/dist"
52+
- name: Deploy to GitHub Pages
53+
id: deployment
54+
uses: actions/deploy-pages@v2

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
tmp
2-
.vscode
2+
.vscode
3+
build

INSTALLER.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<h1>
2+
LNPoS
3+
</h1>
4+
5+
## Free and open-source bitcoin point-of-sale
6+
## Easy setup using browser https://lnbits.github.io/lnpos/installer/
7+
8+
9+
LNPoS includes:
10+
11+
- LNPoS (for online LN payments, original <a href="https://github.com/arcbtc/LNPoS">project</a>)
12+
- LNURLPoS (for offline LN payments, original <a href="https://github.com/arcbtc/LNURLPoS">project</a> )
13+
- OnChain (for onchain payments)
14+
- LNURLATM (for making offline LN withdraw links).
15+
<br></br>
16+
17+
Original <a href="https://twitter.com/arcbtc/status/1484942260013838336">demo</a>
18+
19+
Video tutorial <a href="https://twitter.com/arcbtc/status/1585605023337168896">https://twitter.com/arcbtc/status/1585605023337168896</a>
20+
21+
Join our telegram group <a href="https://t.me/makerbits">MakerBits</a>

build-webinstaller.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/sh
2+
PROJECT_NAME=lnpos
3+
REPO=https://github.com/lnbits/lnpos/releases/download
4+
INSTALLER_PATH=./hardware-installer/public/firmware
5+
6+
git clone https://github.com/lnbits/hardware-installer
7+
8+
cp INSTALLER.md ./hardware-installer/public/INSTALLER.md
9+
cp versions.json ./hardware-installer/src/versions.json
10+
cp installer/config.js ./hardware-installer/src/config.js
11+
12+
sed -i "s/%title%/$PROJECT_NAME/g" ./hardware-installer/index.html
13+
14+
mkdir -p $INSTALLER_PATH
15+
for device in $(jq -r '.devices[]' ./hardware-installer/src/versions.json); do
16+
for version in $(jq -r '.versions[]' ./hardware-installer/src/versions.json); do
17+
mkdir -p $INSTALLER_PATH/$device/$version
18+
wget $REPO/$version/$PROJECT_NAME.ino.bin
19+
wget $REPO/$version/$PROJECT_NAME.ino.partitions.bin
20+
wget $REPO/$version/$PROJECT_NAME.ino.bootloader.bin
21+
mv $PROJECT_NAME* $INSTALLER_PATH/$device/$version
22+
done
23+
done

build.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/sh
2+
command -v arduino-cli >/dev/null 2>&1 || { echo >&2 "arduino-cli not found. Aborting."; exit 1; }
3+
arduino-cli config --additional-urls https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json init
4+
arduino-cli core update-index
5+
arduino-cli core install esp32:esp32
6+
arduino-cli upgrade
7+
arduino-cli lib install WebSockets ArduinoJson AutoConnect Base64 Keypad PageBuilder uBitcoin
8+
arduino-cli compile \
9+
--build-property "build.partitions=min_spiffs" \
10+
--build-property "upload.maximum_size=1966080" \
11+
--library ./libraries/TFT_eSPI \
12+
--library ./libraries/QRCode \
13+
--build-path build --fqbn esp32:esp32:ttgo-lora32 lnpos

index.html

Lines changed: 0 additions & 20 deletions
This file was deleted.

installer/assets/css/base.css

Lines changed: 0 additions & 72 deletions
This file was deleted.

0 commit comments

Comments
 (0)