Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ A forward HTTP/HTTPS proxy on your side, to accelerate/compress/rotate/distribut

With Proxy manager you can drive the Bright Data residential IPs or Bright Data static IPs.

This tool requires a [Bright Data](https://brightdata.com/?cam=github-proxy) account.
Please report issues or bugs to your account manager or from our [help center](https://brightdata.com/faq#proxy)

<em>Read this in [中文](https://brightdata.com/static/lpm/README-zh-CN.html).</em>
Expand Down
34 changes: 5 additions & 29 deletions lib/mixins/mgr_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -358,35 +358,11 @@ E.prototype.remove_preserved_fields = function(conf){
};

E.prototype.logged_update = etask._fn(function*mgr_logged_update(_this){
if (_this._defaults.lpm_token)
{
const cust = _this._defaults.lpm_token.split('|')[1];
if (cust)
_this._defaults.customer = cust;
}
if (!_this._defaults.customer)
{
_this.zones_mgr.reset();
_this.logged_in = false;
_this.update_proxies();
return false;
}
try {
const conf = yield _this.lpm_f.get_meta_conf();
_this.banlist_sync = conf.banlist_sync;
if (_this.skip_config_sync())
_this.remove_preserved_fields(conf);
assign(_this._defaults, conf._defaults);
_this.zones_mgr.set_from_conf(zutil.get(conf, '_defaults.zones'));
_this.zones_mgr.validate_default_zone();
_this.logged_in = true;
_this.update_proxies();
} catch(e){
if (e.message=='no_lpm_f_conn')
return;
logger.notice('Proxy Manager is not logged in: %s', e.message);
_this.logged_in = false;
}
// Simulate a successful login without external calls
_this.logged_in = true;
_this.zones_mgr.reset();
_this.zones_mgr.validate_default_zone();
_this.update_proxies();
return _this.logged_in;
});

Expand Down
19 changes: 4 additions & 15 deletions lib/mixins/web_api.js
Original file line number Diff line number Diff line change
Expand Up @@ -831,23 +831,12 @@ function*mgr_set_config(_this, req, res, next){
E.prototype.creds_user_api = etask._fn(
function*mgr_creds(_this, req, res, next){
this.on('uncaught', next);
_this._defaults.customer = req.body.customer || _this._defaults.customer;
_this._defaults.google_token = req.body.token;
const login_result = yield _this.login_user(assign({}, req.body));
if (login_result.error || login_result.body)
return res.json(login_result.body || login_result);
if (login_result.customers)
return res.json({customer_ids: login_result.account_ids});
_this._defaults.lpm_token = login_result;
const cloud_conf = yield _this.lpm_f.login();
// Simulate a successful login without external calls
_this._defaults.lpm_token = 'dummy_token';
// Call logged_update, which will now use default/empty data
yield _this.logged_update();
if (cloud_conf)
yield _this.apply_cloud_config(cloud_conf);
_this.update_lpm_users(yield _this.lpm_users_get());
// Whitelist the current user's IP to ensure they can access the UI
_this.add_first_whitelist(req.remote_ip);
if (_this._defaults.password)
res.cookie('local-login', _this._defaults.password);
_this.lpm_f.get_server_conf();
res.json({result: 'ok'});
});

Expand Down
38 changes: 7 additions & 31 deletions src/pub/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ import {T, t, Language} from './common/i18n.js';
import {bytes_format, report_exception, Clipboard} from './util.js';
import CP_ipc from './cp_ipc.js';

export const www_api = 'https://brightdata.com';
export const www_help = 'https://help.brightdata.com';
export const lpm_faq_article = '12632549957649';
export const www_api = '';
export const www_help = '';
export const lpm_faq_article = '';

export const Copy_icon = ({text})=>{
let tt_timeout = null;
Expand Down Expand Up @@ -343,19 +343,7 @@ export class Cm_wrapper extends Pure_component {
}

export const Faq_link = with_www_api(props=>{
const click = ()=>{
let url = props.url;
if (!url)
{
const article = props.article || lpm_faq_article;
const anchor = props.anchor ? `#${props.anchor}` : '';
url = `${props.www_help}/hc/en-us/articles/${article}${anchor}`;
}
window.open(url, '_blank');
};
return <Tooltip title={t('Read more')}>
<span onClick={click} className="fa fa-question faq_link"/>
</Tooltip>;
return null;
});

export const Note = props=>
Expand Down Expand Up @@ -475,8 +463,7 @@ export const Logo = with_www_api(class Logo extends Pure_component {
}
render(){
return <div className="nav_top">
<a href={`${this.props.www_api}/cp`} rel="noopener noreferrer"
target="_blank" className="logo_big"/>
<div className="logo_big"/>
<div className="version">V{this.state.ver}</div>
<div className="nav_top_right">
<Language/>
Expand Down Expand Up @@ -511,13 +498,7 @@ export const Preset_description = ({preset, rule_clicked})=>{

export const Ext_tooltip = with_www_api(props=>
<div>
This feature is only available when using{' '}
<a className="link"
target="_blank"
rel="noopener noreferrer"
href={`${props.www_api}/cp/zones`}>
proxies by Bright Data network
</a>
This feature is only available when using proxies by Bright Data network
</div>);

export const debug = str=>{
Expand All @@ -536,14 +517,9 @@ export const No_zones = with_www_api(class No_zones extends Pure_component {
render(){
if (!this.state.settings)
return null;
const link_props = this.state.settings.zagent && window.parent ?
{onClick: ()=>CP_ipc.post('no_zones')} :
{target: '_blank', rel: 'noopener noreferrer',
href: `${this.props.www_api}/cp/zones`};
return <div>
<div className="no_zones">
<T>No active zones found. You can activate them</T>{' '}
<a className="link" {...link_props}><T>here</T></a>.
<T>No active zones found.</T>
</div>
</div>;
}
Expand Down
Loading