@danhachuel/thunderbolt 0.5.3 → 0.5.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/app/main.py CHANGED
@@ -7135,6 +7135,7 @@ def _render_media_provider_card(settings: dict[str, Any], cards: list[dict[str,
7135
7135
  with card_form:
7136
7136
  key_col, model_col = st.columns(2)
7137
7137
  refresh_clicked = False
7138
+ authorize_clicked = False
7138
7139
  with key_col:
7139
7140
  api_key = str(card.get("api_key") or "")
7140
7141
  if definition.requires_api_key:
@@ -7231,7 +7232,12 @@ def _render_media_provider_card(settings: dict[str, Any], cards: list[dict[str,
7231
7232
  edited = dict(card)
7232
7233
  edited.update({"api_key": str(api_key or "").strip(), "model": str(model or "").strip(), "base_url": str(base_url or "").strip(), "enabled": bool(enabled), "supports_image": bool(supports_image), "supports_video": bool(supports_video), "priority": int(priority), **extra_values})
7233
7234
  cards[index] = edited
7234
- if refresh_clicked:
7235
+ if authorize_clicked:
7236
+ # Guardar as credenciais antes de o browser sair para a Canva. No
7237
+ # callback, o código OAuth é trocado usando este card persistido.
7238
+ _persist_media_cards(settings, cards, str(settings.get(MEDIA_IMAGE_ACTIVE_CARD_KEY) or ""), str(settings.get(MEDIA_VIDEO_ACTIVE_CARD_KEY) or ""))
7239
+ st.success("Credenciais Canva guardadas. Abra o link para autorizar.")
7240
+ elif refresh_clicked:
7235
7241
  try:
7236
7242
  discovered = _fetch_media_models(edited)
7237
7243
  st.session_state[f"media_model_catalog_{card_id}"] = discovered
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danhachuel/thunderbolt",
3
- "version": "0.5.3",
3
+ "version": "0.5.5",
4
4
  "description": "Thunderbolt — interface local para operação de canais faceless e motor MoneyPrinterTurbo",
5
5
  "license": "MIT",
6
6
  "main": "scripts/cli.mjs",
package/scripts/cli.mjs CHANGED
@@ -187,6 +187,18 @@ const supportedLanguages = new Set(["en", "zh", "de", "vi", "tr", "pt", "ru", "e
187
187
  const proxy = http.createServer((request, response) => {
188
188
  const requestUrl = new URL(request.url || "/", `http://localhost:${publicPort}`);
189
189
  const pathParts = requestUrl.pathname.split("/").filter(Boolean);
190
+ if (requestUrl.pathname === "/oauth/redirect") {
191
+ requestUrl.pathname = "/";
192
+ requestUrl.searchParams.set("page", "Configuração API");
193
+ response.writeHead(302, {
194
+ Location: `${requestUrl.pathname}${requestUrl.search}`,
195
+ "Cache-Control": "no-store, no-cache, must-revalidate, max-age=0",
196
+ Pragma: "no-cache",
197
+ Expires: "0",
198
+ });
199
+ response.end();
200
+ return;
201
+ }
190
202
  const languagePrefix = pathParts.length === 1 && supportedLanguages.has(pathParts[0]) ? pathParts[0] : "";
191
203
  if (languagePrefix) {
192
204
  requestUrl.pathname = "/";