Spaces:
Sleeping
Sleeping
Download src/lib/sessionConfig.js from ayushsinghal1510/frontendt: direct link, hf CLI and curl.
- Browser
- Download file 703 Bytes
-
https://huggingface.co/spaces/ayushsinghal1510/frontendt/resolve/main/src/lib/sessionConfig.js
- Command line
-
hf download hf://spaces/ayushsinghal1510/frontendt/src/lib/sessionConfig.js
-
curl -L -o sessionConfig.js https://huggingface.co/spaces/ayushsinghal1510/frontendt/resolve/main/src/lib/sessionConfig.js
703 Bytes
| function b64Encode(obj) { | |
| return btoa(unescape(encodeURIComponent(JSON.stringify(obj)))) | |
| } | |
| function b64Decode(str) { | |
| try { | |
| return JSON.parse(decodeURIComponent(escape(atob(str)))) | |
| } catch { | |
| return null | |
| } | |
| } | |
| export function encodeSessionConfig(config) { | |
| return b64Encode(config) | |
| } | |
| export function decodeSessionConfig(encoded) { | |
| return b64Decode(encoded) | |
| } | |
| export function buildInterviewUrl(sessionId, config) { | |
| const base = `${window.location.origin}${window.location.pathname}` | |
| return `${base}#/interview/${sessionId}?cfg=${b64Encode(config)}` | |
| } | |
| export function buildWatchUrl(sessionId) { | |
| return `${window.location.origin}${window.location.pathname}#/watch/${sessionId}` | |
| } | |