fix: remove built-in proxy type filtering

closes #4
This commit is contained in:
Haishan 2018-12-23 15:20:17 +08:00
parent a05a34e140
commit 852c91b44f
4 changed files with 6 additions and 21 deletions

View file

@ -8,14 +8,14 @@ import Button from 'c/Button';
import s0 from 'c/Proxies.module.scss'; import s0 from 'c/Proxies.module.scss';
import { import {
getUserProxies, getProxies,
getProxyGroupNames, getProxyGroupNames,
fetchProxies, fetchProxies,
requestDelayAll requestDelayAll
} from 'd/proxies'; } from 'd/proxies';
const mapStateToProps = s => ({ const mapStateToProps = s => ({
proxies: getUserProxies(s), proxies: getProxies(s),
groupNames: getProxyGroupNames(s) groupNames: getProxyGroupNames(s)
}); });

View file

@ -13,7 +13,7 @@ import fallback from 's/fallback.svg';
import s0 from './Proxy.module.scss'; import s0 from './Proxy.module.scss';
import { getDelay, getUserProxies } from 'd/proxies'; import { getDelay, getProxies } from 'd/proxies';
const colors = { const colors = {
Vmess: '#ca3487', Vmess: '#ca3487',
@ -31,11 +31,9 @@ const icons = {
Fallback: fallback.id Fallback: fallback.id
}; };
// typeof Proxy = 'Shadowsocks' | 'Vmess' | 'Socks5';
const mapStateToProps = s => { const mapStateToProps = s => {
return { return {
proxies: getUserProxies(s), proxies: getProxies(s),
delay: getDelay(s) delay: getDelay(s)
}; };
}; };

View file

@ -6,10 +6,10 @@ import Proxy from 'c/Proxy';
import s0 from './ProxyGroup.module.scss'; import s0 from './ProxyGroup.module.scss';
import { getUserProxies, switchProxy } from 'd/proxies'; import { getProxies, switchProxy } from 'd/proxies';
const mapStateToProps = s => ({ const mapStateToProps = s => ({
proxies: getUserProxies(s) proxies: getProxies(s)
}); });
// should move this to sth like constants.js // should move this to sth like constants.js

View file

@ -1,4 +1,3 @@
import { createSelector } from 'reselect';
import * as proxiesAPI from 'a/proxies'; import * as proxiesAPI from 'a/proxies';
import { getClashAPIConfig } from 'd/app'; import { getClashAPIConfig } from 'd/app';
@ -11,18 +10,6 @@ const ProxyGroupTypes = ['Fallback', 'URLTest', 'Selector'];
export const getProxies = s => s.proxies.proxies; export const getProxies = s => s.proxies.proxies;
export const getDelay = s => s.proxies.delay; export const getDelay = s => s.proxies.delay;
export const getProxyGroupNames = s => s.proxies.groupNames; export const getProxyGroupNames = s => s.proxies.groupNames;
export const getUserProxies = createSelector(
getProxies,
proxies => {
let o = {};
for (const prop in proxies) {
if (ProxyTypeBuiltin.indexOf(prop) < 0) {
o[prop] = proxies[prop];
}
}
return o;
}
);
const CompletedFetchProxies = 'proxies/CompletedFetchProxies'; const CompletedFetchProxies = 'proxies/CompletedFetchProxies';
const OptimisticSwitchProxy = 'proxies/OptimisticSwitchProxy'; const OptimisticSwitchProxy = 'proxies/OptimisticSwitchProxy';