From 919fa792c1cc365ff949a409411b258eae0f4262 Mon Sep 17 00:00:00 2001 From: Yang Hanlin Date: Fri, 12 Apr 2024 00:16:34 +0800 Subject: [PATCH 1/4] :sparkles: feat: support passing `Mj-Api-Secret` through server- or client-side settings --- locales/en-US/common.json | 9 +++++++-- locales/zh-CN/common.json | 7 ++++++- src/app/api/midjourney/route.ts | 30 +++++++++++++++++++++++++++--- src/config/server.ts | 2 ++ src/features/Settings.tsx | 13 +++++++++++-- src/services/midjourney.ts | 2 ++ src/store/global/initialState.ts | 1 + src/store/global/selectors.ts | 2 ++ 8 files changed, 58 insertions(+), 8 deletions(-) diff --git a/locales/en-US/common.json b/locales/en-US/common.json index b0ce974..e463f57 100644 --- a/locales/en-US/common.json +++ b/locales/en-US/common.json @@ -35,8 +35,13 @@ }, "settings": { "MidjourneyAPIProxy": { - "description": "Please refer to <1>midjourney-proxy for deploying the server and then use", - "title": "Midjourney API Proxy Address" + "baseUrl": { + "title": "Midjourney API Proxy Address" + }, + "apiSecret": { + "title": "Midjourney API Proxy Secret" + }, + "description": "Please refer to <1>midjourney-proxy for deploying the server and then use" }, "modalTitle": "Settings", "save": "Save" diff --git a/locales/zh-CN/common.json b/locales/zh-CN/common.json index 779f6db..df00adf 100644 --- a/locales/zh-CN/common.json +++ b/locales/zh-CN/common.json @@ -29,7 +29,12 @@ }, "settings": { "MidjourneyAPIProxy": { - "title": "Midjourney API 代理地址", + "baseUrl": { + "title": "Midjourney API 代理地址" + }, + "apiSecret": { + "title": "Midjourney API 代理 Secret" + }, "description": "请参考 <1>midjourney-proxy 部署好服务端后使用" }, "modalTitle": "设置", diff --git a/src/app/api/midjourney/route.ts b/src/app/api/midjourney/route.ts index 3ca1c2f..b7322b8 100644 --- a/src/app/api/midjourney/route.ts +++ b/src/app/api/midjourney/route.ts @@ -4,7 +4,7 @@ import { getServerConfig } from '@/config/server'; export const runtime = 'edge'; -const { MIDJOURNEY_PROXY_URL: base } = getServerConfig(); +const { MIDJOURNEY_PROXY_URL: base, MIDJOURNEY_PROXY_API_SECRET: apiSecret } = getServerConfig(); const getBase = (req: Request) => { const userDefineBaseUrl = req.headers.get('X-Midjourney-Proxy-Url'); @@ -12,8 +12,15 @@ const getBase = (req: Request) => { return userDefineBaseUrl || base; }; +const getAPISecret = (req: Request) => { + const userDefinedAPISecret = req.headers.get('X-Midjourney-Proxy-Api-Secret'); + + return userDefinedAPISecret || apiSecret; +}; + export const POST = async (req: Request) => { const baseUrl = getBase(req); + const apiSecret = getAPISecret(req); if (!baseUrl) return new Response(JSON.stringify({ type: 'NO_BASE_URL' }), { status: 400 }); @@ -21,19 +28,36 @@ export const POST = async (req: Request) => { const body = await req.text(); + const headers: Record = { + 'Content-Type': 'application/json', + }; + if (apiSecret) { + headers['Mj-Api-Secret'] = apiSecret; + } + return fetch(urlJoin(baseUrl, path), { body, - headers: { 'Content-Type': 'application/json' }, + headers, method: 'POST', }); }; export const GET = async (req: Request) => { const baseUrl = getBase(req); + const apiSecret = getAPISecret(req); if (!baseUrl) return new Response(JSON.stringify({ type: 'NO_BASE_URL' }), { status: 400 }); const path = new URL(req.url).searchParams.get('path')!; - return fetch(urlJoin(baseUrl, path), { headers: { 'Content-Type': 'application/json' } }); + const headers: Record = { + 'Content-Type': 'application/json', + }; + if (apiSecret) { + headers['Mj-Api-Secret'] = apiSecret; + } + + return fetch(urlJoin(baseUrl, path), { + headers, + }); }; diff --git a/src/config/server.ts b/src/config/server.ts index 2c01621..71a7b60 100644 --- a/src/config/server.ts +++ b/src/config/server.ts @@ -5,6 +5,7 @@ declare global { namespace NodeJS { interface ProcessEnv { MIDJOURNEY_PROXY_URL?: string; + MIDJOURNEY_PROXY_API_SECRET?: string; METADATA_BASE_URL?: string; IMGUR_CLIENT_ID?: string; @@ -23,6 +24,7 @@ export const getServerConfig = () => { return { MIDJOURNEY_PROXY_URL: process.env.MIDJOURNEY_PROXY_URL, + MIDJOURNEY_PROXY_API_SECRET: process.env.MIDJOURNEY_PROXY_API_SECRET, METADATA_BASE_URL: process.env.METADATA_BASE_URL, diff --git a/src/features/Settings.tsx b/src/features/Settings.tsx index 96e7b9d..5129568 100644 --- a/src/features/Settings.tsx +++ b/src/features/Settings.tsx @@ -12,9 +12,10 @@ import { settingsSelectors } from '@/store/global/selectors'; const Settings = memo(() => { const { t } = useTranslation('common'); - const [isSettingsModalOpen, proxyURL, updateSettings] = useGlobalStore((s) => [ + const [isSettingsModalOpen, proxyURL, proxyAPISecret, updateSettings] = useGlobalStore((s) => [ s.isSettingsModalOpen, settingsSelectors.proxyURL(s), + settingsSelectors.proxyAPISecret(s), s.updateSettings, ]); @@ -72,7 +73,7 @@ const Settings = memo(() => { /> )} -
{t('settings.MidjourneyAPIProxy.title')}
+
{t('settings.MidjourneyAPIProxy.baseUrl.title')}
{ updateSettings({ MIDJOURNEY_PROXY_URL: e.target.value }); @@ -80,6 +81,14 @@ const Settings = memo(() => { placeholder={'https://your-midjourney-proxy'} value={proxyURL} /> +
{t('settings.MidjourneyAPIProxy.apiSecret.title')}
+ { + updateSettings({ MIDJOURNEY_PROXY_API_SECRET: e.target.value }); + }} + placeholder={'your-midjourney-api-secret'} + value={proxyAPISecret} + /> 请参考 diff --git a/src/services/midjourney.ts b/src/services/midjourney.ts index 3de6a8c..f120b3b 100644 --- a/src/services/midjourney.ts +++ b/src/services/midjourney.ts @@ -65,6 +65,8 @@ class MidjourneyService { body: data ? JSON.stringify(data) : undefined, headers: { 'Content-Type': 'application/json', + 'X-Midjourney-Proxy-Api-Secret': + useGlobalStore.getState().settings.MIDJOURNEY_PROXY_API_SECRET || '', 'X-Midjourney-Proxy-Url': useGlobalStore.getState().settings.MIDJOURNEY_PROXY_URL || '', }, method, diff --git a/src/store/global/initialState.ts b/src/store/global/initialState.ts index 0c3a06d..1bcbc8a 100644 --- a/src/store/global/initialState.ts +++ b/src/store/global/initialState.ts @@ -1,6 +1,7 @@ import { LocaleMode } from '@/types/locale'; export interface AppSettings { + MIDJOURNEY_PROXY_API_SECRET?: string; MIDJOURNEY_PROXY_URL?: string; } diff --git a/src/store/global/selectors.ts b/src/store/global/selectors.ts index 1d32ffe..d419a97 100644 --- a/src/store/global/selectors.ts +++ b/src/store/global/selectors.ts @@ -1,7 +1,9 @@ import { SettingsStore } from './store'; +export const proxyAPISecret = (s: SettingsStore) => s.settings.MIDJOURNEY_PROXY_API_SECRET; export const proxyURL = (s: SettingsStore) => s.settings.MIDJOURNEY_PROXY_URL; export const settingsSelectors = { + proxyAPISecret, proxyURL, }; From e9b9cf1e6d26c2819aadff716abbc9edd9bf498b Mon Sep 17 00:00:00 2001 From: Yang Hanlin Date: Fri, 12 Apr 2024 02:07:11 +0800 Subject: [PATCH 2/4] :sparkles: feat: add `MIDJOURNEY_PROXY_API_SECRET` setting to Midjourney plugin --- public/manifest-dev.json | 9 ++++++++- public/manifest.json | 9 ++++++++- src/store/midjourney/initialState.ts | 1 + 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/public/manifest-dev.json b/public/manifest-dev.json index dbd7fc8..ed41ad5 100644 --- a/public/manifest-dev.json +++ b/public/manifest-dev.json @@ -29,8 +29,15 @@ "type": "object", "properties": { "MIDJOURNEY_PROXY_URL": { + "title": "Midjourney Proxy URL", "type": "string", - "description": "please add url of deployment of [midjourney-proxy](https://github.com/novicezk/midjourney-proxy)" + "description": "Please add URL of deployment of [midjourney-proxy](https://github.com/novicezk/midjourney-proxy)" + }, + "MIDJOURNEY_PROXY_API_SECRET": { + "title": "Midjourney Proxy API Secret", + "type": "string", + "description": "Please add API secret of [midjourney-proxy](https://github.com/novicezk/midjourney-proxy)", + "format": "password" } }, "required": ["MIDJOURNEY_PROXY_URL"] diff --git a/public/manifest.json b/public/manifest.json index 6f5774e..e4a7b3f 100644 --- a/public/manifest.json +++ b/public/manifest.json @@ -29,8 +29,15 @@ "type": "object", "properties": { "MIDJOURNEY_PROXY_URL": { + "title": "Midjourney Proxy URL", "type": "string", - "description": "please add url of deployment of [midjourney-proxy](https://github.com/novicezk/midjourney-proxy)" + "description": "Please add URL of deployment of [midjourney-proxy](https://github.com/novicezk/midjourney-proxy)" + }, + "MIDJOURNEY_PROXY_API_SECRET": { + "title": "Midjourney Proxy API Secret", + "type": "string", + "description": "Please add API secret of [midjourney-proxy](https://github.com/novicezk/midjourney-proxy)", + "format": "password" } }, "required": ["MIDJOURNEY_PROXY_URL"] diff --git a/src/store/midjourney/initialState.ts b/src/store/midjourney/initialState.ts index 1bb4a34..b24654e 100644 --- a/src/store/midjourney/initialState.ts +++ b/src/store/midjourney/initialState.ts @@ -1,6 +1,7 @@ import { MidjourneyTask } from '@/types/task'; export interface AppSettings { + MIDJOURNEY_PROXY_API_SECRET?: string; MIDJOURNEY_PROXY_URL?: string; } From 2232fe8451d7bbb173bd1af5fe02e35bb6c45965 Mon Sep 17 00:00:00 2001 From: Yang Hanlin Date: Fri, 12 Apr 2024 02:56:40 +0800 Subject: [PATCH 3/4] :globe_with_meridians: chore: update translations --- locales/ar/common.json | 9 +++++++-- locales/de-DE/common.json | 9 +++++++-- locales/en-US/common.json | 16 ++++++---------- locales/es-ES/common.json | 19 ++++++++++--------- locales/fr-FR/common.json | 9 +++++++-- locales/it-IT/common.json | 9 +++++++-- locales/ja-JP/common.json | 9 +++++++-- locales/ko-KR/common.json | 9 +++++++-- locales/nl-NL/common.json | 19 ++++++++++--------- locales/pl-PL/common.json | 9 +++++++-- locales/pt-BR/common.json | 19 ++++++++++--------- locales/ru-RU/common.json | 9 +++++++-- locales/tr-TR/common.json | 9 +++++++-- locales/vi-VN/common.json | 9 +++++++-- locales/zh-TW/common.json | 9 +++++++-- 15 files changed, 113 insertions(+), 59 deletions(-) diff --git a/locales/ar/common.json b/locales/ar/common.json index a499ada..6a3a8f6 100644 --- a/locales/ar/common.json +++ b/locales/ar/common.json @@ -29,8 +29,13 @@ }, "settings": { "MidjourneyAPIProxy": { - "description": "يرجى الرجوع إلى <1>midjourney-proxy ونشر الخدمة الخادمية لاستخدامها", - "title": "عنوان وكيل Midjourney API" + "apiSecret": { + "title": "سر وكيل Midjourney API" + }, + "baseUrl": { + "title": "عنوان وكيل Midjourney API" + }, + "description": "يرجى الرجوع إلى <1>midjourney-proxy ونشر الخدمة الخادمية لاستخدامها" }, "modalTitle": "الإعدادات", "save": "حفظ" diff --git a/locales/de-DE/common.json b/locales/de-DE/common.json index 5ff8f52..e23ec96 100644 --- a/locales/de-DE/common.json +++ b/locales/de-DE/common.json @@ -29,8 +29,13 @@ }, "settings": { "MidjourneyAPIProxy": { - "description": "Bitte installieren Sie den <1>midjourney-proxy-Server und verwenden Sie ihn", - "title": "Midjourney API-Proxy-Adresse" + "apiSecret": { + "title": "Midjourney API Proxy Secret" + }, + "baseUrl": { + "title": "Midjourney API Proxy-URL" + }, + "description": "Bitte installieren Sie den <1>midjourney-proxy-Server und verwenden Sie ihn" }, "modalTitle": "Einstellungen", "save": "Speichern" diff --git a/locales/en-US/common.json b/locales/en-US/common.json index e463f57..30b4117 100644 --- a/locales/en-US/common.json +++ b/locales/en-US/common.json @@ -16,13 +16,7 @@ "deleteAll": "Delete All Images", "deleteAllConfirm": "Are you sure you want to delete all images?", "deleteConfirm": "Are you sure you want to delete this image?", - "deleteCurrent": "Delete Current Image", - "task": { - "actions": { - "download": "Download", - "info": "Image Details" - } - } + "deleteCurrent": "Delete Current Image" }, "input": { "placeholder": "Enter Midjourney prompt word...", @@ -35,12 +29,12 @@ }, "settings": { "MidjourneyAPIProxy": { - "baseUrl": { - "title": "Midjourney API Proxy Address" - }, "apiSecret": { "title": "Midjourney API Proxy Secret" }, + "baseUrl": { + "title": "Midjourney API Proxy Address" + }, "description": "Please refer to <1>midjourney-proxy for deploying the server and then use" }, "modalTitle": "Settings", @@ -48,6 +42,8 @@ }, "task": { "actions": { + "download": "Download", + "info": "Image Details", "reroll": "Reroll", "upscale": "Upscale", "variant": "Diversify" diff --git a/locales/es-ES/common.json b/locales/es-ES/common.json index 0d0579f..964b289 100644 --- a/locales/es-ES/common.json +++ b/locales/es-ES/common.json @@ -16,13 +16,7 @@ "deleteAll": "Eliminar todas las imágenes", "deleteAllConfirm": "¿Estás seguro de que quieres eliminar todas las imágenes?", "deleteConfirm": "¿Estás seguro de que quieres eliminar esta imagen?", - "deleteCurrent": "Eliminar imagen actual", - "task": { - "actions": { - "download": "Descargar", - "info": "Detalles de la imagen" - } - } + "deleteCurrent": "Eliminar imagen actual" }, "input": { "placeholder": "Ingrese las palabras clave de Midjourney...", @@ -35,14 +29,21 @@ }, "settings": { "MidjourneyAPIProxy": { - "description": "Por favor consulta <1>midjourney-proxy para desplegar el servidor y luego utilizarlo", - "title": "Dirección del proxy de la API de Midjourney" + "apiSecret": { + "title": "Secreto de la API de Midjourney" + }, + "baseUrl": { + "title": "Dirección de proxy de la API de Midjourney" + }, + "description": "Por favor consulta <1>midjourney-proxy para desplegar el servidor y luego utilizarlo" }, "modalTitle": "Configuración", "save": "Guardar" }, "task": { "actions": { + "download": "Descargar", + "info": "Detalles de la imagen", "reroll": "Volver a generar", "upscale": "Mejorar la calidad", "variant": "Variar" diff --git a/locales/fr-FR/common.json b/locales/fr-FR/common.json index 9a99f2a..99f8cc1 100644 --- a/locales/fr-FR/common.json +++ b/locales/fr-FR/common.json @@ -29,8 +29,13 @@ }, "settings": { "MidjourneyAPIProxy": { - "description": "Veuillez consulter <1>midjourney-proxy pour déployer le service côté serveur avant utilisation", - "title": "Adresse du proxy Midjourney API" + "apiSecret": { + "title": "Secret du proxy API Midjourney" + }, + "baseUrl": { + "title": "Adresse du proxy API Midjourney" + }, + "description": "Veuillez consulter <1>midjourney-proxy pour déployer le service côté serveur avant utilisation" }, "modalTitle": "Paramètres", "save": "Enregistrer" diff --git a/locales/it-IT/common.json b/locales/it-IT/common.json index d79d445..af74bd3 100644 --- a/locales/it-IT/common.json +++ b/locales/it-IT/common.json @@ -35,8 +35,13 @@ }, "settings": { "MidjourneyAPIProxy": { - "description": "Si prega di fare riferimento a <1>midjourney-proxy per utilizzare il servizio lato server", - "title": "Indirizzo del proxy API di Midjourney" + "apiSecret": { + "title": "Segreto del proxy API di Midjourney" + }, + "baseUrl": { + "title": "Indirizzo del proxy API di Midjourney" + }, + "description": "Si prega di fare riferimento a <1>midjourney-proxy per utilizzare il servizio lato server" }, "modalTitle": "Impostazioni", "save": "Salva" diff --git a/locales/ja-JP/common.json b/locales/ja-JP/common.json index 5245103..e061a87 100644 --- a/locales/ja-JP/common.json +++ b/locales/ja-JP/common.json @@ -29,8 +29,13 @@ }, "settings": { "MidjourneyAPIProxy": { - "description": "サーバーをデプロイした後、<1>midjourney-proxy を参照して使用してください", - "title": "Midjourney APIプロキシアドレス" + "apiSecret": { + "title": "Midjourney API プロキシシークレット" + }, + "baseUrl": { + "title": "Midjourney API プロキシアドレス" + }, + "description": "サーバーをデプロイした後、<1>midjourney-proxy を参照して使用してください" }, "modalTitle": "設定", "save": "保存" diff --git a/locales/ko-KR/common.json b/locales/ko-KR/common.json index 838340e..858c4cc 100644 --- a/locales/ko-KR/common.json +++ b/locales/ko-KR/common.json @@ -29,8 +29,13 @@ }, "settings": { "MidjourneyAPIProxy": { - "description": "<1>midjourney-proxy를 참조하여 서버를 배포한 후 사용하세요", - "title": "Midjourney API 프록시 주소" + "apiSecret": { + "title": "Midjourney API 프록시 비밀번호" + }, + "baseUrl": { + "title": "Midjourney API 프록시 주소" + }, + "description": "<1>midjourney-proxy를 참조하여 서버를 배포한 후 사용하세요" }, "modalTitle": "설정", "save": "저장" diff --git a/locales/nl-NL/common.json b/locales/nl-NL/common.json index 67f99ba..02b0923 100644 --- a/locales/nl-NL/common.json +++ b/locales/nl-NL/common.json @@ -16,13 +16,7 @@ "deleteAll": "Alle afbeeldingen verwijderen", "deleteAllConfirm": "Weet je zeker dat je alle afbeeldingen wilt verwijderen?", "deleteConfirm": "Weet je zeker dat je deze afbeelding wilt verwijderen?", - "deleteCurrent": "Huidige afbeelding verwijderen", - "task": { - "actions": { - "download": "Downloaden", - "info": "Afbeeldingsdetails" - } - } + "deleteCurrent": "Huidige afbeelding verwijderen" }, "input": { "placeholder": "Voer een suggestiewoord voor Midjourney in...", @@ -35,14 +29,21 @@ }, "settings": { "MidjourneyAPIProxy": { - "description": "Raadpleeg <1>midjourney-proxy voor het implementeren van de serverzijde service", - "title": "Adres van de Midjourney API-proxy" + "apiSecret": { + "title": "Midjourney API Proxy-geheim" + }, + "baseUrl": { + "title": "Midjourney API Proxy-adres" + }, + "description": "Raadpleeg <1>midjourney-proxy voor het implementeren van de serverzijde service" }, "modalTitle": "Instellingen", "save": "Opslaan" }, "task": { "actions": { + "download": "Downloaden", + "info": "Afbeeldingsdetails", "reroll": "Opnieuw genereren", "upscale": "Opschalen", "variant": "Diversifiëren" diff --git a/locales/pl-PL/common.json b/locales/pl-PL/common.json index 793c260..a6b5dbc 100644 --- a/locales/pl-PL/common.json +++ b/locales/pl-PL/common.json @@ -29,8 +29,13 @@ }, "settings": { "MidjourneyAPIProxy": { - "description": "Proszę skonsultować się z <1>midjourney-proxy w celu skonfigurowania serwera", - "title": "Adres proxy API Midjourney" + "apiSecret": { + "title": "Sekret proxy Midjourney API" + }, + "baseUrl": { + "title": "Adres proxy Midjourney API" + }, + "description": "Proszę skonsultować się z <1>midjourney-proxy w celu skonfigurowania serwera" }, "modalTitle": "Ustawienia", "save": "Zapisz" diff --git a/locales/pt-BR/common.json b/locales/pt-BR/common.json index 12a3249..6435c28 100644 --- a/locales/pt-BR/common.json +++ b/locales/pt-BR/common.json @@ -16,13 +16,7 @@ "deleteAll": "Excluir todas as imagens", "deleteAllConfirm": "Tem certeza de que deseja excluir todas as imagens?", "deleteConfirm": "Tem certeza de que deseja excluir esta imagem?", - "deleteCurrent": "Excluir imagem atual", - "task": { - "actions": { - "download": "Baixar", - "info": "Detalhes da imagem" - } - } + "deleteCurrent": "Excluir imagem atual" }, "input": { "placeholder": "Digite as palavras-chave do Midjourney...", @@ -35,14 +29,21 @@ }, "settings": { "MidjourneyAPIProxy": { - "description": "Consulte <1>midjourney-proxy para implantar o servidor e usá-lo", - "title": "Endereço do proxy da API Midjourney" + "apiSecret": { + "title": "Segredo do Proxy da API Midjourney" + }, + "baseUrl": { + "title": "Endereço do Proxy da API Midjourney" + }, + "description": "Consulte <1>midjourney-proxy para implantar o servidor e usá-lo" }, "modalTitle": "Configurações", "save": "Salvar" }, "task": { "actions": { + "download": "Baixar", + "info": "Detalhes da Imagem", "reroll": "Rolar novamente", "upscale": "Aprimorar", "variant": "Variar" diff --git a/locales/ru-RU/common.json b/locales/ru-RU/common.json index 5616f2c..8588411 100644 --- a/locales/ru-RU/common.json +++ b/locales/ru-RU/common.json @@ -29,8 +29,13 @@ }, "settings": { "MidjourneyAPIProxy": { - "description": "Пожалуйста, укажите адрес сервера для использования <1>midjourney-proxy", - "title": "Адрес прокси Midjourney API" + "apiSecret": { + "title": "Секрет прокси Midjourney API" + }, + "baseUrl": { + "title": "Адрес прокси Midjourney API" + }, + "description": "Пожалуйста, укажите адрес сервера для использования <1>midjourney-proxy" }, "modalTitle": "Настройки", "save": "Сохранить" diff --git a/locales/tr-TR/common.json b/locales/tr-TR/common.json index 115ba70..f3cd6ea 100644 --- a/locales/tr-TR/common.json +++ b/locales/tr-TR/common.json @@ -29,8 +29,13 @@ }, "settings": { "MidjourneyAPIProxy": { - "description": "Lütfen <1>midjourney-proxy bağlantısına giderek sunucu tarafını kurduktan sonra kullanın", - "title": "Midjourney API Vekil Adresi" + "apiSecret": { + "title": "Midjourney API Proxy Gizlisi" + }, + "baseUrl": { + "title": "Midjourney API Proxy Adresi" + }, + "description": "Lütfen <1>midjourney-proxy bağlantısına giderek sunucu tarafını kurduktan sonra kullanın" }, "modalTitle": "Ayarlar", "save": "Kaydet" diff --git a/locales/vi-VN/common.json b/locales/vi-VN/common.json index 51b5f86..b6ae983 100644 --- a/locales/vi-VN/common.json +++ b/locales/vi-VN/common.json @@ -29,8 +29,13 @@ }, "settings": { "MidjourneyAPIProxy": { - "description": "Vui lòng tham khảo <1>midjourney-proxy để triển khai dịch vụ máy chủ trước khi sử dụng", - "title": "Địa chỉ proxy API Midjourney" + "apiSecret": { + "title": "Bí mật proxy API Midjourney" + }, + "baseUrl": { + "title": "Địa chỉ proxy API Midjourney" + }, + "description": "Vui lòng tham khảo <1>midjourney-proxy để triển khai dịch vụ máy chủ trước khi sử dụng" }, "modalTitle": "Cài đặt", "save": "Lưu" diff --git a/locales/zh-TW/common.json b/locales/zh-TW/common.json index a55fe03..6490e92 100644 --- a/locales/zh-TW/common.json +++ b/locales/zh-TW/common.json @@ -29,8 +29,13 @@ }, "settings": { "MidjourneyAPIProxy": { - "description": "請參考 <1>midjourney-proxy 部署好服務端後使用", - "title": "Midjourney API 代理地址" + "apiSecret": { + "title": "Midjourney API 代理密鑰" + }, + "baseUrl": { + "title": "Midjourney API 代理位址" + }, + "description": "請參考 <1>midjourney-proxy 部署好服務端後使用" }, "modalTitle": "設定", "save": "保存" From 789e58ab78b4fe5cc3d448bfeb5779e53a84829a Mon Sep 17 00:00:00 2001 From: Yang Hanlin Date: Tue, 30 Apr 2024 06:56:21 +0800 Subject: [PATCH 4/4] :lipstick: chore: use password input for API secret field in settings --- src/features/Settings.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/features/Settings.tsx b/src/features/Settings.tsx index 5129568..c12f295 100644 --- a/src/features/Settings.tsx +++ b/src/features/Settings.tsx @@ -1,5 +1,5 @@ -import { ActionIcon, Alert, Icon, Input, Modal } from '@lobehub/ui'; -import { Button, Typography } from 'antd'; +import { ActionIcon, Alert, Icon, Modal } from '@lobehub/ui'; +import { Button, Input, Typography } from 'antd'; import isEqual from 'fast-deep-equal'; import { LucideSettings, Save } from 'lucide-react'; import Link from 'next/link'; @@ -82,7 +82,7 @@ const Settings = memo(() => { value={proxyURL} />
{t('settings.MidjourneyAPIProxy.apiSecret.title')}
- { updateSettings({ MIDJOURNEY_PROXY_API_SECRET: e.target.value }); }}