Added telegram bot
Build and Publish / Build and Publish Docker Image (push) Successful in 3m8s

This commit is contained in:
Ultradesu
2026-06-30 18:36:53 +03:00
parent 3def3afeda
commit 3a4bc23a58
12 changed files with 915 additions and 19 deletions
+37 -16
View File
@@ -47,6 +47,9 @@
.section-tabs button.active { background: #17202a; color: #fff; border-color: #17202a; }
.settings-grid { display: grid; grid-template-columns: minmax(180px, .7fr) minmax(240px, 1fr) auto; gap: .55rem .75rem; align-items: center; background: #fff; border: 1px solid #dde2e6; border-radius: 6px; padding: .75rem; }
.settings-row { display: contents; }
.settings-info-row { grid-column: 1 / -1; border: 1px solid #dde2e6; border-left: 4px solid #2d6cdf; border-radius: 6px; background: #f8fafc; padding: .75rem; display: grid; gap: .45rem; }
.settings-info-title { color: #1d2733; font-weight: 750; }
.settings-info-text { margin: 0; color: #34414f; white-space: pre-wrap; overflow-wrap: anywhere; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .84rem; line-height: 1.45; }
.field-name { font-weight: 650; color: #34414f; overflow-wrap: anywhere; }
.field-help { color: #53606d; font-size: .78rem; margin-top: .15rem; overflow-wrap: anywhere; }
.badge { display: inline-block; padding: .15rem .55rem; border-radius: 4px; font-size: .8rem; font-weight: 650; }
@@ -191,21 +194,33 @@
<template x-if="settings.fields.length > 0">
<div class="settings-grid">
<template x-for="field in visibleSettings()" :key="field.key">
<div class="settings-row">
<div class="field-name">
<span x-text="fieldLabel(field.key)"></span>
<div class="field-help" x-text="field.env_var"></div>
</div>
<div>
<template x-if="field.kind === 'bool'">
<input type="checkbox" x-model="settingsForm[field.key]">
</template>
<template x-if="field.kind !== 'bool'">
<input :type="field.kind === 'password' ? 'password' : field.kind" x-model="settingsForm[field.key]">
</template>
<div class="hint">default: <code x-text="field.default_value || '(empty)'"></code></div>
</div>
<span class="badge" :class="`badge-${field.source}`" x-text="field.source"></span>
<div :class="field.kind === 'info' ? 'settings-info-row' : 'settings-row'">
<template x-if="field.kind === 'info'">
<div>
<div class="settings-info-title" x-text="fieldLabel(field.key)"></div>
<pre class="settings-info-text" x-text="field.value"></pre>
</div>
</template>
<template x-if="field.kind !== 'info'">
<div class="field-name">
<span x-text="fieldLabel(field.key)"></span>
<div class="field-help" x-text="field.env_var"></div>
</div>
</template>
<template x-if="field.kind !== 'info'">
<div>
<template x-if="field.kind === 'bool'">
<input type="checkbox" x-model="settingsForm[field.key]">
</template>
<template x-if="field.kind !== 'bool'">
<input :type="field.kind === 'password' ? 'password' : field.kind" x-model="settingsForm[field.key]">
</template>
<div class="hint">default: <code x-text="field.default_value || '(empty)'"></code></div>
</div>
</template>
<template x-if="field.kind !== 'info'">
<span class="badge" :class="`badge-${field.source}`" x-text="field.source"></span>
</template>
</div>
</template>
</div>
@@ -316,7 +331,7 @@ function adminApp(initialView) {
settings: { fields: [] },
settingsForm: {},
settingsSection: 'auth',
settingSections: ['auth', 'oidc', 'kubernetes', 'vpn', 'api'],
settingSections: ['auth', 'oidc', 'kubernetes', 'vpn', 'api', 'telegram'],
debug: null,
userModalOpen: false,
userForm: {},
@@ -401,6 +416,7 @@ function adminApp(initialView) {
this.settings = await this.request('/admin/api/settings');
const form = {};
for (const field of this.settings.fields) {
if (field.kind === 'info') continue;
form[field.key] = field.kind === 'bool' ? field.value === 'true' : field.value;
}
this.settingsForm = form;
@@ -491,6 +507,7 @@ function adminApp(initialView) {
kubernetes: '{{ t.settings_kubernetes }}',
vpn: '{{ t.settings_vpn }}',
api: '{{ t.settings_api }}',
telegram: '{{ t.settings_telegram }}',
}[section] || section;
},
fieldLabel(key) {
@@ -501,6 +518,10 @@ function adminApp(initialView) {
oidc_admin_groups: '{{ t.settings_oidc_admin_groups }}',
oidc_client_groups: '{{ t.settings_oidc_client_groups }}',
swagger_enabled: '{{ t.settings_swagger }}',
telegram_bot_enabled: '{{ t.settings_telegram_enabled }}',
telegram_bot_username: '{{ t.settings_telegram_username }}',
telegram_bot_token: '{{ t.settings_telegram_token }}',
telegram_setup_instructions: '{{ t.settings_telegram_setup_instructions }}',
}[key] || key;
},
};