Ver Fonte

Merge pull request #68 from simple-login/nocdn

No cdn
Son Nguyen Kim há 5 anos atrás
pai
commit
ba985d22dc

+ 2 - 1
.gitignore

@@ -5,4 +5,5 @@ db.sqlite
 .pytest_cache
 .pytest_cache
 .vscode
 .vscode
 .DS_Store
 .DS_Store
-config
+config
+static/node_modules

+ 10 - 1
Dockerfile

@@ -1,11 +1,20 @@
-FROM python:3.7
+# Install npm packages
+FROM node:10.17.0-alpine AS npm
+WORKDIR /code
+COPY ./static/package*.json /code/static/
+RUN cd /code/static && npm install
+
 
 
+FROM python:3.7
 WORKDIR /code
 WORKDIR /code
 
 
 # install dependencies
 # install dependencies
 COPY ./requirements.txt ./
 COPY ./requirements.txt ./
 RUN pip3 install --no-cache-dir -r requirements.txt
 RUN pip3 install --no-cache-dir -r requirements.txt
 
 
+# copy npm packages
+COPY --from=npm /code /code
+
 # copy everything else into /code
 # copy everything else into /code
 COPY . .
 COPY . .
 
 

+ 1 - 1
app/dashboard/templates/dashboard/mfa_setup.html

@@ -5,7 +5,7 @@
 {% endblock %}
 {% endblock %}
 
 
 {% block head %}
 {% block head %}
-  <script src="https://cdnjs.cloudflare.com/ajax/libs/qrious/4.0.2/qrious.min.js"></script>
+  <script src="{{ url_for('static', filename='node_modules/qrious/dist/qrious.min.js') }}"></script>
 {% endblock %}
 {% endblock %}
 
 
 {% block default_content %}
 {% block default_content %}

+ 41 - 0
static/package-lock.json

@@ -0,0 +1,41 @@
+{
+  "name": "simplelogin",
+  "version": "1.0.0",
+  "lockfileVersion": 1,
+  "requires": true,
+  "dependencies": {
+    "font-awesome": {
+      "version": "4.7.0",
+      "resolved": "https://registry.npmjs.org/font-awesome/-/font-awesome-4.7.0.tgz",
+      "integrity": "sha1-j6jPBBGhoxr9B7BtKQK7n8gVoTM="
+    },
+    "intro.js": {
+      "version": "2.9.3",
+      "resolved": "https://registry.npmjs.org/intro.js/-/intro.js-2.9.3.tgz",
+      "integrity": "sha512-hC+EXWnEuJeA3CveGMat3XHePd2iaXNFJIVfvJh2E9IzBMGLTlhWvPIVHAgKlOpO4lNayCxEqzr4N02VmHFr9Q=="
+    },
+    "jquery": {
+      "version": "3.4.1",
+      "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.4.1.tgz",
+      "integrity": "sha512-36+AdBzCL+y6qjw5Tx7HgzeGCzC81MDDgaUP8ld2zhx58HdqXGoBd+tHdrBMiyjGQs0Hxs/MLZTu/eHNJJuWPw=="
+    },
+    "notie": {
+      "version": "4.3.1",
+      "resolved": "https://registry.npmjs.org/notie/-/notie-4.3.1.tgz",
+      "integrity": "sha1-DRmd4VEwJC4hZ1UHq6Y8aSngrdo="
+    },
+    "qrious": {
+      "version": "4.0.2",
+      "resolved": "https://registry.npmjs.org/qrious/-/qrious-4.0.2.tgz",
+      "integrity": "sha512-xWPJIrK1zu5Ypn898fBp8RHkT/9ibquV2Kv24S/JY9VYEhMBMKur1gHVsOiNUh7PHP9uCgejjpZUHUIXXKoU/g=="
+    },
+    "toastr": {
+      "version": "2.1.4",
+      "resolved": "https://registry.npmjs.org/toastr/-/toastr-2.1.4.tgz",
+      "integrity": "sha1-i0O+ZPudDEFIcURvLbjoyk6V8YE=",
+      "requires": {
+        "jquery": ">=1.12.0"
+      }
+    }
+  }
+}

+ 25 - 0
static/package.json

@@ -0,0 +1,25 @@
+{
+  "name": "simplelogin",
+  "version": "1.0.0",
+  "description": "Open source email alias solution",
+  "repository": {
+    "type": "git",
+    "url": "git+https://github.com/simple-login/app.git"
+  },
+  "keywords": [
+    "email-alias"
+  ],
+  "author": "SimpleLogin",
+  "license": "MIT",
+  "bugs": {
+    "url": "https://github.com/simple-login/app/issues"
+  },
+  "homepage": "https://github.com/simple-login/app#readme",
+  "dependencies": {
+    "font-awesome": "^4.7.0",
+    "intro.js": "^2.9.3",
+    "notie": "^4.3.1",
+    "qrious": "^4.0.2",
+    "toastr": "^2.1.4"
+  }
+}

Diff do ficheiro suprimidas por serem muito extensas
+ 0 - 0
static/vendor/bootstrap-social.min.css


Diff do ficheiro suprimidas por serem muito extensas
+ 0 - 0
static/vendor/intro.min.js


Diff do ficheiro suprimidas por serem muito extensas
+ 0 - 0
static/vendor/introjs.min.css


Diff do ficheiro suprimidas por serem muito extensas
+ 0 - 0
static/vendor/notie.min.js


+ 10 - 8
templates/base.html

@@ -22,7 +22,7 @@
     {% block title %}{% endblock %} | SimpleLogin
     {% block title %}{% endblock %} | SimpleLogin
   </title>
   </title>
 
 
-  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
+  <link rel="stylesheet" href="{{ url_for('static', filename='node_modules/font-awesome/css/font-awesome.css') }}">
 
 
   <!-- Dashboard Core -->
   <!-- Dashboard Core -->
   <link href="/static/assets/css/dashboard.css" rel="stylesheet"/>
   <link href="/static/assets/css/dashboard.css" rel="stylesheet"/>
@@ -43,12 +43,14 @@
   <script src="/static/vendor/clipboard.min.js"></script>
   <script src="/static/vendor/clipboard.min.js"></script>
 
 
   <!-- Notie -->
   <!-- Notie -->
-  <link rel="stylesheet" type="text/css" href="https://unpkg.com/notie/dist/notie.min.css">
-  <script src="/static/vendor/notie.min.js"></script>
+  <link rel="stylesheet" type="text/css"
+        href="{{ url_for('static', filename='node_modules/notie/dist/notie.min.css') }}">
+  <script src="{{ url_for('static', filename='node_modules/notie/dist/notie.min.js') }}"></script>
 
 
   <!-- IntroJS -->
   <!-- IntroJS -->
-  <link rel="stylesheet" type="text/css" href="/static/vendor/introjs.min.css">
-  <script src="/static/vendor/intro.min.js"></script>
+  <link rel="stylesheet" type="text/css"
+        href="{{ url_for('static', filename='node_modules/intro.js/minified/introjs.min.css') }}">
+  <script src="{{ url_for('static', filename='node_modules/intro.js/minified/intro.min.js') }}"></script>
 
 
   <!-- Sentry -->
   <!-- Sentry -->
   <script
   <script
@@ -56,11 +58,11 @@
       integrity="sha384-FLzYisBa7tvsi/ZP1ISnzZJqBkmw5mvwk7KOmH82W9wdPZKG3bG9hSO8GQFVSlOu"
       integrity="sha384-FLzYisBa7tvsi/ZP1ISnzZJqBkmw5mvwk7KOmH82W9wdPZKG3bG9hSO8GQFVSlOu"
       crossorigin="anonymous"></script>
       crossorigin="anonymous"></script>
 
 
-  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-social/4.12.0/bootstrap-social.min.css">
+  <link rel="stylesheet" href="/static/vendor/bootstrap-social.min.css">
 
 
   <!-- Toastr library -->
   <!-- Toastr library -->
-  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.css">
-  <script src="https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.js"></script>
+  <link rel="stylesheet" href="{{ url_for('static', filename='node_modules/toastr/build/toastr.min.css') }}">
+  <script src="{{ url_for('static', filename='node_modules/toastr/build/toastr.min.js') }}"></script>
 
 
   <link rel="stylesheet" type="text/css" href="/static/style.css?v={{ VERSION }}">
   <link rel="stylesheet" type="text/css" href="/static/style.css?v={{ VERSION }}">
 
 

Alguns ficheiros não foram mostrados porque muitos ficheiros mudaram neste diff