Browse Source

Build pad image with index.html

numahell 7 years ago
parent
commit
c256e2dfc6
3 changed files with 236 additions and 1 deletions
  1. 14 0
      pad/Dockerfile
  2. 4 1
      pad/docker-compose.yml
  3. 218 0
      pad/index.html

+ 14 - 0
pad/Dockerfile

@@ -0,0 +1,14 @@
+FROM node:alpine as build
+
+RUN apk add --no-cache curl
+RUN mkdir /front-pad
+RUN curl -sSL https://framagit.org/altermediatic/front-pad/repository/master/archive.tar.gz | tar --directory /front-pad -xz --strip 1
+WORKDIR /front-pad
+RUN npm set progress=false && npm i && npm run css
+
+FROM tvelocity/etherpad-lite
+
+WORKDIR /opt/etherpad-lite
+
+COPY --from=build /front-pad/index.html src/templates/
+COPY --from=build /front-pad/static/custom/index.css src/static/custom/

+ 4 - 1
pad/docker-compose.yml

@@ -10,13 +10,16 @@ services:
       - .env
       - .env
 
 
   app:
   app:
-    image: tvelocity/etherpad-lite
+    build: .
     restart: always
     restart: always
     links:
     links:
       - db
       - db
+    volumes:
+      - /srv/etherpad/app:/opt/etherpad-lite/var
     env_file:
     env_file:
       - .env
       - .env
     environment:
     environment:
       - ETHERPAD_DB_HOST=db
       - ETHERPAD_DB_HOST=db
+      - ETHERPAD_TITLE=Bloc Note
     ports:
     ports:
       - "127.0.0.1:9001:9001"
       - "127.0.0.1:9001:9001"

+ 218 - 0
pad/index.html

@@ -0,0 +1,218 @@
+<%
+  var settings = require("ep_etherpad-lite/node/utils/Settings");
+%>
+<!doctype html>
+<html>
+  <head>
+        <title><%=settings.title%></title>
+    <script>
+      /*
+      |@licstart  The following is the entire license notice for the
+      JavaScript code in this page.|
+
+      Copyright 2011 Peter Martischka, Primary Technology.
+
+      Licensed under the Apache License, Version 2.0 (the "License");
+      you may not use this file except in compliance with the License.
+      You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+      Unless required by applicable law or agreed to in writing, software
+      distributed under the License is distributed on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+      See the License for the specific language governing permissions and
+      limitations under the License.
+
+      |@licend  The above is the entire license notice
+      for the JavaScript code in this page.|
+      */
+    </script>
+
+        <meta charset="utf-8">
+        <meta name="referrer" content="no-referrer">
+        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0">
+        <link rel="shortcut icon" href="<%=settings.favicon%>">
+
+        <link rel="localizations" type="application/l10n+json" href="locales.json">
+        <script type="text/javascript" src="static/js/html10n.js"></script>
+        <script type="text/javascript" src="static/js/l10n.js"></script>
+
+        <style>
+            html, body {
+              height: 100%;
+            }
+            body {
+              margin: 0;
+              color: #333;
+              font: 14px helvetica, sans-serif;
+            }
+            #wrapper {
+              border-top: 1px solid #999;
+              margin-top: 160px;
+              padding: 15px;
+              background: #eee;
+            }
+            #inner {
+              position:relative;
+              max-width: 300px;
+              margin: 0 auto;
+            }
+            #button {
+              margin: 0 auto;
+              text-align: center;
+              font: 36px verdana,arial,sans-serif;
+              width:300px;
+              border:none;
+              color: white;
+              text-shadow: 0 -1px 0 rgba(0,0,0,.8);
+              height: 70px;
+              line-height: 70px;
+              background: #555;
+            }
+            #button:hover {
+              cursor: pointer;
+              background: #666;
+            }
+            #button:active {
+              box-shadow: inset 0 1px 12px rgba(0,0,0,0.9);
+              background: #444;
+            }
+            #label {
+              text-align: left;
+              text-shadow: 0 1px 1px #fff;
+              margin: 16px auto 0;
+              display:block;
+            }
+            #padname{
+              height:38px;
+              max-width:280px;
+            }
+            form {
+              height: 38px;
+              background: #fff;
+              border: 1px solid #bbb;
+              border-radius: 3px;
+              position: relative;
+            }
+            button, input {
+              font-weight: bold;
+              font-size: 15px;
+            }
+            input[type="text"] {
+              border-radius: 3px;
+              box-sizing: border-box;
+              -moz-box-sizing: border-box;
+              line-height:36px; /* IE8 hack */
+              padding: 0px 45px 0 10px;
+              *padding: 0; /* IE7 hack */
+              width: 100%;
+              height: 100%;
+              outline: none;
+              border: none;
+              position: absolute;
+            }
+            button[type="submit"] {
+              position: absolute;
+              left:253px;
+              width: 45px;
+              height: 38px;
+            }
+            @media only screen and (min-device-width: 320px) and (max-device-width: 720px) {
+              body {
+                background: #bbb;
+              }
+              #wrapper {
+                margin-top: 0;
+              }
+              #inner {
+                width: 95%;
+              }
+              #label {
+                text-align: center;
+              }
+            }
+        </style>
+        <link href="static/custom/index.css" rel="stylesheet">
+  </head>
+
+  <body>
+
+    <h1>Bloc Note</h1>
+    <main id="classic">
+
+      <div class="row">
+        <div class="col-md-8">
+          <div class="">
+            <h2 class="sr-only">Qu'est-ce que c'est&nbsp;?</h2>
+            <p class="text-center"><img src="accueil/framapad.png" alt="" class="ombre"></p>
+            <div class="caption">
+                <p>Un «&nbsp;pad&nbsp;» est un éditeur de texte collaboratif en ligne.
+                Les contributions de chaque utilisateur sont signalées par un code couleur,
+                apparaissent à l’écran en temps réel et
+                sont enregistrées au fur et à mesure qu’elles sont tapées.</p>
+            </div>
+          </div>
+        </div>
+        <div class="col-md-4" id="howitworks">
+          <h2 class="h3">Comment ça marche&nbsp;?</h2>
+          <ul>
+              <li>Créez un pad.</li>
+              <li>Commencez à <strong>rédiger</strong> votre texte</li>
+              <li>et <strong>invitez</strong> vos collaborateurs.</li>
+              <li>Chaque participant se distingue par une <strong><span class="fc_r5">c</span><span class="fc_o5">o</span><span class="fc_j6">u</span><span class="fc_v5">l</span><span class="fc_b9">e</span><span class="fc_f5">u</span><span class="fc_m5">r</span></strong></li>
+              <li>et peut <strong>tchatter</strong> avec le groupe.</li>
+              <li>Si nécessaire, restaurez une ancienne version depuis l’<strong>historique</strong></li>
+              <li>et une fois votre travail terminé, <strong>exportez</strong>-le.</li>
+          </ul>
+        </div>
+      </div>
+    </main>
+
+    <div id="wrapper">
+    <% e.begin_block("indexWrapper"); %>
+        <div id="inner">
+            <buttOn id="button" onclick="go2Random()" data-l10n-id="index.newPad"></button>
+            <label id="label" for="padname" data-l10n-id="index.createOpenPad"></label>
+            <form action="#" onsubmit="go2Name();return false;">
+                <input type="text" id="padname" maxlength="50" autofocus x-webkit-speech>
+                <button type="submit">OK</button>
+            </form>
+        </div>
+    <% e.end_block(); %>
+    </div>
+
+    <script src="static/custom/index.js"></script>
+    <script>
+        // @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7&dn=apache-2.0.txt
+        function go2Name()
+        {
+            var padname = document.getElementById("padname").value;
+            padname.length > 0 ? window.location = "p/" + padname : alert("Please enter a name")
+        }
+
+        function go2Random()
+        {
+            window.location = "p/" + randomPadName();
+        }
+
+        function randomPadName()
+        {
+            var chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
+            var string_length = 10;
+            var randomstring = '';
+            for (var i = 0; i < string_length; i++)
+            {
+                var rnum = Math.floor(Math.random() * chars.length);
+                randomstring += chars.substring(rnum, rnum + 1);
+            }
+            return randomstring;
+        }
+
+        // start the custom js
+        if (typeof customStart == "function") customStart();
+        // @license-end
+    </script>
+    <div style="display:none"><a href="/javascript" data-jslicense="1">JavaScript license information</a></div>
+  </body>
+</html>