mirror of
https://github.com/rommapp/romm.git
synced 2026-12-03 10:33:22 +01:00
style(steam): format the Steam sign-in change and drop a stale import
Runs the formatters trunk pins over the files it flagged (black, isort and prettier), and removes the Steam Web API middleware import that the removed ResolveVanityURL tests left behind. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NH5s4gb7QNE7xa4pRUsBzx
This commit is contained in:
@@ -430,9 +430,7 @@ class SteamOpenIDService:
|
||||
log.error("Could not verify a Steam sign-in: %s", exc)
|
||||
return None
|
||||
|
||||
if not any(
|
||||
line.strip() == "is_valid:true" for line in body.splitlines()
|
||||
):
|
||||
if not any(line.strip() == "is_valid:true" for line in body.splitlines()):
|
||||
return None
|
||||
|
||||
claimed = _STEAM_OPENID_CLAIMED_ID.match(params.get("openid.claimed_id", ""))
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
import asyncio
|
||||
import json
|
||||
import secrets
|
||||
from urllib.parse import quote
|
||||
from typing import Annotated, Any, Final, cast
|
||||
from urllib.parse import quote
|
||||
|
||||
from fastapi import Body, Form, HTTPException
|
||||
from fastapi import Query
|
||||
from fastapi import Path as PathVar
|
||||
from fastapi import Request, status
|
||||
from fastapi import Query, Request, status
|
||||
from fastapi.responses import FileResponse, RedirectResponse
|
||||
|
||||
from adapters.services.steam import SteamOpenIDService
|
||||
@@ -58,7 +57,6 @@ from handler.steam_library_handler import (
|
||||
unlink_steam_profile,
|
||||
)
|
||||
from logger.logger import log
|
||||
from utils.urls import get_public_base_url
|
||||
from models.audit_event import AuditAction
|
||||
from models.notification import NotificationKind, NotificationLevel
|
||||
from models.user import TEXT_FIELD_LENGTH, Role, User
|
||||
@@ -68,6 +66,7 @@ from tasks.registry import (
|
||||
enqueue_task,
|
||||
)
|
||||
from utils.router import APIRouter
|
||||
from utils.urls import get_public_base_url
|
||||
from utils.validation import (
|
||||
ValidationError,
|
||||
validate_email,
|
||||
|
||||
@@ -35,7 +35,9 @@ def test_the_login_url_asks_steam_to_pick_the_identity():
|
||||
|
||||
|
||||
async def test_an_assertion_steam_signs_yields_its_steam_id(session: AsyncMock):
|
||||
session.post.return_value = _response("ns:http://specs.openid.net/auth/2.0\nis_valid:true\n")
|
||||
session.post.return_value = _response(
|
||||
"ns:http://specs.openid.net/auth/2.0\nis_valid:true\n"
|
||||
)
|
||||
|
||||
steam_id = await SteamOpenIDService().verify(
|
||||
{"openid.mode": "id_res", "openid.claimed_id": CLAIMED_ID}
|
||||
|
||||
@@ -5,11 +5,7 @@ import aiohttp
|
||||
import pytest
|
||||
from tests.factories import STEAM_ID
|
||||
|
||||
from adapters.services.steam import (
|
||||
SteamWebAPIError,
|
||||
SteamWebApiService,
|
||||
web_api_key_middleware,
|
||||
)
|
||||
from adapters.services.steam import SteamWebAPIError, SteamWebApiService
|
||||
|
||||
|
||||
def _response(json_body: object) -> MagicMock:
|
||||
|
||||
@@ -69,9 +69,7 @@ def verify_sign_in():
|
||||
|
||||
def _start_login(client: TestClient, user: User, token: str) -> str:
|
||||
"""Begin a sign-in and hand back the nonce it bound to the session."""
|
||||
response = client.get(
|
||||
f"/api/users/{user.id}/steam/login", headers=_bearer(token)
|
||||
)
|
||||
response = client.get(f"/api/users/{user.id}/steam/login", headers=_bearer(token))
|
||||
assert response.status_code == status.HTTP_200_OK
|
||||
url = str(response.json()["url"])
|
||||
return url.split("state%3D")[-1].split("&")[0]
|
||||
|
||||
@@ -23,7 +23,9 @@ vi.mock("@/services/api/user", () => ({
|
||||
vi.mock("@/composables/useSnackbar", () => ({ useSnackbar: () => snackbar }));
|
||||
vi.mock("@/composables/useConfirm", () => ({ useConfirm: () => confirm }));
|
||||
vi.mock("@/composables/useSocketEvent", () => ({ useSocketEvent: vi.fn() }));
|
||||
vi.mock("vue-router", () => ({ useRoute: () => ({ fullPath: "/settings/user/1" }) }));
|
||||
vi.mock("vue-router", () => ({
|
||||
useRoute: () => ({ fullPath: "/settings/user/1" }),
|
||||
}));
|
||||
|
||||
function mountSection() {
|
||||
return mount(SteamLibrarySection, {
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
// the games it owns. The import runs as a task whose completion arrives as a
|
||||
// notification, which also refreshes the owned count shown here.
|
||||
import { computed, ref } from "vue";
|
||||
import { useRoute } from "vue-router";
|
||||
import { useI18n } from "vue-i18n";
|
||||
import { useRoute } from "vue-router";
|
||||
import SettingsSection from "@/components/Settings/SettingsSection.vue";
|
||||
import { useConfirm } from "@/composables/useConfirm";
|
||||
import { useSnackbar } from "@/composables/useSnackbar";
|
||||
|
||||
Reference in New Issue
Block a user