Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 'trust site' on localhost #491

Merged
merged 5 commits into from Feb 3, 2020
Merged
Changes from 1 commit
Commits
File filter
Filter file types
Jump to
Jump to file
Failed to load files.

Always

Just for now

Prev

Use cliqz-url-parser to handle trusting localhost

  • Loading branch information
benstrumeyer committed Feb 3, 2020
commit 1a22336418bc965e0017331feaddf1163af6d88e
@@ -13,6 +13,7 @@

/* eslint no-use-before-define: 0 */

import { URL } from '@cliqz/url-parser';
import {
UPDATE_SUMMARY_DATA,
UPDATE_CLIQZ_MODULE_DATA,
@@ -112,12 +113,8 @@ const _updateSitePolicy = (state, action) => {
const pageUrlTokens = pageUrl.split('/');
host = pageUrlTokens.length > 2 ? pageUrlTokens[2] : pageHost.replace(/^www\./, '');
} else if (pageHost === 'localhost') {
// Handle localhost port number.
if (pageUrl.includes(':')) {
const port = pageUrl.split(':');
host = `localhost:${port[port.length - 1]}`;
host = host.substring(0, host.length - 1);
}
const url = new URL(pageUrl);
host = url.host;
} else {
host = pageHost.replace(/^www\./, '');
}
ProTip! Use n and p to navigate between commits in a pull request.