@danhachuel/thunderbolt 0.3.92 → 0.3.93
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
|
@@ -1969,10 +1969,17 @@ def render_channels():
|
|
|
1969
1969
|
channel_account_ids.append(current_channel_account_id)
|
|
1970
1970
|
youtube_account_labels[current_channel_account_id] = "Conta Google não configurada"
|
|
1971
1971
|
with st.expander("Upload directo — documento da conta deste canal", expanded=False):
|
|
1972
|
-
st.caption("O DELEGATED_SESSION_ID deste canal
|
|
1972
|
+
st.caption("O DELEGATED_SESSION_ID é individual deste canal. Guarde-o aqui; o valor fica no registo local do canal e não é copiado para o documento JSON partilhado da conta Google.")
|
|
1973
1973
|
with st.form(f"channel_direct_credentials_{channel_id}"):
|
|
1974
1974
|
channel_account_id = st.selectbox("Conta Google do documento deste canal", channel_account_ids, index=channel_account_ids.index(current_channel_account_id) if current_channel_account_id in channel_account_ids else 0, format_func=lambda item: youtube_account_labels.get(item, item or "Sem conta Google associada"), key=f"channel_account_{channel_id}")
|
|
1975
|
-
|
|
1975
|
+
channel_delegated_session_id = st.text_input(
|
|
1976
|
+
"DELEGATED_SESSION_ID deste canal",
|
|
1977
|
+
value=str(channel.get("delegated_session_id") or ""),
|
|
1978
|
+
type="password",
|
|
1979
|
+
key=f"channel_delegated_session_id_{channel_id}",
|
|
1980
|
+
help="Identificador individual usado pelo Upload directo deste canal. Não é partilhado com outros canais nem mostrado nos diagnósticos.",
|
|
1981
|
+
)
|
|
1982
|
+
save_channel_direct_credentials = st.form_submit_button("Guardar conta Google e DELEGATED_SESSION_ID", type="primary", use_container_width=True)
|
|
1976
1983
|
selected_channel_account = youtube_accounts_by_id.get(channel_account_id)
|
|
1977
1984
|
if selected_channel_account:
|
|
1978
1985
|
selected_account_status = document_status(STORAGE, selected_channel_account, channel, settings, channels)
|
|
@@ -1992,8 +1999,15 @@ def render_channels():
|
|
|
1992
1999
|
else:
|
|
1993
2000
|
st.info("Associe este canal a uma conta Google para validar o documento de credenciais.")
|
|
1994
2001
|
if save_channel_direct_credentials:
|
|
1995
|
-
update_channel(
|
|
1996
|
-
|
|
2002
|
+
update_channel(
|
|
2003
|
+
channel_id,
|
|
2004
|
+
{
|
|
2005
|
+
"google_account_id": channel_account_id.strip(),
|
|
2006
|
+
"google_account_email": str(youtube_accounts_by_id.get(channel_account_id, {}).get("email", "")),
|
|
2007
|
+
"delegated_session_id": channel_delegated_session_id.strip(),
|
|
2008
|
+
},
|
|
2009
|
+
)
|
|
2010
|
+
st.success("Conta Google e DELEGATED_SESSION_ID individual do canal guardados.")
|
|
1997
2011
|
st.rerun()
|
|
1998
2012
|
|
|
1999
2013
|
render_channel_videos(channel)
|
|
@@ -363,6 +363,9 @@ def merge_credentials_document(
|
|
|
363
363
|
|
|
364
364
|
|
|
365
365
|
def delegated_session_id(document: dict[str, Any], channel: dict[str, Any]) -> str:
|
|
366
|
+
channel_value = str(channel.get("delegated_session_id") or "").strip() if isinstance(channel, dict) else ""
|
|
367
|
+
if channel_value:
|
|
368
|
+
return channel_value
|
|
366
369
|
mapping = document.get("delegated_session_ids", {}) if isinstance(document, dict) else {}
|
|
367
370
|
if not isinstance(mapping, dict):
|
|
368
371
|
return ""
|
package/package.json
CHANGED