load_authors_by-debug
All checks were successful
Deploy on push / deploy (push) Successful in 6s

This commit is contained in:
Untone 2025-05-26 20:34:51 +03:00
parent 627be9a4f1
commit 301145fcff
4 changed files with 26 additions and 14 deletions

View File

@ -880,9 +880,9 @@ const AdminPage: Component<AdminPageProps> = (props) => {
}
}
return (
<button class="copy-btn" title="Скопировать" onClick={handleCopy} style="margin-left: 6px">
<a class="btn" title="Скопировать" type="button" style="margin-left: 6px" onClick={handleCopy}>
📋
</button>
</a>
)
}
@ -893,9 +893,9 @@ const AdminPage: Component<AdminPageProps> = (props) => {
*/
function ShowHideButton({ shown, onToggle }: { shown: boolean, onToggle: () => void }) {
return (
<button class="show-btn" title={shown ? 'Скрыть' : 'Показать'} onClick={onToggle} style="margin-left: 6px">
<a class="btn" title={shown ? 'Скрыть' : 'Показать'} type="button" style="margin-left: 6px" onClick={onToggle}>
{shown ? '🙈' : '👁️'}
</button>
</a>
)
}
@ -990,17 +990,17 @@ const AdminPage: Component<AdminPageProps> = (props) => {
<tbody>
<For each={section.variables}>
{(variable) => {
const shown = shownVars()[variable.key] || false
const shown = () => shownVars()[variable.key] || false
return (
<tr>
<td>{variable.key}</td>
<td>
{variable.isSecret && !shown
{variable.isSecret && !shown()
? '••••••••'
: (variable.value || <span class="empty-value">не задано</span>)}
<CopyButton value={variable.value || ''} />
{variable.isSecret && (
<ShowHideButton shown={shown} onToggle={() => toggleShow(variable.key)} />
<ShowHideButton shown={shown()} onToggle={() => toggleShow(variable.key)} />
)}
</td>
<td>{variable.description || '-'}</td>

View File

@ -841,3 +841,10 @@ th.sortable.sorted .sort-icon {
color: var(--primary-color);
font-weight: bold;
}
.btn {
text-decoration: none;
margin-left: 6px;
cursor: pointer;
user-select: none;
}

View File

@ -389,12 +389,17 @@ async def load_authors_by(_, info, by, limit, offset):
Returns:
list: Список авторов с учетом критерия
"""
try:
# Получаем ID текущего пользователя и флаг админа из контекста
viewer_id = info.context.get("author", {}).get("id")
is_admin = info.context.get("is_admin", False)
# Используем оптимизированную функцию для получения авторов
return await get_authors_with_stats(limit, offset, by, viewer_id, is_admin)
except Exception as exc:
import traceback
logger.error(f"{exc}:\n{traceback.format_exc()}")
return []
@query.field("load_authors_search")

View File

@ -86,7 +86,7 @@ class EnvManager:
# Переменные, которые следует всегда помечать как секретные
SECRET_VARS_PATTERNS = [
r".*TOKEN.*", r".*SECRET.*", r".*PASSWORD.*", r".*KEY.*",
r".*PWD.*", r".*PASS.*", r".*CRED.*",
r".*PWD.*", r".*PASS.*", r".*CRED.*", r".*_DSN.*",
r".*JWT.*", r".*SESSION.*", r".*OAUTH.*",
r".*GITHUB.*", r".*GOOGLE.*", r".*FACEBOOK.*"
]