From 70090242be0c98d9bc567a2295b39f8db8468584 Mon Sep 17 00:00:00 2001 From: Dict Xiong Date: Tue, 22 Apr 2025 17:12:26 +0800 Subject: [PATCH] feat: remove frigg-client.log --- .update.sh | 3 +-- .zshrc2 | 1 - tools/common.sh | 13 ------------- tools/frigg-client.sh | 20 +++----------------- tools/test.zsh | 1 - 5 files changed, 4 insertions(+), 34 deletions(-) diff --git a/.update.sh b/.update.sh index 1baa6c6..3ac0eef 100644 --- a/.update.sh +++ b/.update.sh @@ -39,8 +39,7 @@ case $DFS_UPDATE_CHANNEL in esac if [[ ${#DFS_COMMIT} != 40 ]]; then fmt_error "invalid commit id" - apost_beacon "dfs.invalid-commit" - apost_log "ERROR" "$THIS_FILE" "invalid commit id: ${DFS_COMMIT}" + apost_beacon "dfs.invalid-commit" "invalid commit id: ${DFS_COMMIT}" exit fi diff --git a/.zshrc2 b/.zshrc2 index bd60d7b..ebd8686 100644 --- a/.zshrc2 +++ b/.zshrc2 @@ -187,7 +187,6 @@ dfs() "$DOTFILES/install.sh" -i echo 'Done. Please open a new shell to see the changes.' ;; - log ) "$DOTFILES/tools/common.sh" "post_log" "INFO" "dfs" "$2" ;; beacon ) "$DOTFILES/tools/common.sh" "post_beacon" "$2" "$3" ;; * ) echo "unknown command \"$1\". available: update, force-update, version, reset, cd, log" ;; esac diff --git a/tools/common.sh b/tools/common.sh index eafb2bd..3fcd6d4 100755 --- a/tools/common.sh +++ b/tools/common.sh @@ -162,19 +162,6 @@ ask_for_Yn() fi } -post_log() -{ - if [[ $# != 3 || -z "$1" || -z "$2" || -z "$3" ]]; then - fmt_fatal "usage: post_log
" - fi - "${DOTFILES}/tools/frigg-client.sh" "log" "[$1][$2] $3" -} - -apost_log() -{ - post_log "$@" 1>/dev/null & -} - post_beacon() { if [[ $# < 1 || -z "$1" ]]; then diff --git a/tools/frigg-client.sh b/tools/frigg-client.sh index 4d5d3da..ff03cdd 100755 --- a/tools/frigg-client.sh +++ b/tools/frigg-client.sh @@ -63,8 +63,8 @@ handle_resp() post_beacon() { - local beacon_type=$1 - local meta=$2 + local beacon_type="$1" + local meta="$2" if [[ -n "$CI" && "$beacon_type" != "gh.ci" && "$beacon_type" != "dfs.invalid-commit" && "$beacon_type" != "dfs.dirty" ]]; then return fi @@ -75,17 +75,6 @@ post_beacon() handle_resp "$resp" } -post_log() -{ - local log_content=$1 - if [[ -z "$log_content" ]]; then - fmt_fatal "log content is required" - fi - init_uuid - resp=$(curl $DFS_CURL_OPTIONS -sSL -X POST -H "Content-Type: text/plain" -d "$log_content" "https://api.beardic.cn/post-log?hostname=$hostname&uuid=$uuid") - handle_resp "$resp" -} - update_dns() { if [[ -z "$DFS_DDNS_IP4$DFS_DDNS_IP6" ]]; then @@ -138,7 +127,7 @@ update_dns() print_help() { - fmt_info "usage: $0 [beacon_type|log_content]" + fmt_info "usage: $0 [beacon_type] [beacon_meta]" } router() @@ -150,9 +139,6 @@ router() beacon) post_beacon "$2" "$3" ;; - log) - post_log "$2" - ;; ddns) update_dns ;; diff --git a/tools/test.zsh b/tools/test.zsh index 0a42b19..a07ff1a 100644 --- a/tools/test.zsh +++ b/tools/test.zsh @@ -27,7 +27,6 @@ fi # check scripts and functions dfs version -dfs log 1 dfs beacon gh.ci $GITHUB_SHA z ~ test ~ -ef "$(pwd)"