瀏覽代碼

Merge branch 'nocdn' into welcome-email-serie

# Conflicts:
#	cron.py
Son NK 5 年之前
父節點
當前提交
6be5d53e4e

+ 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 %}

+ 1 - 1
cron.py

@@ -122,7 +122,7 @@ if __name__ == "__main__":
 
 
     with app.app_context():
     with app.app_context():
         if args.job == "stats":
         if args.job == "stats":
-            LOG.d("Compute stats")
+            LOG.d("Compute Stats")
             stats()
             stats()
         elif args.job == "notify_trial_end":
         elif args.job == "notify_trial_end":
             LOG.d("Notify users with trial ending soon")
             LOG.d("Notify users with trial ending soon")

+ 11 - 2
shell.py

@@ -3,10 +3,9 @@ from IPython import embed
 from sqlalchemy_utils import create_database, database_exists, drop_database
 from sqlalchemy_utils import create_database, database_exists, drop_database
 
 
 from app.config import DB_URI
 from app.config import DB_URI
-from app.email_utils import _render
+from app.email_utils import send_email, render
 from app.models import *
 from app.models import *
 from server import create_app
 from server import create_app
-from app import email_utils
 
 
 
 
 def create_db():
 def create_db():
@@ -31,6 +30,16 @@ def reset_db():
     create_db()
     create_db()
 
 
 
 
+def send_safari_extension_newsletter():
+    for user in User.query.all():
+        send_email(
+            user.email,
+            "Quickly create alias with our Safari extension",
+            render("com/safari-extension.txt", user=user),
+            render("com/safari-extension.html", user=user),
+        )
+
+
 app = create_app()
 app = create_app()
 
 
 with app.app_context():
 with app.app_context():

+ 0 - 1
static/browser.svg

@@ -1 +0,0 @@
-<?xml version="1.0" ?><!DOCTYPE svg  PUBLIC '-//W3C//DTD SVG 1.1//EN'  'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'><svg enable-background="new 0 0 48 48" height="48px" version="1.1" viewBox="0 0 48 48" width="48px" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><g id="Expanded"><g><g><path d="M43,44H5c-2.757,0-5-2.243-5-5V11c0-2.757,2.243-5,5-5h38c2.757,0,5,2.243,5,5v28C48,41.757,45.757,44,43,44z M5,8     c-1.654,0-3,1.346-3,3v28c0,1.654,1.346,3,3,3h38c1.654,0,3-1.346,3-3V11c0-1.654-1.346-3-3-3H5z"/></g><g><path d="M47,18H1c-0.553,0-1-0.448-1-1s0.447-1,1-1h46c0.553,0,1,0.448,1,1S47.553,18,47,18z"/></g><g><circle cx="8" cy="12" r="2"/></g><g><circle cx="14" cy="12" r="2"/></g><g><circle cx="20" cy="12" r="2"/></g></g></g></svg>

+ 1 - 0
static/key.svg

@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="rgb(154, 160, 172)" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-key"><path d="M21 2l-2 2m-7.61 7.61a5.5 5.5 0 1 1-7.778 7.778 5.5 5.5 0 0 1 7.777-7.777zm0 0L15.5 7.5m0 0l3 3L22 7l-3-3m-3.5 3.5L19 4"></path></svg>

+ 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"
+  }
+}

File diff suppressed because it is too large
+ 0 - 0
static/vendor/bootstrap-social.min.css


File diff suppressed because it is too large
+ 0 - 0
static/vendor/intro.min.js


File diff suppressed because it is too large
+ 0 - 0
static/vendor/introjs.min.css


File diff suppressed because it is too large
+ 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 }}">
 
 

+ 1 - 1
templates/menu.html

@@ -18,7 +18,7 @@
   <li class="nav-item">
   <li class="nav-item">
     <a href="{{ url_for('dashboard.api_key') }}"
     <a href="{{ url_for('dashboard.api_key') }}"
        class="nav-link {{ 'active' if active_page == 'api_key' }}">
        class="nav-link {{ 'active' if active_page == 'api_key' }}">
-      <i><img src="/static/browser.svg"></i>
+      <i><img src="/static/key.svg"></i>
       API Key
       API Key
     </a>
     </a>
   </li>
   </li>

Some files were not shown because too many files changed in this diff