переход на бд в настройках

This commit is contained in:
2026-04-04 14:33:10 +10:00
parent 4aa6a469aa
commit 30e99d3b2c
3 changed files with 12 additions and 13 deletions

View File

@@ -63,7 +63,7 @@ const auth_my = async () => {
// Обработка глобального нажатия Enter
const handleKeyDown = (event) => {
if (event.key === "Enter") {
if (event.key === "Enter" && !isLoggedIn.value) {
auth_my();
}
};
@@ -71,7 +71,6 @@ const handleKeyDown = (event) => {
// Добавляем глобальный слушатель при монтировании
onMounted(() => {
window.addEventListener("keydown", handleKeyDown);
// Показываем badge reCAPTCHA при монтировании
showRecaptchaBadge();
});

View File

@@ -146,13 +146,12 @@ import { ref, onMounted } from "vue";
import axios from "axios";
const sources = ref([
{ name: "source1", url: "eee", prompt: "" },
{ name: "source2", url: "https://example2.com/api", prompt: "" },
{ url: "", name: "", promt: "" },
]);
const currentSource = ref(sources.value[0]);
const time = ref("");
const promt = ref("Начальный текст");
const promt_url = ref("https://");
const logs = ref([]);
const tasks = ref([]);
const showLogs = ref(false); // скрыто по умолчанию
@@ -165,7 +164,6 @@ function toggleLogs() {
load_log();
}
}
const load_log = async () => {
try {
const response = await axios.get("https://allowlgroup.ru/api/8001/logs");
@@ -218,7 +216,8 @@ const loadSettings = async () => {
const response = await axios.get("https://allowlgroup.ru/api/8001/settings");
sources.value = response.data.sources;
currentSource.value = sources.value[0];
promt.value = currentSource.value.prompt;
promt.value = currentSource.value.promt;
promt_url.value = currentSource.value.url;
} catch (error) {
console.error("Ошибка при загрузке настроек:", error);
}
@@ -227,16 +226,17 @@ const loadSettings = async () => {
// Выбор источника
const selectSource = (index) => {
currentSource.value = sources.value[index];
promt.value = currentSource.value.prompt;
promt.value = currentSource.value.promt;
promt_url.value = currentSource.value.url;
};
// Сохранение источников
const saveSources = async () => {
try {
await axios.post("https://allowlgroup.ru/api/8001/settings", {
url: currentSource.value.url,
name: currentSource.value.name,
url: "",
prompt: promt.value,
promt: promt.value,
});
// Здесь можно отправить на сервер, если нужно
loadSettings();

View File

@@ -2,7 +2,7 @@
import { ref, onMounted, onBeforeUnmount } from "vue";
import axios from "axios";
// Добавляем emit для уведомления родителя об изменениях
// Добавляем emit для уведомления родителя об изменениях
const emit = defineEmits(["update:viewed", "update:status"]);
const props = defineProps({
@@ -19,7 +19,7 @@ const props = defineProps({
status: Boolean,
});
// Делаем viewed и status реактивными для локального обновления
// Делаем viewed и status реактивными для локального обновления
const localViewed = ref(props.viewed);
const localStatus = ref(props.status);
@@ -66,7 +66,7 @@ function handleClickOutside(event) {
}
}
// Обновляем локально + отправляем emit
// Обновляем локально + отправляем emit
const viewed_b = async () => {
const newValue = !localViewed.value;
localViewed.value = newValue; // Локальное обновление сразу