Skip to content

Commit eef0607

Browse files
committed
Inject TPEN env config into interfaces
Add environment injection to multiple interface HTML pages by including a <meta name="tpen-env" content="prod"> tag, a small inline script that sets window.TPEN_ENV, and a <script src="/config.env.js"></script> before module imports. Changes touch several project, annotator, transcription and index pages (plus small whitespace/formatting and minor markup cleanups) so pages can read runtime config consistently.
1 parent 05282d3 commit eef0607

16 files changed

Lines changed: 208 additions & 77 deletions

interfaces/annotator/line-parser.html

Lines changed: 52 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -5,46 +5,58 @@
55

66
<!DOCTYPE html>
77
<html lang="en">
8-
<head>
9-
<meta charset="UTF-8">
10-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
11-
<title>Line Parser</title>
12-
<script type="module" src="../../components/annotorious-annotator/line-parser.js"></script>
13-
<script type="module" src="../../components/feedback-button/index.js"></script>
14-
<script type="module" src="../../components/gui/site/Header.js"></script>
15-
<script type="module" src="../../components/gui/site/index.js"></script>
16-
<script type="module" src="../../components/explanatory-guide/fixedGuideComponent.js"></script>
17-
<link href="../../components/gui/site/index.css" rel="stylesheet" type="text/css" />
18-
<style>
19-
body {
20-
max-height: 100vh;
21-
min-height: 90vh;
22-
margin: 0px;
23-
padding: 0px;
24-
}
25-
tpen-header {
26-
position: relative;
27-
display: block;
28-
height: 4em;
29-
}
30-
tpen-line-parser {
31-
display: block;
32-
position: relative;
33-
margin: 0px;
34-
padding: 0px;
35-
}
36-
:focus-visible {
37-
outline: none !important;
38-
border: none !important;
39-
}
40-
</style>
41-
</head>
42-
<body>
43-
<tpen-header></tpen-header>
44-
<!-- <tpen-fixed-explanatory-guide heading="Line Parser Guide">
8+
9+
<head>
10+
<meta charset="UTF-8">
11+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
12+
<title>Line Parser</title>
13+
<meta name="tpen-env" content="prod">
14+
<!-- Inject environment before modules -->
15+
<script>
16+
window.TPEN_ENV = window.TPEN_ENV || (document.querySelector('meta[name=\"tpen-env\"]')?.content || 'dev')
17+
</script>
18+
<script src="/config.env.js"></script>
19+
<script type="module" src="../../components/annotorious-annotator/line-parser.js"></script>
20+
<script type="module" src="../../components/feedback-button/index.js"></script>
21+
<script type="module" src="../../components/gui/site/Header.js"></script>
22+
<script type="module" src="../../components/gui/site/index.js"></script>
23+
<script type="module" src="../../components/explanatory-guide/fixedGuideComponent.js"></script>
24+
<link href="../../components/gui/site/index.css" rel="stylesheet" type="text/css" />
25+
<style>
26+
body {
27+
max-height: 100vh;
28+
min-height: 90vh;
29+
margin: 0px;
30+
padding: 0px;
31+
}
32+
33+
tpen-header {
34+
position: relative;
35+
display: block;
36+
height: 4em;
37+
}
38+
39+
tpen-line-parser {
40+
display: block;
41+
position: relative;
42+
margin: 0px;
43+
padding: 0px;
44+
}
45+
46+
:focus-visible {
47+
outline: none !important;
48+
border: none !important;
49+
}
50+
</style>
51+
</head>
52+
53+
<body>
54+
<tpen-header></tpen-header>
55+
<!-- <tpen-fixed-explanatory-guide heading="Line Parser Guide">
4556
Add guide info
4657
</tpen-fixed-explanatory-guide> -->
47-
<tpen-line-parser></tpen-line-parser>
48-
<tpen-feedback-button></tpen-feedback-button>
49-
</body>
58+
<tpen-line-parser></tpen-line-parser>
59+
<tpen-feedback-button></tpen-feedback-button>
60+
</body>
61+
5062
</html>

interfaces/index.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@
33

44
<head>
55
<title>TPEN Interfaces</title>
6+
<meta name="tpen-env" content="prod">
7+
<!-- Inject environment before modules -->
8+
<script>
9+
window.TPEN_ENV = window.TPEN_ENV || (document.querySelector('meta[name=\"tpen-env\"]')?.content || 'dev')
10+
</script>
11+
<script src="/config.env.js"></script>
612
<meta charset="UTF-8">
713
<link href="favicon.ico" rel="icon" type="image/x-icon" />
814
<meta name="viewport" content="width=device-width, initial-scale=1.0">

interfaces/project/all.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@
1010
<meta charset="UTF-8">
1111
<meta name="viewport" content="width=device-width, initial-scale=1.0">
1212
<title>My Projects</title>
13+
<meta name="tpen-env" content="prod">
14+
<!-- Inject environment before modules -->
15+
<script>
16+
window.TPEN_ENV = window.TPEN_ENV || (document.querySelector('meta[name=\"tpen-env\"]')?.content || 'dev')
17+
</script>
18+
<script src="/config.env.js"></script>
1319
<script type="module" src="/api/TPEN.js"></script>
1420
<script type="module" src="/components/gui/site/index.js"></script>
1521
<script type="module" src="/components/projects/list-navigation.js"></script>

interfaces/project/copy-existing-project.html

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@
1010
<meta charset="UTF-8">
1111
<meta name="viewport" content="width=device-width, initial-scale=1.0">
1212
<title>Copy a Project</title>
13+
<meta name="tpen-env" content="prod">
14+
<!-- Inject environment before modules -->
15+
<script>
16+
window.TPEN_ENV = window.TPEN_ENV || (document.querySelector('meta[name=\"tpen-env\"]')?.content || 'dev')
17+
</script>
18+
<script src="/config.env.js"></script>
1319
<script src="/components/copy-existing-project/index.js" type="module"></script>
1420
<script src="/api/TPEN.js" type="module"></script>
1521
<script src="/components/gui/site/index.js" type="module"></script>
@@ -23,11 +29,12 @@
2329
<li>Click <strong>"Copy Project"</strong> to create the duplicate.</li>
2430
<li>Click <strong>"Manage"</strong> to start working on it.</li>
2531
</tpen-fixed-explanatory-guide>
26-
<p>
27-
This will copy <i>everything</i> from the selected project. If you want to specify exactly what to copy <a href="copy-project-options">use the more detailed version here</a>.
32+
<p>
33+
This will copy <i>everything</i> from the selected project. If you want to specify exactly what to copy <a
34+
href="copy-project-options">use the more detailed version here</a>.
2835
</p>
2936
<tpen-copy-existing-project></tpen-copy-existing-project>
3037
</tpen-page>
3138
</body>
3239

33-
</html>
40+
</html>

interfaces/project/copy-project-with-customization.html

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@
1010
<meta charset="UTF-8">
1111
<meta name="viewport" content="width=device-width, initial-scale=1.0">
1212
<title>Copy a Project</title>
13+
<meta name="tpen-env" content="prod">
14+
<!-- Inject environment before modules -->
15+
<script>
16+
window.TPEN_ENV = window.TPEN_ENV || (document.querySelector('meta[name=\"tpen-env\"]')?.content || 'dev')
17+
</script>
18+
<script src="/config.env.js"></script>
1319
<script src="/components/copy-project-with-customization/index.js" type="module"></script>
1420
<script src="/api/TPEN.js" type="module"></script>
1521
<script src="/components/gui/site/index.js" type="module"></script>
@@ -20,9 +26,11 @@
2026
<tpen-page>
2127
<tpen-fixed-explanatory-guide heading="Steps to Copy a Project with Customizations">
2228
<li>Select the project you want to copy.</li>
23-
<li>Choose the specific elements to include (e.g., metadata, group members, QuickType shortcuts, tools, and layers).</li>
29+
<li>Choose the specific elements to include (e.g., metadata, group members, QuickType shortcuts, tools, and
30+
layers).</li>
2431
<li>Optionally, select which members from the original project to include in the new one.</li>
25-
<li>Decide how each layer should be copied: with annotations, without annotations, or excluded entirely. <strong>(By default, no layers are selected.)</strong></li>
32+
<li>Decide how each layer should be copied: with annotations, without annotations, or excluded entirely.
33+
<strong>(By default, no layers are selected.)</strong></li>
2634
<li>Click <strong>"Copy Project"</strong> to create the new project with your chosen settings.</li>
2735
<li>Click <strong>"Manage"</strong> to start working on it.</li>
2836
</tpen-fixed-explanatory-guide>

interfaces/project/create.html

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@
1010
<meta charset="UTF-8">
1111
<meta name="viewport" content="width=device-width, initial-scale=1.0">
1212
<title>Create a Project</title>
13+
<meta name="tpen-env" content="prod">
14+
<!-- Inject environment before modules -->
15+
<script>
16+
window.TPEN_ENV = window.TPEN_ENV || (document.querySelector('meta[name=\"tpen-env\"]')?.content || 'dev')
17+
</script>
18+
<script src="/config.env.js"></script>
1319
<script type="module" src="/components/gui/site/index.js"></script>
1420
<script type="module" src="/components/gui/card/Card.js"></script>
1521
</head>
@@ -43,7 +49,8 @@ <h2 slot="header">Manifest Editor</h2>
4349
</tpen-card>
4450
<tpen-card>
4551
<span slot="icon">
46-
<object data="/assets/icons/IIIF-logo-colored-text.svg" type="image/svg+xml" style="height:1.3em; vertical-align:middle;">iiif</object>
52+
<object data="/assets/icons/IIIF-logo-colored-text.svg" type="image/svg+xml"
53+
style="height:1.3em; vertical-align:middle;">iiif</object>
4754
</span>
4855
<h2 slot="header">Import IIIF Manifest</h2>
4956
<span slot="body">Start a project from a IIIF resource.</span>
@@ -63,12 +70,12 @@ <h2 slot="header">Import T-PEN 2.8 Project</h2>
6370
</body>
6471
<script type="module">
6572
import TPEN from "/api/TPEN.js"
66-
document.getElementById("link-tpen-2.8").addEventListener("click", async(event) => {
73+
document.getElementById("link-tpen-2.8").addEventListener("click", async (event) => {
6774
event.preventDefault()
6875
const userToken = localStorage.getItem("userToken")
6976
let tokenDomain
7077
let isProdTPEN
71-
78+
7279
if (TPEN.TPEN28URL.includes("t-pen.org")) {
7380
tokenDomain = "t-pen.org"
7481
isProdTPEN = true
@@ -77,13 +84,13 @@ <h2 slot="header">Import T-PEN 2.8 Project</h2>
7784
if (TPEN.TPEN28URL.includes("localhost")) {
7885
tokenDomain = "localhost"
7986
}
80-
87+
8188
let cookieString = `userToken=${userToken}; domain=${tokenDomain}; path=/; SameSite=Strict;`
82-
89+
8390
if (isProdTPEN) {
8491
cookieString += " Secure;"
8592
}
86-
93+
8794
document.cookie = cookieString
8895
await fetch(`${TPEN.servicesURL}/project/deletecookie`, {
8996
method: "GET",
@@ -95,4 +102,5 @@ <h2 slot="header">Import T-PEN 2.8 Project</h2>
95102
window.location.href = `${TPEN.TPEN28URL}/TPEN/login.jsp?redirect_uri=${redirectUri}`
96103
})
97104
</script>
105+
98106
</html>

interfaces/project/decline.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@
1010
<meta charset="UTF-8">
1111
<meta name="viewport" content="width=device-width, initial-scale=1.0">
1212
<title>Decline Project Invite</title>
13+
<meta name="tpen-env" content="prod">
14+
<!-- Inject environment before modules -->
15+
<script>
16+
window.TPEN_ENV = window.TPEN_ENV || (document.querySelector('meta[name=\"tpen-env\"]')?.content || 'dev')
17+
</script>
18+
<script src="/config.env.js"></script>
1319
<script src="../../components/decline-project/index.js" type="module"></script>
1420
<script type="module" src="../../components/gui/site/index.js"></script>
1521
<link href="../../components/gui/site/index.css" rel="stylesheet" type="text/css" />

interfaces/project/import-image.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@
1010
<meta charset="UTF-8">
1111
<meta name="viewport" content="width=device-width, initial-scale=1.0">
1212
<title>Import Image URL</title>
13+
<meta name="tpen-env" content="prod">
14+
<!-- Inject environment before modules -->
15+
<script>
16+
window.TPEN_ENV = window.TPEN_ENV || (document.querySelector('meta[name=\"tpen-env\"]')?.content || 'dev')
17+
</script>
18+
<script src="/config.env.js"></script>
1319
<script src="/components/import-image/index.js" type="module"></script>
1420
<script src="/api/TPEN.js" type="module"></script>
1521
<script src="/components/gui/site/index.js" type="module"></script>

interfaces/project/import.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@
1010
<meta charset="UTF-8">
1111
<meta name="viewport" content="width=device-width, initial-scale=1.0">
1212
<title>Import IIIF Manifest</title>
13+
<meta name="tpen-env" content="prod">
14+
<!-- Inject environment before modules -->
15+
<script>
16+
window.TPEN_ENV = window.TPEN_ENV || (document.querySelector('meta[name=\"tpen-env\"]')?.content || 'dev')
17+
</script>
18+
<script src="/config.env.js"></script>
1319
<script src="/components/import-project/index.js" type="module"></script>
1420
<script src="/api/TPEN.js" type="module"></script>
1521
<script src="/components/gui/site/index.js" type="module"></script>

interfaces/project/leave.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@
1010
<meta charset="UTF-8">
1111
<meta name="viewport" content="width=device-width, initial-scale=1.0">
1212
<title>Leave Project</title>
13+
<meta name="tpen-env" content="prod">
14+
<!-- Inject environment before modules -->
15+
<script>
16+
window.TPEN_ENV = window.TPEN_ENV || (document.querySelector('meta[name=\"tpen-env\"]')?.content || 'dev')
17+
</script>
18+
<script src="/config.env.js"></script>
1319
<script src="../../components/leave-project/index.js" type="module"></script>
1420
<script type="module" src="../../components/gui/site/index.js"></script>
1521
<link href="../../components/gui/site/index.css" rel="stylesheet" type="text/css" />

0 commit comments

Comments
 (0)