๐Ÿ“ฆโž”๐Ÿฆ‹ Store and retrieve files on the Atmosphere

get social app name programmatically

+13 -11
+3 -11
src/entry.sh
··· 248 248 _version="$_force_version" &&\ 249 249 atfile.util.print_override_envvar_debug "Version" "_version" 250 250 251 - if [[ $_endpoint_appview != "$_endpoint_appview_default" ]] &&\ 252 - [[ $_endpoint_social_app == "$_endpoint_social_app_default" ]]; then 253 - case "$_endpoint_appview" in 254 - "https://bsky.zeppelin.social") _endpoint_social_app="https://zeppelin.social" ;; 255 - esac 251 + if [[ $_endpoint_social_app != "$_endpoint_social_app_default" ]]; then 252 + _endpoint_social_app_name="$(atfile.util.get_root_domain "$_endpoint_social_app")" 253 + _endpoint_social_app_name="${_endpoint_social_app_name^}" 256 254 fi 257 - 258 - case "$_endpoint_social_app" in 259 - "https://blacksky.community") _endpoint_social_app_name="Blacksky" ;; 260 - "https://deer.social") _endpoint_social_app_name="Deer" ;; 261 - "https://zeppelin.social") _endpoint_social_app_name="Zeppelin" ;; 262 - esac 263 255 264 256 ### Validation 265 257
+10
src/shared/util.sh
··· 424 424 echo -e "$input" | sed -n "$(( index ))"p 425 425 } 426 426 427 + function atfile.util.get_root_domain() { 428 + local url="$1" 429 + local domain=${url#*://} 430 + domain=${domain%%/*} 431 + 432 + local main_part=$(echo "$domain" | tr '.' '\n' | tac | sed -n '2p') 433 + 434 + echo "$main_part" 435 + } 436 + 427 437 function atfile.util.get_mediainfo_field() { 428 438 file="$1" 429 439 category="$2"