blob: e091207e65bc950262ae3dd85179a315c14a661e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# Copyright (C) 2024-2026 Maria Lisina
# Copyright (C) 2024-2026 Danil Lisin
# SPDX-License-Identifier: Apache-2.0
ib_post="$(jq -c ".${ib_iarray}[$((idx - 1))]" "${ib_file}")"
ib_query="id:${ib_id}"
ib_hash="$(sha1sum <<< "${user_id}${ib_board}${ib_query}" | cut -d ' ' -f 1)"
ib_file="${cache}/${ib_hash}.json"
until mkdir "${cache}/${ib_hash}.lock"
do
sleep 1
done
if [[ -n "${ib_iarray}" ]]
then
printf '{"%s":[%s]}' "${ib_iarray}" "${ib_post}" | jq -c > "${ib_file}"
else
printf '[%s]' "${ib_post}" | jq -c > "${ib_file}"
fi
rmdir "${cache}/${ib_hash}.lock"
|