Skip to content

Commit

Permalink
Merge pull request #537 from BlueBubblesApp/development
Browse files Browse the repository at this point in the history
fix: injection of oauth_client
  • Loading branch information
zlshames authored May 27, 2023
2 parents 64323b7 + dda51c2 commit 67284b6
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { RouterContext } from "koa-router";
import { FileSystem } from "@server/fileSystem";
import { GeneralInterface } from "@server/api/v1/interfaces/generalInterface";
import { Success } from "../responses/success";
import { isEmpty } from "@server/helpers/utils";
import { isEmpty, isNotEmpty } from "@server/helpers/utils";

export class FcmRouter {
static async getClientConfig(ctx: RouterContext, _: Next) {
Expand All @@ -14,8 +14,8 @@ export class FcmRouter {
// As such, we need to manually add it back in so the client doesn't break when reading the file.
// This is a monkeypatch. The client only requires the first part of the client_id, before the `-`.
// This value is the same as the project number, so we can just use that.
if (isEmpty(googleServices.oauth_client)) {
googleServices.oauth_client = [
if (isNotEmpty(googleServices.client) && isEmpty(googleServices.client[0].oauth_client)) {
googleServices.client[0].oauth_client = [
{
// The project number exists in multiple fields. Fallback if the project number is not found.
client_id: googleServices?.project_info?.project_number ??
Expand Down

0 comments on commit 67284b6

Please sign in to comment.