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

[WIP] VPN desktop client #603

Merged
merged 31 commits into from
Apr 29, 2021
Merged

[WIP] VPN desktop client #603

merged 31 commits into from
Apr 29, 2021

Conversation

Senyoret1
Copy link
Contributor

Did you run make format && make check?
The go code was not changed. npm run lint and npm run build were used.

Changes:

  • The front end for the VPN desktop client is being added. At least for now, it is being added inside the Skywire manager.

How to test this PR:
Recompile the Skywire manager, open it and navigate to {URL}/#/vpn.

Note: some changes affect the Skywire manager, modifications will be made later to revert the changes for the manager, if appropriate.

@Senyoret1
Copy link
Contributor Author

The last commit includes the following changes:

  • Several improvements were added to the server list of the VPN client, including fixing several small bugs, improving how the elements at the top are organized, making the design work better if the window is resized, and others.
  • Filtering options for the countries were added. With this, the general-purpose filtering window received some improvements that can be used in the Skywire manager.
  • The base code for getting the server list from the discovery service was added.

@Senyoret1
Copy link
Contributor Author

The last commit adds the design for the main page of the VPN client.

@Senyoret1
Copy link
Contributor Author

The last commit includes the following changes:

  • The initial code for starting, stopping and getting the state of the VPN client app was added.

@Senyoret1
Copy link
Contributor Author

The last commit includes the following changes:

  • Errors with the navigation inside the VPN client were fixed.
  • Now it is possible to change the language in the VPN client.
  • The header now uses the basic VPN info service to update the data. At this moment only the “connected” and “disconnected” states are shown, as the rest of the data is still not available.
  • Several other small changes and improvements.

@Senyoret1
Copy link
Contributor Author

The last commits include the following changes:

  • Now the server list works for changing the server and connecting to it. It takes into account special cases, like selecting the same server and having to stop the connection for making the change.
  • Now it is possible to enter the server pk and password manually.
  • Now the general VPN client service centralizes the code for modifying the state of the VPN client app and not just checking its state. It also has several improvements to avoid problems caused by the async communications between the font-end and the visor.
  • There is now a new page for informing the user when there is an error accessing the VPN client app.
  • The UI of the initial tab was improved to give more feedback to the user when an operation is being made.
  • Several other bug fixes and improvements to the code.

@Senyoret1
Copy link
Contributor Author

The last commits include the following changes:

  • Now the VPN desktop client is able to manage server lists (history, favorites and blocked), in the code and UI. A lot of changes were made internally.
  • Severall small changes and fixes.

@Senyoret1
Copy link
Contributor Author

The last commits include the following changes:

  • A settings page was added. It is possible to change the killswitch setting using it. Future settings should be added to it.
  • The status returned by the backend is now used in the status page.
  • The public ip is obtained using the ipify.org service and shown in the UI.

@Senyoret1
Copy link
Contributor Author

The last commit includes several changes, including:

  • The country of the current IP is obtained using ip2c.org.
  • Now a warning is shown if the browser window is too small, as the design is not responsive.
  • The way in which the VPN client makes redirects if the URL is not correct was improved.
  • The loading animation in the server list now reacts well if there are problems checking the backend.
  • Several other improvements and bug fixes.

@Senyoret1
Copy link
Contributor Author

The last commits include the following changes:

  • Several improvements to how the IPs and geolocation are managed.
  • Now the UI shows the data transmisison stats (depends on Additional app stats #649)
  • Several additional small improvements and fixes.

@Senyoret1
Copy link
Contributor Author

The last commit includes the following changes:

  • Several problems in the data storage synchronization that were present if the app was openned in more than one tab/window were solved.
  • Now the app automatically creates a transport for connecting with the server before activating the VPN client app, if needed.
  • A latency graph was added.
  • The code now reacts well is the server pk is changed directly in the node or another instance of the app.
  • An error page was added to prevent problems if the user tries to manage more than one visor with the same app instance.
  • A problem which made the app stop working if the server pk is not valid was solved.
  • Improvements were made to how the blocked servers are managed.
  • A new option for not using external services for getting the IP info was added.
  • The countries tab was removed.
  • Several other smaller improvements and bug fixes.

@Senyoret1
Copy link
Contributor Author

While creating the last commit, most of the code was reviewed and commented. Apart from the code comments, it includes various small fixes and the Spanish translation. Some additional problems were detected and will be fixed next.

@Senyoret1
Copy link
Contributor Author

The last commit includes the following changes:

  • Now the client is able to connect to a server using a password. Several options for managing the passwords were added. The password are not saved in the front-end.
  • A workaround for solving a rendering bug on Chrome was added. The bug made some texts clearer while some animation were being played and while the vertical scrollbar was being shown.
  • Now the top bar is able to show the VPN status the state tab shows.
  • Some improvements for the general app error management were added.
  • A generic component for showing the server name was added, to ensure consistency in the app, as the server names are shown with several optional elements.
  • If the user opens the app in a remote computer, a warning is shown.
  • Several other smaller improvements and bug fixes.

@Senyoret1
Copy link
Contributor Author

The last commit includes several additional improvements for the Skywire VPN desktop client, including the following:

  • Now the UI works well when no server has been set in the backend.
  • Improvements were added to the settings page.
  • The browser tab now shows the correct title.
  • Several other smaller bug fixes and improvements.

@Senyoret1
Copy link
Contributor Author

The last commit includes the following changes:

  • A Skywire logo was added at the top.
  • Now the user is asked for confirmation when changing the killswitch setting if the VPN is running, because the connection is stopped for a moment for making the change.
  • Now the user is not asked for confirmation when stopping the VPN if the killswitch option is not turned on.
  • The dots at the end of one word tooltips were removed.

@Senyoret1
Copy link
Contributor Author

The last commit includes the following changes:

  • The data graphs now always start at 0, to make them easier to underestand.
  • The sorting mechanism for the server list was improved.
  • Some other improvements based on the changes made in the Android client.

@Senyoret1
Copy link
Contributor Author

The last commit includes the following changes:

  • Now the data starts are shown by default using the standard units (bits for speed and bytes for volume)
  • Now AutoScalePipe can process bits.
  • Options for changing the default units for the data stats were added.

},
{
icon: 'settings',
label: 'vpn.settings',

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codacy has a fix for the issue: Strings must use doublequote.

Suggested change
label: 'vpn.settings',
label: "vpn.settings",

import { BackendState, VpnClientService, VpnServiceStates } from 'src/app/services/vpn-client.service';
import { SnackbarService } from 'src/app/services/snackbar.service';
import { AppsService } from 'src/app/services/apps.service';
import { processServiceError } from 'src/app/utils/errors';

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codacy has a fix for the issue: Strings must use doublequote.

Suggested change
import { processServiceError } from 'src/app/utils/errors';
import { processServiceError } from "src/app/utils/errors";

import { SortingModes, SortingColumn, DataSorter } from 'src/app/utils/lists/data-sorter';
import { DataFilterer } from 'src/app/utils/lists/data-filterer';
import { FilterProperties, FilterFieldTypes, PrintableLabel } from 'src/app/utils/filters';
import { countriesList } from 'src/app/utils/countries-list';

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codacy has a fix for the issue: Strings must use doublequote.

Suggested change
import { countriesList } from 'src/app/utils/countries-list';
import { countriesList } from "src/app/utils/countries-list";

(newServerFromDiscovery && (newServerFromHistory || newServerManually)) ||
(newServerManually && (newServerFromHistory || newServerFromDiscovery))
) {
throw new Error('Invalid call');

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codacy has a fix for the issue: Strings must use doublequote.

Suggested change
throw new Error('Invalid call');
throw new Error("Invalid call");

this.listId = 'vbs';
} else if (params.get('type') === Lists.History) {
this.currentList = Lists.History;
this.listId = 'vhs';

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codacy has a fix for the issue: Strings must use doublequote.

Suggested change
this.listId = 'vhs';
this.listId = "vhs";

* must be used in the canActivate and canActivateChild properties of the routing module.
*/
@Injectable({
providedIn: 'root'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codacy has a fix for the issue: Strings must use doublequote.

Suggested change
providedIn: 'root'
providedIn: "root"

* KnownProblems.UnableToConnectWithTheVpnClientApp is used.
*/
@Component({
selector: 'app-vpn-error',

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codacy has a fix for the issue: Strings must use doublequote.

Suggested change
selector: 'app-vpn-error',
selector: "app-vpn-error",

import { Injectable } from '@angular/core';
import { Observable, of } from 'rxjs';
import { HttpClient } from '@angular/common/http';
import { retryWhen, delay, map } from 'rxjs/operators';

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codacy has a fix for the issue: Strings must use doublequote.

Suggested change
import { retryWhen, delay, map } from 'rxjs/operators';
import { retryWhen, delay, map } from "rxjs/operators";

* Page for changing the configuration of the VPN client.
*/
@Component({
selector: 'app-vpn-settings-list',

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codacy has a fix for the issue: Strings must use doublequote.

Suggested change
selector: 'app-vpn-settings-list',
selector: "app-vpn-settings-list",


// Get the PK of the current local visor.
if (params.has('key')) {
this.currentLocalPk = params.get('key');

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codacy has a fix for the issue: Strings must use doublequote.

Suggested change
this.currentLocalPk = params.get('key');
this.currentLocalPk = params.get("key");

// Check if the local visor already has a transport for connecting with the server.
let transportFound = false;
if (nodeInfo.transports && nodeInfo.transports.length > 0) {
(nodeInfo.transports as any[]).forEach(transport => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codacy has a fix for the issue: Expected parentheses around arrow function argument.

Suggested change
(nodeInfo.transports as any[]).forEach(transport => {
(nodeInfo.transports as any[]).forEach((transport) => {

* Page for showing the vpn server lists.
*/
@Component({
selector: 'app-vpn-server-list',

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codacy has a fix for the issue: Strings must use doublequote.

Suggested change
selector: 'app-vpn-server-list',
selector: "app-vpn-server-list",

private static readonly accumulatedMeasurements = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
private static readonly measurementsPerSec = ['B/s', 'KB/s', 'MB/s', 'GB/s', 'TB/s', 'PB/s', 'EB/s', 'ZB/s', 'YB/s'];
private static readonly accumulatedMeasurementsInBits = ['b', 'Kb', 'Mb', 'Gb', 'Tb', 'Pb', 'Eb', 'Zb', 'Yb'];
private static readonly measurementsPerSecInBits = ['b/s', 'Kb/s', 'Mb/s', 'Gb/s', 'Tb/s', 'Pb/s', 'Eb/s', 'Zb/s', 'Yb/s'];

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codacy has a fix for the issue: Strings must use doublequote.

Suggested change
private static readonly measurementsPerSecInBits = ['b/s', 'Kb/s', 'Mb/s', 'Gb/s', 'Tb/s', 'Pb/s', 'Eb/s', 'Zb/s', 'Yb/s'];
private static readonly measurementsPerSecInBits = ["b/s", 'Kb/s', 'Mb/s', 'Gb/s', 'Tb/s', 'Pb/s', 'Eb/s', 'Zb/s', 'Yb/s'];

@@ -0,0 +1,102 @@
import { Component, ViewChild, ElementRef, Inject, OnInit } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codacy has a fix for the issue: Strings must use doublequote.

Suggested change
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { FormBuilder, FormGroup, Validators } from "@angular/forms";

this.vpnData.stateClass = 'red-clear-text';
} else if (data.vpnClientAppData.appState === AppState.Connecting) {
this.vpnData.state = 'vpn.connection-info.state-connecting';
this.vpnData.stateClass = 'yellow-clear-text';

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codacy has a fix for the issue: Strings must use doublequote.

Suggested change
this.vpnData.stateClass = 'yellow-clear-text';
this.vpnData.stateClass = "yellow-clear-text";

@jdknives
Copy link
Member

@Senyoret1 as discussed, I will merge this as it works reasonably well and will make a ticket to address the rest of the open issues in another PR.

@jdknives jdknives merged commit 6b16ae8 into skycoin:develop Apr 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants