dylanebert HF staff commited on
Commit
be445b3
1 Parent(s): 9cfda07

random session username

Browse files
Files changed (3) hide show
  1. package-lock.json +23 -0
  2. package.json +2 -0
  3. src/routes/Vote.svelte +12 -1
package-lock.json CHANGED
@@ -16,11 +16,13 @@
16
  "@sveltejs/adapter-auto": "^2.0.0",
17
  "@sveltejs/adapter-node": "^1.3.1",
18
  "@sveltejs/kit": "^1.20.4",
 
19
  "carbon-icons-svelte": "^12.8.0",
20
  "svelte": "^4.0.5",
21
  "svelte-check": "^3.4.3",
22
  "tslib": "^2.4.1",
23
  "typescript": "^5.0.0",
 
24
  "vite": "^4.4.2"
25
  }
26
  },
@@ -715,6 +717,13 @@
715
  "integrity": "sha512-60BCwRFOZCQhDncwQdxxeOEEkbc5dIMccYLwbxsS4TUNeVECQ/pBJ0j09mrHOl/JJvpRPGwO9SvE4nR2Nb/a4Q==",
716
  "dev": true
717
  },
 
 
 
 
 
 
 
718
  "node_modules/acorn": {
719
  "version": "8.11.2",
720
  "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.2.tgz",
@@ -2006,6 +2015,20 @@
2006
  "node": ">=14.0"
2007
  }
2008
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2009
  "node_modules/vite": {
2010
  "version": "4.5.3",
2011
  "resolved": "https://registry.npmjs.org/vite/-/vite-4.5.3.tgz",
 
16
  "@sveltejs/adapter-auto": "^2.0.0",
17
  "@sveltejs/adapter-node": "^1.3.1",
18
  "@sveltejs/kit": "^1.20.4",
19
+ "@types/uuid": "^9.0.8",
20
  "carbon-icons-svelte": "^12.8.0",
21
  "svelte": "^4.0.5",
22
  "svelte-check": "^3.4.3",
23
  "tslib": "^2.4.1",
24
  "typescript": "^5.0.0",
25
+ "uuid": "^9.0.1",
26
  "vite": "^4.4.2"
27
  }
28
  },
 
717
  "integrity": "sha512-60BCwRFOZCQhDncwQdxxeOEEkbc5dIMccYLwbxsS4TUNeVECQ/pBJ0j09mrHOl/JJvpRPGwO9SvE4nR2Nb/a4Q==",
718
  "dev": true
719
  },
720
+ "node_modules/@types/uuid": {
721
+ "version": "9.0.8",
722
+ "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-9.0.8.tgz",
723
+ "integrity": "sha512-jg+97EGIcY9AGHJJRaaPVgetKDsrTgbRjQ5Msgjh/DQKEFl0DtyRr/VCOyD1T2R1MNeWPK/u7JoGhlDZnKBAfA==",
724
+ "dev": true,
725
+ "license": "MIT"
726
+ },
727
  "node_modules/acorn": {
728
  "version": "8.11.2",
729
  "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.2.tgz",
 
2015
  "node": ">=14.0"
2016
  }
2017
  },
2018
+ "node_modules/uuid": {
2019
+ "version": "9.0.1",
2020
+ "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz",
2021
+ "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==",
2022
+ "dev": true,
2023
+ "funding": [
2024
+ "https://github.com/sponsors/broofa",
2025
+ "https://github.com/sponsors/ctavan"
2026
+ ],
2027
+ "license": "MIT",
2028
+ "bin": {
2029
+ "uuid": "dist/bin/uuid"
2030
+ }
2031
+ },
2032
  "node_modules/vite": {
2033
  "version": "4.5.3",
2034
  "resolved": "https://registry.npmjs.org/vite/-/vite-4.5.3.tgz",
package.json CHANGED
@@ -14,11 +14,13 @@
14
  "@sveltejs/adapter-auto": "^2.0.0",
15
  "@sveltejs/adapter-node": "^1.3.1",
16
  "@sveltejs/kit": "^1.20.4",
 
17
  "carbon-icons-svelte": "^12.8.0",
18
  "svelte": "^4.0.5",
19
  "svelte-check": "^3.4.3",
20
  "tslib": "^2.4.1",
21
  "typescript": "^5.0.0",
 
22
  "vite": "^4.4.2"
23
  },
24
  "type": "module",
 
14
  "@sveltejs/adapter-auto": "^2.0.0",
15
  "@sveltejs/adapter-node": "^1.3.1",
16
  "@sveltejs/kit": "^1.20.4",
17
+ "@types/uuid": "^9.0.8",
18
  "carbon-icons-svelte": "^12.8.0",
19
  "svelte": "^4.0.5",
20
  "svelte-check": "^3.4.3",
21
  "tslib": "^2.4.1",
22
  "typescript": "^5.0.0",
23
+ "uuid": "^9.0.1",
24
  "vite": "^4.4.2"
25
  },
26
  "type": "module",
src/routes/Vote.svelte CHANGED
@@ -1,5 +1,6 @@
1
  <script lang="ts">
2
  import { onMount, onDestroy } from "svelte";
 
3
  import type { IViewer } from "./viewers/IViewer";
4
  import { createViewer } from "./viewers/ViewerFactory";
5
 
@@ -26,12 +27,22 @@
26
  let errorMessage: string = "";
27
  let data: Data;
28
 
 
 
 
 
 
 
 
 
 
29
  async function fetchScenes() {
30
  statusMessage = "Loading...";
31
  errorMessage = "";
32
 
33
  try {
34
- const username = "dylanebert";
 
35
  const url = `https://dylanebert-3d-arena-backend.hf.space/pair?username=${username}`;
36
  const response = await fetch(url, {
37
  method: "GET",
 
1
  <script lang="ts">
2
  import { onMount, onDestroy } from "svelte";
3
+ import { v4 as uuidv4 } from "uuid";
4
  import type { IViewer } from "./viewers/IViewer";
5
  import { createViewer } from "./viewers/ViewerFactory";
6
 
 
27
  let errorMessage: string = "";
28
  let data: Data;
29
 
30
+ function getUsername() {
31
+ let storedUsername = sessionStorage.getItem("username");
32
+ if (!storedUsername) {
33
+ storedUsername = uuidv4();
34
+ sessionStorage.setItem("username", storedUsername);
35
+ }
36
+ return storedUsername;
37
+ }
38
+
39
  async function fetchScenes() {
40
  statusMessage = "Loading...";
41
  errorMessage = "";
42
 
43
  try {
44
+ const username = getUsername();
45
+ console.log(`Fetching with username: ${username}`);
46
  const url = `https://dylanebert-3d-arena-backend.hf.space/pair?username=${username}`;
47
  const response = await fetch(url, {
48
  method: "GET",