aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaria Lisina <sekoohaka.sarisan@gmail.com>2024-09-11 12:47:14 +0300
committerMaria Lisina <sekoohaka.sarisan@gmail.com>2024-09-11 12:47:14 +0300
commit0c9501f890bdb48601d060a4b6d19eb79f1fc238 (patch)
treecd45d04039167ef695f1b02237e1c8f2ee3af4f4
parentc634dacb013b01c75b9f6ba02c999b794e738e69 (diff)
units/ib_file: Execute ib_token only before ib_file download
Signed-off-by: Maria Lisina <sekoohaka.sarisan@gmail.com>
-rw-r--r--submodules/inline_search1
-rw-r--r--units/ib_common16
-rw-r--r--units/ib_file16
-rw-r--r--units/ib_search11
-rw-r--r--units/ib_token1
5 files changed, 18 insertions, 27 deletions
diff --git a/submodules/inline_search b/submodules/inline_search
index 140a78c..d339ff1 100644
--- a/submodules/inline_search
+++ b/submodules/inline_search
@@ -22,6 +22,7 @@ case "${command}" in
;;
esac
+ib_lock=0
. "${units}/ib_search"
if [ -n "${output_text}" ]
diff --git a/units/ib_common b/units/ib_common
index 62dcb09..a04ee3e 100644
--- a/units/ib_common
+++ b/units/ib_common
@@ -70,17 +70,6 @@ else
return 0
fi
-if [ -n "${ib_config}" ]
-then
- . "${units}/ib_token"
-
- if [ -n "${output_text}" ]
- then
- notification_text="${output_title} ${output_text}"
- return 0
- fi
-fi
-
if [ "${ib_name}" = "Idol Complex" ]
then
ib_query="id_range:${ib_post_id}"
@@ -90,8 +79,3 @@ fi
ib_hash="$(printf "%s%s%s" "${user_id}" "${ib_board}" "${ib_post_id}" | enhash)"
. "${units}/ib_file"
-
-if [ -n "${output_text}" ]
-then
- notification_text="${output_text}"
-fi
diff --git a/units/ib_file b/units/ib_file
index 56f66f1..2b7e940 100644
--- a/units/ib_file
+++ b/units/ib_file
@@ -25,6 +25,17 @@ then
rm -f "${ib_file}"
fi
+if [ -n "${ib_config}" ]
+then
+ . "${units}/ib_token"
+
+ if [ -n "${output_text}" ]
+ then
+ rm -fr "${cache}/${ib_hash}.lock"
+ return 0
+ fi
+fi
+
if [ -n "${ib_limit}" ]
then
ib_limit="${ib_dlimit}=${ib_limit}"
@@ -60,6 +71,8 @@ if ! curl --data-urlencode "${ib_dfield1}" \
then
output_title="An error occurred"
output_text="Failed to access ${ib_name} API"
+ notification_text="${output_text}"
+
next_offset=${inline_page:-0}
rm -fr "${ib_file}" "${cache}/${ib_hash}.lock"
@@ -70,6 +83,7 @@ if ! jq -e '.' "${ib_file}" > /dev/null 2>&1
then
output_title="An error occurred"
output_text="An unknown error occurred"
+ notification_text="${output_text}"
rm -fr "${ib_file}" "${cache}/${ib_hash}.lock"
return 0
@@ -100,6 +114,8 @@ then
else
output_text="Try different post ID"
fi
+
+ notification_text="${output_text}"
fi
rm -fr "${cache}/${ib_hash}.lock"
diff --git a/units/ib_search b/units/ib_search
index a7ad28e..d7b52bb 100644
--- a/units/ib_search
+++ b/units/ib_search
@@ -78,17 +78,6 @@ then
shift ${#}
fi
-if [ -n "${ib_config}" ]
-then
- ib_lock=0
- . "${units}/ib_token"
-
- if [ -n "${output_text}" ]
- then
- return 0
- fi
-fi
-
ib_limit=10
ib_page=${inline_page}
diff --git a/units/ib_token b/units/ib_token
index e1a4cd5..f7b447c 100644
--- a/units/ib_token
+++ b/units/ib_token
@@ -27,6 +27,7 @@ then
output_title="Refreshing access token..."
output_text="Try again in a few seconds"
+ notification_text="${output_title} ${output_text}"
else
. "${units}/ib_auth"
fi