0001AMA commited on
Commit
af9dc8a
·
verified ·
1 Parent(s): 88bbe51

Point CornerCafeRestaurant App to live SmOS_CC on Render, not localhost

Browse files
Files changed (4) hide show
  1. README.md +3 -2
  2. index.html +4 -3
  3. script.js +9 -0
  4. webapp/index.html +22 -3
README.md CHANGED
@@ -24,7 +24,7 @@ Public hospitality site for a neighbourhood cafe in Dalkeith — menu, branding,
24
  ## Stack
25
 
26
  - **Static site:** `index.html`, `styles.css`, `script.js`
27
- - **Ordering:** SmOS module **SmOS_CC** (separate repo) — linked from Order online
28
  - **Streamlit:** `streamlit_app.py` wraps the static site for Community Cloud
29
  - **Docker / API:** `app.py` + `Dockerfile` — FastAPI static host and `POST /api/contact` (SMTP)
30
 
@@ -34,7 +34,8 @@ Public hospitality site for a neighbourhood cafe in Dalkeith — menu, branding,
34
  # Static preview (site)
35
  python3 -m http.server 8080
36
  # Site: http://localhost:8080/
37
- # Ordering (SmOS_CC): http://127.0.0.1:8877/modules/SmOS_CC/
 
38
 
39
  # Docker (contact mail via SMTP env vars)
40
  docker build -t CornerCafeRestaurant .
 
24
  ## Stack
25
 
26
  - **Static site:** `index.html`, `styles.css`, `script.js`
27
+ - **Ordering:** SmOS module **SmOS_CC** on [smos.onrender.com](https://smos.onrender.com/modules/SmOS_CC/) — linked from Order online
28
  - **Streamlit:** `streamlit_app.py` wraps the static site for Community Cloud
29
  - **Docker / API:** `app.py` + `Dockerfile` — FastAPI static host and `POST /api/contact` (SMTP)
30
 
 
34
  # Static preview (site)
35
  python3 -m http.server 8080
36
  # Site: http://localhost:8080/
37
+ # Ordering (SmOS_CC): https://smos.onrender.com/modules/SmOS_CC/
38
+ # Local SmOS stack: http://127.0.0.1:8877/modules/SmOS_CC/
39
 
40
  # Docker (contact mail via SMTP env vars)
41
  docker build -t CornerCafeRestaurant .
index.html CHANGED
@@ -116,7 +116,7 @@
116
  <div class="container site-announcement__inner">
117
  <p class="site-announcement__text">
118
  <a href="#order-online"><strong>Order online</strong></a> from
119
- <a href="http://127.0.0.1:8877/modules/SmOS_CC/" rel="noopener noreferrer" target="_blank">CornerCafeRestaurant App</a>
120
  or from
121
  <a href="https://www.just-eat.co.uk/restaurants-the-corner-cafe-dalkeith-eh22" rel="noopener noreferrer" target="_blank">Just Eat</a>.
122
  </p>
@@ -363,7 +363,8 @@
363
  <li>
364
  <a
365
  class="order-channel order-channel--webapp"
366
- href="http://127.0.0.1:8877/modules/SmOS_CC/"
 
367
  target="_blank"
368
  rel="noopener noreferrer">
369
  <span class="order-channel__brand order-channel__brand--web" aria-hidden="true">
@@ -1101,6 +1102,6 @@
1101
  </div>
1102
  </div>
1103
  </footer>
1104
- <script src="script.js?v=1.28" defer></script>
1105
  </body>
1106
  </html>
 
116
  <div class="container site-announcement__inner">
117
  <p class="site-announcement__text">
118
  <a href="#order-online"><strong>Order online</strong></a> from
119
+ <a href="https://smos.onrender.com/modules/SmOS_CC/" data-order-app rel="noopener noreferrer" target="_blank">CornerCafeRestaurant App</a>
120
  or from
121
  <a href="https://www.just-eat.co.uk/restaurants-the-corner-cafe-dalkeith-eh22" rel="noopener noreferrer" target="_blank">Just Eat</a>.
122
  </p>
 
363
  <li>
364
  <a
365
  class="order-channel order-channel--webapp"
366
+ href="https://smos.onrender.com/modules/SmOS_CC/"
367
+ data-order-app
368
  target="_blank"
369
  rel="noopener noreferrer">
370
  <span class="order-channel__brand order-channel__brand--web" aria-hidden="true">
 
1102
  </div>
1103
  </div>
1104
  </footer>
1105
+ <script src="script.js?v=1.29" defer></script>
1106
  </body>
1107
  </html>
script.js CHANGED
@@ -1,5 +1,14 @@
1
  (() => {
2
  const THEME_KEY = "CornerCafeRestaurant-theme";
 
 
 
 
 
 
 
 
 
3
 
4
  const applyChrome = (theme) => {
5
  const meta = document.getElementById("meta-theme-color");
 
1
  (() => {
2
  const THEME_KEY = "CornerCafeRestaurant-theme";
3
+ const ORDER_APP_LOCAL = "http://127.0.0.1:8877/modules/SmOS_CC/";
4
+ const ORDER_APP_PROD = "https://smos.onrender.com/modules/SmOS_CC/";
5
+
6
+ const orderAppUrl = () =>
7
+ /^(localhost|127\.0\.0\.1)$/.test(window.location.hostname) ? ORDER_APP_LOCAL : ORDER_APP_PROD;
8
+
9
+ document.querySelectorAll("[data-order-app]").forEach((el) => {
10
+ el.setAttribute("href", orderAppUrl());
11
+ });
12
 
13
  const applyChrome = (theme) => {
14
  const meta = document.getElementById("meta-theme-color");
webapp/index.html CHANGED
@@ -2,13 +2,32 @@
2
  <html lang="en">
3
  <head>
4
  <meta charset="UTF-8">
5
- <meta http-equiv="refresh" content="0; url=http://127.0.0.1:8877/modules/SmOS_CC/">
6
  <title>Redirecting to CornerCafeRestaurant App…</title>
7
  <script>
8
- location.replace("http://127.0.0.1:8877/modules/SmOS_CC/");
 
 
 
 
 
 
9
  </script>
10
  </head>
11
  <body>
12
- <p>Ordering moved to <a href="http://127.0.0.1:8877/modules/SmOS_CC/">CornerCafeRestaurant App</a>.</p>
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  </body>
14
  </html>
 
2
  <html lang="en">
3
  <head>
4
  <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
  <title>Redirecting to CornerCafeRestaurant App…</title>
7
  <script>
8
+ (function () {
9
+ var local = /^(localhost|127\.0\.0\.1)$/.test(location.hostname);
10
+ var url = local
11
+ ? "http://127.0.0.1:8877/modules/SmOS_CC/"
12
+ : "https://smos.onrender.com/modules/SmOS_CC/";
13
+ location.replace(url);
14
+ })();
15
  </script>
16
  </head>
17
  <body>
18
+ <p>
19
+ Opening
20
+ <a id="order-app-fallback" href="https://smos.onrender.com/modules/SmOS_CC/">CornerCafeRestaurant App</a>…
21
+ </p>
22
+ <script>
23
+ (function () {
24
+ var local = /^(localhost|127\.0\.0\.1)$/.test(location.hostname);
25
+ var url = local
26
+ ? "http://127.0.0.1:8877/modules/SmOS_CC/"
27
+ : "https://smos.onrender.com/modules/SmOS_CC/";
28
+ var link = document.getElementById("order-app-fallback");
29
+ if (link) link.href = url;
30
+ })();
31
+ </script>
32
  </body>
33
  </html>