From 7c42b2ff7b431f49c4ab8cfb97ed5a51a6574586 Mon Sep 17 00:00:00 2001
From: Benjamin Auder <benjamin.auder@somewhere>
Date: Thu, 12 Mar 2020 17:30:04 +0100
Subject: [PATCH] Prepare smoother future updates

---
 .gitignore                      |  6 ++++--
 client/dist/.gitkeep            |  0
 hooks/post-update.dist          |  3 ++-
 server/app.js                   |  2 +-
 server/fallback/README          |  2 ++
 server/while_update/favicon.ico |  1 -
 server/while_update/index.html  | 27 ---------------------------
 7 files changed, 9 insertions(+), 32 deletions(-)
 create mode 100644 client/dist/.gitkeep
 create mode 100644 server/fallback/README
 delete mode 100644 server/while_update/favicon.ico
 delete mode 100644 server/while_update/index.html

diff --git a/.gitignore b/.gitignore
index 0fafd876..82f780c5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,8 +1,10 @@
 # Various files
-/hooks/post-update
 /server/db/vchess.sqlite
 /server/config/parameters.js
-/client/dist/
+/server/fallback/*
+!/server/fallback/README
+/client/dist/*
+!/client/dist/.gitkeep
 /client/src/parameters.js
 
 # Dependency directories#
diff --git a/client/dist/.gitkeep b/client/dist/.gitkeep
new file mode 100644
index 00000000..e69de29b
diff --git a/hooks/post-update.dist b/hooks/post-update.dist
index 46eff669..3d4099c4 100755
--- a/hooks/post-update.dist
+++ b/hooks/post-update.dist
@@ -14,4 +14,5 @@ if [ $clientLines -ne 0 ]; then
 	cd client
 	npm run build
 fi
-# TOOD: also should restart the service if server code changes
+
+# NOTE: should also restart the service if server code changes
diff --git a/server/app.js b/server/app.js
index d029c956..785088b3 100644
--- a/server/app.js
+++ b/server/app.js
@@ -31,7 +31,7 @@ app.use(cookieParser());
 // Client "prod" files:
 app.use(express.static(path.join(__dirname, 'static')));
 // Update in progress:
-app.use(express.static(path.join(__dirname, 'while_update')));
+app.use(express.static(path.join(__dirname, 'fallback')));
 
 // In development stage the client side has its own server
 if (params.cors.enable)
diff --git a/server/fallback/README b/server/fallback/README
new file mode 100644
index 00000000..4365b1d3
--- /dev/null
+++ b/server/fallback/README
@@ -0,0 +1,2 @@
+Fallback folder to server while server updates.
+Updated after each client code update.
diff --git a/server/while_update/favicon.ico b/server/while_update/favicon.ico
deleted file mode 100644
index 7b26be14..00000000
--- a/server/while_update/favicon.ico
+++ /dev/null
@@ -1 +0,0 @@
-#$# git-fat 79e7b6b353fa77bdb2ab20fcb86055db27175b91                 9662
diff --git a/server/while_update/index.html b/server/while_update/index.html
deleted file mode 100644
index db6b0c7f..00000000
--- a/server/while_update/index.html
+++ /dev/null
@@ -1,27 +0,0 @@
-<!DOCTYPE html>
-<html>
-  <head>
-    <meta charset="utf-8">
-    <title>vchess - club</title>
-    <meta http-equiv="X-UA-Compatible" content="IE=edge">
-    <meta name="viewport" content="width=device-width,initial-scale=1.0">
-    <style>
-      #container {
-        position: absolute;
-        width: 100%;
-        top: 30%;
-      }
-      p {
-        text-align: center;
-        font-weight: bold;
-        font-size: 2rem;
-      }
-    </style>
-  </head>
-  <body>
-    <div id="container">
-      <p>Website update in progress !</p>
-      <p>It won't be long. Don't worry :)</p>
-    </div>
-  </body>
-</html>
-- 
2.44.0