mirror of
https://github.com/dergigi/boris.git
synced 2025-12-18 15:14:20 +01:00
fix: improve command construction in publish-markdown script
This commit is contained in:
@@ -37,12 +37,8 @@ publish_file() {
|
|||||||
# Extract title from first H1 if available, otherwise use filename
|
# Extract title from first H1 if available, otherwise use filename
|
||||||
local title=$(echo "$content" | grep -m 1 "^# " | sed 's/^# //' || echo "$identifier")
|
local title=$(echo "$content" | grep -m 1 "^# " | sed 's/^# //' || echo "$identifier")
|
||||||
|
|
||||||
# Build nak command
|
|
||||||
local nak_cmd="nak event -k 30023 -d \"$identifier\" -t \"title=\\\"$title\\\"\" --content -"
|
|
||||||
|
|
||||||
# Add relays if provided
|
# Add relays if provided
|
||||||
if [ ${#relays[@]} -gt 0 ]; then
|
if [ ${#relays[@]} -gt 0 ]; then
|
||||||
nak_cmd="$nak_cmd ${relays[*]}"
|
|
||||||
echo " Relays: ${relays[*]}"
|
echo " Relays: ${relays[*]}"
|
||||||
else
|
else
|
||||||
echo " Note: No relays specified. Event will be created but not published."
|
echo " Note: No relays specified. Event will be created but not published."
|
||||||
@@ -52,7 +48,21 @@ publish_file() {
|
|||||||
# Publish as kind 30023 (NIP-23 blog post)
|
# Publish as kind 30023 (NIP-23 blog post)
|
||||||
# The "d" tag is required for replaceable events (kind 30023)
|
# The "d" tag is required for replaceable events (kind 30023)
|
||||||
# Using the filename (without extension) as the identifier
|
# Using the filename (without extension) as the identifier
|
||||||
echo "$content" | eval "$nak_cmd"
|
# Build command array to avoid eval issues
|
||||||
|
local cmd_args=(
|
||||||
|
"event"
|
||||||
|
"-k" "30023"
|
||||||
|
"-d" "$identifier"
|
||||||
|
"-t" "title=\"$title\""
|
||||||
|
"--content" "-"
|
||||||
|
)
|
||||||
|
|
||||||
|
# Add relays if provided
|
||||||
|
if [ ${#relays[@]} -gt 0 ]; then
|
||||||
|
cmd_args+=("${relays[@]}")
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "$content" | nak "${cmd_args[@]}"
|
||||||
|
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
echo "✅ Successfully published: $filename"
|
echo "✅ Successfully published: $filename"
|
||||||
|
|||||||
Reference in New Issue
Block a user