Skip to content

Commit

Permalink
Merge branch 'master' into junyi/err-propagation-electron
Browse files Browse the repository at this point in the history
  • Loading branch information
jyyi1 committed Jun 21, 2024
2 parents 9a89335 + 568108d commit c8be75d
Show file tree
Hide file tree
Showing 16 changed files with 33 additions and 27 deletions.
6 changes: 6 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,12 @@
"no-prototype-builtins": "off",
"prefer-const": "error",
"@typescript-eslint/ban-types": "off",
"@typescript-eslint/explicit-member-accessibility": [
"error",
{
"accessibility": "no-public"
}
],
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-explicit-any": "error",
Expand Down
2 changes: 1 addition & 1 deletion client/electron/process.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export class ChildProcessHelper {
/**
* Whether to enable verbose logging for the process. Must be called before launch().
*/
public isDebugModeEnabled = false;
isDebugModeEnabled = false;

private stdOutListener?: ((data?: string | Buffer) => void) | null;

Expand Down
4 changes: 2 additions & 2 deletions client/electron/routing_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,11 +215,11 @@ export class RoutingDaemon {
return this.writeReset();
}

public get onceDisconnected() {
get onceDisconnected() {
return this.disconnected;
}

public set onNetworkChange(newListener: ((status: TunnelStatus) => void) | undefined) {
set onNetworkChange(newListener: ((status: TunnelStatus) => void) | undefined) {
this.networkChangeListener = newListener;
}
}
Expand Down
2 changes: 1 addition & 1 deletion client/src/www/app/electron_main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class ElectronUpdater extends AbstractUpdater {
}

class ElectronVpnInstaller implements VpnInstaller {
public async installVpn(): Promise<void> {
async installVpn(): Promise<void> {
const err = await window.electron.methodChannel.invoke('install-outline-services');

// catch custom errors (even simple as numbers) does not work for ipcRenderer:
Expand Down
2 changes: 1 addition & 1 deletion client/src/www/app/electron_outline_tunnel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export class ElectronOutlineTunnel implements Tunnel {

private running = false;

constructor(public readonly id: string) {
constructor(readonly id: string) {
// This event is received when the proxy connects. It is mainly used for signaling the UI that
// the proxy has been automatically connected at startup (if the user was connected at shutdown)
window.electron.methodChannel.on(`proxy-connected-${this.id}`, () => {
Expand Down
2 changes: 1 addition & 1 deletion client/src/www/app/fake_tunnel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const FAKE_UNREACHABLE_HOSTNAME = '10.0.0.24';
export class FakeOutlineTunnel implements Tunnel {
private running = false;

constructor(public readonly id: string) {}
constructor(readonly id: string) {}

private playBroken(hostname?: string) {
return hostname === FAKE_BROKEN_HOSTNAME;
Expand Down
4 changes: 2 additions & 2 deletions client/src/www/app/outline_server_repository/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ interface OutlineServerJson {
// Maintains a persisted set of servers and liaises with the core.
export class OutlineServerRepository implements ServerRepository {
// Name by which servers are saved to storage.
public static readonly SERVERS_STORAGE_KEY_V0 = 'servers';
public static readonly SERVERS_STORAGE_KEY = 'servers_v1';
static readonly SERVERS_STORAGE_KEY_V0 = 'servers';
static readonly SERVERS_STORAGE_KEY = 'servers_v1';
private serverById!: Map<string, OutlineServer>;
private lastForgottenServer: OutlineServer | null = null;

Expand Down
6 changes: 3 additions & 3 deletions client/src/www/app/outline_server_repository/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ export class OutlineServer implements Server {
private sessionConfig?: ShadowsocksSessionConfig;

constructor(
public readonly id: string,
public readonly accessKey: string,
public readonly type: ServerType,
readonly id: string,
readonly accessKey: string,
readonly type: ServerType,
private _name: string,
private tunnel: Tunnel,
private eventQueue: events.EventQueue
Expand Down
2 changes: 1 addition & 1 deletion client/src/www/app/vpn_installer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export interface VpnInstaller {
* An VPN installer which does nothing to the OS.
*/
export class NoOpVpnInstaller implements VpnInstaller {
public installVpn(): Promise<void> {
installVpn(): Promise<void> {
return Promise.resolve();
}
}
6 changes: 3 additions & 3 deletions client/src/www/model/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ import {CustomError} from '@outline/infrastructure/custom_error';
import {Server} from './server';

export class ServerAlreadyAdded extends CustomError {
constructor(public readonly server: Server) {
constructor(readonly server: Server) {
super();
}
}

export class ShadowsocksUnsupportedCipher extends CustomError {
constructor(public readonly cipher: string) {
constructor(readonly cipher: string) {
super();
}
}
Expand Down Expand Up @@ -78,7 +78,7 @@ export class ProxyConnectionFailure extends CustomError {
//
// TODO: Rename this class, "plugin" is a poor name since the Electron apps do not have plugins.
export class OutlinePluginError extends CustomError {
constructor(public readonly errorCode: ErrorCode) {
constructor(readonly errorCode: ErrorCode) {
super();
}
}
Expand Down
14 changes: 7 additions & 7 deletions client/src/www/model/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,31 +20,31 @@ export interface OutlineEvent {}
export type OutlineEventListener<T extends OutlineEvent> = (event: T) => void;

export class ServerAdded implements OutlineEvent {
constructor(public readonly server: Server) {}
constructor(readonly server: Server) {}
}

export class ServerForgotten implements OutlineEvent {
constructor(public readonly server: Server) {}
constructor(readonly server: Server) {}
}

export class ServerForgetUndone implements OutlineEvent {
constructor(public readonly server: Server) {}
constructor(readonly server: Server) {}
}

export class ServerRenamed implements OutlineEvent {
constructor(public readonly server: Server) {}
constructor(readonly server: Server) {}
}

export class ServerConnected implements OutlineEvent {
constructor(public readonly server: Server) {}
constructor(readonly server: Server) {}
}

export class ServerDisconnected implements OutlineEvent {
constructor(public readonly server: Server) {}
constructor(readonly server: Server) {}
}

export class ServerReconnecting implements OutlineEvent {
constructor(public readonly server: Server) {}
constructor(readonly server: Server) {}
}

// Simple publisher-subscriber queue.
Expand Down
2 changes: 1 addition & 1 deletion infrastructure/path_api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export class PathApiClient {
* @param base A valid URL
* @param fingerprint A SHA-256 hash of the expected leaf certificate, in binary encoding.
*/
constructor(public readonly base: string, public readonly fetcher: Fetcher) {}
constructor(readonly base: string, public readonly fetcher: Fetcher) {}

/**
* Makes a request relative to the base URL with a JSON body.
Expand Down
2 changes: 1 addition & 1 deletion infrastructure/timeout_promise.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import {CustomError} from './custom_error';

export class OperationTimedOut extends CustomError {
constructor(public readonly timeoutMs: number, public readonly operationName: string) {
constructor(readonly timeoutMs: number, public readonly operationName: string) {
super();
}
}
Expand Down
2 changes: 1 addition & 1 deletion server_manager/model/digitalocean.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export class Region implements location.CloudLocation {
syd: location.SYDNEY,
tor: location.TORONTO,
};
constructor(public readonly id: string) {}
constructor(readonly id: string) {}

get location(): location.GeoLocation {
return Region.LOCATION_MAP[this.id.substring(0, 3).toLowerCase()];
Expand Down
2 changes: 1 addition & 1 deletion server_manager/model/gcp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export class Zone implements location.CloudLocation {
};

/** ID is a GCP Zone ID like "us-central1-a". */
constructor(public readonly id: string) {}
constructor(readonly id: string) {}

/** Returns a region ID like "us-central1". */
get regionId(): string {
Expand Down
2 changes: 1 addition & 1 deletion server_manager/model/location.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
* When the key and value are equal, this indicates that they are redundant.
*/
export class GeoLocation {
constructor(public readonly id: string, public readonly countryCode: string) {}
constructor(readonly id: string, public readonly countryCode: string) {}

countryIsRedundant(): boolean {
return this.countryCode === this.id;
Expand Down

0 comments on commit c8be75d

Please sign in to comment.