mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-02-15 04:32:13 +00:00
feat: omit username and tokens in logs
This commit is contained in:
parent
192008c76c
commit
5b18aba2b8
1 changed files with 9 additions and 2 deletions
|
@ -6,6 +6,7 @@ import { uploadGamesBatch } from "./library-sync";
|
||||||
import { clearGamesRemoteIds } from "./library-sync/clear-games-remote-id";
|
import { clearGamesRemoteIds } from "./library-sync/clear-games-remote-id";
|
||||||
import { logger } from "./logger";
|
import { logger } from "./logger";
|
||||||
import { UserNotLoggedInError } from "@shared";
|
import { UserNotLoggedInError } from "@shared";
|
||||||
|
import { omit } from "lodash-es";
|
||||||
|
|
||||||
interface HydraApiOptions {
|
interface HydraApiOptions {
|
||||||
needsAuth: boolean;
|
needsAuth: boolean;
|
||||||
|
@ -96,11 +97,14 @@ export class HydraApi {
|
||||||
this.instance.interceptors.response.use(
|
this.instance.interceptors.response.use(
|
||||||
(response) => {
|
(response) => {
|
||||||
logger.log(" ---- RESPONSE -----");
|
logger.log(" ---- RESPONSE -----");
|
||||||
|
const data = Array.isArray(response.data)
|
||||||
|
? response.data
|
||||||
|
: omit(response.data, ["username", "accessToken", "refreshToken"]);
|
||||||
logger.log(
|
logger.log(
|
||||||
response.status,
|
response.status,
|
||||||
response.config.method,
|
response.config.method,
|
||||||
response.config.url,
|
response.config.url,
|
||||||
response.data
|
data
|
||||||
);
|
);
|
||||||
return response;
|
return response;
|
||||||
},
|
},
|
||||||
|
@ -166,7 +170,10 @@ export class HydraApi {
|
||||||
this.userAuth.authToken = accessToken;
|
this.userAuth.authToken = accessToken;
|
||||||
this.userAuth.expirationTimestamp = tokenExpirationTimestamp;
|
this.userAuth.expirationTimestamp = tokenExpirationTimestamp;
|
||||||
|
|
||||||
logger.log("Token refreshed", this.userAuth);
|
logger.log(
|
||||||
|
"Token refreshed. New expiration:",
|
||||||
|
this.userAuth.expirationTimestamp
|
||||||
|
);
|
||||||
|
|
||||||
userAuthRepository.upsert(
|
userAuthRepository.upsert(
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue