mirror of
https://github.com/owntracks/frontend.git
synced 2026-02-17 21:19:50 +00:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a9998e8e3b | ||
|
|
2c4ead262a | ||
|
|
6b1d35be51 | ||
|
|
34cc4895b0 |
@@ -2,6 +2,12 @@
|
||||
|
||||
Dates are in UTC.
|
||||
|
||||
## 2.3.0 (2020-05-09)
|
||||
|
||||
- Add `api.fetchOptions` config option - this allows sending custom HTTP headers or including
|
||||
cookies in the request
|
||||
- Upgrade dependencies
|
||||
|
||||
## 2.2.0 (2020-03-18)
|
||||
|
||||
- Improve mobile layout further:
|
||||
|
||||
@@ -6,7 +6,7 @@ COPY . ./
|
||||
RUN yarn build
|
||||
|
||||
FROM nginx:1.17-alpine
|
||||
LABEL version="2.2.0"
|
||||
LABEL version="2.3.0"
|
||||
LABEL description="OwnTracks UI"
|
||||
LABEL maintainer="Linus Groh <mail@linusgroh.de>"
|
||||
ENV LISTEN_PORT=80 \
|
||||
|
||||
@@ -24,6 +24,7 @@ window.owntracks.config = {};
|
||||
|
||||
- `api`
|
||||
- [`baseUrl`](#apibaseurl)
|
||||
- [`fetchOptions`](#apifetchoptions)
|
||||
- [`endDateTime`](#enddatetime)
|
||||
- [`ignorePingLocation`](#ignorepinglocation)
|
||||
- [`locale`](#locale)
|
||||
@@ -89,6 +90,26 @@ Base URL for the recorder's HTTP and WebSocket API. Keep CORS in mind.
|
||||
};
|
||||
```
|
||||
|
||||
### `api.fetchOptions`
|
||||
|
||||
Options for API requests (made with `fetch()`). See [`fetch()` docs on MDN] for details.
|
||||
|
||||
You can use this for example to send custom HTTP headers or to include cookies in the request.
|
||||
|
||||
- Type: [`Object`]
|
||||
- Default: `{}`
|
||||
- Example:
|
||||
```js
|
||||
// Include credentials (e.g. cookies)
|
||||
window.owntracks.config = {
|
||||
api: {
|
||||
fetchOptions: {
|
||||
credentials: "include"
|
||||
}
|
||||
}
|
||||
};
|
||||
```
|
||||
|
||||
### `endDateTime`
|
||||
|
||||
Initial end date and time (browser timezone) for fetched data.
|
||||
@@ -458,3 +479,4 @@ Whether to enable verbose mode or not.
|
||||
[`object`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object
|
||||
[`string`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String
|
||||
[css `<color>`]: https://developer.mozilla.org/en-US/docs/Web/CSS/color_value
|
||||
[`fetch()` docs on MDN]: https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch#Parameters
|
||||
|
||||
34
package.json
34
package.json
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "owntracks-ui",
|
||||
"version": "2.2.0",
|
||||
"version": "2.3.0",
|
||||
"author": {
|
||||
"name": "Linus Groh",
|
||||
"email": "mail@linusgroh.de"
|
||||
@@ -18,42 +18,42 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"clipboard-copy": "^3.1.0",
|
||||
"core-js": "^3.6.4",
|
||||
"core-js": "^3.6.5",
|
||||
"deepmerge": "^4.2.2",
|
||||
"leaflet": "^1.6.0",
|
||||
"leaflet.heat": "^0.2.0",
|
||||
"moment": "^2.24.0",
|
||||
"moment": "^2.25.3",
|
||||
"vue": "^2.6.11",
|
||||
"vue-ctk-date-time-picker": "^2.4.0",
|
||||
"vue-feather-icons": "^5.0.0",
|
||||
"vue-i18n": "^8.15.5",
|
||||
"vue-i18n": "^8.17.4",
|
||||
"vue-js-modal": "^1.3.33",
|
||||
"vue-mq": "^1.0.1",
|
||||
"vue-outside-events": "^1.1.3",
|
||||
"vue-router": "^3.1.6",
|
||||
"vue2-leaflet": "^2.5.2",
|
||||
"vuex": "^3.1.3"
|
||||
"vuex": "^3.3.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@vue/cli-plugin-babel": "^4.2.3",
|
||||
"@vue/cli-plugin-eslint": "^4.2.3",
|
||||
"@vue/cli-plugin-unit-jest": "^4.2.3",
|
||||
"@vue/cli-service": "^4.2.3",
|
||||
"@vue/cli-plugin-babel": "~4.3.1",
|
||||
"@vue/cli-plugin-eslint": "~4.3.1",
|
||||
"@vue/cli-plugin-unit-jest": "~4.3.1",
|
||||
"@vue/cli-service": "~4.3.1",
|
||||
"@vue/eslint-config-prettier": "^6.0.0",
|
||||
"@vue/test-utils": "1.0.0-beta.32",
|
||||
"@vue/test-utils": "1.0.2",
|
||||
"babel-core": "7.0.0-bridge.0",
|
||||
"babel-eslint": "^10.1.0",
|
||||
"babel-jest": "^25.1.0",
|
||||
"cors-anywhere": "^0.4.1",
|
||||
"eslint": "^6.8.0",
|
||||
"eslint-plugin-prettier": "^3.1.2",
|
||||
"babel-jest": "^26.0.1",
|
||||
"cors-anywhere": "^0.4.3",
|
||||
"eslint": "^7.0.0",
|
||||
"eslint-plugin-prettier": "^3.1.3",
|
||||
"eslint-plugin-vue": "^6.2.2",
|
||||
"jest-fetch-mock": "^3.0.3",
|
||||
"lint-staged": "^10.0.8",
|
||||
"lint-staged": "^10.2.2",
|
||||
"moment-locales-webpack-plugin": "^1.2.0",
|
||||
"node-sass": "^4.13.1",
|
||||
"node-sass": "^4.14.1",
|
||||
"sass-loader": "^8.0.2",
|
||||
"vue-cli-plugin-i18n": "^0.6.1",
|
||||
"vue-cli-plugin-i18n": "~1.0.1",
|
||||
"vue-template-compiler": "^2.6.11"
|
||||
},
|
||||
"license": "MIT",
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import config from "@/config";
|
||||
import { log, logLevels } from "@/logging";
|
||||
import { getApiUrl, getLocationHistoryCount } from "@/util";
|
||||
|
||||
@@ -12,7 +13,9 @@ const fetchApi = (path, params = {}) => {
|
||||
const url = getApiUrl(path);
|
||||
Object.keys(params).forEach(key => url.searchParams.append(key, params[key]));
|
||||
log("HTTP", `GET ${url.href}`);
|
||||
return fetch(url.href).catch(error => log("HTTP", error, logLevels.ERROR));
|
||||
return fetch(url.href, config.api.fetchOptions).catch(error =>
|
||||
log("HTTP", error, logLevels.ERROR)
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -10,6 +10,7 @@ startDateTime.setHours(0, 0, 0, 0);
|
||||
const DEFAULT_CONFIG = {
|
||||
api: {
|
||||
baseUrl: `${window.location.protocol}//${window.location.host}`,
|
||||
fetchOptions: {},
|
||||
},
|
||||
endDateTime,
|
||||
ignorePingLocation: true,
|
||||
|
||||
Reference in New Issue
Block a user