Cleanup android app user agent

This commit is contained in:
2026-05-25 19:05:48 +02:00
parent 68042c978b
commit d9d9e3992c
5 changed files with 22 additions and 4 deletions
+1
View File
@@ -158,6 +158,7 @@ func (h *Handler) OidcLogged(c *echo.Context) error {
// @Param provider path string true "OIDC provider id" Example(google)
// @Param token query string true "Opaque token returned by /oidc/logged/:provider"
// @Param tenant query string false "Optional tenant passthrough for federated setups"
// @Param device query string false "The device the created session will be used on" example(android tv)
// @Param Authorization header string false "Bearer token to link provider to current account"
// @Success 201 {object} SessionWToken
// @Failure 404 {object} KError "Unknown OIDC provider"
+1 -1
View File
@@ -126,7 +126,7 @@ func (h *Handler) createSession(c *echo.Context, user *User) error {
return err
}
dev := cmp.Or(c.Param("device"), c.Request().Header.Get("User-Agent"))
dev := cmp.Or(c.QueryParam("device"), c.Request().Header.Get("User-Agent"))
device := &dev
if dev == "" {
device = nil
+2 -1
View File
@@ -1,5 +1,6 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
dist/
uniwind-types.d.ts
# dependencies
node_modules
.pnp
@@ -50,4 +51,4 @@ apps/web/next-env.d.ts
# The following patterns were generated by expo-cli
expo-env.d.ts
# @end expo-cli
# @end expo-cli
+8 -2
View File
@@ -1,5 +1,7 @@
import { Platform } from "react-native";
import { z } from "zod/v4";
import { type Account, type KyooError, User } from "~/models";
import { capitalize } from "~/primitives";
import { defaultApiUrl } from "~/providers/account-provider";
import {
addAccount,
@@ -29,9 +31,11 @@ export const login = async (
try {
const controller = new AbortController();
setTimeout(() => controller.abort(), 5_000);
const device =
Platform.OS === "web" ? "" : `?device=${capitalize(Platform.OS)} App`;
const { token } = await queryFn({
method: "POST",
url: `${apiUrl}/auth/${action === "login" ? "sessions" : "users"}`,
url: `${apiUrl}/auth/${action === "login" ? "sessions" : "users"}${device}`,
body,
authToken: null,
signal: controller.signal,
@@ -60,9 +64,11 @@ export const oidcLogin = async (
) => {
apiUrl ??= defaultApiUrl;
try {
const device =
Platform.OS === "web" ? "" : `?device=${capitalize(Platform.OS)} App`;
const { token } = await queryFn({
method: "GET",
url: `${apiUrl}/auth/oidc/callback/${provider}?token=${code}`,
url: `${apiUrl}/auth/oidc/callback/${provider}?token=${code}${device}`,
authToken: linkToToken,
parser: linkToToken ? null : z.object({ token: z.string() }),
});
+10
View File
@@ -0,0 +1,10 @@
// NOTE: This file is generated by uniwind and it should not be edited manually.
/// <reference types="uniwind/types" />
declare module "uniwind" {
export interface UniwindConfig {
themes: readonly ["light", "dark"];
}
}
export {};