nemhiyo commited on
Commit
c8a5541
·
verified ·
1 Parent(s): db13e15

Forward Private Space authentication to app assets

Browse files
Files changed (1) hide show
  1. index.html +31 -5
index.html CHANGED
@@ -6,8 +6,36 @@
6
  <meta name="description" content="Drama-3-Japaneseの演技タグ155種類を試聴し、聴感評価を送る非商用の共同検証。">
7
  <meta name="theme-color" content="#242346">
8
  <title>Drama-3-Japanese 演技タグ共同検証</title>
9
- <link rel="stylesheet" href="./assets/styles.css">
10
- <script type="module" src="./assets/app.js"></script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  </head>
12
  <body>
13
  <a class="skip" href="#catalog">試聴一覧へ</a>
@@ -39,9 +67,7 @@
39
  </div>
40
  <p class="baseline-line">「また明日ね。」</p>
41
  <div class="wave baseline-wave" id="baseline-wave" aria-hidden="true"></div>
42
- <audio id="baseline-player" controls preload="none" aria-label="タグを付けない基準音声">
43
- <source src="./audio/000.wav" type="audio/wav">
44
- </audio>
45
  <p class="clip-note">タグなし・参照音声なし</p>
46
  </section>
47
  </section>
 
6
  <meta name="description" content="Drama-3-Japaneseの演技タグ155種類を試聴し、聴感評価を送る非商用の共同検証。">
7
  <meta name="theme-color" content="#242346">
8
  <title>Drama-3-Japanese 演技タグ共同検証</title>
9
+ <meta name="referrer" content="no-referrer">
10
+ <script type="module">
11
+ const page = new URL(window.location.href);
12
+ const privateStaticSpace = page.protocol === "https:" && /^[a-z0-9-]+\.static\.hf\.space$/.test(page.hostname);
13
+ const signature = privateStaticSpace ? page.searchParams.get("__sign") : null;
14
+
15
+ function assetUrl(path) {
16
+ const url = new URL(path, page);
17
+ if (url.origin !== page.origin || !/^\/(?:assets|audio)\//.test(url.pathname)) {
18
+ throw new Error("Unexpected Space asset path");
19
+ }
20
+ if (signature) url.searchParams.set("__sign", signature);
21
+ return url.href;
22
+ }
23
+
24
+ try {
25
+ const stylesheet = document.createElement("link");
26
+ stylesheet.rel = "stylesheet";
27
+ stylesheet.href = assetUrl("./assets/styles.css");
28
+ document.head.append(stylesheet);
29
+ document.getElementById("baseline-player").src = assetUrl("./audio/000.wav");
30
+ const { startApp } = await import(assetUrl("./assets/app.js"));
31
+ await startApp(assetUrl);
32
+ } catch {
33
+ const error = document.getElementById("catalog-error");
34
+ error.textContent = "試聴ページを読み込めませんでした。Hugging FaceのAppタブを再読み込みしてください。";
35
+ error.hidden = false;
36
+ document.getElementById("count").textContent = "読み込み失敗";
37
+ }
38
+ </script>
39
  </head>
40
  <body>
41
  <a class="skip" href="#catalog">試聴一覧へ</a>
 
67
  </div>
68
  <p class="baseline-line">「また明日ね。」</p>
69
  <div class="wave baseline-wave" id="baseline-wave" aria-hidden="true"></div>
70
+ <audio id="baseline-player" controls preload="metadata" aria-label="タグを付けない基準音声"></audio>
 
 
71
  <p class="clip-note">タグなし・参照音声なし</p>
72
  </section>
73
  </section>