build: fix ihm_client build (config import Vite); bump 1.1.1; update CHANGELOG (docker-support-v2)
This commit is contained in:
parent
b9580c0113
commit
7e3d160d5c
@ -1,3 +1,4 @@
|
||||
## 1.1.1 - Correction build (config Vite) pour docker-support-v2
|
||||
# Changelog - ihm_client
|
||||
|
||||
Tous les changements notables de ce projet seront documentés dans ce fichier.
|
||||
|
4
package-lock.json
generated
4
package-lock.json
generated
@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "sdk_client",
|
||||
"version": "1.1.0",
|
||||
"version": "1.1.1",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "sdk_client",
|
||||
"version": "1.1.0",
|
||||
"version": "1.1.1",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@angular/elements": "^19.0.1",
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "sdk_client",
|
||||
"version": "1.1.0",
|
||||
"version": "1.1.1",
|
||||
"description": "",
|
||||
"main": "dist/index.js",
|
||||
"scripts": {
|
||||
|
7
src/config.ts
Normal file
7
src/config.ts
Normal file
@ -0,0 +1,7 @@
|
||||
export const config = {
|
||||
api: {
|
||||
baseUrl: (import.meta as any).env?.VITE_BASE_URL || process.env.VITE_BASE_URL || 'http://localhost'
|
||||
}
|
||||
};
|
||||
|
||||
export default config;
|
@ -6,6 +6,7 @@ import ModalService from './modal.service';
|
||||
import Database from './database.service';
|
||||
import { navigate } from '../router';
|
||||
import { storeData, retrieveData, testData } from './storage.service';
|
||||
import config from '../config';
|
||||
import { BackUp } from '~/models/backup.model';
|
||||
|
||||
export const U32_MAX = 4294967295;
|
||||
@ -87,7 +88,7 @@ export default class Services {
|
||||
*/
|
||||
public async connectAllRelays(): Promise<void> {
|
||||
const connectedUrls: string[] = [];
|
||||
|
||||
|
||||
// Connect to all relays
|
||||
for (const wsurl of Object.keys(this.relayAddresses)) {
|
||||
try {
|
||||
@ -99,7 +100,7 @@ export default class Services {
|
||||
console.error(`Failed to connect to ${wsurl}:`, error);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Wait for at least one handshake message if we have connections
|
||||
if (connectedUrls.length > 0) {
|
||||
await this.waitForHandshakeMessage();
|
||||
@ -343,18 +344,18 @@ export default class Services {
|
||||
roles: Record<string, RoleDefinition>,
|
||||
): Promise<ApiReturn> {
|
||||
let relayAddress = this.getAllRelays()[0]?.spAddress;
|
||||
|
||||
|
||||
if (!relayAddress || relayAddress === '') {
|
||||
console.log('No relay address found, connecting to relays...');
|
||||
await this.connectAllRelays();
|
||||
|
||||
|
||||
// After connectAllRelays completes, relay addresses should be updated
|
||||
relayAddress = this.getAllRelays()[0]?.spAddress;
|
||||
if (!relayAddress || relayAddress === '') {
|
||||
throw new Error('No relay address available after connecting to relays');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const feeRate = 1;
|
||||
|
||||
// We can't encode files as the rest because Uint8Array is not valid json
|
||||
@ -362,12 +363,12 @@ export default class Services {
|
||||
// TODO encoding of relatively large binaries (=> 1M) is a bit long now and blocking
|
||||
const privateSplitData = this.splitData(privateData);
|
||||
const publicSplitData = this.splitData(publicData);
|
||||
const encodedPrivateData = {
|
||||
...this.sdkClient.encode_json(privateSplitData.jsonCompatibleData),
|
||||
const encodedPrivateData = {
|
||||
...this.sdkClient.encode_json(privateSplitData.jsonCompatibleData),
|
||||
...this.sdkClient.encode_binary(privateSplitData.binaryData)
|
||||
};
|
||||
const encodedPublicData = {
|
||||
...this.sdkClient.encode_json(publicSplitData.jsonCompatibleData),
|
||||
const encodedPublicData = {
|
||||
...this.sdkClient.encode_json(publicSplitData.jsonCompatibleData),
|
||||
...this.sdkClient.encode_binary(publicSplitData.binaryData)
|
||||
};
|
||||
|
||||
@ -388,10 +389,10 @@ export default class Services {
|
||||
await this.checkConnections([...members]);
|
||||
|
||||
const result = this.sdkClient.create_new_process (
|
||||
encodedPrivateData,
|
||||
encodedPrivateData,
|
||||
roles,
|
||||
encodedPublicData,
|
||||
relayAddress,
|
||||
relayAddress,
|
||||
feeRate,
|
||||
this.getAllMembers()
|
||||
);
|
||||
@ -429,12 +430,12 @@ export default class Services {
|
||||
await this.checkConnections([...members]);
|
||||
const privateSplitData = this.splitData(privateData);
|
||||
const publicSplitData = this.splitData(publicData);
|
||||
const encodedPrivateData = {
|
||||
...this.sdkClient.encode_json(privateSplitData.jsonCompatibleData),
|
||||
const encodedPrivateData = {
|
||||
...this.sdkClient.encode_json(privateSplitData.jsonCompatibleData),
|
||||
...this.sdkClient.encode_binary(privateSplitData.binaryData)
|
||||
};
|
||||
const encodedPublicData = {
|
||||
...this.sdkClient.encode_json(publicSplitData.jsonCompatibleData),
|
||||
const encodedPublicData = {
|
||||
...this.sdkClient.encode_json(publicSplitData.jsonCompatibleData),
|
||||
...this.sdkClient.encode_binary(publicSplitData.binaryData)
|
||||
};
|
||||
try {
|
||||
@ -544,7 +545,7 @@ export default class Services {
|
||||
}
|
||||
|
||||
async parseNewTx(newTxMsg: string) {
|
||||
const parsedMsg: NewTxMessage = JSON.parse(newTxMsg);
|
||||
const parsedMsg: NewTxMessage = JSON.parse(newTxMsg);
|
||||
if (parsedMsg.error !== null) {
|
||||
console.error('Received error in new tx message:', parsedMsg.error);
|
||||
return;
|
||||
@ -881,7 +882,7 @@ export default class Services {
|
||||
try {
|
||||
const device = await this.getDeviceFromDatabase();
|
||||
if (device) {
|
||||
const pairedMember = device['paired_member'];
|
||||
const pairedMember = device['paired_member'];
|
||||
return pairedMember.sp_addresses;
|
||||
} else {
|
||||
return null;
|
||||
@ -1055,7 +1056,7 @@ export default class Services {
|
||||
} catch (e) {
|
||||
console.error(`Failed to save data to db: ${e}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public async getBlobFromDb(hash: string): Promise<Blob | null> {
|
||||
const db = await Database.getInstance();
|
||||
@ -1184,7 +1185,7 @@ export default class Services {
|
||||
});
|
||||
}
|
||||
|
||||
// Now we can transfer them to memory
|
||||
// Now we can transfer them to memory
|
||||
await this.restoreSecretsFromDB();
|
||||
}
|
||||
|
||||
@ -1225,7 +1226,7 @@ export default class Services {
|
||||
if (!key) {
|
||||
const roles = state.roles;
|
||||
let hasAccess = false;
|
||||
// If we're not supposed to have access to this attribute, ignore
|
||||
// If we're not supposed to have access to this attribute, ignore
|
||||
for (const role of Object.values(roles)) {
|
||||
for (const rule of Object.values(role.validation_rules)) {
|
||||
if (rule.fields.includes(attribute)) {
|
||||
@ -1246,7 +1247,7 @@ export default class Services {
|
||||
const maxRetries = 5;
|
||||
const retryDelay = 500; // delay in milliseconds
|
||||
let retries = 0;
|
||||
|
||||
|
||||
while ((!hash || !key) && retries < maxRetries) {
|
||||
await new Promise(resolve => setTimeout(resolve, retryDelay));
|
||||
// Re-read hash and key after waiting
|
||||
@ -1279,7 +1280,7 @@ export default class Services {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -1321,7 +1322,7 @@ export default class Services {
|
||||
await this.resetDevice();
|
||||
|
||||
await this.saveDeviceInDatabase(device);
|
||||
|
||||
|
||||
this.restoreDevice(device);
|
||||
|
||||
// TODO restore secrets and processes from file
|
||||
@ -1478,7 +1479,7 @@ export default class Services {
|
||||
private async waitForHandshakeMessage(timeoutMs: number = 10000): Promise<void> {
|
||||
const startTime = Date.now();
|
||||
const pollInterval = 100; // Check every 100ms
|
||||
|
||||
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
const checkForHandshake = () => {
|
||||
// Check if we have any members (indicating handshake was received)
|
||||
@ -1487,17 +1488,17 @@ export default class Services {
|
||||
resolve();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Check timeout
|
||||
if (Date.now() - startTime >= timeoutMs) {
|
||||
reject(new Error(`No handshake message received after ${timeoutMs}ms timeout`));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Continue polling
|
||||
setTimeout(checkForHandshake, pollInterval);
|
||||
};
|
||||
|
||||
|
||||
checkForHandshake();
|
||||
});
|
||||
}
|
||||
@ -1548,7 +1549,7 @@ export default class Services {
|
||||
this.sendCommitMessage(JSON.stringify(content));
|
||||
}, 1000)
|
||||
}
|
||||
|
||||
|
||||
public getRoles(process: Process): Record<string, RoleDefinition> | null {
|
||||
const lastCommitedState = this.getLastCommitedState(process);
|
||||
if (lastCommitedState && lastCommitedState.roles && Object.keys(lastCommitedState.roles).length != 0) {
|
||||
@ -1728,7 +1729,7 @@ export default class Services {
|
||||
return process.states[index + 1];
|
||||
}
|
||||
|
||||
return null;
|
||||
return null;
|
||||
}
|
||||
|
||||
public isPairingProcess(roles: Record<string, RoleDefinition>): boolean {
|
||||
|
Loading…
x
Reference in New Issue
Block a user