Searching txt.sour.is

Twts matching #twtxt.
Sort by: Newest, Oldest, Most Relevant

@prologic@twtxt.net

#!/bin/sh

# Validate environment
if ! command -v msgbus > /dev/null; then
    printf "missing msgbus command. Use:  go install git.mills.io/prologic/msgbus/cmd/msgbus@latest"
    exit 1
fi

if ! command -v salty > /dev/null; then
    printf "missing salty command. Use:  go install go.mills.io/salty/cmd/salty@latest"
    exit 1
fi

if ! command -v salty-keygen > /dev/null; then
    printf "missing salty-keygen command. Use:  go install go.mills.io/salty/cmd/salty-keygen@latest"
    exit 1
fi

if [ -z "$SALTY_IDENTITY" ]; then
    export SALTY_IDENTITY="$HOME/.config/salty/$USER.key"
fi

get_user () {
    user=$(grep user: "$SALTY_IDENTITY" | awk '{print $3}')
    if [ -z "$user" ]; then
        user="$USER"
    fi
    echo "$user"
}

stream () {
    if [ -z "$SALTY_IDENTITY" ]; then
        echo "SALTY_IDENTITY not set"
        exit 2
    fi

    jq -r '.payload' | base64 -d | salty -i "$SALTY_IDENTITY" -d
}

lookup () {
    if [ $# -lt 1 ]; then
    printf "Usage: %s nick@domain\n" "$(basename "$0")"
    exit 1
    fi

    user="$1"
    nick="$(echo "$user" | awk -F@ '{ print $1 }')"
    domain="$(echo "$user" | awk -F@ '{ print $2 }')"

    curl -qsSL "https://$domain/.well-known/salty/${nick}.json"
}

readmsgs () {
    topic="$1"

    if [ -z "$topic" ]; then
        topic=$(get_user)
    fi

    export SALTY_IDENTITY="$HOME/.config/salty/$topic.key"
    if [ ! -f "$SALTY_IDENTITY" ]; then
        echo "identity file missing for user $topic" >&2
        exit 1
    fi

    msgbus sub "$topic" "$0"
}

sendmsg () {
    if [ $# -lt 2 ]; then
        printf "Usage: %s nick@domain.tld <message>\n" "$(basename "$0")"
        exit 0
    fi

    if [ -z "$SALTY_IDENTITY" ]; then
        echo "SALTY_IDENTITY not set"
        exit 2
    fi

    user="$1"
    message="$2"

    salty_json="$(mktemp /tmp/salty.XXXXXX)"

    lookup "$user" > "$salty_json"

    endpoint="$(jq -r '.endpoint' < "$salty_json")"
    topic="$(jq -r '.topic' < "$salty_json")"
    key="$(jq -r '.key' < "$salty_json")"

    rm "$salty_json"

    message="[$(date +%FT%TZ)] <$(get_user)> $message"

    echo "$message" \
        | salty -i "$SALTY_IDENTITY" -r "$key" \
        | msgbus -u "$endpoint" pub "$topic"
}

make_user () {
    mkdir -p "$HOME/.config/salty"

    if [ $# -lt 1 ]; then
        user=$USER
    else
        user=$1
    fi

    identity_file="$HOME/.config/salty/$user.key"

    if [ -f "$identity_file" ]; then
        printf "user key exists!"
        exit 1
    fi

    # Check for msgbus env.. probably can make it fallback to looking for a config file?
    if [ -z "$MSGBUS_URI" ]; then
        printf "missing MSGBUS_URI in environment"
        exit 1
    fi


    salty-keygen -o "$identity_file"
    echo "# user: $user" >> "$identity_file"

    pubkey=$(grep key: "$identity_file" | awk '{print $4}')

    cat <<- EOF
Create this file in your webserver well-known folder. https://hostname.tld/.well-known/salty/$user.json

{
  "endpoint": "$MSGBUS_URI",
  "topic": "$user",
  "key": "$pubkey"
}

EOF
}

# check if streaming
if [ ! -t 1 ]; then
    stream
    exit 0
fi

# Show Help
if [ $# -lt 1 ]; then
    printf "Commands: send read lookup"
    exit 0
fi


CMD=$1
shift

case $CMD in
    send)
        sendmsg "$@"
    ;;
    read)
        readmsgs "$@"
    ;;
    lookup)
        lookup "$@"
    ;;
    make-user)
        make_user "$@"
    ;;
esac

⤋ Read More

@prologic@twtxt.net, who calls me name when I am busy profiting? 😂 In a less serious note—because nothing is more serious than making profit, of course—yes, it seems your avatar issue has been fixed. I am kind of sad, I looked forward each day to see which random one was going to show. LOL.

⤋ Read More

@prologic@twtxt.net you be the man! I can’t remember the last time something gave as much troubles as this. The mention and the way to handle images are two things that have stuck in my head. Hopefully this is the last time there is an issue with this one! 🤞🏻

⤋ Read More
In-reply-to » @prologic I am seeing a problem in which not-so-active users, such as myself, are ending up having a blank "Recent twts from..." under their profiles because, I assume, the cache long expired. What can be done about it? Business personalities such as myself can't be around here that often! Could something be implemented so that, say, the last 10 or 20 twts are always visible under one's profile? Neep-gren!

@prologic@twtxt.net let us take the path of less resistance, that is, less effort, for now. I am going to be a great-grandfather before search ever get implemented locally, least one to search on “all pods”. In other words, let us don’t bite more than we can chew. 😹 Neep-gren!

⤋ Read More
In-reply-to » @prologic I am seeing a problem in which not-so-active users, such as myself, are ending up having a blank "Recent twts from..." under their profiles because, I assume, the cache long expired. What can be done about it? Business personalities such as myself can't be around here that often! Could something be implemented so that, say, the last 10 or 20 twts are always visible under one's profile? Neep-gren!

@prologic@twtxt.net I fully agree with making it a pod-level setting (forget about user-level, let us not complicate things too much; we all know users know nothing). Should I send a latinum over for this, or will an issue just suffice? Neep-gren!

⤋ Read More

@prologic@twtxt.net I am seeing a problem in which not-so-active users, such as myself, are ending up having a blank “Recent twts from…” under their profiles because, I assume, the cache long expired. What can be done about it? Business personalities such as myself can’t be around here that often! Could something be implemented so that, say, the last 10 or 20 twts are always visible under one’s profile? Neep-gren!

⤋ Read More

@fastidious@arrakis.netbros.com, I am sure profit—or the search for it—was involved. Most likely that pilot was a Ferengi in disguise. We are known to visit lesser planets seeking to exploit. Sometimes it works out, sometimes it doesn’t. Hoping my fellow Ferengi fares well or, at the very least, lets me know where his Latinum is.

⤋ Read More

@fastidious@arrakis.netbros.com the things Gemini has going for it are mutual TLS and lack of JavaScript. Which makes for a secure albeit boring experience (much like gopher). The fake markdown is a bit of a drag.

A render mode for Gemini probably wouldnt be too hard. There are markdown to Gemini libs out there.

With Web3 the whole trust a 3rd party browser ext + high fees + env impact for compute and storage are serious no gos for me.. I have heard one too many horror stories about clicking the wrong link and some script draining your metamask wallet.

⤋ Read More