Baka-proofing OpenRouter OAuth flow

This commit is contained in:
Cohee
2026-03-09 20:46:46 +02:00
parent 3ad9b05e27
commit ae5c65c3cf
17 changed files with 40 additions and 1 deletions
+2
View File
@@ -337,6 +337,8 @@
"koboldcpp API key (optional)": "مفتاح koboldcpp API (اختياري)",
"Example: http://127.0.0.1:5001": "مثال: http://127.0.0.1:5001",
"Authorize": "تفويض",
"OpenRouter API key already exists": "مفتاح API OpenRouter موجود بالفعل",
"Do you really wish to create a new OpenRouter key? Your existing key will not be deleted.": "هل تريد حقاً إنشاء مفتاح OpenRouter جديد؟ لن يتم حذف مفتاحك الموجود.",
"Get your OpenRouter API token using OAuth flow. You will be redirected to openrouter.ai": "احصل على رمز واجهة برمجة التطبيقات الخاص بك لموزع الاتصالات باستخدام تدفق OAuth. سيتم توجيهك إلى openrouter.ai",
"Bypass status check": "تجاوز فحص الحالة",
"Chat Completion Source": "مصدر استكمال الدردشة",
+2
View File
@@ -337,6 +337,8 @@
"koboldcpp API key (optional)": "koboldcpp API-Schlüssel (optional)",
"Example: http://127.0.0.1:5001": "Beispiel: http://127.0.0.1:5001",
"Authorize": "Autorisieren",
"OpenRouter API key already exists": "OpenRouter API-Schlüssel existiert bereits",
"Do you really wish to create a new OpenRouter key? Your existing key will not be deleted.": "Möchten Sie wirklich einen neuen OpenRouter API-Schlüssel erstellen? Ihr vorhandener Schlüssel wird nicht gelöscht.",
"Get your OpenRouter API token using OAuth flow. You will be redirected to openrouter.ai": "Hole dein OpenRouter-API-Token mit OAuth-Fluss. Du wirst zu openrouter.ai weitergeleitet",
"Bypass status check": "Umgehe Statusüberprüfung",
"Chat Completion Source": "Quelle für Chat-Vervollständigung",
+2
View File
@@ -337,6 +337,8 @@
"koboldcpp API key (optional)": "Clave API de koboldcpp (opcional)",
"Example: http://127.0.0.1:5001": "Ejemplo: http://127.0.0.1:5001",
"Authorize": "Autorizar",
"OpenRouter API key already exists": "La clave de API de OpenRouter ya existe",
"Do you really wish to create a new OpenRouter key? Your existing key will not be deleted.": "¿Realmente deseas crear una nueva clave de API de OpenRouter? Tu clave existente no será eliminada.",
"Get your OpenRouter API token using OAuth flow. You will be redirected to openrouter.ai": "Obtenga su token de API de OpenRouter utilizando el flujo OAuth. Será redirigido a openrouter.ai",
"Bypass status check": "Saltar la verificación del estado",
"Chat Completion Source": "Fuente de Completado de Chat",
+2
View File
@@ -320,6 +320,8 @@
"koboldcpp API key (optional)": "Clé API koboldcpp (facultatif)",
"Example: http://127.0.0.1:5001": "Exemple : http://127.0.0.1:5001",
"Authorize": "Autoriser",
"OpenRouter API key already exists": "La clé API OpenRouter existe déjà",
"Do you really wish to create a new OpenRouter key? Your existing key will not be deleted.": "Voulez-vous vraiment créer une nouvelle clé OpenRouter ? Votre clé existante ne sera pas supprimée.",
"Get your OpenRouter API token using OAuth flow. You will be redirected to openrouter.ai": "Obtenez votre jeton API OpenRouter en utilisant le flux OAuth. Vous serez redirigé vers openrouter.ai",
"Bypass status check": "Contourner la vérification de l'état",
"Chat Completion Source": "Source de complétion de chat",
+2
View File
@@ -335,6 +335,8 @@
"koboldcpp API key (optional)": "koboldcpp API lykill (valfrjálst)",
"Example: http://127.0.0.1:5001": "Dæmi: http://127.0.0.1:5001",
"Authorize": "Heimild",
"OpenRouter API key already exists": "OpenRouter API lykill er þegar til",
"Do you really wish to create a new OpenRouter key? Your existing key will not be deleted.": "Viltu virkilega búa til nýjan OpenRouter lykil? Núverandi lykill þinn verður ekki eytt.",
"Get your OpenRouter API token using OAuth flow. You will be redirected to openrouter.ai": "Fáðu API lykilinn þinn fyrir OpenRouter með því að nota OAuth strauminn. Þú verður endurvísað(ð/ur) á openrouter.ai",
"Bypass status check": "Hlaupa framhjá stöðutík",
"Chat Completion Source": "Heimild að fullvirkni spjalls",
+2
View File
@@ -337,6 +337,8 @@
"koboldcpp API key (optional)": "Chiave API koboldcpp (opzionale)",
"Example: http://127.0.0.1:5001": "Esempio: http://127.0.0.1:5001",
"Authorize": "Autorizzare",
"OpenRouter API key already exists": "La chiave API di OpenRouter esiste già",
"Do you really wish to create a new OpenRouter key? Your existing key will not be deleted.": "Desideri veramente creare una nuova chiave API di OpenRouter? La tua chiave esistente non verrà eliminata.",
"Get your OpenRouter API token using OAuth flow. You will be redirected to openrouter.ai": "Ottieni il tuo token API di OpenRouter utilizzando il flusso OAuth. Sarai reindirizzato su openrouter.ai",
"Bypass status check": "Ignora controllo stato",
"Chat Completion Source": "Fonte di Completamento della Chat",
+2
View File
@@ -337,6 +337,8 @@
"koboldcpp API key (optional)": "koboldcpp API キー (オプション)",
"Example: http://127.0.0.1:5001": "例: http://127.0.0.1:5001",
"Authorize": "承認",
"OpenRouter API key already exists": "OpenRouter API キーは既に存在します",
"Do you really wish to create a new OpenRouter key? Your existing key will not be deleted.": "新しい OpenRouter キーを作成してもよろしいですか?既存のキーは削除されません。",
"Get your OpenRouter API token using OAuth flow. You will be redirected to openrouter.ai": "OAuthフローを使用してOpenRouter APIトークンを取得します。 openrouter.aiにリダイレクトされます",
"Bypass status check": "ステータスのチェックをバイパスする",
"Chat Completion Source": "チャット補完ソース",
+2
View File
@@ -337,6 +337,8 @@
"koboldcpp API key (optional)": "koboldcpp API 키(선택사항)",
"Example: http://127.0.0.1:5001": "예: http://127.0.0.1:5001",
"Authorize": "승인하기",
"OpenRouter API key already exists": "OpenRouter API 키가 이미 존재합니다",
"Do you really wish to create a new OpenRouter key? Your existing key will not be deleted.": "정말 새로운 OpenRouter 키를 만들기를 원하십니까? 기존 키는 삭제되지 않습니다.",
"Get your OpenRouter API token using OAuth flow. You will be redirected to openrouter.ai": "OAuth 플로우를 사용하여 OpenRouter API 토큰을 가져옵니다. openrouter.ai로 리디렉션됩니다.",
"Legacy API (pre-OAI, no streaming)": "레거시 API (OAI 이전, 스트리밍 없음)",
"Bypass status check": "상태 확인 우회",
+2
View File
@@ -333,6 +333,8 @@
"koboldcpp API key (optional)": "koboldcpp API-sleutel (optioneel)",
"Example: http://127.0.0.1:5001": "Voorbeeld: http://127.0.0.1:5001",
"Authorize": "Toestemming geven",
"OpenRouter API key already exists": "OpenRouter API-sleutel bestaat al",
"Do you really wish to create a new OpenRouter key? Your existing key will not be deleted.": "Wilt u echt een nieuwe OpenRouter API-sleutel maken? Uw bestaande sleutel wordt niet verwijderd.",
"Get your OpenRouter API token using OAuth flow. You will be redirected to openrouter.ai": "Haal uw OpenRouter API-token op met behulp van OAuth-flow. U wordt doorgestuurd naar openrouter.ai",
"Bypass status check": "Omzeil statuscontrole",
"Chat Completion Source": "Bron voor Chatvoltooiing",
+2
View File
@@ -335,6 +335,8 @@
"koboldcpp API key (optional)": "Chave API koboldcpp (opcional)",
"Example: http://127.0.0.1:5001": "Exemplo: http://127.0.0.1:5001",
"Authorize": "Autorizar",
"OpenRouter API key already exists": "A chave de API do OpenRouter já existe",
"Do you really wish to create a new OpenRouter key? Your existing key will not be deleted.": "Você realmente deseja criar uma nova chave OpenRouter? Sua chave existente não será excluída.",
"Get your OpenRouter API token using OAuth flow. You will be redirected to openrouter.ai": "Obtenha seu token da API do OpenRouter usando o fluxo OAuth. Você será redirecionado para openrouter.ai",
"Bypass status check": "Ignorar verificação de status",
"Chat Completion Source": "Fonte de conclusão de chat",
+2
View File
@@ -758,6 +758,8 @@
"Doesn't work? Try adding": "Не работает? Попробуйте добавить в конце",
"at the end!": "!",
"Authorize": "Авторизоваться",
"OpenRouter API key already exists": "Ключ API OpenRouter уже существует",
"Do you really wish to create a new OpenRouter key? Your existing key will not be deleted.": "Вы действительно хотите создать новый ключ OpenRouter? Ваш существующий ключ не будет удален.",
"No persona description": "[Нет описания]",
"Not connected to API!": "Нет соединения с API!",
"Type a message, or /? for help": "Введите сообщение, или /? для получения справки",
+2
View File
@@ -339,6 +339,8 @@
"koboldcpp API key (optional)": "คีย์ API ของ koboldcpp (เพิ่มเติม)",
"Example: http://127.0.0.1:5001": "ตัวอย่าง: http://127.0.0.1:5001",
"Authorize": "อนุญาต",
"OpenRouter API key already exists": "คีย์ API ของ OpenRouter มีอยู่แล้ว",
"Do you really wish to create a new OpenRouter key? Your existing key will not be deleted.": "คุณต้องการสร้างคีย์ OpenRouter ใหม่จริง ๆ หรือไม่ คีย์ที่มีอยู่ของคุณจะไม่ถูกลบ",
"Get your OpenRouter API token using OAuth flow. You will be redirected to openrouter.ai": "โปรดเข้าสู่ระบบเพื่อรับ OpenRouter API Token โดยใช้ OAuth Flow จากนั้นคุณจะถูกเปลี่ยนเส้นทางไปยังเว็บไซต์ของ openrouter.ai",
"Bypass status check": "ข้ามการตรวจสอบสถานะ",
"Chat Completion Source": "แหล่งที่มาของ Chat Completion",
+2
View File
@@ -335,6 +335,8 @@
"koboldcpp API key (optional)": "API-ключ koboldcpp (необов’язково)",
"Example: http://127.0.0.1:5001": "Приклад: http://127.0.0.1:5001",
"Authorize": "Авторизувати",
"OpenRouter API key already exists": "API ключ OpenRouter вже існує",
"Do you really wish to create a new OpenRouter key? Your existing key will not be deleted.": "Ви дійсно бажаєте створити новий ключ OpenRouter API? Ваш існуючий ключ не буде видалено.",
"Get your OpenRouter API token using OAuth flow. You will be redirected to openrouter.ai": "Отримайте свій токен API OpenRouter за допомогою OAuth. Вас буде перенаправлено на openrouter.ai",
"Bypass status check": "Обійти перевірку статусу",
"Chat Completion Source": "Джерело Chat Completion",
+2
View File
@@ -335,6 +335,8 @@
"koboldcpp API key (optional)": "Key API koboldcpp (tùy chọn)",
"Example: http://127.0.0.1:5001": "Ví dụ: http://127.0.0.1:5001",
"Cho phép": "Ủy quyền",
"OpenRouter API key already exists": "Key API OpenRouter đã tồn tại",
"Do you really wish to create a new OpenRouter key? Your existing key will not be deleted.": "Bạn có thực sự muốn tạo khóa OpenRouter mới không? Khóa hiện có của bạn sẽ không bị xóa.",
"Get your OpenRouter API token using OAuth flow. You will be redirected to openrouter.ai": "Nhận mã thông báo API OpenRouter của bạn bằng cách sử dụng luồng OAuth. Bạn sẽ được chuyển hướng đến openrouter.ai",
"Bypass status check": "Bỏ qua check trạng thái",
"Chat Completion Source": "Nguồn cho Chat Completion",
+2
View File
@@ -427,6 +427,8 @@
"Bypass status check": "跳过状态检查",
"Derive context size from backend": "从后端获取上下文长度",
"Authorize": "授权",
"OpenRouter API key already exists": "OpenRouter API 密钥已存在",
"Do you really wish to create a new OpenRouter key? Your existing key will not be deleted.": "您确定要创建新的 OpenRouter API 密钥吗?您现有的密钥不会被删除。",
"Get your OpenRouter API token using OAuth flow. You will be redirected to openrouter.ai": "使用 OAuth 流程获取您的 OpenRouter API 令牌。您将被重定向到 openrouter.ai",
"Chat Completion Source": "聊天补全来源",
"Custom (OpenAI-compatible)": "自定义(兼容 OpenAI",
+2
View File
@@ -334,6 +334,8 @@
"koboldcpp API key (optional)": "KoboldCpp API 金鑰(可選)",
"Example: http://127.0.0.1:5001": "範例:http://127.0.0.1:5001",
"Authorize": "授權",
"OpenRouter API key already exists": "OpenRouter API 密鑰已存在",
"Do you really wish to create a new OpenRouter key? Your existing key will not be deleted.": "您確定要建立新的 OpenRouter API 金鑰嗎?您現有的金鑰不會被刪除。",
"Get your OpenRouter API token using OAuth flow. You will be redirected to openrouter.ai": "使用 OAuth 流程取得您的 OpenRouter API 符元。您將被重新導向到 openrouter.ai",
"Bypass status check": "繞過狀態檢查",
"Chat Completion Source": "聊天補全來源",
+8 -1
View File
@@ -474,7 +474,14 @@ export async function renameSecret(key, id, label) {
/**
* Redirects the user to authorize OpenRouter.
*/
function authorizeOpenRouter() {
async function authorizeOpenRouter() {
if (secret_state[SECRET_KEYS.OPENROUTER]) {
const confirmed = await Popup.show.confirm(t`OpenRouter API key already exists`, t`Do you really wish to create a new OpenRouter key? Your existing key will not be deleted.`);
if (!confirmed) {
return;
}
}
const redirectUrl = new URL('/callback/openrouter', window.location.origin);
const openRouterUrl = `https://openrouter.ai/auth?callback_url=${encodeURIComponent(redirectUrl.toString())}`;
location.href = openRouterUrl;