mirror of
https://github.com/gosticks/web.git
synced 2026-12-03 17:51:39 +00:00
+3
-3
@@ -189,9 +189,9 @@ fs.emptyDirSync("public/fakeAPI/dns");
|
||||
fs.emptyDirSync("public/fakeAPI/stats");
|
||||
|
||||
console.log("Generating new fake API data...");
|
||||
write("public/fakeAPI/dns/whitelist", list("white"));
|
||||
write("public/fakeAPI/dns/blacklist", list("black"));
|
||||
write("public/fakeAPI/dns/wildlist", list("wild"));
|
||||
write("public/fakeAPI/dns/whitelist", list());
|
||||
write("public/fakeAPI/dns/blacklist", list());
|
||||
write("public/fakeAPI/dns/regexlist", list());
|
||||
write("public/fakeAPI/dns/status", status());
|
||||
write("public/fakeAPI/stats/overTime/history", historyOverTime(144));
|
||||
write("public/fakeAPI/stats/overTime/clients", clientsOverTime(144, 5));
|
||||
|
||||
@@ -11,6 +11,5 @@
|
||||
"Type": "Type",
|
||||
"Action": "Action",
|
||||
"Enabled": "Enabled",
|
||||
"Disabled": "Disabled",
|
||||
"Regex": "Regex"
|
||||
"Disabled": "Disabled"
|
||||
}
|
||||
@@ -6,5 +6,6 @@
|
||||
"Exact": "Exact",
|
||||
"Wildcard": "Wildcard",
|
||||
"Login": "Login",
|
||||
"Logout": "Logout"
|
||||
"Logout": "Logout",
|
||||
"Regex": "Regex"
|
||||
}
|
||||
@@ -49,7 +49,7 @@ class DomainInput extends Component {
|
||||
return (
|
||||
<div className="form-group input-group">
|
||||
<input
|
||||
type="text" className="form-control" placeholder={t("Add a domain (example.com or sub.example.com)")}
|
||||
type="text" className="form-control" placeholder={this.props.placeholder}
|
||||
value={this.state.domain} onKeyPress={(e) => e.charCode === 13 ? this.onAdd() : null}
|
||||
onChange={this.handleChange}
|
||||
disabled={!api.loggedIn}
|
||||
@@ -72,6 +72,7 @@ class DomainInput extends Component {
|
||||
}
|
||||
|
||||
DomainInput.propTypes = {
|
||||
placeholder: PropTypes.string.isRequired,
|
||||
domains: PropTypes.array.isRequired,
|
||||
onAdding: PropTypes.func.isRequired,
|
||||
onAlreadyAdded: PropTypes.func.isRequired,
|
||||
|
||||
@@ -100,6 +100,7 @@ class ListPage extends Component {
|
||||
<h2 className="text-center">{this.props.title}</h2>
|
||||
<br/>
|
||||
<DomainInput
|
||||
placeholder={this.props.placeholder}
|
||||
domains={this.state.domains}
|
||||
apiCall={this.props.add}
|
||||
onAdding={this.onAdding}
|
||||
@@ -136,6 +137,7 @@ class ListPage extends Component {
|
||||
ListPage.propTypes = {
|
||||
title: PropTypes.string.isRequired,
|
||||
note: PropTypes.object,
|
||||
placeholder: PropTypes.string.isRequired,
|
||||
add: PropTypes.func.isRequired,
|
||||
refresh: PropTypes.func.isRequired,
|
||||
remove: PropTypes.func.isRequired
|
||||
|
||||
@@ -78,7 +78,7 @@ const status = t => ({
|
||||
"1": t("Blocked"),
|
||||
"2": t("Allowed (forwarded)"),
|
||||
"3": t("Allowed (cached)"),
|
||||
"4": t("Blocked (wildcard)"),
|
||||
"4": t("Blocked (regex)"),
|
||||
"5": t("Blocked (blacklist)")
|
||||
});
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ import Dashboard from '../views/Dashboard';
|
||||
import QueryLog from '../components/QueryLog';
|
||||
import Whitelist from "../views/Whitelist";
|
||||
import Blacklist from "../views/Blacklist";
|
||||
import Wildlist from "../views/Wildlist";
|
||||
import Regexlist from "../views/Regexlist";
|
||||
import Login from "../views/Login";
|
||||
import Logout from "../views/Logout";
|
||||
import { api } from "../utils";
|
||||
@@ -36,7 +36,7 @@ export default props => (
|
||||
<AuthRoute path="/query-log" name="Query Log" component={QueryLog}/>
|
||||
<Route path="/whitelist" name="Whitelist" component={Whitelist}/>
|
||||
<Route path="/blacklist" name="Blacklist" component={Blacklist}/>
|
||||
<Route path="/wildlist" name="Wildlist" component={Wildlist}/>
|
||||
<Route path="/regexlist" name="Regexlist" component={Regexlist}/>
|
||||
<Route path="/login" name="Login" component={Login}/>
|
||||
<AuthRoute path="/logout" name="Logout" component={Logout}/>
|
||||
</Switch>
|
||||
|
||||
+3
-3
@@ -13,7 +13,7 @@ export const routes = t => ({
|
||||
'/query-log': t('Query Log'),
|
||||
'/whitelist': t('Whitelist'),
|
||||
'/blacklist': `${t('Blacklist')} (${t('Exact')})`,
|
||||
'/wildlist': `${t('Blacklist')} (${t('Wildcard')})`,
|
||||
'/regexlist': `${t('Blacklist')} (${t('Regex')})`,
|
||||
'/login': t('Login'),
|
||||
'/logout': t('Logout')
|
||||
});
|
||||
@@ -49,8 +49,8 @@ export const nav = [
|
||||
auth: false
|
||||
},
|
||||
{
|
||||
name: 'Wildcard',
|
||||
url: '/wildlist',
|
||||
name: 'Regex',
|
||||
url: '/regexlist',
|
||||
icon: 'fa fa-ban',
|
||||
auth: false
|
||||
}
|
||||
|
||||
+6
-6
@@ -93,8 +93,8 @@ export const api = {
|
||||
getBlacklist() {
|
||||
return api.get("dns/blacklist");
|
||||
},
|
||||
getWildlist() {
|
||||
return api.get("dns/wildlist");
|
||||
getRegexlist() {
|
||||
return api.get("dns/regexlist");
|
||||
},
|
||||
addWhitelist(domain) {
|
||||
return api.post("dns/whitelist", { "domain": domain });
|
||||
@@ -102,8 +102,8 @@ export const api = {
|
||||
addBlacklist(domain) {
|
||||
return api.post("dns/blacklist", { "domain": domain });
|
||||
},
|
||||
addWildlist(domain) {
|
||||
return api.post("dns/wildlist", { "domain": domain });
|
||||
addRegexlist(domain) {
|
||||
return api.post("dns/regexlist", { "domain": domain });
|
||||
},
|
||||
removeWhitelist(domain) {
|
||||
return api.delete("dns/whitelist/" + domain);
|
||||
@@ -111,8 +111,8 @@ export const api = {
|
||||
removeBlacklist(domain) {
|
||||
return api.delete("dns/blacklist/" + domain);
|
||||
},
|
||||
removeWildlist(domain) {
|
||||
return api.delete("dns/wildlist/" + domain);
|
||||
removeRegexlist(domain) {
|
||||
return api.delete("dns/regexlist/" + encodeURIComponent(domain));
|
||||
},
|
||||
getStatus() {
|
||||
return api.get("dns/status")
|
||||
|
||||
@@ -19,6 +19,7 @@ const Blacklist = props => {
|
||||
return (
|
||||
<ListPage
|
||||
title={`${t("Blacklist")} (${t("Exact")})`}
|
||||
placeholder={t("Add a domain (example.com or sub.example.com)")}
|
||||
add={api.addBlacklist}
|
||||
remove={api.removeBlacklist}
|
||||
refresh={api.getBlacklist}
|
||||
|
||||
+1
-1
@@ -158,4 +158,4 @@ class Login extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
export default translate(["common", "login"])(Login);
|
||||
export default translate(["login", "location"])(Login);
|
||||
@@ -3,7 +3,7 @@
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* Web Interface
|
||||
* Wildlist page
|
||||
* Regexlist page
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
@@ -13,23 +13,19 @@ import { translate } from 'react-i18next';
|
||||
import ListPage from "../components/ListPage";
|
||||
import { api } from "../utils";
|
||||
|
||||
const Wildlist = props => {
|
||||
const Regexlist = props => {
|
||||
const { t } = props;
|
||||
|
||||
return (
|
||||
<ListPage
|
||||
title={`${t("Blacklist")} (${t("Wildcard")})`}
|
||||
note={(
|
||||
<p>
|
||||
{t("Note: Only the domain and subdomains of the blocked domain will be blocked.")}
|
||||
</p>
|
||||
)}
|
||||
add={api.addWildlist}
|
||||
remove={api.removeWildlist}
|
||||
refresh={api.getWildlist}
|
||||
title={`${t("Blacklist")} (${t("Regex")})`}
|
||||
placeholder={t("Input a regular expression")}
|
||||
add={api.addRegexlist}
|
||||
remove={api.removeRegexlist}
|
||||
refresh={api.getRegexlist}
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
export default translate(["location", "lists"])(Wildlist);
|
||||
export default translate(["location", "lists"])(Regexlist);
|
||||
@@ -19,7 +19,7 @@ const Whitelist = props => {
|
||||
return (
|
||||
<ListPage
|
||||
title={t("Whitelist")}
|
||||
note={<p>{t("Note: Whitelisting a subdomain of a wildcard blocked domain is not possible.")}</p>}
|
||||
placeholder={t("Add a domain (example.com or sub.example.com)")}
|
||||
add={api.addWhitelist}
|
||||
remove={api.removeWhitelist}
|
||||
refresh={api.getWhitelist}
|
||||
|
||||
Reference in New Issue
Block a user