repo: actpub
action: blob
revision: 
path_from: ap-uncacheactor
revision_from: refs/heads/master:
path_to: 
revision_to: 
git.thebackupbox.net
actpub
git clone git://git.thebackupbox.net/actpub

blob of:

actpub

/ ap-uncacheactor

blob_plain of this file

refs/heads/master:/ap-uncacheactor

 #!/usr/bin/env bash

 ### guess

 if [ ! "$1" ];then
   printf 'usage: ap-uncacheactor \n' >&2
   exit 0
 fi

 acct="$1"

 if [ "$(uricut -s <<< "$1")" == "acct" ];then
   acct="$(uricut -p <<< "$1")"
 fi

 if grep ':' <<< "$acct" >/dev/null 2>&1;then
   uri="$acct"
   acct="$(uricut -p <<< "$(ap-actor2acct "$uri")")"
 else
   uri="$(ap-getactoruri "$acct")"
 fi

 acct="$(sed 's/^@//' <<< "${acct}")"

 printf 'acct: %s\n' "$acct" >&2
 printf 'uri: %s\n' "$uri" >&2

 mkdir -p ~/.cache/ap/actor
 cache_file=~/.cache/ap/actor/"$(sha256sum <<< "$uri" | cut '-d ' -f1)"

 rm "${cache_file}" && echo "${cache_file} deleted" >&2
 rm ~/.cache/ap/actor/"${acct}" && echo ~/.cache/ap/actor/"${acct} deleted" >&2