From d669ad5622fba037b7f835e71d753c1d9434671c Mon Sep 17 00:00:00 2001 From: anpigon Date: Wed, 18 Oct 2023 14:49:05 +0900 Subject: [PATCH] fix(apis): update safeStorage variable to use window object instead of global object to ensure compatibility with browser environment fix(settings): update safeStorage variable to use window object instead of global object to ensure compatibility with browser environment --- src/apis/google_books_api.ts | 2 +- src/settings/settings.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/apis/google_books_api.ts b/src/apis/google_books_api.ts index a42997b..d093f48 100644 --- a/src/apis/google_books_api.ts +++ b/src/apis/google_books_api.ts @@ -2,7 +2,7 @@ import { apiGet, BaseBooksApiImpl } from '@apis/base_api'; import { Book } from '@models/book.model'; import { GoogleBooksResponse, VolumeInfo } from './models/google_books_response'; -const safeStorage = global.electron?.remote.safeStorage; +const safeStorage = (window as any).electron?.remote.safeStorage; export class GoogleBooksApi implements BaseBooksApiImpl { constructor(private readonly localePreference: string, private readonly apiKey?: string) {} diff --git a/src/settings/settings.ts b/src/settings/settings.ts index c798dfd..5b222f5 100644 --- a/src/settings/settings.ts +++ b/src/settings/settings.ts @@ -10,7 +10,7 @@ import { SettingServiceProviderModal } from '@views/setting_service_provider_mod const docUrl = 'https://github.com/anpigon/obsidian-book-search-plugin'; -const safeStorage = global.electron?.remote.safeStorage; +const safeStorage = (window as any).electron?.remote.safeStorage; export enum DefaultFrontmatterKeyType { snakeCase = 'Snake Case',