diff --git a/config.py b/config.py index 851e11e..6b654be 100644 --- a/config.py +++ b/config.py @@ -1,15 +1,18 @@ import os + class Config(object): DEBUG = False TESTING = False URL_PREFIX = '' - + + class ProductionConfig(Config): DEBUG = False URL_PREFIX = os.environ.get("URL_PREFIX") - + class DevelopmentConfig(Config): ENV = "development" DEVELOPMENT = True + DEBUG = True diff --git a/exquisite_branch/__init__.py b/exquisite_branch/__init__.py index ed25e6a..cacbd6c 100644 --- a/exquisite_branch/__init__.py +++ b/exquisite_branch/__init__.py @@ -1,7 +1,8 @@ import os -from flask import Flask +from flask import Flask, send_from_directory from . import prefix + def create_app(test_config=None): # create and configure the app app = Flask(__name__, instance_relative_config=True) @@ -26,6 +27,12 @@ def create_app(test_config=None): from . import db db.init_app(app) + @app.route("/favicon.ico") + def favicon(): + return send_from_directory( + os.path.join(app.root_path, "static"), "favicon.ico", mimetype="image/vnd.microsoft.icon", + ) + from . import draw app.register_blueprint(draw.bp) @@ -38,8 +45,7 @@ def create_app(test_config=None): from . import home app.register_blueprint(home.bp) - - - app.wsgi_app = prefix.PrefixMiddleware(app.wsgi_app, prefix=os.environ.get("URL_PREFIX", '')) + app.wsgi_app = prefix.PrefixMiddleware( + app.wsgi_app, prefix=os.environ.get("URL_PREFIX", '')) return app diff --git a/exquisite_branch/static/css/global.css b/exquisite_branch/static/css/global.css index dab5c64..375efcf 100644 --- a/exquisite_branch/static/css/global.css +++ b/exquisite_branch/static/css/global.css @@ -2,6 +2,7 @@ html, body { margin: 0; background-color: var(--background); + font-size: 1.25rem; } * { diff --git a/exquisite_branch/static/css/share.css b/exquisite_branch/static/css/share.css new file mode 100644 index 0000000..55d7022 --- /dev/null +++ b/exquisite_branch/static/css/share.css @@ -0,0 +1,28 @@ +.share { + width: 100vw; + height: 100vh; + + line-height: 2; + + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; +} + +a { + color: currentColor; + text-decoration: none; +} + +button.clipboard { + background: none; + border: none; + text-decoration: underline; + cursor: pointer; + font-size: 1rem; +} + +button.clipboard:hover { + color: dodgerblue; +} diff --git a/exquisite_branch/static/favicon.ico b/exquisite_branch/static/favicon.ico new file mode 100644 index 0000000..80ea9e5 Binary files /dev/null and b/exquisite_branch/static/favicon.ico differ diff --git a/exquisite_branch/static/js/copy.js b/exquisite_branch/static/js/copy.js new file mode 100644 index 0000000..6290ab0 --- /dev/null +++ b/exquisite_branch/static/js/copy.js @@ -0,0 +1,22 @@ +copies = document.querySelectorAll("[data-copy]"); + +Array.from(copies).forEach((copy) => { + clipboard = document.createElement("button"); + clipboard.classList.add("clipboard"); + clipboard.innerHTML = "Copy to clipboard"; + insertAfter(clipboard, copy); + clipboard.addEventListener("click", (e) => { + navigator.clipboard.writeText(copy.dataset.copy).then( + function () { + clipboard.innerHTML = "Copied!"; + }, + function (err) { + console.error("Async: Could not copy text: ", err); + } + ); + }); +}); + +function insertAfter(newNode, referenceNode) { + referenceNode.parentNode.insertBefore(newNode, referenceNode.nextSibling); +} diff --git a/exquisite_branch/templates/share.html b/exquisite_branch/templates/share.html index d8312d2..96e77f5 100644 --- a/exquisite_branch/templates/share.html +++ b/exquisite_branch/templates/share.html @@ -8,12 +8,16 @@ + +