diff options
| author | Maria Lisina <sekoohaka.sarisan@gmail.com> | 2025-08-17 16:26:58 +0500 |
|---|---|---|
| committer | Maria Lisina <sekoohaka.sarisan@gmail.com> | 2025-08-17 16:26:58 +0500 |
| commit | ca558111f309c8e8ccd389df3e76a68bb1340840 (patch) | |
| tree | 9d3340b4577fa3e139733e340f9cb784a2039f35 /auth | |
| parent | a78a32090245e7caf8a35c4dde798aee7bd7ad10 (diff) | |
*/*: Initial new Sankaku Complex support
Signed-off-by: Maria Lisina <sekoohaka.sarisan@gmail.com>
Diffstat (limited to 'auth')
| -rw-r--r-- | auth/config/idolcomplex.zsh | 11 | ||||
| -rw-r--r-- | auth/config/sankakucomplex.zsh (renamed from auth/config/sankakuchannel.zsh) | 10 | ||||
| -rw-r--r-- | auth/idolcomplex.zsh | 136 | ||||
| -rw-r--r-- | auth/sankakucomplex.zsh (renamed from auth/sankakuchannel.zsh) | 0 |
4 files changed, 9 insertions, 148 deletions
diff --git a/auth/config/idolcomplex.zsh b/auth/config/idolcomplex.zsh deleted file mode 100644 index c4a89cb..0000000 --- a/auth/config/idolcomplex.zsh +++ /dev/null @@ -1,11 +0,0 @@ -# Copyright (C) 2024-2025 Maria Lisina -# Copyright (C) 2024-2025 Danil Lisin -# SPDX-License-Identifier: Apache-2.0 - -ib_auth="https://idol.sankakucomplex.com" -ib_cookie="_idolcomplex_session" -ib_expire=86400 -ib_login_file="username" -ib_key_file="password" -ib_login_word="email or username" -ib_key_word="password" diff --git a/auth/config/sankakuchannel.zsh b/auth/config/sankakucomplex.zsh index 196538f..10072a0 100644 --- a/auth/config/sankakuchannel.zsh +++ b/auth/config/sankakucomplex.zsh @@ -2,7 +2,15 @@ # Copyright (C) 2024-2025 Danil Lisin # SPDX-License-Identifier: Apache-2.0 -ib_auth="https://sankakuapi.com" +case "${ib_board}" in + (i) + ib_auth="https://i.sankakuapi.com" + ;; + (s) + ib_auth="https://sankakuapi.com" + ;; +esac + ib_header="Authorization: Bearer" ib_expire=86400 ib_login_file="login" diff --git a/auth/idolcomplex.zsh b/auth/idolcomplex.zsh deleted file mode 100644 index 7c8a393..0000000 --- a/auth/idolcomplex.zsh +++ /dev/null @@ -1,136 +0,0 @@ -# Copyright (C) 2024-2025 Maria Lisina -# Copyright (C) 2024-2025 Danil Lisin -# SPDX-License-Identifier: Apache-2.0 - -ib_cookies="${cookies_file}" -ib_auth_file="${cache}/${update_id}_login.html" -dump+=(${ib_auth_file##*/}) - -if ! curl --connect-timeout ${connrefused_timeout} \ - --cookie-jar "${ib_cookies}" \ - --max-time ${external_timeout} \ - --output "${ib_auth_file}" \ - --proxy "${external_proxy}" \ - --request GET \ - --retry 1 \ - --retry-connrefused \ - --retry-max-time $((external_timeout - connrefused_timeout)) \ - --silent \ - --user-agent "${useragent}" \ - "${ib_auth}/users/login" -then - output_text="Failed to access ${ib_name} API" - log_text="ib_auth (${update_id}): ${output_text}" - - . "${units}/log.zsh" - . "${units}/dump.zsh" - - return 0 -fi - -ib_action="$(xq -a "action" -q "form" "${ib_auth_file}")" -ib_token="$(xq -a "value" -q "form>input[name=authenticity_token]" "${ib_auth_file}")" - -if [[ -z "${ib_action}" || -z "${ib_token}" ]] -then - output_text="Failed to get authorization data" - log_text="ib_auth (${update_id}): ${output_text}" - - . "${units}/log.zsh" - . "${units}/dump.zsh" - - return 0 -fi - -ib_auth_file="${cache}/${update_id}_authenticate.html" -dump+=(${ib_auth_file##*/}) - -if ! curl --connect-timeout ${connrefused_timeout} \ - --cookie "${ib_cookies}" \ - --cookie-jar "${ib_cookies}" \ - --data-urlencode "authenticity_token=${ib_token}" \ - --data-urlencode "user[name]=${ib_login}" \ - --data-urlencode "user[password]=${ib_key}" \ - --data-urlencode "commit=Login" \ - --header "Referer: ${ib_auth}/users/login" \ - --max-time ${external_timeout} \ - --output "${ib_auth_file}" \ - --proxy "${external_proxy}" \ - --request POST \ - --retry 1 \ - --retry-connrefused \ - --retry-max-time $((external_timeout - connrefused_timeout)) \ - --silent \ - --user-agent "${useragent}" \ - "${ib_auth}${ib_action}" -then - output_text="Failed to access ${ib_name} API" - log_text="ib_auth (${update_id}): ${output_text}" - - . "${units}/log.zsh" - . "${units}/dump.zsh" - - return 0 -fi - -if [[ -s "${ib_auth_file}" ]] -then - output_text="An unknown error occurred" - log_text="ib_auth (${update_id}): ${output_text}" - - . "${units}/log.zsh" - . "${units}/dump.zsh" - - return 0 -fi - -ib_auth_file="${cache}/${update_id}_home.html" -dump+=(${ib_auth_file##*/}) - -if ! curl --connect-timeout ${connrefused_timeout} \ - --cookie "${ib_cookies}" \ - --max-time ${external_timeout} \ - --output "${ib_auth_file}" \ - --proxy "${external_proxy}" \ - --request GET \ - --retry 1 \ - --retry-connrefused \ - --retry-max-time $((external_timeout - connrefused_timeout)) \ - --silent \ - --user-agent "${useragent}" \ - "${ib_auth}/users/home" -then - output_text="Failed to access ${ib_name} API" - log_text="ib_auth (${update_id}): ${output_text}" - - . "${units}/log.zsh" - . "${units}/dump.zsh" - - return 0 -fi - -ib_notice="$(xq -q "div[id=notice]" "${ib_auth_file}")" - -if [[ -n "${ib_notice}" && "${ib_notice}" != "You are now logged in" ]] -then - output_text="$(htmlescape <<< "${ib_notice}")" - log_text="ib_auth (${update_id}): ${ib_notice}" - - . "${units}/log.zsh" - . "${units}/dump.zsh" - - return 0 -fi - -if [[ -z "${ib_notice}" ]] -then - output_text="Failed to verify user authorization" - log_text="ib_auth (${update_id}): ${output_text}" - - . "${units}/log.zsh" - . "${units}/dump.zsh" - - return 0 -fi - -strftime %s > "${timestamp_file}" diff --git a/auth/sankakuchannel.zsh b/auth/sankakucomplex.zsh index 86010be..86010be 100644 --- a/auth/sankakuchannel.zsh +++ b/auth/sankakucomplex.zsh |
