aboutsummaryrefslogtreecommitdiff
path: root/src/background/repositories/BrowserSettingRepository.ts
blob: 272cc1e47e9f710f78fac3292773f90191ba3060 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import { injectable } from "tsyringe";
import * as urls from "../../shared/urls";

declare namespace browser.browserSettings.homepageOverride {
  type BrowserSettings = {
    value: string;
    levelOfControl: LevelOfControlType;
  };

  type LevelOfControlType =
    | "not_controllable"
    | "controlled_by_other_extensions"
    | "controllable_by_this_extension"
    | "controlled_by_this_extension";

  function get(param: { [key: string]: string }): Promise<BrowserSettings>;
}

@injectable()
export default class BrowserSettingRepository {
  async getHomepageUrls(): Promise<string[]> {
    const { value } = await browser.browserSettings.homepageOverride.get({});
    return value.split("|").map(urls.normalizeUrl);
  }
}