Change default subdomain to unset
This commit is contained in:
parent
8e55c13d72
commit
1f8bc33830
@ -28,3 +28,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
### Changed
|
### Changed
|
||||||
- Update README with example configuration and instructions for local installation
|
- Update README with example configuration and instructions for local installation
|
||||||
|
|
||||||
|
## [1.0.22] - 2019-03-28
|
||||||
|
### Changed
|
||||||
|
- Change the default value of subdomain to `unset` to have a well-formed URL.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "moco-browser-extensions",
|
"name": "moco-browser-extensions",
|
||||||
"description": "Browser plugin for MOCO",
|
"description": "Browser plugin for MOCO",
|
||||||
"version": "1.0.21",
|
"version": "1.0.22",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "yarn start:chrome",
|
"start": "yarn start:chrome",
|
||||||
|
@ -2,6 +2,8 @@ import { head } from "lodash/fp"
|
|||||||
export const isChrome = () => typeof browser === "undefined" && chrome
|
export const isChrome = () => typeof browser === "undefined" && chrome
|
||||||
export const isFirefox = () => typeof browser !== "undefined" && chrome
|
export const isFirefox = () => typeof browser !== "undefined" && chrome
|
||||||
|
|
||||||
|
const DEFAULT_SUBDOMAIN = "unset"
|
||||||
|
|
||||||
export const getSettings = (withDefaultSubdomain = true) => {
|
export const getSettings = (withDefaultSubdomain = true) => {
|
||||||
const keys = ["subdomain", "apiKey"]
|
const keys = ["subdomain", "apiKey"]
|
||||||
const { version } = chrome.runtime.getManifest()
|
const { version } = chrome.runtime.getManifest()
|
||||||
@ -9,7 +11,7 @@ export const getSettings = (withDefaultSubdomain = true) => {
|
|||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
chrome.storage.sync.get(keys, data => {
|
chrome.storage.sync.get(keys, data => {
|
||||||
if (withDefaultSubdomain) {
|
if (withDefaultSubdomain) {
|
||||||
data.subdomain = data.subdomain || "__unset__"
|
data.subdomain = data.subdomain || DEFAULT_SUBDOMAIN
|
||||||
}
|
}
|
||||||
resolve({ ...data, version })
|
resolve({ ...data, version })
|
||||||
})
|
})
|
||||||
@ -17,7 +19,7 @@ export const getSettings = (withDefaultSubdomain = true) => {
|
|||||||
} else {
|
} else {
|
||||||
return browser.storage.sync.get(keys).then(data => {
|
return browser.storage.sync.get(keys).then(data => {
|
||||||
if (withDefaultSubdomain) {
|
if (withDefaultSubdomain) {
|
||||||
data.subdomain = data.subdomain || "__unset__"
|
data.subdomain = data.subdomain || DEFAULT_SUBDOMAIN
|
||||||
}
|
}
|
||||||
return { ...data, version }
|
return { ...data, version }
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user