Merge wizard-update branch: add QR code feature and README updates
This commit is contained in:
commit
a0a51255c2
7 changed files with 343 additions and 166 deletions
|
|
@ -4,6 +4,11 @@ get_log_info() {
|
|||
USER_HOME=$HOME
|
||||
USER_NAME=$(whoami)
|
||||
|
||||
# Ensure node is in PATH for QR generation
|
||||
if [ "$OS" = "Mac" ]; then
|
||||
export PATH="$USER_HOME/node/bin:$PATH"
|
||||
fi
|
||||
|
||||
LOG_DIR="$INSTALL_DIR/logs"
|
||||
DATA_DIR="$INSTALL_DIR/"
|
||||
START_TIME=$(date +%s)
|
||||
|
|
@ -116,12 +121,18 @@ get_log_info() {
|
|||
log "A node admin has not yet enrolled via Nostr."
|
||||
log "Paste this string into ShockWallet as a node source to connect as administrator:"
|
||||
log "${SECONDARY_COLOR}$admin_connect${RESET_COLOR}"
|
||||
echo ""
|
||||
log "Or scan this QR code with ShockWallet:"
|
||||
node "$INSTALL_DIR/scripts/qr_generator.js" "$admin_connect" 2>/dev/null || log "QR code generation unavailable"
|
||||
break
|
||||
fi
|
||||
elif [ -f "$DATA_DIR/app.nprofile" ]; then
|
||||
app_nprofile=$(cat "$DATA_DIR/app.nprofile")
|
||||
log "${SECONDARY_COLOR}Lightning.Pub${RESET_COLOR} is already set up. Use this nprofile to invite guest users:"
|
||||
log "${SECONDARY_COLOR}$app_nprofile${RESET_COLOR}"
|
||||
echo ""
|
||||
log "Or scan this QR code with ShockWallet:"
|
||||
node "$INSTALL_DIR/scripts/qr_generator.js" "$app_nprofile" 2>/dev/null || log "QR code generation unavailable"
|
||||
break
|
||||
fi
|
||||
sleep $WAIT_INTERVAL
|
||||
|
|
|
|||
|
|
@ -77,6 +77,18 @@ install_nodejs_mac() {
|
|||
install_nodejs_linux() {
|
||||
export NVM_DIR="$USER_HOME/.nvm"
|
||||
|
||||
# Check for snap curl which cannot access hidden folders, nvm falls back to wget if curl is not installed
|
||||
if snap list 2>/dev/null | grep -q "^curl "; then
|
||||
log "ERROR: Snap curl detected"
|
||||
log ""
|
||||
log "Snap curl cannot access hidden folders needed for Node.js installation."
|
||||
log "Please remove snap curl and install native curl:"
|
||||
log " sudo snap remove curl"
|
||||
log " sudo apt install curl"
|
||||
log ""
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Load nvm if it already exists
|
||||
[ -s "${NVM_DIR}/nvm.sh" ] && \. "${NVM_DIR}/nvm.sh"
|
||||
|
||||
|
|
|
|||
15
scripts/qr_generator.js
Executable file
15
scripts/qr_generator.js
Executable file
|
|
@ -0,0 +1,15 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
import qrcode from 'qrcode-terminal';
|
||||
|
||||
const text = process.argv[2];
|
||||
|
||||
if (!text) {
|
||||
console.error('Usage: qr_generator.js <text>');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
qrcode.generate(text, { small: true }, (qr) => {
|
||||
console.log(qr);
|
||||
});
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue