Disable robo-identities

This commit is contained in:
Reckless_Satoshi 2024-03-31 16:16:24 +01:00
parent d3acb6bfb8
commit 10a5dee619
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 { Avatar, Badge, Tooltip } from '@mui/material';
import { SendReceiveIcon } from '../Icons'; import { SendReceiveIcon } from '../Icons';
import placeholder from './placeholder.json'; import placeholder from './placeholder.json';
import { robohash } from './RobohashGenerator'; // import { robohash } from './RobohashGenerator';
import { AppContext, type UseAppStoreType } from '../../contexts/AppContext'; import { AppContext, type UseAppStoreType } from '../../contexts/AppContext';
interface Props { interface Props {
@ -53,22 +53,22 @@ const RobotAvatar: React.FC<Props> = ({
const backgroundImage = `url(data:${backgroundData.mime};base64,${backgroundData.data})`; const backgroundImage = `url(data:${backgroundData.mime};base64,${backgroundData.data})`;
const className = placeholderType === 'loading' ? 'loadingAvatar' : 'generatingAvatar'; const className = placeholderType === 'loading' ? 'loadingAvatar' : 'generatingAvatar';
useEffect(() => { // useEffect(() => {
// TODO: HANDLE ANDROID AVATARS TOO (when window.NativeRobosats !== undefined) // // TODO: HANDLE ANDROID AVATARS TOO (when window.NativeRobosats !== undefined)
if (hashId !== undefined) { // if (hashId !== undefined) {
robohash // robohash
.generate(hashId, small ? 'small' : 'large') // .generate(hashId, small ? 'small' : 'large')
.then((avatar) => { // .then((avatar) => {
setAvatarSrc(avatar); // setAvatarSrc(avatar);
}) // })
.catch(() => { // .catch(() => {
setAvatarSrc(''); // setAvatarSrc('');
}); // });
setTimeout(() => { // setTimeout(() => {
setActiveBackground(false); // setActiveBackground(false);
}, backgroundFadeTime); // }, backgroundFadeTime);
} // }
}, [hashId]); // }, [hashId]);
useEffect(() => { useEffect(() => {
if (shortAlias !== undefined) { if (shortAlias !== undefined) {

View File

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

View File

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