Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ Issues = "https://github.com/pathbit/9RTKSync/issues"
[tool.setuptools.packages.find]
where = ["src"]

[tool.setuptools.package-data]
"*" = ["locales/*.json"]

# A suite tem de rodar sem depender de `pip install -e`. Sem isto, o repo
# que por acaso tem uma instalacao editavel na maquina passa e o irmao
# reprova na coleta -- com o mesmo codigo. Foi o que aconteceu aqui.
Expand Down
977 changes: 49 additions & 928 deletions src/nine_rtksync/i18n.py

Large diffs are not rendered by default.

296 changes: 296 additions & 0 deletions src/nine_rtksync/locales/en.json

Large diffs are not rendered by default.

296 changes: 296 additions & 0 deletions src/nine_rtksync/locales/es.json

Large diffs are not rendered by default.

296 changes: 296 additions & 0 deletions src/nine_rtksync/locales/pt.json

Large diffs are not rendered by default.

506 changes: 392 additions & 114 deletions src/nine_rtksync/render.py

Large diffs are not rendered by default.

16 changes: 13 additions & 3 deletions src/nine_rtksync/sessao.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@


def _assina(carga: str) -> str:
return hmac.new(_SEGREDO, carga.encode("utf-8"), hashlib.sha256).hexdigest()
return hmac.new(
_SEGREDO,
f"sessao|{NOME_DO_COOKIE}|".encode("ascii") + carga.encode("utf-8"),
hashlib.sha256,
).hexdigest()


def _assina_estado(carga: str) -> str:
Expand Down Expand Up @@ -109,7 +113,10 @@ def cabecalho_para_gravar(valor: str) -> str:


def cabecalho_para_apagar() -> str:
return f"{NOME_DO_COOKIE}=; Path=/; HttpOnly; SameSite=Strict; Max-Age=0"
return (
f"{NOME_DO_COOKIE}=; Path=/; Expires=Thu, 01 Jan 1970 00:00:00 GMT; "
f"Max-Age=0; HttpOnly; SameSite=Strict"
)


def ler_cookie(cabecalho_cookie: str, nome_procurado: str) -> str:
Expand Down Expand Up @@ -191,7 +198,10 @@ def cabecalho_para_gravar_estado(valor: str) -> str:

def cabecalho_para_apagar_estado() -> str:
"""Consumo de uso único: o mesmo `Path` do cookie, ou o navegador não o apaga."""
return f"{NOME_DO_COOKIE_DE_ESTADO}=; Path=/sso/; HttpOnly; SameSite=Lax; Max-Age=0"
return (
f"{NOME_DO_COOKIE_DE_ESTADO}=; Path=/sso/; Expires=Thu, 01 Jan 1970 00:00:00 GMT; "
f"Max-Age=0; HttpOnly; SameSite=Lax"
)


def ler_estado_do_cabecalho(cabecalho_cookie: str) -> str:
Expand Down
Loading
Loading