Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const fileToKey = (data, storyId) => {
const { name, type } = data;
// console.log(name, type);
let namespace = storyId;
if (namespace.indexOf("_")) namespace = namespace.split("_").pop();
if (namespace.length < 36) namespace = shortUuid().toUUID(namespace);
const uuid = uuidv5(`${type},${name}`, namespace);
return `${shortUuid().fromUUID(uuid)}-${name}`;
};
const fileToKey = (data, storyId) => {
const { name, type } = data;
// console.log(name, type);
let namespace = storyId;
if (namespace.indexOf("_")) namespace = namespace.split("_").pop();
if (namespace.length < 36) namespace = shortUuid().toUUID(namespace);
const uuid = uuidv5(`${type},${name}`, namespace);
return `${shortUuid().fromUUID(uuid)}-${name}`;
};
const fileToKey = (data, storyId) => {
const { name, type } = data;
// console.log(name, type);
let namespace = storyId;
if (namespace.indexOf("_")) namespace = namespace.split("_").pop();
if (namespace.length < 36) namespace = shortUuid().toUUID(namespace);
const uuid = uuidv5(`${type},${name}`, namespace);
return `${shortUuid().fromUUID(uuid)}-${name}`;
};
const fileToKey = (data, storyId) => {
const { name, type } = data;
// console.log(name, type);
let namespace = storyId;
if (namespace.indexOf("_")) namespace = namespace.split("_").pop();
if (namespace.length < 36) namespace = shortUuid().toUUID(namespace);
const uuid = uuidv5(`${type},${name}`, namespace);
return `${shortUuid().fromUUID(uuid)}-${name}`;
};
export const initAccount = () => (dispatch, getState) => {
let peerId = localStorage.getItem('peer');
console.log("Peerid: ", peerId);
if(!peerId) {
peerId = short.uuid();
localStorage.setItem('peer', peerId);
}
const peer = webrtc.createPeer(peerId);
const board = localStorage.getItem('board');
let user = localStorage.getItem('user');
peer.on('connection', (_conn) => {
_conn.on('open', (d) => {
console.log('Conn open - receiver side', d);
// closeModal()(dispatch);
});
export const fixClassName = ({ className, ...props }) => {
// const escapedClassName = escapeClassNames(className)
const convertedProps = convertProps(props)
const elementExists = inComponentClassCache(className)
// Extract imageData.
const imageData = getCurrentSrcData(convertedProps)
// Add an additional unique class for multiple s.
const additionalClassname = uuid.generate()
// Create random "uniquely hashed" additionalClass if needed.
const randomClass = ` gbi-${hashString(
(imageData && imageData.srcSet) || className
)}-${additionalClassname}`
// Should an element exist, add randomized class.
const additionalClass = elementExists ? randomClass : ``
const componentClassNames = `${className || ``}${additionalClass ||
``}`.trim()
// Add it to cache if it doesn't exist.
if (!elementExists) activateCacheForComponentClass(className)
return [componentClassNames]
}
const computeId = (userId, storyId) => {
let namespace = userId;
if (namespace.indexOf(":") > 0) namespace = namespace.split(":").pop();
let id = storyId;
if (id.indexOf("_")) id = id.split("_").pop();
if (id.length < 36) id = shortUuid().toUUID(id);
const uuid = uuidv5(id, namespace);
return shortUuid().fromUUID(uuid);
};
const computeId = (userId, storyId) => {
let namespace = userId;
if (namespace.indexOf(":") > 0) namespace = namespace.split(":").pop();
let id = storyId;
if (id.indexOf("_")) id = id.split("_").pop();
if (id.length < 36) id = shortUuid().toUUID(id);
const uuid = uuidv5(id, namespace);
return shortUuid().fromUUID(uuid);
};
const computeId = (userId, storyId) => {
let namespace = userId;
if (namespace.indexOf(":") > 0) namespace = namespace.split(":").pop();
let id = storyId;
if (id.indexOf("_")) id = id.split("_").pop();
if (id.length < 36) id = shortUuid().toUUID(id);
const uuid = uuidv5(id, namespace);
return shortUuid().fromUUID(uuid);
};
peer.on('error', (err) => {
console.log('error', err);
if(err.message.indexOf('is taken') !== -1) {
localStorage.setItem('peer', short.uuid());
window.location.reload();
} else if(err.message.indexOf('Could not connect to peer ') !== -1) {
localStorage.removeItem('user');
localStorage.removeItem('board');
}
});