mirror of
https://github.com/gosticks/web.git
synced 2026-07-01 06:30:02 +00:00
Update packages to the latest versions
It seems an update to the formatter caused the license headers to get reformatted, so that is the bulk of the changes. The other large change is that the translate HOC function was renamed to withNamespaces. With the license headers all getting updated, I updated the year to 2019. Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
This commit is contained in:
2
LICENSE
2
LICENSE
@@ -1,5 +1,5 @@
|
||||
Pi-hole Web Interface
|
||||
Copyright (C) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
Copyright (C) 2019 Pi-hole, LLC (https://pi-hole.net)
|
||||
|
||||
This software is licensed under the European Union Public License
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/* Pi-hole: A black hole for Internet advertisements
|
||||
* (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Create fake API data
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
* (c) 2019 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Create fake API data
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
|
||||
const faker = require("faker");
|
||||
const fs = require("fs-extra");
|
||||
|
||||
1197
package-lock.json
generated
1197
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
52
package.json
52
package.json
@@ -4,46 +4,46 @@
|
||||
"private": true,
|
||||
"homepage": "/admin",
|
||||
"devDependencies": {
|
||||
"enzyme": "^3.3.0",
|
||||
"enzyme-adapter-react-16": "^1.1.1",
|
||||
"enzyme": "^3.8.0",
|
||||
"enzyme-adapter-react-16": "^1.7.1",
|
||||
"faker": "^4.1.0",
|
||||
"fetch-mock": "^6.5.0",
|
||||
"fs-extra": "^6.0.0",
|
||||
"jest-enzyme": "^6.0.2",
|
||||
"fetch-mock": "^7.3.0",
|
||||
"fs-extra": "^7.0.1",
|
||||
"jest-enzyme": "^7.0.1",
|
||||
"multi-progress": "^2.0.0",
|
||||
"node-fetch": "^2.1.2",
|
||||
"node-sass-chokidar": "^1.3.0",
|
||||
"npm-run-all": "^4.1.3",
|
||||
"prettier": "^1.14.3",
|
||||
"node-fetch": "^2.3.0",
|
||||
"node-sass-chokidar": "^1.3.4",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"prettier": "^1.15.3",
|
||||
"react-scripts": "^2.1.3",
|
||||
"react-test-renderer": "^16.4.1"
|
||||
"react-test-renderer": "^16.7.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@coreui/coreui": "^2.0.2",
|
||||
"@coreui/coreui": "^2.1.6",
|
||||
"@coreui/coreui-plugin-chartjs-custom-tooltips": "^1.2.0",
|
||||
"@coreui/icons": "0.2.0",
|
||||
"@coreui/react": "^2.0.4",
|
||||
"@coreui/icons": "0.3.0",
|
||||
"@coreui/react": "^2.1.3",
|
||||
"@fortawesome/fontawesome-free": "^5.6.3",
|
||||
"bootstrap": "^4.1.1",
|
||||
"bootstrap": "^4.2.1",
|
||||
"bootstrap-daterangepicker": "^3.0.3",
|
||||
"chart.js": "^2.7.2",
|
||||
"i18next": "^11.3.2",
|
||||
"i18next-browser-languagedetector": "^2.2.0",
|
||||
"chart.js": "^2.7.3",
|
||||
"i18next": "^13.1.4",
|
||||
"i18next-browser-languagedetector": "^2.2.4",
|
||||
"i18next-xhr-backend": "^1.5.1",
|
||||
"ionicons": "^3.0.0",
|
||||
"ionicons": "^4.5.1",
|
||||
"lodash.debounce": "^4.0.8",
|
||||
"moment": "^2.23.0",
|
||||
"prop-types": "^15.6.1",
|
||||
"react": "^16.4.1",
|
||||
"prop-types": "^15.6.2",
|
||||
"react": "^16.7.0",
|
||||
"react-bootstrap-daterangepicker": "^4.1.0",
|
||||
"react-bootstrap-typeahead": "^3.2.4",
|
||||
"react-chartjs-2": "^2.7.2",
|
||||
"react-dom": "^16.4.1",
|
||||
"react-i18next": "^7.6.1",
|
||||
"react-chartjs-2": "^2.7.4",
|
||||
"react-dom": "^16.7.0",
|
||||
"react-i18next": "^9.0.3",
|
||||
"react-router-dom": "^4.3.1",
|
||||
"react-table": "^6.8.2",
|
||||
"react-transition-group": "^2.3.1",
|
||||
"reactstrap": "^6.1.0",
|
||||
"react-table": "^6.8.6",
|
||||
"react-transition-group": "^2.5.3",
|
||||
"reactstrap": "^7.1.0",
|
||||
"sha.js": "^2.4.11",
|
||||
"simple-line-icons": "^2.4.1"
|
||||
},
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/* Pi-hole: A black hole for Internet advertisements
|
||||
* (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Alert component
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
* (c) 2019 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Alert component
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
|
||||
import React from "react";
|
||||
import PropTypes from "prop-types";
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/* Pi-hole: A black hole for Internet advertisements
|
||||
* (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Alert component test
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
* (c) 2019 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Alert component test
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
|
||||
import React from "react";
|
||||
import { shallow } from "enzyme";
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/* Pi-hole: A black hole for Internet advertisements
|
||||
* (c) 2018 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Boxed layout button
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
* (c) 2019 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Boxed layout button
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
|
||||
import React from "react";
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/* Pi-hole: A black hole for Internet advertisements
|
||||
* (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* BoxedLayoutButton component test
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
* (c) 2019 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* BoxedLayoutButton component test
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
|
||||
import React from "react";
|
||||
import { shallow } from "enzyme";
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
/* Pi-hole: A black hole for Internet advertisements
|
||||
* (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Footer component
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
* (c) 2019 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Footer component
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
|
||||
import React from "react";
|
||||
import { translate } from "react-i18next";
|
||||
import { withNamespaces } from "react-i18next";
|
||||
import FooterUpdateStatus from "./FooterUpdateStatus";
|
||||
|
||||
const Footer = props => {
|
||||
@@ -32,4 +32,4 @@ const Footer = props => {
|
||||
);
|
||||
};
|
||||
|
||||
export default translate(["common", "footer"])(Footer);
|
||||
export default withNamespaces(["common", "footer"])(Footer);
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/* Pi-hole: A black hole for Internet advertisements
|
||||
* (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Footer component test
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
* (c) 2019 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Footer component test
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
|
||||
import React from "react";
|
||||
import { shallow } from "enzyme";
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
/* Pi-hole: A black hole for Internet advertisements
|
||||
* (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* FooterUpdateStatus component
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
* (c) 2019 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* FooterUpdateStatus component
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
|
||||
import React from "react";
|
||||
import { translate } from "react-i18next";
|
||||
import { withNamespaces } from "react-i18next";
|
||||
import { Link } from "react-router-dom";
|
||||
|
||||
const FooterUpdateStatus = props => {
|
||||
@@ -27,4 +27,4 @@ const FooterUpdateStatus = props => {
|
||||
}
|
||||
};
|
||||
|
||||
export default translate("footer")(FooterUpdateStatus);
|
||||
export default withNamespaces("footer")(FooterUpdateStatus);
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/* Pi-hole: A black hole for Internet advertisements
|
||||
* (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Header component
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
* (c) 2019 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Header component
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
|
||||
import React from "react";
|
||||
import { Link } from "react-router-dom";
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/* Pi-hole: A black hole for Internet advertisements
|
||||
* (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* A button in the sidebar
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
* (c) 2019 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* A button in the sidebar
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
|
||||
/* eslint-disable jsx-a11y/anchor-is-valid */
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/* Pi-hole: A black hole for Internet advertisements
|
||||
* (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* A dropdown in the sidebar
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
* (c) 2019 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* A dropdown in the sidebar
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
|
||||
/* eslint-disable jsx-a11y/anchor-is-valid */
|
||||
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
/* Pi-hole: A black hole for Internet advertisements
|
||||
* (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Sidebar component
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
* (c) 2019 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Sidebar component
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
|
||||
import React from "react";
|
||||
import { translate } from "react-i18next";
|
||||
import { withNamespaces } from "react-i18next";
|
||||
import { NavLink } from "react-router-dom";
|
||||
import { Nav, NavItem } from "reactstrap";
|
||||
import logo from "../../img/logo.svg";
|
||||
@@ -102,4 +102,4 @@ const Sidebar = ({ items, ...props }) => {
|
||||
);
|
||||
};
|
||||
|
||||
export default translate(["common", "location"])(Sidebar);
|
||||
export default withNamespaces(["common", "location"])(Sidebar);
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/* Pi-hole: A black hole for Internet advertisements
|
||||
* (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Sidebar component test
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
* (c) 2019 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Sidebar component test
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
|
||||
import React from "react";
|
||||
import { shallow } from "enzyme";
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
/* Pi-hole: A black hole for Internet advertisements
|
||||
* (c) 2019 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Status badge component
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
|
||||
import React, { Component } from "react";
|
||||
import PropTypes from "prop-types";
|
||||
import { translate } from "react-i18next";
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/* Pi-hole: A black hole for Internet advertisements
|
||||
* (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* SummaryStats component test
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
* (c) 2019 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* SummaryStats component test
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
|
||||
import React from "react";
|
||||
import { shallow } from "enzyme";
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/* Pi-hole: A black hole for Internet advertisements
|
||||
* (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* WithAPIData Component
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
* (c) 2019 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* WithAPIData Component
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
|
||||
import { Component } from "react";
|
||||
import PropTypes from "prop-types";
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/* Pi-hole: A black hole for Internet advertisements
|
||||
* (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Chart Tooltip component
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
* (c) 2019 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Chart Tooltip component
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
|
||||
import React, { Component } from "react";
|
||||
import PropTypes from "prop-types";
|
||||
@@ -67,10 +67,12 @@ class ChartTooltip extends Component {
|
||||
// Transform and sort the tooltip data
|
||||
let data = [];
|
||||
if (tooltip.body) {
|
||||
data = tooltip.body.map(body => body.lines).map((item, i) => ({
|
||||
data: item[0],
|
||||
colors: tooltip.labelColors[i]
|
||||
}));
|
||||
data = tooltip.body
|
||||
.map(body => body.lines)
|
||||
.map((item, i) => ({
|
||||
data: item[0],
|
||||
colors: tooltip.labelColors[i]
|
||||
}));
|
||||
}
|
||||
data.sort((a, b) =>
|
||||
a.data.split(": ")[0].localeCompare(b.data.split(": ")[0])
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
/* Pi-hole: A black hole for Internet advertisements
|
||||
* (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Clients Graph component
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
* (c) 2019 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Clients Graph component
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
|
||||
import React, { Component } from "react";
|
||||
import ReactDOM from "react-dom";
|
||||
import PropTypes from "prop-types";
|
||||
import { Line } from "react-chartjs-2";
|
||||
import { translate } from "react-i18next";
|
||||
import { withNamespaces } from "react-i18next";
|
||||
import { padNumber } from "../../util";
|
||||
import api from "../../util/api";
|
||||
import ChartTooltip from "./ChartTooltip";
|
||||
@@ -193,7 +193,7 @@ export const loadingProps = {
|
||||
datasets: []
|
||||
};
|
||||
|
||||
export const TranslatedClientsGraph = translate("dashboard")(ClientsGraph);
|
||||
export const TranslatedClientsGraph = withNamespaces("dashboard")(ClientsGraph);
|
||||
|
||||
export default props => (
|
||||
<WithAPIData
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/* Pi-hole: A black hole for Internet advertisements
|
||||
* (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* ClientsGraph component test
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
* (c) 2019 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* ClientsGraph component test
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
|
||||
import React from "react";
|
||||
import { shallow } from "enzyme";
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/* Pi-hole: A black hole for Internet advertisements
|
||||
* (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Generic Doughnut Chart component
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
* (c) 2019 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Generic Doughnut Chart component
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
|
||||
import React, { Component } from "react";
|
||||
import { Doughnut } from "react-chartjs-2";
|
||||
@@ -163,9 +163,9 @@ export const transformData = apiData => {
|
||||
i < colors.length
|
||||
? colors[i]
|
||||
: "#" +
|
||||
parseInt("" + Math.random() * 0xffffff, 10)
|
||||
.toString(16)
|
||||
.padStart(6, "0")
|
||||
parseInt("" + Math.random() * 0xffffff, 10)
|
||||
.toString(16)
|
||||
.padStart(6, "0")
|
||||
);
|
||||
|
||||
i++;
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/* Pi-hole: A black hole for Internet advertisements
|
||||
* (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* GenericDoughnutChart component test
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
* (c) 2019 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* GenericDoughnutChart component test
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
|
||||
import React from "react";
|
||||
import { shallow } from "enzyme";
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/* Pi-hole: A black hole for Internet advertisements
|
||||
* (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Queries Graph component
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
* (c) 2019 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Queries Graph component
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
|
||||
import React, { Component } from "react";
|
||||
import PropTypes from "prop-types";
|
||||
import { Line } from "react-chartjs-2";
|
||||
import { translate } from "react-i18next";
|
||||
import { withNamespaces } from "react-i18next";
|
||||
import { padNumber } from "../../util";
|
||||
import api from "../../util/api";
|
||||
import { WithAPIData } from "../common/WithAPIData";
|
||||
@@ -183,7 +183,7 @@ export const loadingProps = {
|
||||
blocked_over_time: []
|
||||
};
|
||||
|
||||
export const TranslatedQueriesGraph = translate("dashboard")(QueriesGraph);
|
||||
export const TranslatedQueriesGraph = withNamespaces("dashboard")(QueriesGraph);
|
||||
|
||||
export default props => (
|
||||
<WithAPIData
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
/* Pi-hole: A black hole for Internet advertisements
|
||||
* (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Query Types Chart component
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
* (c) 2019 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Query Types Chart component
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
|
||||
import React from "react";
|
||||
import { translate } from "react-i18next";
|
||||
import { withNamespaces } from "react-i18next";
|
||||
import api from "../../util/api";
|
||||
import GenericDoughnutChart from "./GenericDoughnutChart";
|
||||
|
||||
@@ -31,4 +31,4 @@ const QueryTypesChart = ({ t }) => (
|
||||
/>
|
||||
);
|
||||
|
||||
export default translate("dashboard")(QueryTypesChart);
|
||||
export default withNamespaces("dashboard")(QueryTypesChart);
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
/* Pi-hole: A black hole for Internet advertisements
|
||||
* (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Summary Stats component
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
* (c) 2019 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Summary Stats component
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
|
||||
import React, { Component, Fragment } from "react";
|
||||
import PropTypes from "prop-types";
|
||||
import { translate } from "react-i18next";
|
||||
import { withNamespaces } from "react-i18next";
|
||||
import { WithAPIData } from "../common/WithAPIData";
|
||||
import api from "../../util/api";
|
||||
|
||||
@@ -129,7 +129,7 @@ export const initialProps = {
|
||||
uniqueClients: "---"
|
||||
};
|
||||
|
||||
export const TranslatedSummaryStats = translate(["common", "dashboard"])(
|
||||
export const TranslatedSummaryStats = withNamespaces(["common", "dashboard"])(
|
||||
SummaryStats
|
||||
);
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/* Pi-hole: A black hole for Internet advertisements
|
||||
* (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* SummaryStats component test
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
* (c) 2019 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* SummaryStats component test
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
|
||||
import React from "react";
|
||||
import { shallow } from "enzyme";
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
/* Pi-hole: A black hole for Internet advertisements
|
||||
* (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Top Blocked component
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
* (c) 2019 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Top Blocked component
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
|
||||
import React from "react";
|
||||
import { translate } from "react-i18next";
|
||||
import { withNamespaces } from "react-i18next";
|
||||
import api from "../../util/api";
|
||||
import TopTable from "./TopTable";
|
||||
|
||||
@@ -74,4 +74,4 @@ const TopBlocked = ({ t, ...props }) => (
|
||||
/>
|
||||
);
|
||||
|
||||
export default translate(["common", "dashboard"])(TopBlocked);
|
||||
export default withNamespaces(["common", "dashboard"])(TopBlocked);
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/* Pi-hole: A black hole for Internet advertisements
|
||||
* (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* TopBlocked component test
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
* (c) 2019 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* TopBlocked component test
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
|
||||
import React from "react";
|
||||
import { transformData, generateRows } from "./TopBlocked";
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
/* Pi-hole: A black hole for Internet advertisements
|
||||
* (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Top Clients component
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
* (c) 2019 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Top Clients component
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
|
||||
import React from "react";
|
||||
import { translate } from "react-i18next";
|
||||
import { withNamespaces } from "react-i18next";
|
||||
import api from "../../util/api";
|
||||
import TopTable from "./TopTable";
|
||||
|
||||
@@ -74,4 +74,4 @@ const TopClients = ({ t, ...props }) => (
|
||||
/>
|
||||
);
|
||||
|
||||
export default translate(["common", "dashboard"])(TopClients);
|
||||
export default withNamespaces(["common", "dashboard"])(TopClients);
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/* Pi-hole: A black hole for Internet advertisements
|
||||
* (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* TopClients component test
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
* (c) 2019 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* TopClients component test
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
|
||||
import React from "react";
|
||||
import { transformData, generateRows } from "./TopClients";
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
/* Pi-hole: A black hole for Internet advertisements
|
||||
* (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Top Domains component
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
* (c) 2019 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Top Domains component
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
|
||||
import React from "react";
|
||||
import { translate } from "react-i18next";
|
||||
import { withNamespaces } from "react-i18next";
|
||||
import api from "../../util/api";
|
||||
import TopTable from "./TopTable";
|
||||
|
||||
@@ -74,4 +74,4 @@ const TopDomains = ({ t, ...props }) => (
|
||||
/>
|
||||
);
|
||||
|
||||
export default translate(["common", "dashboard"])(TopDomains);
|
||||
export default withNamespaces(["common", "dashboard"])(TopDomains);
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/* Pi-hole: A black hole for Internet advertisements
|
||||
* (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* TopDomains component test
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
* (c) 2019 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* TopDomains component test
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
|
||||
import React from "react";
|
||||
import { generateRows, transformData } from "./TopDomains";
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/* Pi-hole: A black hole for Internet advertisements
|
||||
* (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Generic top items component
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
* (c) 2019 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Generic top items component
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
|
||||
import React, { Component } from "react";
|
||||
import PropTypes from "prop-types";
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/* Pi-hole: A black hole for Internet advertisements
|
||||
* (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* TopTable component test
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
* (c) 2019 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* TopTable component test
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
|
||||
import React from "react";
|
||||
import { shallow } from "enzyme";
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
/* Pi-hole: A black hole for Internet advertisements
|
||||
* (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Upstream Servers / Forward Destinations Chart component
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
* (c) 2019 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Upstream Servers / Forward Destinations Chart component
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
|
||||
import React from "react";
|
||||
import { translate } from "react-i18next";
|
||||
import { withNamespaces } from "react-i18next";
|
||||
import api from "../../util/api";
|
||||
import GenericDoughnutChart from "./GenericDoughnutChart";
|
||||
|
||||
@@ -27,4 +27,4 @@ const UpstreamsChart = ({ t }) => (
|
||||
/>
|
||||
);
|
||||
|
||||
export default translate("dashboard")(UpstreamsChart);
|
||||
export default withNamespaces("dashboard")(UpstreamsChart);
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
/* Pi-hole: A black hole for Internet advertisements
|
||||
* (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Domain Input component
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
* (c) 2019 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Domain Input component
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
|
||||
import React, { Component } from "react";
|
||||
import PropTypes from "prop-types";
|
||||
import { translate } from "react-i18next";
|
||||
import { withNamespaces } from "react-i18next";
|
||||
import api from "../../util/api";
|
||||
|
||||
class DomainInput extends Component {
|
||||
@@ -86,4 +86,4 @@ DomainInput.defaultProps = {
|
||||
placeholder: ""
|
||||
};
|
||||
|
||||
export default translate(["common", "lists"])(DomainInput);
|
||||
export default withNamespaces(["common", "lists"])(DomainInput);
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/* Pi-hole: A black hole for Internet advertisements
|
||||
* (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* DomainInput component test
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
* (c) 2019 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* DomainInput component test
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
|
||||
import React from "react";
|
||||
import { shallow } from "enzyme";
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
/* Pi-hole: A black hole for Internet advertisements
|
||||
* (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Domain List component
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
* (c) 2019 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Domain List component
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
|
||||
import React from "react";
|
||||
import PropTypes from "prop-types";
|
||||
import { translate } from "react-i18next";
|
||||
import { withNamespaces } from "react-i18next";
|
||||
import api from "../../util/api";
|
||||
import { Button } from "reactstrap";
|
||||
|
||||
@@ -64,4 +64,4 @@ DomainList.propTypes = {
|
||||
onRemove: PropTypes.func.isRequired
|
||||
};
|
||||
|
||||
export default translate(["common", "lists"])(DomainList);
|
||||
export default withNamespaces(["common", "lists"])(DomainList);
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/* Pi-hole: A black hole for Internet advertisements
|
||||
* (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* DomainList component test
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
* (c) 2019 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* DomainList component test
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
|
||||
import React from "react";
|
||||
import { shallow } from "enzyme";
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
/* Pi-hole: A black hole for Internet advertisements
|
||||
* (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* List Page component (abstracted whitelist, blacklist, etc)
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
* (c) 2019 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* List Page component (abstracted whitelist, blacklist, etc)
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
|
||||
import React, { Component } from "react";
|
||||
import PropTypes from "prop-types";
|
||||
import { translate } from "react-i18next";
|
||||
import { withNamespaces } from "react-i18next";
|
||||
import DomainInput from "./DomainInput";
|
||||
import Alert from "../common/Alert";
|
||||
import DomainList from "./DomainList";
|
||||
@@ -165,4 +165,4 @@ class ListPage extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
export default translate(["common", "lists"])(ListPage);
|
||||
export default withNamespaces(["common", "lists"])(ListPage);
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/* Pi-hole: A black hole for Internet advertisements
|
||||
* (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* ListPage component test
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
* (c) 2019 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* ListPage component test
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
|
||||
import React from "react";
|
||||
import { shallow } from "enzyme";
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
/* Pi-hole: A black hole for Internet advertisements
|
||||
* (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Query Log component
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
* (c) 2019 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Query Log component
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
|
||||
import React, { Component, Fragment } from "react";
|
||||
import ReactTable from "react-table";
|
||||
import DateRangePicker from "react-bootstrap-daterangepicker";
|
||||
import { Button } from "reactstrap";
|
||||
import i18n from "i18next";
|
||||
import { translate } from "react-i18next";
|
||||
import { withNamespaces } from "react-i18next";
|
||||
import debounce from "lodash.debounce";
|
||||
import moment from "moment";
|
||||
import { ignoreCancel, makeCancelable, padNumber } from "../../util";
|
||||
@@ -518,4 +518,4 @@ const columns = t => [
|
||||
}
|
||||
];
|
||||
|
||||
export default translate(["common", "query-log"])(QueryLog);
|
||||
export default withNamespaces(["common", "query-log"])(QueryLog);
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
/* Pi-hole: A black hole for Internet advertisements
|
||||
* (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Forgot Password Reminder
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
* (c) 2019 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Forgot Password Reminder
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
|
||||
import React, { Component } from "react";
|
||||
import PropTypes from "prop-types";
|
||||
import { translate } from "react-i18next";
|
||||
import { withNamespaces } from "react-i18next";
|
||||
|
||||
class ForgotPassword extends Component {
|
||||
state = {
|
||||
@@ -85,4 +85,4 @@ ForgotPassword.propTypes = {
|
||||
error: PropTypes.bool.isRequired
|
||||
};
|
||||
|
||||
export default translate("login")(ForgotPassword);
|
||||
export default withNamespaces("login")(ForgotPassword);
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/* Pi-hole: A black hole for Internet advertisements
|
||||
* (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* ForgotPassword component test
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
* (c) 2019 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* ForgotPassword component test
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
|
||||
import React from "react";
|
||||
import { shallow } from "enzyme";
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/* Pi-hole: A black hole for Internet advertisements
|
||||
* (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Settings :: DNS :: Upstream DNS Servers
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
* (c) 2019 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Settings :: DNS :: Upstream DNS Servers
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
|
||||
import React, { Fragment } from "react";
|
||||
import PropTypes from "prop-types";
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
/* Pi-hole: A black hole for Internet advertisements
|
||||
* (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Settings :: DHCP
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
* (c) 2019 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Settings :: DHCP
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
|
||||
import React, { Component } from "react";
|
||||
import { translate } from "react-i18next";
|
||||
import { withNamespaces } from "react-i18next";
|
||||
import { ignoreCancel, makeCancelable } from "../../util";
|
||||
import api from "../../util/api";
|
||||
import {
|
||||
@@ -308,4 +308,4 @@ class DHCPInfo extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
export default translate(["common", "settings", "api-errors"])(DHCPInfo);
|
||||
export default withNamespaces(["common", "settings", "api-errors"])(DHCPInfo);
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/* Pi-hole: A black hole for Internet advertisements
|
||||
* (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* DHCPInfo component test
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
* (c) 2019 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* DHCPInfo component test
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
|
||||
import React from "react";
|
||||
import { shallow } from "enzyme";
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
/* Pi-hole: A black hole for Internet advertisements
|
||||
* (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Settings :: DNS
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
* (c) 2019 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Settings :: DNS
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
|
||||
import React, { Component } from "react";
|
||||
import { translate } from "react-i18next";
|
||||
import { withNamespaces } from "react-i18next";
|
||||
import { ignoreCancel, makeCancelable } from "../../util";
|
||||
import api from "../../util/api";
|
||||
import DnsList from "./DnsList";
|
||||
@@ -229,4 +229,4 @@ class DNSInfo extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
export default translate(["common", "settings"])(DNSInfo);
|
||||
export default withNamespaces(["common", "settings"])(DNSInfo);
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/* Pi-hole: A black hole for Internet advertisements
|
||||
* (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* An Editable List of Upstream DNS Servers
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
* (c) 2019 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* An Editable List of Upstream DNS Servers
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
|
||||
import React from "react";
|
||||
import PropTypes from "prop-types";
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/* Pi-hole: A black hole for Internet advertisements
|
||||
* (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* A Upstream DNS List Item
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
* (c) 2019 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* A Upstream DNS List Item
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
|
||||
import React from "react";
|
||||
import PropTypes from "prop-types";
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
/* Pi-hole: A black hole for Internet advertisements
|
||||
* (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Input For New DNS List Items
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
* (c) 2019 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Input For New DNS List Items
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
|
||||
import React, { Component } from "react";
|
||||
import PropTypes from "prop-types";
|
||||
import { Button, InputGroup, InputGroupAddon, ListGroupItem } from "reactstrap";
|
||||
import { Typeahead } from "react-bootstrap-typeahead";
|
||||
import { translate } from "react-i18next";
|
||||
import { withNamespaces } from "react-i18next";
|
||||
import { preconfiguredUpstreamOptions } from "./preconfiguredUpstreams";
|
||||
|
||||
/**
|
||||
@@ -92,4 +92,4 @@ class DnsListNewItem extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
export default translate("settings")(DnsListNewItem);
|
||||
export default withNamespaces("settings")(DnsListNewItem);
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/* Pi-hole: A black hole for Internet advertisements
|
||||
* (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Settings :: DNS :: DNS Options
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
* (c) 2019 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Settings :: DNS :: DNS Options
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
|
||||
import React, { Fragment } from "react";
|
||||
import PropTypes from "prop-types";
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
/* Pi-hole: A black hole for Internet advertisements
|
||||
* (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Settings :: FTL Information component
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
* (c) 2019 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Settings :: FTL Information component
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
|
||||
import React, { Component } from "react";
|
||||
import PropTypes from "prop-types";
|
||||
import { translate } from "react-i18next";
|
||||
import { withNamespaces } from "react-i18next";
|
||||
import api from "../../util/api";
|
||||
import { WithAPIData } from "../common/WithAPIData";
|
||||
|
||||
@@ -48,7 +48,7 @@ export const initialData = {
|
||||
sqliteVersion: ""
|
||||
};
|
||||
|
||||
export const TranslatedFTLInfo = translate(["settings"])(FTLInfo);
|
||||
export const TranslatedFTLInfo = withNamespaces(["settings"])(FTLInfo);
|
||||
|
||||
export default props => (
|
||||
<WithAPIData
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
/* Pi-hole: A black hole for Internet advertisements
|
||||
* (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Settings :: Network component
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
* (c) 2019 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Settings :: Network component
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
|
||||
import React, { Component } from "react";
|
||||
import PropTypes from "prop-types";
|
||||
import { translate } from "react-i18next";
|
||||
import { withNamespaces } from "react-i18next";
|
||||
import api from "../../util/api";
|
||||
import { Col, Form, FormGroup, Input, Label } from "reactstrap";
|
||||
import { WithAPIData } from "../common/WithAPIData";
|
||||
@@ -87,7 +87,7 @@ export const initialData = () => ({
|
||||
hostname: ""
|
||||
});
|
||||
|
||||
export const TranslatedNetworkInfo = translate(["common", "settings"])(
|
||||
export const TranslatedNetworkInfo = withNamespaces(["common", "settings"])(
|
||||
NetworkInfo
|
||||
);
|
||||
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
/* Pi-hole: A black hole for Internet advertisements
|
||||
* (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Settings :: Version - Card component
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
* (c) 2019 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Settings :: Version - Card component
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
|
||||
import React, { Component } from "react";
|
||||
import { translate } from "react-i18next";
|
||||
import { withNamespaces } from "react-i18next";
|
||||
import PropTypes from "prop-types";
|
||||
import { Collapse } from "reactstrap";
|
||||
|
||||
@@ -75,4 +75,4 @@ class VersionCard extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
export default translate(["common", "settings"])(VersionCard);
|
||||
export default withNamespaces(["common", "settings"])(VersionCard);
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
/* Pi-hole: A black hole for Internet advertisements
|
||||
* (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Settings :: Version Information component
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
* (c) 2019 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Settings :: Version Information component
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
|
||||
import React, { Component } from "react";
|
||||
import PropTypes from "prop-types";
|
||||
import { translate } from "react-i18next";
|
||||
import { withNamespaces } from "react-i18next";
|
||||
import api from "../../util/api";
|
||||
import VersionCard from "./VersionCard";
|
||||
import { WithAPIData } from "../common/WithAPIData";
|
||||
@@ -98,7 +98,7 @@ export const initialData = {
|
||||
}
|
||||
};
|
||||
|
||||
export const TranslatedVersionInfo = translate(["common"])(VersionInfo);
|
||||
export const TranslatedVersionInfo = withNamespaces(["common"])(VersionInfo);
|
||||
|
||||
export default props => (
|
||||
<WithAPIData
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/* Pi-hole: A black hole for Internet advertisements
|
||||
* (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Preconfigured Upstream DNS Servers
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
* (c) 2019 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Preconfigured Upstream DNS Servers
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
|
||||
/**
|
||||
* A list of preconfigured upstream DNS servers. Each item has primary and
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/* Pi-hole: A black hole for Internet advertisements
|
||||
* (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Development config
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
* (c) 2019 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Development config
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
|
||||
export default {
|
||||
developmentMode: true,
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/* Pi-hole: A black hole for Internet advertisements
|
||||
* (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Config handler
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
* (c) 2019 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Config handler
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
|
||||
import developmentConfig from "./config.development";
|
||||
import productionConfig from "./config.production";
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/* Pi-hole: A black hole for Internet advertisements
|
||||
* (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Production config
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
* (c) 2019 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Production config
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
|
||||
export default {
|
||||
developmentMode: false,
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/* Pi-hole: A black hole for Internet advertisements
|
||||
* (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Main container of the web interface (performs main routing)
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
* (c) 2019 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Main container of the web interface (performs main routing)
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
|
||||
import React from "react";
|
||||
import { Switch, Route, Redirect } from "react-router-dom";
|
||||
|
||||
10
src/i18n.js
10
src/i18n.js
@@ -1,3 +1,13 @@
|
||||
/* Pi-hole: A black hole for Internet advertisements
|
||||
* (c) 2019 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Internationalization setup
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
|
||||
import i18n from "i18next";
|
||||
import XHR from "i18next-xhr-backend";
|
||||
import LanguageDetector from "i18next-browser-languagedetector";
|
||||
|
||||
16
src/index.js
16
src/index.js
@@ -1,12 +1,12 @@
|
||||
/* Pi-hole: A black hole for Internet advertisements
|
||||
* (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Starting point for React
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
* (c) 2019 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Starting point for React
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
|
||||
import React from "react";
|
||||
import ReactDOM from "react-dom";
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/* Pi-hole: A black hole for Internet advertisements
|
||||
* (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Navigation information
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
* (c) 2019 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Navigation information
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
|
||||
import Dashboard from "./views/Dashboard";
|
||||
import QueryLog from "./components/log/QueryLog";
|
||||
|
||||
@@ -194,3 +194,7 @@
|
||||
.pull-right {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.nav-item button {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
2
src/scss/vendors/_variables.scss
vendored
2
src/scss/vendors/_variables.scss
vendored
@@ -1,6 +1,6 @@
|
||||
// Override Boostrap variables
|
||||
@import "../variables";
|
||||
@import "node_modules/@coreui/coreui/scss/bootstrap-variables";
|
||||
@import "node_modules/@coreui/coreui/scss/bootstrap/_variables";
|
||||
@import "node_modules/bootstrap/scss/mixins";
|
||||
@import "node_modules/bootstrap/scss/functions";
|
||||
@import "node_modules/bootstrap/scss/variables";
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/* Pi-hole: A black hole for Internet advertisements
|
||||
* (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Test Setup
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
* (c) 2019 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Test Setup
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
|
||||
import { configure } from "enzyme";
|
||||
import Adapter from "enzyme-adapter-react-16";
|
||||
@@ -19,8 +19,8 @@ configure({ adapter: new Adapter() });
|
||||
|
||||
// Mock out react-i18next
|
||||
jest.mock("react-i18next", () => ({
|
||||
// This mock makes sure any components using the translate HoC receive the t function as a prop
|
||||
translate: () => component => {
|
||||
// This mock makes sure any components using the withNamespaces HoC receive the t function as a prop
|
||||
withNamespaces: () => component => {
|
||||
component.defaultProps = { ...component.defaultProps, t: key => key };
|
||||
return component;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
/* Pi-hole: A black hole for Internet advertisements
|
||||
* (c) 2019 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* API functions
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
|
||||
import http from "./http";
|
||||
import config from "../config";
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/* Pi-hole: A black hole for Internet advertisements
|
||||
* (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Utility function tests
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
* (c) 2019 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Utility function tests
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
|
||||
import api from "./api";
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/* Pi-hole: A black hole for Internet advertisements
|
||||
* (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Basic HTTP functions for accessing API endpoints
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
* (c) 2019 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Basic HTTP functions for accessing API endpoints
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
|
||||
import api from "./api";
|
||||
import config from "../config";
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/* Pi-hole: A black hole for Internet advertisements
|
||||
* (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Various utilities
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
* (c) 2019 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Various utilities
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
|
||||
/**
|
||||
* Pad a two digit number
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/* Pi-hole: A black hole for Internet advertisements
|
||||
* (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Utility functions for validating domains, hostnames etc.
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
* (c) 2019 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Utility functions for validating domains, hostnames etc.
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
|
||||
export function isValidHostname(hostname) {
|
||||
// Must not exceed 253 characters total
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/* Pi-hole: A black hole for Internet advertisements
|
||||
* (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Validation function tests
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
* (c) 2019 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Validation function tests
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
|
||||
import {
|
||||
isPositiveNumber,
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
/* Pi-hole: A black hole for Internet advertisements
|
||||
* (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Blacklist page
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
* (c) 2019 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Blacklist page
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
|
||||
import React from "react";
|
||||
import { translate } from "react-i18next";
|
||||
import { withNamespaces } from "react-i18next";
|
||||
import api from "../util/api";
|
||||
import ListPage from "../components/list/ListPage";
|
||||
import { isValidDomain } from "../validate";
|
||||
@@ -31,4 +31,4 @@ const Blacklist = props => {
|
||||
);
|
||||
};
|
||||
|
||||
export default translate("location")(Blacklist);
|
||||
export default withNamespaces("location")(Blacklist);
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/* Pi-hole: A black hole for Internet advertisements
|
||||
* (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Dashboard page
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
* (c) 2019 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Dashboard page
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
|
||||
import React, { Fragment } from "react";
|
||||
import SummaryStats from "../components/dashboard/SummaryStats";
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/* Pi-hole: A black hole for Internet advertisements
|
||||
* (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Login page
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
* (c) 2019 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Login page
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
|
||||
import React, { Component, Fragment } from "react";
|
||||
import { Redirect } from "react-router-dom";
|
||||
@@ -15,7 +15,7 @@ import api from "../util/api";
|
||||
import logo from "../img/logo.svg";
|
||||
import { routes } from "../routes";
|
||||
import ForgotPassword from "../components/login/ForgotPassword";
|
||||
import { translate } from "react-i18next";
|
||||
import { withNamespaces } from "react-i18next";
|
||||
import config from "../config";
|
||||
|
||||
class Login extends Component {
|
||||
@@ -176,4 +176,4 @@ class Login extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
export default translate(["login", "location"])(Login);
|
||||
export default withNamespaces(["login", "location"])(Login);
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/* Pi-hole: A black hole for Internet advertisements
|
||||
* (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Logout the user
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
* (c) 2019 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Logout the user
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
|
||||
import React, { Component } from "react";
|
||||
import { Redirect } from "react-router-dom";
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
/* Pi-hole: A black hole for Internet advertisements
|
||||
* (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Settings Page - Networking DNS & DHCP
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
* (c) 2019 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Settings Page - Networking DNS & DHCP
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
|
||||
import React, { Component } from "react";
|
||||
import { translate } from "react-i18next";
|
||||
import { withNamespaces } from "react-i18next";
|
||||
import { Nav, NavItem, NavLink, TabContent, TabPane } from "reactstrap";
|
||||
import DHCPInfo from "../components/settings/DHCPInfo";
|
||||
import DNSInfo from "../components/settings/DNSInfo";
|
||||
@@ -83,4 +83,4 @@ class Networking extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
export default translate(["common", "settings"])(Networking);
|
||||
export default withNamespaces(["common", "settings"])(Networking);
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
/* Pi-hole: A black hole for Internet advertisements
|
||||
* (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Regexlist page
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
* (c) 2019 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Regexlist page
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
|
||||
import React from "react";
|
||||
import { translate } from "react-i18next";
|
||||
import { withNamespaces } from "react-i18next";
|
||||
import ListPage from "../components/list/ListPage";
|
||||
import api from "../util/api";
|
||||
import { isValidRegex } from "../validate";
|
||||
@@ -31,4 +31,4 @@ const Regexlist = props => {
|
||||
);
|
||||
};
|
||||
|
||||
export default translate(["location", "lists"])(Regexlist);
|
||||
export default withNamespaces(["location", "lists"])(Regexlist);
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/* Pi-hole: A black hole for Internet advertisements
|
||||
* (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Settings - Software versions
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
* (c) 2019 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Settings - Software versions
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
|
||||
import React from "react";
|
||||
import VersionInfo from "../components/settings/VersionInfo";
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
/* Pi-hole: A black hole for Internet advertisements
|
||||
* (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Whitelist page
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
* (c) 2019 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Whitelist page
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
|
||||
import React from "react";
|
||||
import { translate } from "react-i18next";
|
||||
import { withNamespaces } from "react-i18next";
|
||||
import ListPage from "../components/list/ListPage";
|
||||
import api from "../util/api";
|
||||
import { isValidDomain } from "../validate";
|
||||
@@ -31,4 +31,4 @@ const Whitelist = props => {
|
||||
);
|
||||
};
|
||||
|
||||
export default translate(["location", "lists"])(Whitelist);
|
||||
export default withNamespaces(["location", "lists"])(Whitelist);
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
/* Pi-hole: A black hole for Internet advertisements
|
||||
* (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Update translations from POEditor
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
* (c) 2019 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Update translations from POEditor
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
|
||||
const fs = require("fs-extra");
|
||||
const fetch = require('node-fetch');
|
||||
const MultiProgress = require('multi-progress');
|
||||
const fetch = require("node-fetch");
|
||||
const MultiProgress = require("multi-progress");
|
||||
|
||||
const PROJECT_ID = 66305;
|
||||
const I18N_FOLDER = "public/i18n";
|
||||
@@ -19,7 +19,7 @@ const multi = new MultiProgress(process.stderr);
|
||||
|
||||
const apiToken = process.env.POEDITOR_API_TOKEN;
|
||||
|
||||
if(!apiToken) {
|
||||
if (!apiToken) {
|
||||
console.log("Please set the POEDITOR_API_TOKEN environment variable");
|
||||
process.exit(1);
|
||||
}
|
||||
@@ -40,23 +40,20 @@ function makeFormData(data) {
|
||||
* Return a list of languages which are at least 90% translated
|
||||
*/
|
||||
function getTranslatedLanguages() {
|
||||
return fetch(
|
||||
"https://api.poeditor.com/v2/languages/list",
|
||||
{
|
||||
method: "POST",
|
||||
body: makeFormData({
|
||||
"api_token": apiToken,
|
||||
"id": PROJECT_ID,
|
||||
}),
|
||||
headers: { "Content-Type": "application/x-www-form-urlencoded" }
|
||||
}
|
||||
)
|
||||
return fetch("https://api.poeditor.com/v2/languages/list", {
|
||||
method: "POST",
|
||||
body: makeFormData({
|
||||
api_token: apiToken,
|
||||
id: PROJECT_ID
|
||||
}),
|
||||
headers: { "Content-Type": "application/x-www-form-urlencoded" }
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
return data.result.languages
|
||||
.filter(lang => lang.percentage >= 70)
|
||||
.map(lang => lang.code)
|
||||
})
|
||||
.map(lang => lang.code);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -67,20 +64,17 @@ function getTranslatedLanguages() {
|
||||
* @param bar the progress bar
|
||||
*/
|
||||
function fetchTag(lang, tag, bar) {
|
||||
fetch(
|
||||
"https://api.poeditor.com/v2/projects/export",
|
||||
{
|
||||
method: "POST",
|
||||
body: makeFormData({
|
||||
"api_token": apiToken,
|
||||
"id": PROJECT_ID,
|
||||
"language": lang,
|
||||
"type": "json",
|
||||
"tags": tag
|
||||
}),
|
||||
headers: { "Content-Type": "application/x-www-form-urlencoded" }
|
||||
}
|
||||
)
|
||||
fetch("https://api.poeditor.com/v2/projects/export", {
|
||||
method: "POST",
|
||||
body: makeFormData({
|
||||
api_token: apiToken,
|
||||
id: PROJECT_ID,
|
||||
language: lang,
|
||||
type: "json",
|
||||
tags: tag
|
||||
}),
|
||||
headers: { "Content-Type": "application/x-www-form-urlencoded" }
|
||||
})
|
||||
.then(exportResponse => {
|
||||
bar.tick();
|
||||
return exportResponse.json();
|
||||
@@ -92,39 +86,42 @@ function fetchTag(lang, tag, bar) {
|
||||
})
|
||||
.then(langData => {
|
||||
const parsedData = langData.reduce((map, item) => {
|
||||
|
||||
// Check for plurals
|
||||
if(typeof item.definition === "string") {
|
||||
if (typeof item.definition === "string") {
|
||||
map[item.term] = item.definition;
|
||||
} else if(item.definition === null) {
|
||||
} else if (item.definition === null) {
|
||||
// Don't add missing strings. They will be loaded from the fallback language.
|
||||
return map;
|
||||
} else {
|
||||
// Check if there's just singular and plural
|
||||
if(Object.keys(item.definition).length === 2) {
|
||||
if (Object.keys(item.definition).length === 2) {
|
||||
map[item.term] = item.definition["one"];
|
||||
map[item.term + "_plural"] = item.definition["other"];
|
||||
} else {
|
||||
// Map POEditor's plural keys to i18next's plural suffixes
|
||||
const pluralMap = {
|
||||
"zero": "0",
|
||||
"one": "1",
|
||||
"two": "2",
|
||||
"few": "3",
|
||||
"many": "4",
|
||||
"other": "5"
|
||||
zero: "0",
|
||||
one: "1",
|
||||
two: "2",
|
||||
few: "3",
|
||||
many: "4",
|
||||
other: "5"
|
||||
};
|
||||
|
||||
// Add the various plural keys
|
||||
for(let plural of Object.keys(item.definition))
|
||||
map[item.term + "_" + pluralMap[plural]] = item.definition[plural];
|
||||
for (let plural of Object.keys(item.definition))
|
||||
map[item.term + "_" + pluralMap[plural]] =
|
||||
item.definition[plural];
|
||||
}
|
||||
}
|
||||
|
||||
return map;
|
||||
}, {});
|
||||
|
||||
fs.outputFileSync(`${I18N_FOLDER}/${lang}/${tag}.json`, JSON.stringify(parsedData, null, 4));
|
||||
fs.outputFileSync(
|
||||
`${I18N_FOLDER}/${lang}/${tag}.json`,
|
||||
JSON.stringify(parsedData, null, 4)
|
||||
);
|
||||
bar.tick();
|
||||
});
|
||||
}
|
||||
@@ -155,8 +152,7 @@ function fetchAllTags(lang) {
|
||||
// Render at 0%
|
||||
bar.tick(0);
|
||||
|
||||
for(const tag of tags)
|
||||
fetchTag(lang, tag, bar);
|
||||
for (const tag of tags) fetchTag(lang, tag, bar);
|
||||
}
|
||||
|
||||
// Remove old translations
|
||||
@@ -165,10 +161,8 @@ fs.emptyDirSync(I18N_FOLDER);
|
||||
|
||||
// Get the translated languages and download the translations
|
||||
console.log("Fetching languages");
|
||||
getTranslatedLanguages()
|
||||
.then(languages => {
|
||||
console.log(`Languages over 70% translated: ${languages.join(", ")}`);
|
||||
getTranslatedLanguages().then(languages => {
|
||||
console.log(`Languages over 70% translated: ${languages.join(", ")}`);
|
||||
|
||||
for(const lang of languages)
|
||||
fetchAllTags(lang);
|
||||
});
|
||||
for (const lang of languages) fetchAllTags(lang);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user