Skip to content

Commit 4124415

Browse files
committed
refactor(storage): derive platform list from PLATFORMS_CONFIG and remove hardcoded arrays
1 parent d71890e commit 4124415

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

src/core/storage/index.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { SettingsStorage } from './settings';
33
import { StatsStorage } from './stats';
44
import { SessionStorage } from './session';
55
import { SecurityStorage } from './security';
6-
import { PlatformId } from '../../types';
6+
import { PlatformId, PLATFORMS_CONFIG } from '../../types';
77

88
export class StorageFacade {
99
public settings: SettingsStorage;
@@ -65,7 +65,7 @@ export class StorageFacade {
6565
}
6666

6767
public async isAnyPlatformBlocked(): Promise<boolean> {
68-
const platforms: PlatformId[] = ['youtube_shorts', 'youtube_watch', 'instagram', 'global'];
68+
const platforms = Object.keys(PLATFORMS_CONFIG) as PlatformId[];
6969
for (const p of platforms) {
7070
if (await this.isCurrentlyBlocked(p)) return true;
7171
}
@@ -200,9 +200,7 @@ export class StorageFacade {
200200
}
201201

202202
// Sessions
203-
async ensureSession(
204-
platforms: PlatformId[] = ['youtube_shorts', 'youtube_watch', 'instagram', 'global'],
205-
) {
203+
async ensureSession(platforms: PlatformId[] = Object.keys(PLATFORMS_CONFIG) as PlatformId[]) {
206204
const wasReset = await this.session.ensureSession(platforms);
207205
if (wasReset) {
208206
for (const p of platforms) {

0 commit comments

Comments
 (0)