Skip to content

Commit

Permalink
Merge branch 'main' into auto-updater
Browse files Browse the repository at this point in the history
  • Loading branch information
f1ames committed Jan 4, 2024
2 parents f9349ad + aab31dc commit 8a063e9
Show file tree
Hide file tree
Showing 9 changed files with 150 additions and 56 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/monokle-build-nightly.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
name: monokle-build-nightly

on:
schedule:
- cron: '0 2 * * *'
workflow_dispatch:
inputs:
ref:
Expand Down
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

### [2.4.4](https://github.com/kubeshop/monokle/compare/v2.4.3...v2.4.4) (2024-01-04)


### Bug Fixes

* add client data to synchronizer instances ([46ffb9f](https://github.com/kubeshop/monokle/commit/46ffb9fed0dc0b152637485fd8443097ebb8fd0d))
* fix synchronizer invalid calls ([178b830](https://github.com/kubeshop/monokle/commit/178b83029796fe0163c41d92757052498c04e1bf))
* send machineId only when tracking enabled ([44c35df](https://github.com/kubeshop/monokle/commit/44c35df10de3884e865ec2d6b1ab568f0694ec1f))

### [2.4.3](https://github.com/kubeshop/monokle/compare/v2.4.3-nightly-2023-12-08.0...v2.4.3) (2023-12-08)

### [2.4.2](https://github.com/kubeshop/monokle/compare/v2.4.2-nightly-2023-10-23.0...v2.4.2) (2023-10-23)
Expand Down
7 changes: 5 additions & 2 deletions electron/app/services/cloud/authenticator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@ import {app} from 'electron';

import {join} from 'path';

import {Authenticator, StorageHandlerAuth, createDefaultMonokleAuthenticator} from '@monokle/synchronizer';
import {Authenticator, StorageHandlerAuth, createMonokleAuthenticatorFromOrigin} from '@monokle/synchronizer';
import {getClientConfig} from './client-config';

export const AUTH_CLIENT_ID = 'mc-cli';

let authenticator: Authenticator | undefined;

const initAuthenticator = async (cloudStorageDir: string) => {
const newAuthenticator = createDefaultMonokleAuthenticator(new StorageHandlerAuth(cloudStorageDir));
const newAuthenticator = await createMonokleAuthenticatorFromOrigin(AUTH_CLIENT_ID, getClientConfig(), undefined, new StorageHandlerAuth(cloudStorageDir));
authenticator = newAuthenticator;
return newAuthenticator;
};
Expand Down
18 changes: 18 additions & 0 deletions electron/app/services/cloud/client-config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import {type, release} from 'os';
import {machineIdSync} from 'node-machine-id';
import {app} from 'electron';
import electronStore from '@shared/utils/electronStore';

const CLIENT_NAME = 'Monokle Desktop';

export function getClientConfig() {
const isTrackingDisabled = Boolean(electronStore.get('appConfig.disableEventTracking'));
const additionalData = isTrackingDisabled ? undefined : { machineId: machineIdSync() };

return {
name: CLIENT_NAME,
version: app.getVersion(),
os: `${type()} ${release()}`,
additionalData,
};
}
4 changes: 2 additions & 2 deletions electron/app/services/cloud/policy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import {getUser} from './user';
export const getPolicy = async (repoPath: string) => {
const synchronizer = await getSynchronizer();
const user = await getUser();
if (!user?.token || !synchronizer) {
if (!user?.tokenInfo || !synchronizer) {
return null;
}

try {
const policy = await synchronizer.getPolicy(repoPath, true, user.token);
const policy = await synchronizer.getPolicy(repoPath, true, user.tokenInfo);
return policy;
} catch (e: any) {
if (e instanceof Error) {
Expand Down
4 changes: 2 additions & 2 deletions electron/app/services/cloud/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ export const getInfo = async (
): Promise<{projectInfo: CloudProjectInfo; policyInfo: CloudPolicyInfo} | null> => {
const synchronizer = await getSynchronizer();
const user = await getUser();
if (!user?.token || !synchronizer) {
if (!user?.tokenInfo || !synchronizer) {
return null;
}

try {
const project = await synchronizer?.getProjectInfo(repoPath, user.token, true);
const project = await synchronizer?.getProjectInfo(repoPath, user.tokenInfo, true);
return project
? {
projectInfo: {...project, link: synchronizer.generateDeepLinkProject(project.slug)},
Expand Down
5 changes: 3 additions & 2 deletions electron/app/services/cloud/synchronizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ import {app} from 'electron';

import {join} from 'path';

import {StorageHandlerPolicy, Synchronizer, createDefaultMonokleSynchronizer} from '@monokle/synchronizer';
import {StorageHandlerPolicy, Synchronizer, createMonokleSynchronizerFromOrigin} from '@monokle/synchronizer';
import {getClientConfig} from './client-config';

let synchronizer: Synchronizer | undefined;

const initSynchronizer = async (cloudStorageDir: string) => {
const newSynchronizer = createDefaultMonokleSynchronizer(new StorageHandlerPolicy(cloudStorageDir));
const newSynchronizer = await createMonokleSynchronizerFromOrigin(getClientConfig(), undefined, new StorageHandlerPolicy(cloudStorageDir));
synchronizer = newSynchronizer;
return newSynchronizer;
};
Expand Down
Loading

0 comments on commit 8a063e9

Please sign in to comment.