Disable robo-identities

This commit is contained in:
Reckless_Satoshi 2024-03-31 16:16:24 +01:00
parent fbab420841
commit 1c11ecb5a9
No known key found for this signature in database
GPG Key ID: 9C4585B561315571
3 changed files with 26 additions and 26 deletions

View File

@ -3,7 +3,7 @@ import SmoothImage from 'react-smooth-image';
import { Avatar, Badge, Tooltip } from '@mui/material';
import { SendReceiveIcon } from '../Icons';
import placeholder from './placeholder.json';
import { robohash } from './RobohashGenerator';
// import { robohash } from './RobohashGenerator';
import { AppContext, type UseAppStoreType } from '../../contexts/AppContext';
interface Props {
@ -53,22 +53,22 @@ const RobotAvatar: React.FC<Props> = ({
const backgroundImage = `url(data:${backgroundData.mime};base64,${backgroundData.data})`;
const className = placeholderType === 'loading' ? 'loadingAvatar' : 'generatingAvatar';
useEffect(() => {
// TODO: HANDLE ANDROID AVATARS TOO (when window.NativeRobosats !== undefined)
if (hashId !== undefined) {
robohash
.generate(hashId, small ? 'small' : 'large')
.then((avatar) => {
setAvatarSrc(avatar);
})
.catch(() => {
setAvatarSrc('');
});
setTimeout(() => {
setActiveBackground(false);
}, backgroundFadeTime);
}
}, [hashId]);
// useEffect(() => {
// // TODO: HANDLE ANDROID AVATARS TOO (when window.NativeRobosats !== undefined)
// if (hashId !== undefined) {
// robohash
// .generate(hashId, small ? 'small' : 'large')
// .then((avatar) => {
// setAvatarSrc(avatar);
// })
// .catch(() => {
// setAvatarSrc('');
// });
// setTimeout(() => {
// setActiveBackground(false);
// }, backgroundFadeTime);
// }
// }, [hashId]);
useEffect(() => {
if (shortAlias !== undefined) {

View File

@ -10,7 +10,7 @@ import { apiClient } from '../services/api';
import { validateTokenEntropy } from '../utils';
import { compareUpdateLimit } from './Limit.model';
import { defaultOrder } from './Order.model';
import { robohash } from '../components/RobotAvatar/RobohashGenerator';
// import { robohash } from '../components/RobotAvatar/RobohashGenerator';
export interface Contact {
nostr?: string | undefined;
@ -174,9 +174,9 @@ export class Coordinator {
};
generateAllMakerAvatars = async (data: [PublicOrder]): Promise<void> => {
for (const order of data) {
void robohash.generate(order.maker_hash_id, 'small');
}
// for (const order of data) {
// void robohash.generate(order.maker_hash_id, 'small');
// }
};
loadBook = (onDataLoad: () => void = () => {}): void => {

View File

@ -1,17 +1,17 @@
import { sha256 } from 'js-sha256';
import { Robot, type Order } from '.';
import { robohash } from '../components/RobotAvatar/RobohashGenerator';
import { generate_roboname } from 'robo-identities-wasm';
// import { robohash } from '../components/RobotAvatar/RobohashGenerator';
// import { generate_roboname } from 'robo-identities-wasm';
class Slot {
constructor(token: string, shortAliases: string[], robotAttributes: Record<any, any>) {
this.token = token;
this.hashId = sha256(sha256(this.token));
this.nickname = generate_roboname(this.hashId);
this.nickname = 'No Nick Display (WIP)';
// trigger RoboHash avatar generation in webworker and store in RoboHash class cache.
void robohash.generate(this.hashId, 'small');
void robohash.generate(this.hashId, 'large');
// void robohash.generate(this.hashId, 'small');
// void robohash.generate(this.hashId, 'large');
this.robots = shortAliases.reduce((acc: Record<string, Robot>, shortAlias: string) => {
acc[shortAlias] = new Robot(robotAttributes);